Don't just look for python2. Instead, first look for python, and then
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 May 2013 20:04:46 +0000 (20:04 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 May 2013 20:04:46 +0000 (20:04 +0000)
see whether it's Python 2 or not; if it's not, *then* look for Python 2.

That way, you can use Python on systems where python is Python 2 and
python2 doesn't exist.

Move the check for Python up after the check for Perl.  (All the program
checks arguably belong together.)

AC_PATH_PROG() does AC_SUBST() for you; don't do it ourselves.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@49253 f5534014-38df-0310-8fa8-9805f1628bb7

configure.ac

index 8ce5b51eb856adcc17fcdba00bc1021bd9ee8999..2a2b0f0d6b13b514783c8f221126e7055ecf3c9b 100644 (file)
@@ -44,7 +44,9 @@ AC_DEFINE(VERSION_MICRO, version_micro, [Wireshark's micro version])
 
 AM_DISABLE_STATIC
 
-dnl Checks for programs.
+#
+# Checks for programs used in the build process.
+#
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
@@ -54,6 +56,34 @@ AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
 AC_PATH_PROG(PERL, perl)
+
+# Check for Python.
+AC_PATH_PROG(PYTHON, python)
+if test ! -z "$PYTHON"; then
+       #
+       # OK, we found Python; is it Python 2.x?
+       # Note: we don't use named components for sys.version_info to get
+       # the major version number, as named components for version_info
+       # were apparently introduced in Python 2.7.
+       #
+       AC_MSG_CHECKING([whether $PYTHON is Python 2])
+       python_major_version=`$PYTHON -c 'import sys; print sys.version_info[[0]]'`
+       if test "$python_major_version" = 2; then
+               AC_MSG_RESULT([yes])
+       else
+               #
+               # It's not 2.x.
+               #
+               AC_MSG_RESULT([no])
+
+               #
+               # Try looking for python2; if we find it, we assume it's
+               # Python 2
+               #
+               AC_PATH_PROG(PYTHON, python2)
+       fi
+fi
+
 #
 # XXX - should autogen.sh check for YACC/Bison and Flex?  A user building
 # from a distribution tarball shouldn't have to have YACC/Bison or Flex,
@@ -133,12 +163,6 @@ else
        fi
 fi
 
-AC_SUBST(PERL)
-AC_SUBST(LEX)
-AC_SUBST(POD2MAN)
-AC_SUBST(POD2HTML)
-AC_SUBST(XMLLINT)
-
 #
 # Set "ac_supports_gcc_flags" if the compiler is known to support GCC-style
 # flags such as -pedantic, -W warning flags and -f feature flags.  Currently,
@@ -414,8 +438,6 @@ AC_PATH_PROG(LYNX, lynx)
 AC_CHECK_PROG(HAVE_LYNX, lynx, "yes", "no")
 AM_CONDITIONAL(HAVE_LYNX, test x$HAVE_LYNX = xyes)
 
-AC_PATH_PROG(PYTHON, python2)
-
 # Check for w3m (html -> text)
 AC_PATH_PROG(W3M, w3m)
 AC_CHECK_PROG(HAVE_W3M, w3m, "yes", "no")