1 From 670d0961a823df0db28f39a354430f3dc2519418 Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Sat, 28 May 2016 12:53:33 +0200
4 Subject: [PATCH] configure: fix uuid support detection on static build
6 This change adds uuid support detection using pkg-config, before falling
7 back on default AC_CHECK_LIB calls.
9 Using flags from pkg-config is useful for static build, because they
10 also include dependency flags; whereas
12 AC_CHECK_LIB function achieves its test by trying to link against the
13 requested library, without taking care of its dependency
14 requirements/flags. Therefore, in case of static build, it can fail on
15 the uuid detection like [1], because the uuid's dependency flags
16 (regarding gettext) are missing.
17 Instead, using pkg-config to do the check will take care of getting and
18 setting all required flags.
20 This change adds uuid detection using pkg-config helper before falling
21 back on the standard AC_CHECK_LIB detection for platforms missing
24 This issue [1] has been triggered on Buildroot farms.
26 [1] http://autobuild.buildroot.net/results/43b/43b98ddf9eb44152ed9ac4a98d887af14831d8da/build-end.log
28 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
30 configure.ac | 10 ++++++++++
31 1 file changed, 10 insertions(+)
33 diff --git a/configure.ac b/configure.ac
34 index 632fe39..b344fa8 100644
37 @@ -65,6 +65,15 @@ esac
38 AM_CONDITIONAL([BABELTRACE_BUILD_WITH_MINGW], [test "x$MINGW32" = "xyes"])
41 +PKG_CHECK_MODULES([UUID], [uuid],
43 + LIBS="${UUID_LIBS} ${LIBS}"
44 + CFLAGS="${CFLAGS} ${UUID_CFLAGS}"
45 + AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.])
49 +# try detecting libuuid without pkg-config
50 AC_CHECK_LIB([uuid], [uuid_generate],
52 AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_LIBUUID], 1, [Has libuuid support.])
53 @@ -83,6 +92,7 @@ AC_CHECK_LIB([uuid], [uuid_generate],
54 AC_MSG_ERROR([Cannot find libuuid uuid_generate nor libc uuid_create. Use [LDFLAGS]=-Ldir to specify their location.])
60 AM_CONDITIONAL([BABELTRACE_BUILD_WITH_LIBUUID], [test "x$have_libuuid" = "xyes"])