-# Note: We need to try a few different variants, since some systems have a
-# python3.pc file, others have a python-3.3.pc file, and so on.
-# See also: http://sigrok.org/wiki/Libsigrokdecode/Python
-CPPFLAGS_PYTHON=""
-LDFLAGS_PYTHON=""
-PKG_CHECK_MODULES([python3], [python3 >= 3.0],
- [CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python3_CFLAGS";
- LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python3_LIBS"],
-[PKG_CHECK_MODULES([python33], [python-3.3 >= 3.0],
- [CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python33_CFLAGS";
- LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python33_LIBS"],
-[PKG_CHECK_MODULES([python32], [python-3.2 >= 3.0],
- [CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python32_CFLAGS";
- LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python32_LIBS"],
-[PKG_CHECK_MODULES([python31], [python-3.1 >= 3.0],
- [CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python31_CFLAGS";
- LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python31_LIBS"],
-[PKG_CHECK_MODULES([python30], [python-3.0 >= 3.0],
- [CPPFLAGS_PYTHON="$CPPFLAGS_PYTHON $python30_CFLAGS";
- LDFLAGS_PYTHON="$LDFLAGS_PYTHON $python30_LIBS"],
-)])])])])
-case "$build" in
-*mingw*)
- # We currently hardcode the paths to the Python 3.2 default install
- # location as there's no 'python-config' script on Windows, it seems.
- # Note: We add both the /c/ and c:/ syntax (needed for cmake).
- AC_MSG_WARN([using hardcoded Python3 configuration on MinGW])
- CPPFLAGS_PYTHON="-I/c/Python32/include -Ic:/Python32/include"
- LDFLAGS_PYTHON="-L/c/Python32/libs -Lc:/Python32/libs -lpython32"
- ;;
-esac
-AC_SUBST(CPPFLAGS_PYTHON)
-AC_SUBST(LDFLAGS_PYTHON)
+SR_PKG_CHECK([python3], [SRD_PKGLIBS],
+ [python3 >= 3.2], [python-3.6 >= 3.6], [python-3.5 >= 3.5], [python-3.4 >= 3.4], [python-3.3 >= 3.3], [python-3.2 >= 3.2])
+AS_IF([test "x$sr_have_python3" = xno],
+ [AC_MSG_ERROR([Cannot find Python 3 development headers.])])