Commit e53422a5 authored by Evan Hunt's avatar Evan Hunt Committed by Mark Andrews
Browse files

test for argparse in configure

parent efc5d784
......@@ -1555,6 +1555,7 @@ with_pic
with_tags
enable_libbind
enable_developer
with_python
enable_kqueue
enable_epoll
enable_devpoll
......@@ -2272,6 +2273,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)
......@@ -19636,7 +19638,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
......@@ -19682,6 +19695,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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment