From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id C69BA3896C19 for ; Thu, 24 Nov 2022 23:51:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C69BA3896C19 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x334.google.com with SMTP id t25-20020a1c7719000000b003cfa34ea516so5239195wmi.1 for ; Thu, 24 Nov 2022 15:51:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=yAGKGtEAlOjvZYm+2fJVtyCnQ+F08FPOgqQ8D+Ndk4I=; b=Jf9Uv4LQSlUxnM5wFOHG4hMb3G8iGKY+wad+Wbu7BEBZszZZERLHxxBst5DFnZOp+k HVzf1/fTrlO7GK5J3PpcpbytNhHCN9SUFqHeRWFvaXFfQapvtlQW7Yq5i1nWTcIGAE1x AkCLmhC+Az0U79myUriv0Qm5v6I97bu1oQn1/7IxUQq6qhrpxbJe8Z8H9n0ZVVYO+9xr ZcYZze/6AMpYEo9kc0hdALvLUxxn6Ajbj6FYtGQde//tOw9BjXl85nAvdtkrxZAInrHK /u7s8dqnfTEFdJfzCsX2uxe1LRfB6XlGSbkIgWt1aUiwPfK/diyxDnskO+Nd7lytfeIf HbOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yAGKGtEAlOjvZYm+2fJVtyCnQ+F08FPOgqQ8D+Ndk4I=; b=JD83grwhgT8pOsyTGL/eQ7RS4ZVicfAgTK2gFXsjNrPeKZrDemeqMJCrMtCZgEDyK7 aNo7AC0dnWpgPMkcR+79rJsxoJbQbgibSr6EHy/WWx8hYfPwWeefsThuRNnwsEAwqW5z Ohym1fmK1uT9udd6VTjmHJYsStid0wTpLn9U2jm35gi3fGzNp1MThnbpRLZGMo3zE4Xq ZZ4v5qAhJtXOvpJw8ELVBdAL8i1KTAeacqMs23ApGgNVFevf2xCXXb0DMhm83i6LOHVX emA+ymbiDBCJp6Zn+nKWqk+juoBZcbKF2zcit+RjFbxRfdqbkuLcsXj+7JJnwSXUavnr xdHQ== X-Gm-Message-State: ANoB5pmLVblVtgTeV5iLHwjwI1j8t22aks3XudzDL9qqg7xD9yE0fIV6 wlVRjYJ7HIhboNa+Mqz4192nE9KWkKmu3/vY X-Google-Smtp-Source: AA0mqf6DLB8W0IT3qPpJeuxn8rhQwHH8vD9OIvqMfCtjFT0G96yYTo23r0fB634m5HHEnCaYbrBN0w== X-Received: by 2002:a05:600c:a382:b0:3c6:bece:49b5 with SMTP id hn2-20020a05600ca38200b003c6bece49b5mr19370698wmb.160.1669333895132; Thu, 24 Nov 2022 15:51:35 -0800 (PST) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id m1-20020a056000024100b00228cbac7a25sm2368173wrz.64.2022.11.24.15.51.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2022 15:51:34 -0800 (PST) Date: Thu, 24 Nov 2022 23:51:33 +0000 (GMT) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org Subject: [PATCH 3/3] GDB: Use standard autoconf macros for `pkg-config' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_ASCII_DIVIDERS,KAM_LINEPADDING,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: We use standard autoconf macros for `pkg-config' with other directories outside gdb/ already and we have them available in config/pkg.m4. Use them for GDB too then, taking advantage of shared cached results where available, respecting the PKG_CONFIG command-line `configure' variable, making standard GUILE_CFLAGS, GUILE_LIBS, SRCHIGH_CFLAGS and SRCHIGH_LIBS command-line `configure' variables available automatically, and reducing code duplicated locally in `configure.ac'. The only complication is our local non-standard `/path/to/pkg-config' override available as an argument to `--with-guile=', not handled by standard macros, where the PKG_CONFIG command-line `configure' variable, is the documented way to override the automatically determined location of the `pkg-config' program, but it applies globally rather than just for Guile configuration under gdb/. This is handled by temporarily overriding the ac_cv_path_PKG_CONFIG cache variable, replacing any global value already set. While not a documented interface and subject to change with future versions of `pkg-config' it is not supposed to be an issue because we are also in control of the macros in config/pkg.m4, so when updating those we can adjust the references here accordingly if required. --- gdb/Makefile.in | 2 gdb/configure | 824 +++++++++++++++++++++++++++++++++++++------------------ gdb/configure.ac | 155 ++++------ 3 files changed, 631 insertions(+), 350 deletions(-) Index: src/gdb/Makefile.in =================================================================== --- src.orig/gdb/Makefile.in +++ src/gdb/Makefile.in @@ -623,7 +623,7 @@ CPPFLAGS = @CPPFLAGS@ # are sometimes a little generic, we think that the risk of collision # with other header files is high. If that happens, we try to mitigate # a bit the consequences by putting the Python includes last in the list. -INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@ \ +INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CFLAGS@ @PYTHON_CPPFLAGS@ \ @LARGEFILE_CPPFLAGS@ # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. Index: src/gdb/configure =================================================================== --- src.orig/gdb/configure +++ src/gdb/configure @@ -724,15 +724,14 @@ PTHREAD_LIBS PTHREAD_CC ax_pthread_config ALLOCA -SRCHIGH_CFLAGS SRCHIGH_LIBS +SRCHIGH_CFLAGS HAVE_GUILE_FALSE HAVE_GUILE_TRUE -GUILE_LIBS -GUILE_CPPFLAGS GUILD_TARGET_FLAG GUILD -pkg_config_prog_path +GUILE_LIBS +GUILE_CFLAGS HAVE_PYTHON_FALSE HAVE_PYTHON_TRUE PYTHON_LIBS @@ -995,6 +994,10 @@ YACC YFLAGS ZSTD_CFLAGS ZSTD_LIBS +GUILE_CFLAGS +GUILE_LIBS +SRCHIGH_CFLAGS +SRCHIGH_LIBS XMKMF' ac_subdirs_all='testsuite gdbtk' @@ -1768,6 +1771,13 @@ if test -n "$ac_init_help"; then default value of `-d' given by some make applications. ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config ZSTD_LIBS linker flags for ZSTD, overriding pkg-config + GUILE_CFLAGS + C compiler flags for GUILE, overriding pkg-config + GUILE_LIBS linker flags for GUILE, overriding pkg-config + SRCHIGH_CFLAGS + C compiler flags for SRCHIGH, overriding pkg-config + SRCHIGH_LIBS + linker flags for SRCHIGH, overriding pkg-config XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help @@ -11451,7 +11461,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11454 "configure" +#line 11464 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11557,7 +11567,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11560 "configure" +#line 11570 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22846,16 +22856,97 @@ $as_echo_n "checking whether to use guil { $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. +try_guile_versions="guile-3.0 guile-2.2 guile-2.0" +case "${with_guile}" in +no|auto|yes) + try_guile=${with_guile} + ;; +[\\/]* | ?:[\\/]*) + try_guile=yes + if test ! -x "${with_guile}"; then + as_fn_error $? "Guile config program not executable: ${with_guile}" "$LINENO" 5 + fi + guile_PKG_CONFIG_set=yes + guile_PKG_CONFIG=${PKG_CONFIG} + guile_cache_PKG_CONFIG=${ac_cv_path_PKG_CONFIG} + PKG_CONFIG=${with_guile} + ac_cv_path_PKG_CONFIG=${with_guile} + ;; +"" | */*) + # Disallow --with=guile="" and --with-guile=foo/bar. + as_fn_error $? "invalid value for --with-guile" "$LINENO" 5 + ;; +*) + try_guile=yes + try_guile_versions=${with_guile} + ;; +esac + + + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-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_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # 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 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_pkg_config_prog_path+:} false; then : +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else - case $pkg_config_prog_path in + case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_pkg_config_prog_path="$pkg_config_prog_path" # Let the user override the test with a path. + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -22865,7 +22956,7 @@ do 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_pkg_config_prog_path="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_ac_pt_PKG_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 @@ -22873,41 +22964,62 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_pkg_config_prog_path" && ac_cv_path_pkg_config_prog_path="missing" ;; esac fi -pkg_config_prog_path=$ac_cv_path_pkg_config_prog_path -if test -n "$pkg_config_prog_path"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config_prog_path" >&5 -$as_echo "$pkg_config_prog_path" >&6; } +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + 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 + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.29 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi -try_guile_versions="guile-3.0 guile-2.2 guile-2.0" have_libguile=no -case "${with_guile}" in -no) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: guile support disabled; some features will be unavailable." >&5 -$as_echo "$as_me: WARNING: guile support disabled; some features will be unavailable." >&2;} - ;; +case "${try_guile}" in auto) - if test "${pkg_config_prog_path}" = "missing"; then + if test x"${PKG_CONFIG}" = x; 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 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; } + { $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; } for guile_version in ${guile_version_list}; do case "${guile_version}" in *[^.0-9]*) @@ -22916,111 +23028,107 @@ $as_echo_n "checking for usable guile fr guile_version=guile-"${guile_version}" ;; esac - ${pkg_config} --exists ${guile_version} 2>/dev/null - if test $? != 0; then - continue - fi - new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 - fi - new_LIBS=`${pkg_config} --static --libs ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 - fi - found_usable_guile=${guile_version} - break - done - if test "${found_usable_guile}" = "checking"; then - if test "${flag_errors}" = "yes"; then - as_fn_error $? "unable to find usable guile version from \"${guile_version_list}\"" "$LINENO" 5 - else - found_usable_guile=no - fi - fi - if test "${found_usable_guile}" != no; then - save_CPPFLAGS=$CPPFLAGS - save_LIBS=$LIBS - CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" - LIBS="$LIBS $new_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + _save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${guile_version}" >&5 +$as_echo_n "checking for ${guile_version}... " >&6; } + +if test -n "$GUILE_CFLAGS"; then + pkg_cv_GUILE_CFLAGS="$GUILE_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\${guile_version}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "${guile_version}") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUILE_CFLAGS=`$PKG_CONFIG --cflags "${guile_version}" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GUILE_LIBS"; then + pkg_cv_GUILE_LIBS="$GUILE_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\${guile_version}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "${guile_version}") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUILE_LIBS=`$PKG_CONFIG --libs "${guile_version}" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + +if test $pkg_failed = no; then + pkg_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $pkg_cv_GUILE_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include "libguile.h" + int main () { -scm_init_guile (); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - have_libguile=yes - GUILE_CPPFLAGS=$new_CPPFLAGS - GUILE_LIBS=$new_LIBS + else - found_usable_guile=no + pkg_failed=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled" -if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then : - -$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h - - + LDFLAGS=$pkg_save_LDFLAGS fi - CPPFLAGS=$save_CPPFLAGS - LIBS=$save_LIBS - if test "${found_usable_guile}" = no; then - if test "${flag_errors}" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "linking guile version ${guile_version} test program failed -See \`config.log' for more details" "$LINENO" 5; } - fi - fi - fi - { $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_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - 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; } - for guile_version in ${guile_version_list}; do - case "${guile_version}" in - *[^.0-9]*) - ;; - *) - guile_version=guile-"${guile_version}" - ;; - esac - ${pkg_config} --exists ${guile_version} 2>/dev/null - if test $? != 0; then - continue - fi - new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 - fi - new_LIBS=`${pkg_config} --static --libs ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GUILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "${guile_version}" 2>&1` + else + GUILE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "${guile_version}" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GUILE_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + GUILE_CFLAGS=$pkg_cv_GUILE_CFLAGS + GUILE_LIBS=$pkg_cv_GUILE_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + found_usable_guile=${guile_version} +fi +PKG_CONFIG=$_save_PKG_CONFIG + if test "${found_usable_guile}" != "checking"; then + break fi - found_usable_guile=${guile_version} - break done if test "${found_usable_guile}" = "checking"; then if test "${flag_errors}" = "yes"; then @@ -23032,8 +23140,8 @@ $as_echo_n "checking for usable guile fr if test "${found_usable_guile}" != no; then save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS - CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" - LIBS="$LIBS $new_LIBS" + CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS" + LIBS="$LIBS $GUILE_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "libguile.h" @@ -23047,8 +23155,6 @@ scm_init_guile (); _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_libguile=yes - GUILE_CPPFLAGS=$new_CPPFLAGS - GUILE_LIBS=$new_LIBS else found_usable_guile=no fi @@ -23071,22 +23177,26 @@ $as_echo "$as_me: error: in \`$ac_pwd':" as_fn_error $? "linking guile version ${guile_version} test program failed See \`config.log' for more details" "$LINENO" 5; } fi + unset GUILE_CFLAGS + unset GUILE_LIBS fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_guile}" >&5 $as_echo "${found_usable_guile}" >&6; } + fi ;; -[\\/]* | ?:[\\/]*) - if test -x "${with_guile}"; then +yes) + if test x"${PKG_CONFIG}" = x; then + as_fn_error $? "pkg-config not found" "$LINENO" 5 + fi - pkg_config=${with_guile} guile_version_list=${try_guile_versions} flag_errors=yes 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; } + { $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; } for guile_version in ${guile_version_list}; do case "${guile_version}" in *[^.0-9]*) @@ -23095,118 +23205,107 @@ $as_echo_n "checking for usable guile fr guile_version=guile-"${guile_version}" ;; esac - ${pkg_config} --exists ${guile_version} 2>/dev/null - if test $? != 0; then - continue - fi - new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 - fi - new_LIBS=`${pkg_config} --static --libs ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 - fi - found_usable_guile=${guile_version} - break - done - if test "${found_usable_guile}" = "checking"; then - if test "${flag_errors}" = "yes"; then - as_fn_error $? "unable to find usable guile version from \"${guile_version_list}\"" "$LINENO" 5 - else - found_usable_guile=no - fi - fi - if test "${found_usable_guile}" != no; then - save_CPPFLAGS=$CPPFLAGS - save_LIBS=$LIBS - CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" - LIBS="$LIBS $new_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + _save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${guile_version}" >&5 +$as_echo_n "checking for ${guile_version}... " >&6; } + +if test -n "$GUILE_CFLAGS"; then + pkg_cv_GUILE_CFLAGS="$GUILE_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\${guile_version}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "${guile_version}") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUILE_CFLAGS=`$PKG_CONFIG --cflags "${guile_version}" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GUILE_LIBS"; then + pkg_cv_GUILE_LIBS="$GUILE_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\${guile_version}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "${guile_version}") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GUILE_LIBS=`$PKG_CONFIG --libs "${guile_version}" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + +if test $pkg_failed = no; then + pkg_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $pkg_cv_GUILE_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include "libguile.h" + int main () { -scm_init_guile (); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - have_libguile=yes - GUILE_CPPFLAGS=$new_CPPFLAGS - GUILE_LIBS=$new_LIBS + else - found_usable_guile=no + pkg_failed=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ac_fn_c_check_func "$LINENO" "scm_set_automatic_finalization_enabled" "ac_cv_func_scm_set_automatic_finalization_enabled" -if test "x$ac_cv_func_scm_set_automatic_finalization_enabled" = xyes; then : - -$as_echo "#define HAVE_GUILE_MANUAL_FINALIZATION 1" >>confdefs.h - - + LDFLAGS=$pkg_save_LDFLAGS fi - CPPFLAGS=$save_CPPFLAGS - LIBS=$save_LIBS - if test "${found_usable_guile}" = no; then - if test "${flag_errors}" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "linking guile version ${guile_version} test program failed -See \`config.log' for more details" "$LINENO" 5; } - fi - fi - fi - { $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. - as_fn_error $? "invalid value for --with-guile" "$LINENO" 5 - ;; -*) - # 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_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - 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; } - for guile_version in ${guile_version_list}; do - case "${guile_version}" in - *[^.0-9]*) - ;; - *) - guile_version=guile-"${guile_version}" - ;; - esac - ${pkg_config} --exists ${guile_version} 2>/dev/null - if test $? != 0; then - continue - fi - new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 - fi - new_LIBS=`${pkg_config} --static --libs ${guile_version}` - if test $? != 0; then - as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GUILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "${guile_version}" 2>&1` + else + GUILE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "${guile_version}" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GUILE_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + GUILE_CFLAGS=$pkg_cv_GUILE_CFLAGS + GUILE_LIBS=$pkg_cv_GUILE_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + found_usable_guile=${guile_version} +fi +PKG_CONFIG=$_save_PKG_CONFIG + if test "${found_usable_guile}" != "checking"; then + break fi - found_usable_guile=${guile_version} - break done if test "${found_usable_guile}" = "checking"; then if test "${flag_errors}" = "yes"; then @@ -23218,8 +23317,8 @@ $as_echo_n "checking for usable guile fr if test "${found_usable_guile}" != no; then save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS - CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" - LIBS="$LIBS $new_LIBS" + CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS" + LIBS="$LIBS $GUILE_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "libguile.h" @@ -23233,8 +23332,6 @@ scm_init_guile (); _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_libguile=yes - GUILE_CPPFLAGS=$new_CPPFLAGS - GUILE_LIBS=$new_LIBS else found_usable_guile=no fi @@ -23257,61 +23354,35 @@ $as_echo "$as_me: error: in \`$ac_pwd':" as_fn_error $? "linking guile version ${guile_version} test program failed See \`config.log' for more details" "$LINENO" 5; } fi + unset GUILE_CFLAGS + unset GUILE_LIBS fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_guile}" >&5 $as_echo "${found_usable_guile}" >&6; } ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: guile support disabled; some features will be unavailable." >&5 +$as_echo "$as_me: WARNING: guile support disabled; some features will be unavailable." >&2;} + ;; esac if test "${have_libguile}" != no; then - case "${with_guile}" in - [\\/]* | ?:[\\/]*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the absolute file name of the 'guild' command" >&5 $as_echo_n "checking for the absolute file name of the 'guild' command... " >&6; } if ${ac_cv_guild_program_name+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_guild_program_name="`"${with_guile}" --variable guild "${guile_version}"`" - - # In Guile up to 2.0.11 included, guile-2.0.pc would not define - # the 'guild' and 'bindir' variables. In that case, try to guess - # what the program name is, at the risk of getting it wrong if - # Guile was configured with '--program-suffix' or similar. - if test "x$ac_cv_guild_program_name" = "x"; then - guile_exec_prefix="`"${with_guile}" --variable exec_prefix "${guile_version}"`" - ac_cv_guild_program_name="$guile_exec_prefix/bin/guild" - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_guild_program_name" >&5 -$as_echo "$ac_cv_guild_program_name" >&6; } - - if ! "$ac_cv_guild_program_name" --version >&5 2>&5; then - as_fn_error $? "'$ac_cv_guild_program_name' appears to be unusable" "$LINENO" 5 - fi - - GUILD="$ac_cv_guild_program_name" - - - ;; - *) - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the absolute file name of the 'guild' command" >&5 -$as_echo_n "checking for the absolute file name of the 'guild' command... " >&6; } -if ${ac_cv_guild_program_name+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_guild_program_name="`"${pkg_config_prog_path}" --variable guild "${guile_version}"`" + ac_cv_guild_program_name="`"${PKG_CONFIG}" --variable guild "${guile_version}"`" # In Guile up to 2.0.11 included, guile-2.0.pc would not define # the 'guild' and 'bindir' variables. In that case, try to guess # what the program name is, at the risk of getting it wrong if # Guile was configured with '--program-suffix' or similar. if test "x$ac_cv_guild_program_name" = "x"; then - guile_exec_prefix="`"${pkg_config_prog_path}" --variable exec_prefix "${guile_version}"`" + guile_exec_prefix="`"${PKG_CONFIG}" --variable exec_prefix "${guile_version}"`" ac_cv_guild_program_name="$guile_exec_prefix/bin/guild" fi @@ -23326,8 +23397,6 @@ $as_echo "$ac_cv_guild_program_name" >&6 GUILD="$ac_cv_guild_program_name" - ;; - esac if test "$cross_compiling" = no; then @@ -23356,6 +23425,8 @@ $as_echo "$ac_cv_guild_ok" >&6; } if test "$ac_cv_guild_ok" = no; then have_libguile=no + unset GUILE_CFLAGS + unset GUILE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling guile support" >&5 $as_echo "$as_me: WARNING: disabling guile support" >&2;} fi @@ -23374,7 +23445,7 @@ $as_echo "#define HAVE_GUILE 1" >>confde save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" LIBS="$GUILE_LIBS" - CPPFLAGS="$GUILE_CPPFLAGS" + CPPFLAGS="$GUILE_CFLAGS" for ac_func in scm_new_smob do : ac_fn_c_check_func "$LINENO" "scm_new_smob" "ac_cv_func_scm_new_smob" @@ -23394,8 +23465,6 @@ else CONFIG_OBS="$CONFIG_OBS guile/guile.o" CONFIG_SRCS="$CONFIG_SRCS guile/guile.c" fi - - if test "${have_libguile}" != no; then HAVE_GUILE_TRUE= HAVE_GUILE_FALSE='#' @@ -23405,6 +23474,132 @@ else fi +if test x"${guile_PKG_CONFIG_set}" != x; then + PKG_CONFIG=${guile_PKG_CONFIG} + ac_cv_path_PKG_CONFIG=${guile_cache_PKG_CONFIG} + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-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_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # 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 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_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 + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + 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 + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.29 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +fi + # ---------------------------- # # Check for source highlight. # # ---------------------------- # @@ -23431,23 +23626,118 @@ fi if test "${enable_source_highlight}" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the source-highlight library" >&5 $as_echo_n "checking for the source-highlight library... " >&6; } - if test "${pkg_config_prog_path}" = "missing"; then + if test x"${PKG_CONFIG}" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no - pkg-config not found" >&5 $as_echo "no - pkg-config not found" >&6; } if test "${enable_source_highlight}" = "yes"; then as_fn_error $? "pkg-config was not found in your system" "$LINENO" 5 fi else - if ${pkg_config_prog_path} --exists source-highlight; then + _save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for source-highlight" >&5 +$as_echo_n "checking for source-highlight... " >&6; } + +if test -n "$SRCHIGH_CFLAGS"; then + pkg_cv_SRCHIGH_CFLAGS="$SRCHIGH_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"source-highlight\""; } >&5 + ($PKG_CONFIG --exists --print-errors "source-highlight") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SRCHIGH_CFLAGS=`$PKG_CONFIG --cflags "source-highlight" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SRCHIGH_LIBS"; then + pkg_cv_SRCHIGH_LIBS="$SRCHIGH_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"source-highlight\""; } >&5 + ($PKG_CONFIG --exists --print-errors "source-highlight") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SRCHIGH_LIBS=`$PKG_CONFIG --libs "source-highlight" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + +if test $pkg_failed = no; then + pkg_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $pkg_cv_SRCHIGH_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + pkg_failed=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$pkg_save_LDFLAGS +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SRCHIGH_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "source-highlight" 2>&1` + else + SRCHIGH_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "source-highlight" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SRCHIGH_PKG_ERRORS" >&5 + + have_source_highlight=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_source_highlight=no +else + SRCHIGH_CFLAGS=$pkg_cv_SRCHIGH_CFLAGS + SRCHIGH_LIBS=$pkg_cv_SRCHIGH_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_source_highlight=yes +fi +PKG_CONFIG=$_save_PKG_CONFIG + if test x"${have_source_highlight}" = xyes; then case "$LDFLAGS" in *static-libstdc*) as_fn_error $? "source highlight is incompatible with -static-libstdc++; either use --disable-source-highlight or --without-static-standard-libraries" "$LINENO" 5 ;; esac - srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight` - srchigh_pkg_libs=`${pkg_config_prog_path} --static --libs source-highlight` - # Now that we have found a source-highlight library, check if we can use # it. In particular, we're trying to detect the situation that the # library is using the new libstdc++ library abi ( see @@ -23465,8 +23755,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu save_CXXFLAGS="$CXXFLAGS" save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS $srchigh_pkg_cflags" - LIBS="$LIBS $srchigh_pkg_libs" + CXXFLAGS="$CXXFLAGS $SRCHIGH_CFLAGS" + LIBS="$LIBS $SRCHIGH_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -23503,14 +23793,14 @@ $as_echo "#define HAVE_SOURCE_HIGHLIGHT { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - SRCHIGH_CFLAGS="$srchigh_pkg_cflags" - SRCHIGH_LIBS="$srchigh_pkg_libs" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test "${enable_source_highlight}" = "yes"; then as_fn_error $? "source-highlight in your system could not be used" "$LINENO" 5 fi + unset SRCHIGH_CFLAGS + unset SRCHIGH_LIBS fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -23522,8 +23812,6 @@ $as_echo "no" >&6; } fi fi - - # ------------------------- # # Checks for header files. # # ------------------------- # Index: src/gdb/configure.ac =================================================================== --- src.orig/gdb/configure.ac +++ src/gdb/configure.ac @@ -995,20 +995,18 @@ AM_CONDITIONAL(HAVE_PYTHON, test "${have # -------------------- # dnl Utility to simplify finding libguile. -dnl $1 = pkg-config-program -dnl $2 = space-separated list of guile version numbers or package names to try -dnl $3 = yes|no, indicating whether to flag errors or ignore them -dnl $4 = the shell variable to assign the result to +dnl $1 = space-separated list of guile version numbers or package names to try +dnl $2 = yes|no, indicating whether to flag errors or ignore them +dnl $3 = the shell variable to assign the result to dnl If libguile is found we store "yes" here. AC_DEFUN([AC_TRY_LIBGUILE], [ - pkg_config=$1 - guile_version_list=$2 - flag_errors=$3 - define([have_libguile_var],$4) + guile_version_list=$1 + flag_errors=$2 + define([have_libguile_var],$3) found_usable_guile=checking - AC_MSG_CHECKING([for usable guile from ${pkg_config}]) + AC_MSG_CHECKING([for usable guile from ${PKG_CONFIG}]) for guile_version in ${guile_version_list}; do case "${guile_version}" in *[[^.0-9]]*) @@ -1017,23 +1015,11 @@ AC_DEFUN([AC_TRY_LIBGUILE], guile_version=guile-"${guile_version}" ;; esac - ${pkg_config} --exists ${guile_version} 2>/dev/null - if test $? != 0; then - continue - fi - dnl pkg-config says the package exists, so if we get an error now, - dnl that's bad. - new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}` - if test $? != 0; then - AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}]) - fi - new_LIBS=`${pkg_config} --static --libs ${guile_version}` - if test $? != 0; then - AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}]) + PKG_CHECK_MODULES_STATIC([GUILE], [${guile_version}], + [found_usable_guile=${guile_version}], [:]) + if test "${found_usable_guile}" != "checking"; then + break fi - dnl If we get this far, great. - found_usable_guile=${guile_version} - break done if test "${found_usable_guile}" = "checking"; then if test "${flag_errors}" = "yes"; then @@ -1047,13 +1033,11 @@ AC_DEFUN([AC_TRY_LIBGUILE], if test "${found_usable_guile}" != no; then save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS - CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" - LIBS="$LIBS $new_LIBS" + CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS" + LIBS="$LIBS $GUILE_LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "libguile.h"]], [[scm_init_guile ();]])], - [have_libguile_var=yes - GUILE_CPPFLAGS=$new_CPPFLAGS - GUILE_LIBS=$new_LIBS], + [have_libguile_var=yes], [found_usable_guile=no]) dnl scm_set_automatic_finalization_enabled added in Guile 2.2. AC_CHECK_FUNC(scm_set_automatic_finalization_enabled, @@ -1066,6 +1050,8 @@ AC_DEFUN([AC_TRY_LIBGUILE], if test "${flag_errors}" = yes; then AC_MSG_FAILURE([linking guile version ${guile_version} test program failed]) fi + unset GUILE_CFLAGS + unset GUILE_LIBS fi fi AC_MSG_RESULT([${found_usable_guile}]) @@ -1079,13 +1065,13 @@ dnl The pkg-config program must b dnl auto - Same as "yes", but if guile is missing from the system, dnl fall back to "no". dnl guile-version [guile-version-choice-2 ...] - -dnl A space-separated list of guile package version numbers -dnl or names to try. Numbers have "guile-" prepended while -dnl names are passed to pkg-config as-is. +dnl Same as "yes", with a space-separated list of guile package +dnl version numbers or names to try. Numbers have "guile-" +dnl prepended while names are passed to pkg-config as-is. dnl E.g. 3.0, guile-2.0 or guile-2.2-uninstalled. dnl This requires making sure PKG_CONFIG_PATH is set appropriately. dnl /path/to/pkg-config - -dnl Use this pkg-config program. +dnl Same as "yes", but use this pkg-config program. dnl NOTE: This needn't be the "real" pkg-config program. dnl It could be a shell script. It is invoked as: dnl pkg-config --exists $version @@ -1101,64 +1087,67 @@ 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-3.0 guile-2.2 guile-2.0" -have_libguile=no case "${with_guile}" in -no) - AC_MSG_WARN([guile support disabled; some features will be unavailable.]) - ;; -auto) - 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) +no|auto|yes) + try_guile=${with_guile} ;; [[\\/]]* | ?:[[\\/]]*) - if test -x "${with_guile}"; then - AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile) - else + try_guile=yes + if test ! -x "${with_guile}"; then AC_MSG_ERROR([Guile config program not executable: ${with_guile}]) fi + guile_PKG_CONFIG_set=yes + guile_PKG_CONFIG=${PKG_CONFIG} + guile_cache_PKG_CONFIG=${ac_cv_path_PKG_CONFIG} + PKG_CONFIG=${with_guile} + ac_cv_path_PKG_CONFIG=${with_guile} ;; "" | */*) # Disallow --with=guile="" and --with-guile=foo/bar. 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 + try_guile=yes + try_guile_versions=${with_guile} + ;; +esac + +dnl We check guile with pkg-config. +PKG_PREREQ([0.29]) +PKG_PROG_PKG_CONFIG([0.29]) + +have_libguile=no +case "${try_guile}" in +auto) + if test x"${PKG_CONFIG}" = x; then + AC_MSG_WARN([pkg-config not found, guile support disabled]) + else + AC_TRY_LIBGUILE(${try_guile_versions}, no, have_libguile) + fi + ;; +yes) + if test x"${PKG_CONFIG}" = x; then AC_MSG_ERROR([pkg-config not found]) fi - AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${with_guile}, yes, have_libguile) + AC_TRY_LIBGUILE(${try_guile_versions}, yes, have_libguile) + ;; +*) + AC_MSG_WARN([guile support disabled; some features will be unavailable.]) ;; esac if test "${have_libguile}" != no; then dnl Get the name of the 'guild' program. - case "${with_guile}" in - [[\\/]]* | ?:[[\\/]]*) - GDB_GUILE_PROGRAM_NAMES(["${with_guile}"], ["${guile_version}"]) - ;; - *) - GDB_GUILE_PROGRAM_NAMES(["${pkg_config_prog_path}"], ["${guile_version}"]) - ;; - esac + GDB_GUILE_PROGRAM_NAMES(["${PKG_CONFIG}"], ["${guile_version}"]) dnl Make sure guild can handle this host. GDB_TRY_GUILD([$srcdir/guile/lib/gdb/support.scm]) dnl If not, disable guile support. if test "$ac_cv_guild_ok" = no; then have_libguile=no + unset GUILE_CFLAGS + unset GUILE_LIBS AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host) fi fi @@ -1175,7 +1164,7 @@ if test "${have_libguile}" != no; then save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" LIBS="$GUILE_LIBS" - CPPFLAGS="$GUILE_CPPFLAGS" + CPPFLAGS="$GUILE_CFLAGS" AC_CHECK_FUNCS([scm_new_smob]) LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS" @@ -1185,10 +1174,16 @@ else CONFIG_OBS="$CONFIG_OBS guile/guile.o" CONFIG_SRCS="$CONFIG_SRCS guile/guile.c" fi -AC_SUBST(GUILE_CPPFLAGS) -AC_SUBST(GUILE_LIBS) AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no) +if test x"${guile_PKG_CONFIG_set}" != x; then + PKG_CONFIG=${guile_PKG_CONFIG} + ac_cv_path_PKG_CONFIG=${guile_cache_PKG_CONFIG} + + dnl Rerun with the override removed. + PKG_PROG_PKG_CONFIG([0.29]) +fi + # ---------------------------- # # Check for source highlight. # # ---------------------------- # @@ -1204,13 +1199,16 @@ AC_ARG_ENABLE([source-highlight], if test "${enable_source_highlight}" != "no"; then AC_MSG_CHECKING([for the source-highlight library]) - if test "${pkg_config_prog_path}" = "missing"; then + if test x"${PKG_CONFIG}" = x; then AC_MSG_RESULT([no - pkg-config not found]) if test "${enable_source_highlight}" = "yes"; then AC_MSG_ERROR([pkg-config was not found in your system]) fi else - if ${pkg_config_prog_path} --exists source-highlight; then + PKG_CHECK_MODULES_STATIC([SRCHIGH], [source-highlight], + [have_source_highlight=yes], + [have_source_highlight=no]) + if test x"${have_source_highlight}" = xyes; then case "$LDFLAGS" in *static-libstdc*) AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl @@ -1219,9 +1217,6 @@ either use --disable-source-highlight or ;; esac - srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight` - srchigh_pkg_libs=`${pkg_config_prog_path} --static --libs source-highlight` - # Now that we have found a source-highlight library, check if we can use # it. In particular, we're trying to detect the situation that the # library is using the new libstdc++ library abi ( see @@ -1234,8 +1229,8 @@ either use --disable-source-highlight or AC_LANG_PUSH(C++) save_CXXFLAGS="$CXXFLAGS" save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS $srchigh_pkg_cflags" - LIBS="$LIBS $srchigh_pkg_libs" + CXXFLAGS="$CXXFLAGS $SRCHIGH_CFLAGS" + LIBS="$LIBS $SRCHIGH_LIBS" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include ], @@ -1253,13 +1248,13 @@ either use --disable-source-highlight or AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1, [Define to 1 if the source-highlight library is available]) AC_MSG_RESULT([yes]) - SRCHIGH_CFLAGS="$srchigh_pkg_cflags" - SRCHIGH_LIBS="$srchigh_pkg_libs" else AC_MSG_RESULT([no]) if test "${enable_source_highlight}" = "yes"; then AC_MSG_ERROR([source-highlight in your system could not be used]) fi + unset SRCHIGH_CFLAGS + unset SRCHIGH_LIBS fi else AC_MSG_RESULT([no]) @@ -1269,8 +1264,6 @@ either use --disable-source-highlight or fi fi fi -AC_SUBST(SRCHIGH_LIBS) -AC_SUBST(SRCHIGH_CFLAGS) # ------------------------- # # Checks for header files. #