PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 28 Jul 2020 13:59:20 +0000 (06:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 28 Jul 2020 13:59:30 +0000 (06:59 -0700)
There is no need to check $pkg_cv_[]$1[]_LIBS works if package check
failed.

config/

PR binutils/26301
* pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
$pkg_failed = no.

binutils/

PR binutils/26301
* configure: Regenerated.

gdb/

PR binutils/26301
* configure: Regenerated.

binutils/ChangeLog
binutils/configure
config/ChangeLog
config/pkg.m4
gdb/ChangeLog
gdb/configure

index 2c76b2aab0d7aa1cb7b288f69c2ee46994fecf30..5d32d262c0348b14c861644f4e8e43df9472e7f4 100644 (file)
@@ -3,6 +3,11 @@
        PR binutils/26301
        * configure: Regenerated.
 
+2020-07-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/26301
+       * configure: Regenerated.
+
 2020-07-27  Alan Modra  <amodra@gmail.com>
 
        * objdump.c (dump_section): Don't return without calling
index 4620a6b105d84f793d9c1caf158df3fe98427662..18316b7696ddb86be7f013a4af5eb99630c3d55a 100755 (executable)
     pkg_failed=untried
 fi
 
-pkg_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-return 0;
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  pkg_failed=no
+
 else
   pkg_failed=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LDFLAGS=$pkg_save_LDFLAGS
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
 
 
 
index 2cd61774cf141312d74f7e0c276553f66d60b338..f93d86a969b8526e82c30c56543d96ff3dceb693 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/26301
+       * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
+       $pkg_failed = no.
+
 2020-07-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/26301
index 45587e97c8b41026340d57f8638e6d5f019cb596..7ebf517cd6a880d28680ffe90dce2c13e83e7382 100644 (file)
@@ -148,10 +148,12 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
 dnl Check whether $pkg_cv_[]$1[]_LIBS works.
-pkg_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
-AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
-LDFLAGS=$pkg_save_LDFLAGS
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+  AC_TRY_LINK([],[], [], [pkg_failed=yes])
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
 
 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
index defca83c2637d0d736c87ed17a34edc73fc673ce..96ffac925730825d3b41232f298c2cb3fb0ac0c2 100644 (file)
@@ -3,6 +3,11 @@
        PR binutils/26301
        * configure: Regenerated.
 
+2020-07-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/26301
+       * configure: Regenerated.
+
 2020-07-28  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * python/py-frame.c: Remove 'user-regs.h' include.
index eb38aaacfcaf55023f4c4e78fcef0280222371ca..5ef85e8c866a48c0e0526f39b50f0e17cef951bc 100755 (executable)
@@ -7037,27 +7037,29 @@ fi
     pkg_failed=untried
 fi
 
-pkg_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-return 0;
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  pkg_failed=no
+
 else
   pkg_failed=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LDFLAGS=$pkg_save_LDFLAGS
+  LDFLAGS=$pkg_save_LDFLAGS
+fi