bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH 2/5] use pkg-config to check libuuid deps if available


From: Mike Frysinger
Subject: [Bug-wget] [PATCH 2/5] use pkg-config to check libuuid deps if available
Date: Mon, 27 Oct 2014 14:55:22 -0400

Newer versions of these packages ship with pkg-config files, so if we can
detect it via those, do so.  If that fails, fall back to the old methods.

Also add a configure flag to explicitly control its usage.
---
 configure.ac | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8ec6c09..a5fb67d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -550,20 +550,32 @@ fi
 dnl
 dnl Check for UUID
 dnl
-AC_CHECK_HEADER(uuid.h,
-                AC_CHECK_FUNC(uuid, uuid_create,
-                  [AC_DEFINE([HAVE_UUID_CREATE], 1,
-                             [Define if uuid_create is available.])
-                  ])
-)
 
-AC_CHECK_HEADER(uuid/uuid.h,
-                AC_CHECK_LIB(uuid, uuid_generate,
-                  [LIBS="${LIBS} -luuid"
-                   AC_DEFINE([HAVE_LIBUUID], 1,
-                             [Define if libuuid is available.])
-                  ])
-)
+AC_ARG_WITH(libuuid, AC_HELP_STRING([--without-libuuid],
+                                    [Generate UUIDs for WARC files via 
libuuid]))
+
+AS_IF([test "X$with_libuuid" != "Xno"],[
+  PKG_CHECK_MODULES([UUID], uuid, [
+    LIBS="$UUID_LIBS $LIBS"
+    CFLAGS="$UUID_CFLAGS $CFLAGS"
+    AC_DEFINE([HAVE_LIBUUID], [1], [Define if using libuuid.])
+  ], [
+    AC_CHECK_HEADER(uuid.h,
+                    AC_CHECK_FUNC(uuid, uuid_create,
+                      [AC_DEFINE([HAVE_UUID_CREATE], 1,
+                                 [Define if uuid_create is available.])
+                      ])
+    )
+
+    AC_CHECK_HEADER(uuid/uuid.h,
+                    AC_CHECK_LIB(uuid, uuid_generate,
+                      [LIBS="${LIBS} -luuid"
+                       AC_DEFINE([HAVE_LIBUUID], 1,
+                                 [Define if libuuid is available.])
+                      ])
+    )
+  ])
+])
 
 dnl
 dnl Check for PCRE
-- 
2.1.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]