PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works

It is quite normal to have headers without library on multilib OSes.
Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS
works.

config/

	PR binutils/26301
	* pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
	$pkg_cv_[]$1[]_LIBS works.

binutils/

	PR binutils/26301
	* configure: Regenerated.

gdb/

	PR binutils/26301
	* configure: Regenerated.
This commit is contained in:
H.J. Lu 2020-07-28 03:50:10 -07:00
parent 1a02d6b0ff
commit d70f978b44
7 changed files with 71 additions and 2 deletions

View File

@ -1,7 +1,5 @@
2020-07-24 Aaron Merey <amerey@redhat.com>
* config/debuginfod.m4: use PKG_CHECK_MODULES.
* config/pkg.m4: New file.
* configure: Rebuild.
* configure.ac: Remove AC_DEBUGINFOD.

View File

@ -1,3 +1,8 @@
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

22
binutils/configure vendored
View File

@ -12439,6 +12439,28 @@ fi
pkg_failed=untried
fi
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
if test $pkg_failed = yes; then

View File

@ -1,3 +1,14 @@
2020-07-28 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/26301
* pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
$pkg_cv_[]$1[]_LIBS works.
2020-07-24 Aaron Merey <amerey@redhat.com>
* debuginfod.m4: use PKG_CHECK_MODULES.
* pkg.m4: New file.
2020-07-04 Nick Clifton <nickc@redhat.com>
Binutils 2.35 branch created.

View File

@ -147,6 +147,12 @@ AC_MSG_CHECKING([for $2])
_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
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])

View File

@ -1,3 +1,8 @@
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.

22
gdb/configure vendored
View File

@ -7037,6 +7037,28 @@ fi
pkg_failed=untried
fi
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
if test $pkg_failed = yes; then