From e1402065ee37ec094d31ccf08fe32efc8df679f1 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 10 Feb 2014 23:04:38 -0800 Subject: Don't crash if pkg-config is not found and guile wasn't explicitly requested. * configure.ac: Don't crash if pkg-config is not found and guile wasn't explicitly requested. Use AC_MSG_ERROR instead of AC_ERROR in guile checks. * configure: Regenerate. --- gdb/ChangeLog | 7 ++++++ gdb/configure | 72 ++++++++++++++++++++++++-------------------------------- gdb/configure.ac | 41 +++++++++++++++++++------------- 3 files changed, 62 insertions(+), 58 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2fcd4a9..435a570 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-02-11 Doug Evans + + * configure.ac: Don't crash if pkg-config is not found and guile + wasn't explicitly requested. Use AC_MSG_ERROR instead of AC_ERROR + in guile checks. + * configure: Regenerate. + 2014-02-11 Yao Qi * aix-thread.c (aix_thread_xfer_partial): Update comments. diff --git a/gdb/configure b/gdb/configure index f856cc4..fd61bb5 100755 --- a/gdb/configure +++ b/gdb/configure @@ -8692,6 +8692,22 @@ fi # -------------------- # + + + + +# Check whether --with-guile was given. +if test "${with_guile+set}" = set; then : + withval=$with_guile; +else + with_guile=auto +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use guile" >&5 +$as_echo_n "checking whether to use guile... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_guile" >&5 +$as_echo "$with_guile" >&6; } + # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -8734,23 +8750,6 @@ fi - - - - - -# Check whether --with-guile was given. -if test "${with_guile+set}" = set; then : - withval=$with_guile; -else - with_guile=auto -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use guile" >&5 -$as_echo_n "checking whether to use guile... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_guile" >&5 -$as_echo "$with_guile" >&6; } - try_guile_versions="guile-2.0" have_libguile=no case "${with_guile}" in @@ -8759,17 +8758,15 @@ no) $as_echo "$as_me: WARNING: guile support disabled; some features will be unavailable." >&2;} ;; auto) + if test "${pkg_config_prog_path}" = "missing"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found, guile support disabled" >&5 +$as_echo "$as_me: WARNING: pkg-config not found, guile support disabled" >&2;} + else pkg_config=${pkg_config_prog_path} guile_version_list=${try_guile_versions} flag_errors=no - if test "${pkg_config}" = "missing"; then - as_fn_error "pkg-config program not found" "$LINENO" 5 - fi - if test ! -f "${pkg_config}"; then - as_fn_error "pkg-config program ${pkg_config} not found" "$LINENO" 5 - fi found_usable_guile=checking { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } @@ -8835,19 +8832,17 @@ See \`config.log' for more details." "$LINENO" 5; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_guile}" >&5 $as_echo "${found_usable_guile}" >&6; } + fi ;; yes) + if test "${pkg_config_prog_path}" = "missing"; then + as_fn_error "pkg-config not found" "$LINENO" 5 + fi pkg_config=${pkg_config_prog_path} guile_version_list=${try_guile_versions} flag_errors=yes - if test "${pkg_config}" = "missing"; then - as_fn_error "pkg-config program not found" "$LINENO" 5 - fi - if test ! -f "${pkg_config}"; then - as_fn_error "pkg-config program ${pkg_config} not found" "$LINENO" 5 - fi found_usable_guile=checking { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } @@ -8915,17 +8910,12 @@ $as_echo "${found_usable_guile}" >&6; } ;; [\\/]* | ?:[\\/]*) + if test -x "${with_guile}"; then pkg_config=${with_guile} guile_version_list=${try_guile_versions} flag_errors=yes - if test "${pkg_config}" = "missing"; then - as_fn_error "pkg-config program not found" "$LINENO" 5 - fi - if test ! -f "${pkg_config}"; then - as_fn_error "pkg-config program ${pkg_config} not found" "$LINENO" 5 - fi found_usable_guile=checking { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } @@ -8991,6 +8981,9 @@ See \`config.log' for more details." "$LINENO" 5; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_guile}" >&5 $as_echo "${found_usable_guile}" >&6; } + else + as_fn_error "Guile config program not executable: ${with_guile}" "$LINENO" 5 + fi ;; "" | */*) # Disallow --with=guile="" and --with-guile=foo/bar. @@ -8998,17 +8991,14 @@ $as_echo "${found_usable_guile}" >&6; } ;; *) # A space separate list of guile versions to try, in order. + if test "${pkg_config_prog_path}" = "missing"; then + as_fn_error "pkg-config not found" "$LINENO" 5 + fi pkg_config=${pkg_config_prog_path} guile_version_list=${with_guile} flag_errors=yes - if test "${pkg_config}" = "missing"; then - as_fn_error "pkg-config program not found" "$LINENO" 5 - fi - if test ! -f "${pkg_config}"; then - as_fn_error "pkg-config program ${pkg_config} not found" "$LINENO" 5 - fi found_usable_guile=checking { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } diff --git a/gdb/configure.ac b/gdb/configure.ac index 73decd0..494d711 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1058,10 +1058,6 @@ AC_SUBST(PYTHON_LIBS) # Check for libguile. # # -------------------- # -dnl We check guile with pkg-config. - -AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing) - dnl Utility to simplify finding libguile. dnl $1 = pkg-config-program dnl $2 = space-separate list of guile versions to try @@ -1075,12 +1071,6 @@ AC_DEFUN([AC_TRY_LIBGUILE], guile_version_list=$2 flag_errors=$3 define([have_libguile_var],$4) - if test "${pkg_config}" = "missing"; then - AC_ERROR(pkg-config program not found) - fi - if test ! -f "${pkg_config}"; then - AC_ERROR(pkg-config program ${pkg_config} not found) - fi found_usable_guile=checking AC_MSG_CHECKING([for usable guile from ${pkg_config}]) for guile_version in ${guile_version_list}; do @@ -1092,11 +1082,11 @@ AC_DEFUN([AC_TRY_LIBGUILE], dnl that's bad. new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` if test $? != 0; then - AC_ERROR(failure running pkg-config --cflags ${guile_version}) + AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}]) fi new_LIBS=`${pkg_config} --libs ${guile_version}` if test $? != 0; then - AC_ERROR(failure running pkg-config --libs ${guile_version}) + AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}]) fi dnl If we get this far, great. found_usable_guile=${guile_version} @@ -1104,7 +1094,7 @@ AC_DEFUN([AC_TRY_LIBGUILE], done if test "${found_usable_guile}" = "checking"; then if test "${flag_errors}" = "yes"; then - AC_ERROR(unable to find usable guile version from "${guile_version_list}") + AC_MSG_ERROR([unable to find usable guile version from "${guile_version_list}"]) else found_usable_guile=no fi @@ -1126,7 +1116,7 @@ AC_DEFUN([AC_TRY_LIBGUILE], LIBS=$save_LIBS if test "${found_usable_guile}" = no; then if test "${flag_errors}" = yes; then - AC_MSG_FAILURE(linking guile version ${guile_version} test program failed) + AC_MSG_FAILURE([linking guile version ${guile_version} test program failed]) fi fi fi @@ -1161,6 +1151,9 @@ AC_ARG_WITH(guile, AC_MSG_CHECKING([whether to use guile]) AC_MSG_RESULT([$with_guile]) +dnl We check guile with pkg-config. +AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing) + try_guile_versions="guile-2.0" have_libguile=no case "${with_guile}" in @@ -1168,20 +1161,34 @@ no) AC_MSG_WARN([guile support disabled; some features will be unavailable.]) ;; auto) - AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, no, have_libguile) + if test "${pkg_config_prog_path}" = "missing"; then + AC_MSG_WARN([pkg-config not found, guile support disabled]) + else + AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, no, have_libguile) + fi ;; yes) + if test "${pkg_config_prog_path}" = "missing"; then + AC_MSG_ERROR([pkg-config not found]) + fi AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, yes, have_libguile) ;; [[\\/]]* | ?:[[\\/]]*) - AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile) + if test -x "${with_guile}"; then + AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile) + else + AC_MSG_ERROR([Guile config program not executable: ${with_guile}]) + fi ;; "" | */*) # Disallow --with=guile="" and --with-guile=foo/bar. - AC_ERROR(invalid value for --with-guile) + AC_MSG_ERROR([invalid value for --with-guile]) ;; *) # A space separate list of guile versions to try, in order. + if test "${pkg_config_prog_path}" = "missing"; then + AC_MSG_ERROR([pkg-config not found]) + fi AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${with_guile}, yes, have_libguile) ;; esac -- cgit v1.1