binutils/configure: look for msgpack-c.pc (in addition to msgpack.pc)

msgpack.pc was renamed to msgpack-c.pc in this commit [1].  This means
that we now find both in the wild.  For example Debian Bookworm has
msgpack.pc [2] while Debian Trixie has msgpack-c.pc [3].

Update the check in configure.ac to check for both.  Nothing in the code
needs to change.

[1] 01f3d24fee
[2] https://packages.debian.org/bookworm/amd64/libmsgpack-dev/filelist
[3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist
This commit is contained in:
Simon Marchi 2026-05-07 15:23:12 -04:00 committed by Simon Marchi
parent 4355b37ca0
commit 520c7eefed
2 changed files with 251 additions and 8 deletions

244
binutils/configure vendored
View file

@ -16004,6 +16004,93 @@ fi
if test "$with_msgpack" != no; then :
have_msgpack=no
# msgpack.pc was renamed to msgpack-c.pc at some point, look for the new
# one first.
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgpack-c" >&5
$as_echo_n "checking for msgpack-c... " >&6; }
if test -n "$MSGPACK_CFLAGS"; then
pkg_cv_MSGPACK_CFLAGS="$MSGPACK_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"msgpack-c\""; } >&5
($PKG_CONFIG --exists --print-errors "msgpack-c") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MSGPACK_CFLAGS=`$PKG_CONFIG --cflags "msgpack-c" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$MSGPACK_LIBS"; then
pkg_cv_MSGPACK_LIBS="$MSGPACK_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"msgpack-c\""; } >&5
($PKG_CONFIG --exists --print-errors "msgpack-c") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MSGPACK_LIBS=`$PKG_CONFIG --libs "msgpack-c" 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_MSGPACK_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
MSGPACK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "msgpack-c" 2>&1`
else
MSGPACK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "msgpack-c" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$MSGPACK_PKG_ERRORS" >&5
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgpack" >&5
@ -16087,23 +16174,172 @@ fi
# Put the nasty error message in config.log where it belongs
echo "$MSGPACK_PKG_ERRORS" >&5
if test "$with_msgpack" = yes; then :
as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5
as_fn_error $? "Package requirements (msgpack) were not met:
$MSGPACK_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables MSGPACK_CFLAGS
and MSGPACK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables MSGPACK_CFLAGS
and MSGPACK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
MSGPACK_CFLAGS=$pkg_cv_MSGPACK_CFLAGS
MSGPACK_LIBS=$pkg_cv_MSGPACK_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_msgpack=yes
fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if test "$with_msgpack" = yes; then :
as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgpack" >&5
$as_echo_n "checking for msgpack... " >&6; }
if test -n "$MSGPACK_CFLAGS"; then
pkg_cv_MSGPACK_CFLAGS="$MSGPACK_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"msgpack\""; } >&5
($PKG_CONFIG --exists --print-errors "msgpack") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MSGPACK_CFLAGS=`$PKG_CONFIG --cflags "msgpack" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$MSGPACK_LIBS"; then
pkg_cv_MSGPACK_LIBS="$MSGPACK_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"msgpack\""; } >&5
($PKG_CONFIG --exists --print-errors "msgpack") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_MSGPACK_LIBS=`$PKG_CONFIG --libs "msgpack" 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_MSGPACK_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
MSGPACK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "msgpack" 2>&1`
else
MSGPACK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "msgpack" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$MSGPACK_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (msgpack) were not met:
$MSGPACK_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables MSGPACK_CFLAGS
and MSGPACK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables MSGPACK_CFLAGS
and MSGPACK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
MSGPACK_CFLAGS=$pkg_cv_MSGPACK_CFLAGS
MSGPACK_LIBS=$pkg_cv_MSGPACK_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_msgpack=yes
fi
else
MSGPACK_CFLAGS=$pkg_cv_MSGPACK_CFLAGS
MSGPACK_LIBS=$pkg_cv_MSGPACK_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_msgpack=yes
fi
if test "$have_msgpack" = yes; then :
$as_echo "#define HAVE_MSGPACK 1" >>confdefs.h
else
if test "$with_msgpack" = yes; then :
as_fn_error $? "--with-msgpack was given, but msgpack is missing or unusable." "$LINENO" 5
fi
fi
fi

View file

@ -295,10 +295,17 @@ AC_ARG_WITH([msgpack],
[with_msgpack=auto])
AS_IF([test "$with_msgpack" != no],
[PKG_CHECK_MODULES(MSGPACK, msgpack,
[AC_DEFINE([HAVE_MSGPACK], [1], [Define to 1 if msgpack is available.])],
[AS_IF([test "$with_msgpack" = yes],
[AC_MSG_ERROR([--with-msgpack was given, but msgpack is missing or unusable.])])])])
[have_msgpack=no
# msgpack.pc was renamed to msgpack-c.pc at some point, look for the new
# one first.
PKG_CHECK_MODULES([MSGPACK], [msgpack-c], [have_msgpack=yes],
[PKG_CHECK_MODULES([MSGPACK], [msgpack], [have_msgpack=yes])])
AS_IF([test "$have_msgpack" = yes],
[AC_DEFINE([HAVE_MSGPACK], [1], [Define to 1 if msgpack is available.])],
[AS_IF([test "$with_msgpack" = yes],
[AC_MSG_ERROR([--with-msgpack was given, but msgpack is missing or unusable.])])])])
# target-specific stuff: