--with-python (#970)

add --with-python configure option #969
This commit is contained in:
Scott Fennell 2020-03-17 12:28:34 -05:00 committed by GitHub
parent 255a53f34d
commit 3aa32b673e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 253 additions and 18 deletions

View File

@ -360,20 +360,60 @@ AS_IF([test "$ac_cv_path_CURL" = "nocurl"],AC_MSG_ERROR([could not find curl]),[
AC_PATH_PROG(PERL, perl)
AX_PROG_PERL_VERSION([5.14.0], [], [AC_MSG_ERROR([Trick requires perl version >= 5.14.0])])
AC_PATH_PROG(PYTHON, python${PYTHON_VERSION}, nopython)
AS_IF([test "$ac_cv_path_PYTHON" = "nopython"],
AC_ARG_WITH(
[python],
AS_HELP_STRING(
[--with-python@<:@=DIR@:>@],
[python root directory],
),
[
AC_PATH_PROG(PYTHON3, python3, nopython3)
AS_IF([test "$ac_cv_path_PYTHON3" = "nopython3"],
AC_MSG_ERROR([could not find python or python3]),
PYTHON_HOME="$withval"
AC_PATH_PROG(PYTHON, python${PYTHON_VERSION}, nopython, "$PYTHON_HOME")
AS_IF(
[test "$ac_cv_path_PYTHON" = "nopython"],
[
PYTHON_CPPFLAGS=`${PYTHON3}-config --includes`
PYTHON_LIBS=`${PYTHON3}-config --libs`
PYTHON=$PYTHON3
]
AC_PATH_PROG(PYTHON, python, nopython, "$PYTHON_HOME")
AS_IF(
[test "$ac_cv_path_PYTHON" = "nopython"],
AC_MSG_ERROR([could not find python<version> or python in specified path]),
[]
)
],
[]
)
AC_PATH_PROG(PYTHON_CONFIG, python${PYTHON_VERSION}-config, nopython-config, "$PYTHON_HOME")
AS_IF(
[test "$ac_cv_path_PYTHON_CONFIG" = "nopython-config"],
[
AC_PATH_PROG(PYTHON_CONFIG, python-config, nopython-config, "$PYTHON_HOME")
AS_IF(
[test "$ac_cv_path_PYTHON_CONFIG" = "nopython-config"],
AC_MSG_ERROR([could not find python<version>-config or python-config in specified path please install python${PYTHON_VERSION}-dev]),
[]
)
],
[]
)
PYTHON_CPPFLAGS=`${PYTHON_CONFIG} --includes`
PYTHON_LIBS=`${PYTHON_CONFIG} --libs`
],
[AX_PYTHON_DEVEL([>='2.5'])]
[
AC_PATH_PROG(PYTHON, python${PYTHON_VERSION}, nopython)
AS_IF([test "$ac_cv_path_PYTHON" = "nopython"],
[
AC_PATH_PROG(PYTHON3, python3, nopython3)
AS_IF([test "$ac_cv_path_PYTHON3" = "nopython3"],
AC_MSG_ERROR([could not find python or python3]),
[
PYTHON_CPPFLAGS=`${PYTHON3}-config --includes`
PYTHON_LIBS=`${PYTHON3}-config --libs`
PYTHON=$PYTHON3
]
)
],
[AX_PYTHON_DEVEL([>='2.5'])]
)
]
)
AC_PATH_PROG(GNUPLOT, gnuplot, nognuplot)

211
configure vendored
View File

@ -658,6 +658,7 @@ PYTHON_LIBS
PYTHON_CPPFLAGS
PYTHON_VERSION
PYTHON3
PYTHON_CONFIG
PYTHON
PERL_VERSION
SED
@ -747,6 +748,7 @@ with_x
enable_32bit
enable_offline
enable_mongoose
with_python
with_swig
enable_java
with_llvm
@ -1417,6 +1419,7 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-x use the X Window System
--with-python[=DIR] python root directory
--with-swig[=DIR] path of directory containing the SWIG executable.
--with-llvm[=DIR] LLVM root directory
--with-zlib=DIR root directory path of zlib installation [defaults to
@ -5364,7 +5367,196 @@ $as_echo "$as_me: WARNING: could not find the perl interpreter" >&2;}
fi
# Extract the first word of "python${PYTHON_VERSION}", so it can be a program name with args.
# Check whether --with-python was given.
if test "${with_python+set}" = set; then :
withval=$with_python;
PYTHON_HOME="$withval"
# Extract the first word of "python${PYTHON_VERSION}", so it can be a program name with args.
set dummy python${PYTHON_VERSION}; 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 :
$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
for as_dir in "$PYTHON_HOME"
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="nopython"
;;
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; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON" = "nopython"; then :
# Extract the first word of "python", so it can be a program name with args.
set dummy python; 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 :
$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
for as_dir in "$PYTHON_HOME"
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"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="nopython"
;;
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; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON" = "nopython"; then :
as_fn_error $? "could not find python<version> or python in specified path" "$LINENO" 5
fi
fi
# Extract the first word of "python${PYTHON_VERSION}-config", so it can be a program name with args.
set dummy python${PYTHON_VERSION}-config; 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_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PYTHON_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON_CONFIG="$PYTHON_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in "$PYTHON_HOME"
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_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON_CONFIG" && ac_cv_path_PYTHON_CONFIG="nopython-config"
;;
esac
fi
PYTHON_CONFIG=$ac_cv_path_PYTHON_CONFIG
if test -n "$PYTHON_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CONFIG" >&5
$as_echo "$PYTHON_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON_CONFIG" = "nopython-config"; then :
# Extract the first word of "python-config", so it can be a program name with args.
set dummy python-config; 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_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PYTHON_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON_CONFIG="$PYTHON_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in "$PYTHON_HOME"
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_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON_CONFIG" && ac_cv_path_PYTHON_CONFIG="nopython-config"
;;
esac
fi
PYTHON_CONFIG=$ac_cv_path_PYTHON_CONFIG
if test -n "$PYTHON_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CONFIG" >&5
$as_echo "$PYTHON_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON_CONFIG" = "nopython-config"; then :
as_fn_error $? "could not find python<version>-config or python-config in specified path please install python${PYTHON_VERSION}-dev" "$LINENO" 5
fi
fi
PYTHON_CPPFLAGS=`${PYTHON_CONFIG} --includes`
PYTHON_LIBS=`${PYTHON_CONFIG} --libs`
else
# Extract the first word of "python${PYTHON_VERSION}", so it can be a program name with args.
set dummy python${PYTHON_VERSION}; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@ -5405,10 +5597,9 @@ $as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON" = "nopython"; then :
if test "$ac_cv_path_PYTHON" = "nopython"; then :
# Extract the first word of "python3", so it can be a program name with args.
# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@ -5449,13 +5640,13 @@ $as_echo "no" >&6; }
fi
if test "$ac_cv_path_PYTHON3" = "nopython3"; then :
if test "$ac_cv_path_PYTHON3" = "nopython3"; then :
as_fn_error $? "could not find python or python3" "$LINENO" 5
else
PYTHON_CPPFLAGS=`${PYTHON3}-config --includes`
PYTHON_LIBS=`${PYTHON3}-config --libs`
PYTHON=$PYTHON3
PYTHON_CPPFLAGS=`${PYTHON3}-config --includes`
PYTHON_LIBS=`${PYTHON3}-config --libs`
PYTHON=$PYTHON3
fi
@ -5812,6 +6003,10 @@ See \`config.log' for more details" "$LINENO" 5; }
fi
fi
# Extract the first word of "gnuplot", so it can be a program name with args.
set dummy gnuplot; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5