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

Message ID 20260507192328.692827-1-simon.marchi@efficios.com
State New
Headers
Series binutils/configure: look for msgpack-c.pc (in addition to msgpack.pc) |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Build failed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Build failed

Commit Message

Simon Marchi May 7, 2026, 7:23 p.m. UTC
  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] https://github.com/msgpack/msgpack-c/commit/01f3d24feee3a06b2a83c89b54fd0ec778d14610
[2] https://packages.debian.org/bookworm/amd64/libmsgpack-dev/filelist
[3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist

Change-Id: I7e16d7a30669eed947a4a2b95ce1ded7c1d5e49a
---
 binutils/configure    | 244 +++++++++++++++++++++++++++++++++++++++++-
 binutils/configure.ac |  15 ++-
 2 files changed, 251 insertions(+), 8 deletions(-)


base-commit: e1428067748d6b713637241855d1c315fb657c8b
  

Comments

Jan Beulich May 15, 2026, 1:44 p.m. UTC | #1
On 07.05.2026 21:23, Simon Marchi wrote:
> 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] https://github.com/msgpack/msgpack-c/commit/01f3d24feee3a06b2a83c89b54fd0ec778d14610
> [2] https://packages.debian.org/bookworm/amd64/libmsgpack-dev/filelist
> [3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist

Looks plausible, so: Okay, albeit preferably ...

> Change-Id: I7e16d7a30669eed947a4a2b95ce1ded7c1d5e49a

... with this line omitted.

Jan
  
Simon Marchi May 15, 2026, 2:14 p.m. UTC | #2
On 2026-05-15 09:44, Jan Beulich wrote:
> On 07.05.2026 21:23, Simon Marchi wrote:
>> 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] https://github.com/msgpack/msgpack-c/commit/01f3d24feee3a06b2a83c89b54fd0ec778d14610
>> [2] https://packages.debian.org/bookworm/amd64/libmsgpack-dev/filelist
>> [3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist
> 
> Looks plausible, so: Okay, albeit preferably ...
> 
>> Change-Id: I7e16d7a30669eed947a4a2b95ce1ded7c1d5e49a
> 
> ... with this line omitted.
> 
> Jan

Thanks, pushed with that line removed.

Simon
  
Jiang, Haochen May 15, 2026, 6:03 p.m. UTC | #3
> From: Simon Marchi <simon.marchi@efficios.com>
> Sent: Friday, May 15, 2026 10:15 PM
> To: Beulich, Jan <JBeulich@suse.com>
> 
> On 2026-05-15 09:44, Jan Beulich wrote:
> > On 07.05.2026 21:23, Simon Marchi wrote:
> >> 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] https://github.com/msgpack/msgpack-
> c/commit/01f3d24feee3a06b2a83c89b54fd0ec778d14610
> >> [2] https://packages.debian.org/bookworm/amd64/libmsgpack-
> dev/filelist
> >> [3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist
> >
> > Looks plausible, so: Okay, albeit preferably ...
> >
> >> Change-Id: I7e16d7a30669eed947a4a2b95ce1ded7c1d5e49a
> >
> > ... with this line omitted.
> >
> > Jan
> 
> Thanks, pushed with that line removed.
> 

I have now got errors on all my machines everywhere with:

checking for msgpack-c... no
checking for msgpack... no
configure: error: Package requirements (msgpack) were not met:

Package 'msgpack', required by 'virtual:world', not found

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.
make[1]: *** [Makefile:4065: configure-binutils] Error 1
make[1]: Leaving directory '/export/users/haochenj/env/build_master'
make: *** [Makefile:1033: all] Error 2

Should I re-install something? Should it be considered as a breaking
change that needed to be mentioned somewhere?

Thx,
Haochen

> Simon
  
Jiang, Haochen May 15, 2026, 6:11 p.m. UTC | #4
> From: Jiang, Haochen
> Sent: Saturday, May 16, 2026 2:04 AM
> 
> > From: Simon Marchi <simon.marchi@efficios.com>
> > Sent: Friday, May 15, 2026 10:15 PM
> >
> > On 2026-05-15 09:44, Jan Beulich wrote:
> > > On 07.05.2026 21:23, Simon Marchi wrote:
> > >> 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] https://github.com/msgpack/msgpack-
> > c/commit/01f3d24feee3a06b2a83c89b54fd0ec778d14610
> > >> [2] https://packages.debian.org/bookworm/amd64/libmsgpack-
> > dev/filelist
> > >> [3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist
> > >
> > > Looks plausible, so: Okay, albeit preferably ...
> > >
> > >> Change-Id: I7e16d7a30669eed947a4a2b95ce1ded7c1d5e49a
> > >
> > > ... with this line omitted.
> > >
> > > Jan
> >
> > Thanks, pushed with that line removed.
> >
> 
> I have now got errors on all my machines everywhere with:
> 
> checking for msgpack-c... no
> checking for msgpack... no
> configure: error: Package requirements (msgpack) were not met:
> 
> Package 'msgpack', required by 'virtual:world', not found
> 
> 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.
> make[1]: *** [Makefile:4065: configure-binutils] Error 1
> make[1]: Leaving directory '/export/users/haochenj/env/build_master'
> make: *** [Makefile:1033: all] Error 2
> 
> Should I re-install something? Should it be considered as a breaking
> change that needed to be mentioned somewhere?
> 

It seems to me that the community build bot is also complaining about
the same thing in this thread. Seems not only me meeting the problem.

https://sourceware.org/pipermail/binutils/2026-May/149343.html

Thx,
Haochen
  
Alan Modra May 16, 2026, 12:48 a.m. UTC | #5
It needs this, to tell PKG_CHECK_MODULES that a missing module will be
handled by the caller.

diff --git a/binutils/configure.ac b/binutils/configure.ac
index 234eeaadab3..74baea68529 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -300,7 +300,7 @@ AS_IF([test "$with_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])])
+     [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.])],
  
Jiang, Haochen May 16, 2026, 4:12 a.m. UTC | #6
> From: Alan Modra <amodra@gmail.com>
> Sent: Saturday, May 16, 2026 8:48 AM
> 
> It needs this, to tell PKG_CHECK_MODULES that a missing module will be
> handled by the caller.
> 
> diff --git a/binutils/configure.ac b/binutils/configure.ac
> index 234eeaadab3..74baea68529 100644
> --- a/binutils/configure.ac
> +++ b/binutils/configure.ac
> @@ -300,7 +300,7 @@ AS_IF([test "$with_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])])
> +     [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.])],
> 

That patch on trunk has fixed my issue. Thx for the help.

Thx,
Haochen

> --
> Alan Modra
  
Simon Marchi May 18, 2026, 8:30 p.m. UTC | #7
On 2026-05-16 00:12, Jiang, Haochen wrote:
>> From: Alan Modra <amodra@gmail.com>
>> Sent: Saturday, May 16, 2026 8:48 AM
>>
>> It needs this, to tell PKG_CHECK_MODULES that a missing module will be
>> handled by the caller.
>>
>> diff --git a/binutils/configure.ac b/binutils/configure.ac
>> index 234eeaadab3..74baea68529 100644
>> --- a/binutils/configure.ac
>> +++ b/binutils/configure.ac
>> @@ -300,7 +300,7 @@ AS_IF([test "$with_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])])
>> +     [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.])],
>>
> 
> That patch on trunk has fixed my issue. Thx for the help.
> 
> Thx,
> Haochen
> 
>> --
>> Alan Modra

Sorry for the breakage, and thanks for taking care of fixing it.

Simon
  

Patch

diff --git a/binutils/configure b/binutils/configure
index 889f9c0f949a..1a13811c8ffb 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -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
 
diff --git a/binutils/configure.ac b/binutils/configure.ac
index 5553942b2384..234eeaadab32 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -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: