From: Evan Hunt Date: Mon, 30 Apr 2012 17:13:31 +0000 (-0700) Subject: test for argparse in configure X-Git-Tag: v9.10.0a1~1062^2^2~5 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=002c5c8cbc64c99b34bc273113f010bbdb77d82c;p=thirdparty%2Fbind9.git test for argparse in configure --- diff --git a/configure b/configure index 1bb57133c58..05eeaa7d8b5 100755 --- a/configure +++ b/configure @@ -1552,6 +1552,7 @@ with_pic with_tags enable_libbind enable_developer +with_python enable_kqueue enable_epoll enable_devpoll @@ -2269,6 +2270,7 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] + --with-python=PATH Specify path to python interpreter --with-openssl=PATH Build with OpenSSL yes|no|path. (Required for DNSSEC) @@ -5166,7 +5168,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5169 "configure"' > conftest.$ac_ext + echo '#line 5171 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7461,11 +7463,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7464: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7466: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7468: \$? = $ac_status" >&5 + echo "$as_me:7470: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7751,11 +7753,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7754: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7756: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7758: \$? = $ac_status" >&5 + echo "$as_me:7760: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7855,11 +7857,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7858: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7860: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7862: \$? = $ac_status" >&5 + echo "$as_me:7864: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9880,7 +9882,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12330: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12332: \$? = $ac_status" >&5 + echo "$as_me:12334: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12429,11 +12431,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12432: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12434: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12436: \$? = $ac_status" >&5 + echo "$as_me:12438: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14012,11 +14014,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14015: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14017: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14019: \$? = $ac_status" >&5 + echo "$as_me:14021: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14116,11 +14118,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14119: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14121: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14123: \$? = $ac_status" >&5 + echo "$as_me:14125: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16281,11 +16283,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16284: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16286: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16288: \$? = $ac_status" >&5 + echo "$as_me:16290: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16571,11 +16573,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16574: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16576: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16578: \$? = $ac_status" >&5 + echo "$as_me:16580: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16675,11 +16677,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16678: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16680: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16682: \$? = $ac_status" >&5 + echo "$as_me:16684: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19633,7 +19635,18 @@ done # Python is also optional; it is used by the tools in bin/python. # If python is unavailable, we simply don't build those. # -for ac_prog in python + +# Check whether --with-python was given. +if test "${with_python+set}" = set; then : + withval=$with_python; use_python="$withval" +else + use_python="unspec" +fi + + +case "$use_python" in + unspec) + 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 @@ -19679,6 +19692,32 @@ fi done + testscript='try: import argparse +except: exit(1)' + if $PYTHON -c "$testscript"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $PYTHON" >&5 +$as_echo "using $PYTHON" >&6; } + else + as_fn_error "python 'argparse' module not supported" "$LINENO" 5 + fi + ;; + yes) + as_fn_error "--with-python must specify a path" "$LINENO" 5 + ;; + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } + ;; + *) + cat >>confdefs.h <<_ACEOF +#define PYTHON "$use_python" +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using \"$use_python\"" >&5 +$as_echo "using \"$use_python\"" >&6; } + + ;; +esac PYTHON_TOOLS='' if test "X$PYTHON" != "X"; then diff --git a/configure.in b/configure.in index f1d1269b38e..571d371c376 100644 --- a/configure.in +++ b/configure.in @@ -140,8 +140,34 @@ AC_SUBST(PERL) # Python is also optional; it is used by the tools in bin/python. # If python is unavailable, we simply don't build those. # -AC_PATH_PROGS(PYTHON, python) -AC_SUBST(PYTHON) +AC_ARG_WITH(python, +[ --with-python=PATH Specify path to python interpreter], + use_python="$withval", use_python="unspec") + +case "$use_python" in + unspec) + AC_PATH_PROGS(PYTHON, python) + AC_SUBST(PYTHON) + testscript='try: import argparse +except: exit(1)' + if $PYTHON -c "$testscript"; then + AC_MSG_RESULT([using $PYTHON]) + else + AC_MSG_ERROR([python 'argparse' module not supported]) + fi + ;; + yes) + AC_MSG_ERROR([--with-python must specify a path]) + ;; + no) + AC_MSG_RESULT(disabled) + ;; + *) + AC_DEFINE_UNQUOTED(PYTHON, "$use_python") + AC_MSG_RESULT(using "$use_python") + AC_SUBST(PYTHON) + ;; +esac PYTHON_TOOLS='' if test "X$PYTHON" != "X"; then