From 77081999c458104f6802d56e2ef58e9fb0b68fc1 Mon Sep 17 00:00:00 2001 From: Vincent Castellano Date: Sun, 17 May 2015 15:58:32 -0700 Subject: [PATCH] Fixes to autotools for python detection --- Makefile.in | 3 +- autotools.sh | 1 - ax_python.m4 | 12 +- bootstrap | 6 + config.h.in | 6 +- configure | 422 ++++++++++++++++++++++----------------------------- configure.ac | 57 ++++--- 7 files changed, 240 insertions(+), 267 deletions(-) delete mode 100755 autotools.sh create mode 100755 bootstrap diff --git a/Makefile.in b/Makefile.in index 0423097..efbc79e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,8 +4,7 @@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ @OPENSSL_LDFLAGS@ CPPFLAGS=@CPPFLAGS@ @OPENSSL_INCLUDES@ DEFS=@DEFS@ -COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC -#TODO re-add -Werror +COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Werror -Wextra -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@ @OPENSSL_LIBS@ LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS} LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS} diff --git a/autotools.sh b/autotools.sh deleted file mode 100755 index e180398..0000000 --- a/autotools.sh +++ /dev/null @@ -1 +0,0 @@ -aclocal ; autoheader; automake ; autoconf diff --git a/ax_python.m4 b/ax_python.m4 index 5739922..1695480 100644 --- a/ax_python.m4 +++ b/ax_python.m4 @@ -56,7 +56,8 @@ AC_DEFUN([AX_PYTHON], [AC_MSG_CHECKING(for python build information) AC_MSG_RESULT([]) -for python in python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do +for python in python3.4 python3.3 python3.2 python3.1 python2.7 python2.6 python3, python2, python; do + AC_CHECK_PROGS(PYTHON_BIN, [$python]) ax_python_bin=$PYTHON_BIN if test x$ax_python_bin != x; then @@ -87,12 +88,21 @@ AC_MSG_RESULT([ Binary: $ax_python_bin]) AC_MSG_RESULT([ Library: $ax_python_lib]) AC_MSG_RESULT([ Include Dir: $ax_python_header]) + +PYTHON_FOUND=yes if test x$ax_python_header != xno; then PYTHON_INCLUDE_DIR=$ax_python_header AC_SUBST(PYTHON_INCLUDE_DIR) +else + PYTHON_FOUND=no fi + if test x$ax_python_lib != xno; then PYTHON_LIB=$ax_python_lib AC_SUBST(PYTHON_LIB) +else + PYTHON_FOUND=no fi +AC_SUBST(PYTHON_FOUND) + ])dnl diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..67cea4f --- /dev/null +++ b/bootstrap @@ -0,0 +1,6 @@ +#! /bin/sh + +aclocal +autoheader +automake --gnu --add-missing +autoconf diff --git a/config.h.in b/config.h.in index 72b5487..bb5f2d6 100644 --- a/config.h.in +++ b/config.h.in @@ -164,12 +164,12 @@ /* use lua */ #undef USE_LUA -/* fixed for correct valgrind work */ -#undef VALGRIND_FIXES - /* use python */ #undef USE_PYTHON +/* fixed for correct valgrind work */ +#undef VALGRIND_FIXES + /* Define to `int' if doesn't define. */ #undef gid_t diff --git a/configure b/configure index 1408bc9..3eae742 100755 --- a/configure +++ b/configure @@ -624,15 +624,7 @@ EXTRA_LIBS LIBOBJS PYTHON_CFLAGS PYTHON_LIBS -pkgpyexecdir -pyexecdir -pkgpythondir -pythondir -PYTHON_PLATFORM -PYTHON_EXEC_PREFIX -PYTHON_PREFIX -PYTHON_VERSION -PYTHON +PYTHON_FOUND PYTHON_LIB PYTHON_INCLUDE_DIR PYTHON_BIN @@ -708,8 +700,8 @@ with_zlib enable_libconfig enable_extf enable_liblua -enable_json enable_python +enable_json with_progname enable_valgrind ' @@ -724,8 +716,7 @@ CPPFLAGS CPP LUA LUA_INCLUDE -LUA_LIB -PYTHON' +LUA_LIB' # Initialize some variables set by options. @@ -1338,9 +1329,9 @@ Optional Features: --enable-libconfig/--disable-libconfig --enable-extf/--disable-extf --enable-liblua/--disable-liblua +--enable-python/--disable-python --enable-json/--disable-json --enable-valgrind/--disable-valgrind ---enable-python/--disable-python Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1363,7 +1354,6 @@ Some influential environment variables: LUA The Lua interpreter, e.g. /usr/bin/lua5.1 LUA_INCLUDE The Lua includes, e.g. -I/usr/include/lua5.1 LUA_LIB The Lua library, e.g. -llua5.1 - PYTHON the Python interpreter Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -5940,14 +5930,25 @@ fi fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +$as_echo_n "checking for python... " >&6; } # Check whether --enable-python was given. if test "${enable_python+set}" = set; then : enableval=$enable_python; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python build information" >&5 + if test "x$enableval" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python build information" >&5 $as_echo_n "checking for python build information... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } -for python in python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do +for python in python3.4 python3.3 python3.2 python3.1 python2.7 python2.6 python3, python2, python; do + for ac_prog in $python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6097,102 +6098,69 @@ $as_echo " Library: $ax_python_lib" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: Include Dir: $ax_python_header" >&5 $as_echo " Include Dir: $ax_python_header" >&6; } + +PYTHON_FOUND=yes if test x$ax_python_header != xno; then PYTHON_INCLUDE_DIR=$ax_python_header +else + PYTHON_FOUND=no fi + if test x$ax_python_lib != xno; then PYTHON_LIB=$ax_python_lib -fi - - - - - - - - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 2.7.0" >&5 -$as_echo_n "checking whether $PYTHON version is >= 2.7.0... " >&6; } - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7.0'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 - ($PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "Python interpreter is too old" "$LINENO" 5 + PYTHON_FOUND=no fi - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7.0" >&5 -$as_echo_n "checking for a Python interpreter with version >= 2.7.0... " >&6; } -if ${am_cv_pathless_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do - test "$am_cv_pathless_PYTHON" = none && break - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7.0'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 - ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - break -fi - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 -$as_echo "$am_cv_pathless_PYTHON" >&6; } - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: + + + + if test $PYTHON_FOUND = no ; then + as_fn_error $? "No supported python lib version found. Try --disable-python" "$LINENO" 5 else - # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. -set dummy $am_cv_pathless_PYTHON; ac_word=$2 + + + EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" + CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" + +$as_echo "#define USE_PYTHON 1" >>confdefs.h + + fi + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 +$as_echo "enabled" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python build information" >&5 +$as_echo_n "checking for python build information... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +for python in python3.4 python3.3 python3.2 python3.1 python2.7 python2.6 python3, python2, python; do + +for ac_prog in $python +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : +if ${ac_cv_prog_PYTHON_BIN+:} false; then : $as_echo_n "(cached) " >&6 else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$PYTHON_BIN"; then + ac_cv_prog_PYTHON_BIN="$PYTHON_BIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + ac_cv_prog_PYTHON_BIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6200,185 +6168,164 @@ done done IFS=$as_save_IFS - ;; -esac fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } +fi +PYTHON_BIN=$ac_cv_prog_PYTHON_BIN +if test -n "$PYTHON_BIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_BIN" >&5 +$as_echo "$PYTHON_BIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi + test -n "$PYTHON_BIN" && break +done - - if test "$PYTHON" = :; then - as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 - else - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 -$as_echo_n "checking for $am_display_PYTHON version... " >&6; } -if ${am_cv_python_version+:} false; then : +ax_python_bin=$PYTHON_BIN +if test x$ax_python_bin != x; then + as_ac_Lib=`$as_echo "ac_cv_lib_$ax_python_bin''_main" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_python_bin" >&5 +$as_echo_n "checking for main in -l$ax_python_bin... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else - am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$ax_python_bin $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 -$as_echo "$am_cv_python_version" >&6; } - PYTHON_VERSION=$am_cv_python_version - - - - PYTHON_PREFIX='${prefix}' - - PYTHON_EXEC_PREFIX='${exec_prefix}' - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 -$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } -if ${am_cv_python_platform+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + ax_python_lib=$ax_python_bin +else + ax_python_lib=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 -$as_echo "$am_cv_python_platform" >&6; } - PYTHON_PLATFORM=$am_cv_python_platform - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[:3] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 -$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } -if ${am_cv_python_pythondir+:} false; then : + if test x$ax_python_lib == xno; then + as_ac_Lib=`$as_echo "ac_cv_lib_${ax_python_bin}m''_main" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l${ax_python_bin}m" >&5 +$as_echo_n "checking for main in -l${ax_python_bin}m... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else - if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix + ac_check_lib_save_LIBS=$LIBS +LIBS="-l${ax_python_bin}m $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + ax_python_lib=${ax_python_bin}m +else + ax_python_lib=no +fi + + fi + if test x$ax_python_lib != xno; then + ax_python_header=`$ax_python_bin -c "from distutils.sysconfig import *; print(get_config_var('CONFINCLUDEPY'))"` + if test x$ax_python_header != x; then + break; fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 -$as_echo "$am_cv_python_pythondir" >&6; } - pythondir=$am_cv_python_pythondir +done +if test x$ax_python_bin = x; then + ax_python_bin=no +fi +if test x$ax_python_header = x; then + ax_python_header=no +fi +if test x$ax_python_lib = x; then + ax_python_lib=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: results of the Python check:" >&5 +$as_echo " results of the Python check:" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Binary: $ax_python_bin" >&5 +$as_echo " Binary: $ax_python_bin" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Library: $ax_python_lib" >&5 +$as_echo " Library: $ax_python_lib" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Include Dir: $ax_python_header" >&5 +$as_echo " Include Dir: $ax_python_header" >&6; } +PYTHON_FOUND=yes +if test x$ax_python_header != xno; then + PYTHON_INCLUDE_DIR=$ax_python_header - pkgpythondir=\${pythondir}/$PACKAGE - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 -$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } -if ${am_cv_python_pyexecdir+:} false; then : - $as_echo_n "(cached) " >&6 else - if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - + PYTHON_FOUND=no +fi + +if test x$ax_python_lib != xno; then + PYTHON_LIB=$ax_python_lib + +else + PYTHON_FOUND=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 -$as_echo "$am_cv_python_pyexecdir" >&6; } - pyexecdir=$am_cv_python_pyexecdir - pkgpyexecdir=\${pyexecdir}/$PACKAGE + + if test $PYTHON_FOUND = no ; then + as_fn_error $? "No supported python lib version found. Try --disable-python" "$LINENO" 5 + else - - fi - - - PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'` - - - EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" - CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" - + EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" + CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" $as_echo "#define USE_PYTHON 1" >>confdefs.h + fi fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libjansson" >&5 $as_echo_n "checking for libjansson... " >&6; } # Check whether --enable-json was given. @@ -6499,6 +6446,7 @@ $as_echo "#define USE_JSON 1" >>confdefs.h fi + #check for custom prog name { $as_echo "$as_me:${as_lineno-$LINENO}: checking progname" >&5 $as_echo_n "checking progname... " >&6; } diff --git a/configure.ac b/configure.ac index 2379821..a2c09e5 100644 --- a/configure.ac +++ b/configure.ac @@ -94,20 +94,45 @@ AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua], AC_MSG_ERROR([No lua found. Try --disable-liblua]) ]) ]) + +AC_MSG_CHECKING([for python]) AC_ARG_ENABLE(python,[--enable-python/--disable-python], [ - AX_PYTHON() - dnl python checks (you can change the required python version bellow) - AM_PATH_PYTHON(2.7.0) - PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'` - AC_SUBST([PYTHON_LIBS]) - AC_SUBST([PYTHON_CFLAGS]) - EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" - CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" + if test "x$enableval" = "xno" ; then + AC_MSG_RESULT([disabled]) + else + AC_MSG_RESULT([enabled]) - AC_DEFINE(USE_PYTHON,1,[use python]) + AX_PYTHON() + AC_SUBST([PYTHON_FOUND]) + if test $PYTHON_FOUND = no ; then + AC_MSG_ERROR([No supported python lib version found. Try --disable-python]) + else + AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYTHON_CFLAGS]) + EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" + CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" + AC_DEFINE(USE_PYTHON,1,[use python]) + fi + fi + ],[ + AC_MSG_RESULT([enabled]) + + AX_PYTHON() + AC_SUBST([PYTHON_FOUND]) + if test $PYTHON_FOUND = no ; then + AC_MSG_ERROR([No supported python lib version found. Try --disable-python]) + else + AC_SUBST([PYTHON_LIBS]) + AC_SUBST([PYTHON_CFLAGS]) + EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" + CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" + AC_DEFINE(USE_PYTHON,1,[use python]) + fi ]) + + AC_MSG_CHECKING([for libjansson]) AC_ARG_ENABLE(json,[--enable-json/--disable-json], [ @@ -124,20 +149,6 @@ AC_ARG_ENABLE(json,[--enable-json/--disable-json], AC_DEFINE(USE_JSON,1,[use json]) ]) -AC_ARG_ENABLE(python,[--enable-python/--disable-python], - [ - AX_PYTHON() - dnl python checks (you can change the required python version bellow) - AM_PATH_PYTHON(2.7.0) - PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'` - AC_SUBST([PYTHON_LIBS]) - AC_SUBST([PYTHON_CFLAGS]) - EXTRA_LIBS="${EXTRA_LIBS} -l${PYTHON_LIB}" - CPPFLAGS="${CPPFLAGS} -I${PYTHON_INCLUDE_DIR}" - - AC_DEFINE(USE_PYTHON,1,[use python]) - ]) - #check for custom prog name AC_MSG_CHECKING([progname]) AC_ARG_WITH(progname,[--with-progname=],