From: Matthias Klose Date: Wed, 20 Feb 2019 13:25:36 +0100 Subject: Use system python-config if available Forwarded: https://sourceware.org/ml/gdb-patches/2012-12/msg00751.html --- gdb/configure | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++---- gdb/configure.ac | 14 ++++---- 2 files changed, 108 insertions(+), 12 deletions(-) Index: gdb/gdb/configure =================================================================== --- gdb.orig/gdb/configure 2019-02-22 11:22:07.547598653 +0100 +++ gdb/gdb/configure 2019-02-22 11:22:07.543598605 +0100 @@ -715,6 +715,7 @@ PYTHON_LIBS PYTHON_CPPFLAGS PYTHON_CFLAGS +python_config python_prog_path LTLIBMPFR LIBMPFR @@ -10478,29 +10479,122 @@ esac esac + python_config= if test "${python_prog}" != missing; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}${python_prog}-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}${python_prog}-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 test "${ac_cv_prog_python_config+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$python_config"; then + ac_cv_prog_python_config="$python_config" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_python_config="${ac_tool_prefix}${python_prog}-config" + $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 + +fi +fi +python_config=$ac_cv_prog_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 + + +fi +if test -z "$ac_cv_prog_python_config"; then + ac_ct_python_config=$python_config + # Extract the first word of "${python_prog}-config", so it can be a program name with args. +set dummy ${python_prog}-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 test "${ac_cv_prog_ac_ct_python_config+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_python_config"; then + ac_cv_prog_ac_ct_python_config="$ac_ct_python_config" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_python_config="${python_prog}-config" + $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 + +fi +fi +ac_ct_python_config=$ac_cv_prog_ac_ct_python_config +if test -n "$ac_ct_python_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_python_config" >&5 +$as_echo "$ac_ct_python_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_python_config" = x; then + python_config="${python_prog} ${srcdir}/python/python-config.py" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + python_config=$ac_ct_python_config + fi +else + python_config="$ac_cv_prog_python_config" +fi + # We have a python program to use, but it may be too old. # Don't flag an error for --with-python=auto (the default). have_python_config=yes - python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes` + python_includes=`${python_config} --includes` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - as_fn_error $? "failure running python-config --includes" "$LINENO" 5 + as_fn_error $? "failure running ${python-config} --includes" "$LINENO" 5 fi fi - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags` + python_libs=`${python_config} --ldflags` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - as_fn_error $? "failure running python-config --ldflags" "$LINENO" 5 + as_fn_error $? "failure running ${python-config} --ldflags" "$LINENO" 5 fi fi - python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix` + python_prefix=`${python_config} --exec-prefix` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - as_fn_error $? "failure running python-config --exec-prefix" "$LINENO" 5 + as_fn_error $? "failure running ${python-config} --exec-prefix" "$LINENO" 5 fi fi else Index: gdb/gdb/configure.ac =================================================================== --- gdb.orig/gdb/configure.ac 2019-02-22 11:22:07.547598653 +0100 +++ gdb/gdb/configure.ac 2019-02-22 11:22:07.547598653 +0100 @@ -834,29 +834,31 @@ esac esac + python_config= if test "${python_prog}" != missing; then + AC_CHECK_TOOL(python_config,[${python_prog}-config],[${python_prog} ${srcdir}/python/python-config.py]) # We have a python program to use, but it may be too old. # Don't flag an error for --with-python=auto (the default). have_python_config=yes - python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes` + python_includes=`${python_config} --includes` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - AC_ERROR(failure running python-config --includes) + AC_ERROR(failure running ${python_config} --includes) fi fi - python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags` + python_libs=`${python_config} --ldflags` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - AC_ERROR(failure running python-config --ldflags) + AC_ERROR(failure running ${python_config} --ldflags) fi fi - python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix` + python_prefix=`${python_config} --exec-prefix` if test $? != 0; then have_python_config=failed if test "${with_python}" != auto; then - AC_ERROR(failure running python-config --exec-prefix) + AC_ERROR(failure running ${python_config} --exec-prefix) fi fi else