On Tuesday 16 December 2014 13:47:36 Jérémie Courrèges-Anglas wrote: > Tim Ruehsen <[email protected]> writes: > > On Tuesday 16 December 2014 00:26:35 Jérémie Courrèges-Anglas wrote: > >> Hi, > >> > >> in src/warc.c three methods are provided to generate uuids: libuuid, > >> uuid functions from libc, and a fallback method. At least OpenBSD, > >> FreeBSD and NetBSD provide those uuid functions in their libc. > >> > >> http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/uuid.3 > >> > >> This diff fixes the detection and use of those functions. It does not > >> change the fact that libuuid is always preferred if present and not > >> explicitely disabled. > > > > Thanks for your contribution ! > > Thanks for looking at it! > > > It looks like a good opportunity to fix ./configure's libuuid detection. > > > > We just have to agree on an approach. > > Suggestion: > > if --with-libuuid explicitly specified > > > > search for libuuid (pkg-config or fallback to AC_SEARCH_LIBS) > > if not found print error and stop > > > > else > > > > search for uuid_create (AC_CHECK_FUNC) > > if not found > > > > if --without-libuuid explicitly specified > > > > use fallback code > > > > else > > > > search for libuuid (pkg-config or fallback to AC_SEARCH_LIBS) > > if not found > > > > use fallback code > > I think this makes sense and would be a nice addition on any OS that > provides those uuid functions natively. > > > What do you think ? > > Would you like to amend your patch or should I do it ? > > Given the following points: > - I didn't sign the FSF paperwork thus I'm trying to submit minimal > diffs only > - this first patch allows me to keep libuuid disabled in the OpenBSD > port and yet use the features provided by libc > - this first patch only attempts to correct the handling of uuid.h / > uuid_create (not libuuid), > my opinion is that your proposal ought to be implemented in an > additional patch. I'm interested in reviewing such a patch.
Thanks, your patch has been pushed to git. On top of it I created the attached patch that implements my suggestion from above. Please review and test on OpenBSD if possible. Tim
From 540595955bc44daecf294216133e9e50cfe4fcb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim Rühsen?= <[email protected]> Date: Wed, 17 Dec 2014 10:29:12 +0100 Subject: [PATCH] configure.ac: Fix libuuid and uuid_create detection --with-libuuid now explictly asks for libuuid. --without-libuuid ignores libuuid and tries to use libc builtin functions. Else try builtin functions first, libuuid second and fallback to Wget's own function. --- configure.ac | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index ff016ce..ef49a59 100644 --- a/configure.ac +++ b/configure.ac @@ -646,27 +646,36 @@ dnl AC_ARG_WITH(libuuid, AC_HELP_STRING([--without-libuuid], [Generate UUIDs for WARC files via libuuid])) -AS_IF([test "X$with_libuuid" != "Xno"],[ +AS_IF([test "x$with_libuuid" = xyes], [ + # libuuid was explicitly requested PKG_CHECK_MODULES([UUID], uuid, [ LIBS="$UUID_LIBS $LIBS" CFLAGS="$UUID_CFLAGS $CFLAGS" - AC_DEFINE([HAVE_LIBUUID], [1], [Define if using libuuid.]) + uuid_mode=1 + ], [ + AC_SEARCH_LIBS(uuid_generate, uuid, + [uuid_mode=1], + [AC_MSG_ERROR(*** libuuid was explicitly requested but wasn't found.)]) + ]) +], [test "x$with_libuuid" = xno], [ + # libuuid was explicitly *not* requested + AC_CHECK_HEADER(uuid.h, + AC_CHECK_FUNC(uuid_create, [uuid_mode=2])) +], [ + # default: + AC_CHECK_HEADER(uuid.h, [ + AC_CHECK_FUNC(uuid_create, [uuid_mode=2]) ], [ 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_SEARCH_LIBS(uuid_generate, uuid, [uuid_mode=1])) ]) ]) -AC_CHECK_HEADER(uuid.h, - AC_CHECK_FUNC(uuid_create, - [AC_DEFINE([HAVE_UUID_CREATE], 1, [Define if uuid_create is available.])] - ) -) +AS_IF([test "x$uuid_mode" = x1], [ + AC_DEFINE([HAVE_LIBUUID], [1], [Define if using libuuid.]) +], [test "x$uuid_mode" = x2], [ + AC_DEFINE([HAVE_UUID_CREATE], 1, [Define if uuid_create is available.]) +]) dnl dnl Check for PCRE -- 2.1.3
signature.asc
Description: This is a digitally signed message part.
