+# We also need to find the name of the python3 executable (for 'make install').
+# Some OSes call this python3, some call it python3.2, etc. etc.
+AC_CHECK_PROGS([PYTHON3], [python3.4 python3.3 python3.2 python3])
+if test "x$PYTHON3" == "x"; then
+ AC_MSG_ERROR([cannot find python3 executable.])
+fi
+
+# Link against libm, this is required (among other things) by Python.
+AC_SEARCH_LIBS([pow], [m])
+
+# The Check unit testing framework is optional. Disable if not found.
+PKG_CHECK_MODULES([check], [check >= 0.9.4],
+ [have_check="yes"; CFLAGS="$CFLAGS $check_CFLAGS";
+ LIBS="$LIBS $check_LIBS"], [have_check="no"])
+AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
+
+# libsigrok is optional (only used for the protocol decoder test framework).
+# Disable if not found.
+PKG_CHECK_MODULES([libsigrok], [libsigrok >= 0.2.0],
+ [LIBSIGROK_CFLAGS="$libsigrok_CFLAGS"; LIBSIGROK_LIBS="$libsigrok_LIBS"],
+ [build_runtc="no"])
+AC_SUBST([LIBSIGROK_CFLAGS])
+AC_SUBST([LIBSIGROK_LIBS])
+