This patch seems to behave correctly in every one of my cases. I'd appreciate
more eyeballs and at least 2 +1's before applying it to 1.2.x for the next
release. It does in fact behave wonderfully on the specific Mac OS/X 10.3 box
which was giving me problems, due to a binary distro of python injecting
/usr/lib/libuuid.so[*] set of files without corresponding include files.
The function's detected, then the detection is discarded due to a failed test
compilation.
Oh it seems the ${nl}'s were superfluous, but since I don't know if every flavor
of autoconf + local shell behaves nicely, I'm tempted to leave them.
Comments/feedback/votes please? You may want to push misc/unix/rand.c to
head in order to also check the new conditionals on our uuid_s_ok result-check.
Bill
[EMAIL PROTECTED] wrote:
Author: wrowe
Date: Thu Mar 2 14:53:49 2006
New Revision: 382541
URL: http://svn.apache.org/viewcvs?rev=382541&view=rev
Log:
Address bug 37999 and other exceptions to the existing uuid detection code;
favor uuid_create or uuid_generate if they live in the clib, and perform
a true compile/link test on our suspected success case, disabling the
code if this fails.
More sets of eyes and feedback to [EMAIL PROTECTED] requested before we
backport this
patch to APR 1.2.x
Authored by: wrowe, maxb
Modified:
apr/apr/trunk/configure.in
apr/apr/trunk/misc/unix/rand.c
Modified: apr/apr/trunk/configure.in
URL:
http://svn.apache.org/viewcvs/apr/apr/trunk/configure.in?rev=382541&r1=382540&r2=382541&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Thu Mar 2 14:53:49 2006
@@ -1803,15 +1803,61 @@
dnl ----------------------------- Checking for UUID Support
echo "${nl}Checking for OS UUID Support..."
-osuuid="0"
-AC_CHECK_HEADERS(uuid/uuid.h uuid.h)
+AC_CHECK_HEADERS(uuid.h sys/uuid.h uuid/uuid.h, break)
-# Check for uuid_generate in libc or libuuid
+apr_revert_save_LIBS=$LIBS
+
+# Prefer the flavor(s) that live in libc;
+AC_SEARCH_LIBS(uuid_create, uuid)
AC_SEARCH_LIBS(uuid_generate, uuid)
+if test "$ac_cv_search_uuid_create" = "none required" -o \
+ "$ac_cv_search_uuid_generate" = "none required"; then
+ LIBS=$apr_revert_save_LIBS
+fi
+
+AC_CHECK_FUNCS(uuid_create uuid_generate)
-AC_CHECK_FUNCS([uuid_generate uuid_create], [osuuid=1; break])
+AC_CACHE_CHECK([for os uuid usability], [apr_cv_osuuid], [
+# Ensure this test closely mirrors misc/unix/rand.c!
+uuid_includes=" ${nl}
+#if defined(HAVE_SYS_TYPES_H) ${nl}
+#include <sys/types.h> ${nl}
+#endif ${nl}
+#if defined(HAVE_UNISTD_H) ${nl}
+#include <unistd.h> ${nl}
+#endif ${nl}
+#if defined(HAVE_UUID_H) ${nl}
+#include <uuid.h> ${nl}
+#elif defined(HAVE_SYS_UUID_H) ${nl}
+#include <sys/uuid.h> ${nl}
+#elif defined(HAVE_UUID_UUID_H) ${nl}
+#include <uuid/uuid.h> ${nl}
+#endif ${nl}
+"
+ apr_cv_osuuid=no
+ if test $ac_cv_func_uuid_create = yes; then
+ AC_TRY_LINK([$uuid_includes], [
+ uuid_t g;
+ uint32_t s;
+ uuid_create(&g, &s);
+ if (s == uuid_s_ok) s = 0;
+ ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_create=no])
+ fi
+ if test $ac_cv_func_uuid_generate = yes; then
+ AC_TRY_LINK([$uuid_includes], [
+ uuid_t g;
+ uuid_generate(g);
+ ], [apr_cv_osuuid=yes], [apr_cv_func_uuid_generate=no])
+ fi
+])
+if test $apr_cv_osuuid = yes; then
+ osuuid="1"
+else
+ osuuid="0"
+ LIBS=$apr_revert_save_LIBS
+fi
AC_SUBST(osuuid)
Modified: apr/apr/trunk/misc/unix/rand.c
URL:
http://svn.apache.org/viewcvs/apr/apr/trunk/misc/unix/rand.c?rev=382541&r1=382540&r2=382541&view=diff
==============================================================================
--- apr/apr/trunk/misc/unix/rand.c (original)
+++ apr/apr/trunk/misc/unix/rand.c Thu Mar 2 14:53:49 2006
@@ -35,8 +35,10 @@
#if APR_HAVE_SYS_UN_H
#include <sys/un.h>
#endif
-#ifdef HAVE_UUID_H
+#if defined(HAVE_UUID_H)
#include <uuid.h>
+#elif defined(HAVE_SYS_UUID_H)
+#include <sys/uuid.h>
#elif defined(HAVE_UUID_UUID_H)
#include <uuid/uuid.h>
#endif
@@ -45,6 +47,8 @@
#define SHUT_RDWR 2
#endif
+#if APR_HAS_OS_UUID
+
#if defined(HAVE_UUID_CREATE)
APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data)
@@ -71,6 +75,8 @@
return APR_SUCCESS;
}
#endif
+
+#endif /* APR_HAS_OS_UUID */
#if APR_HAS_RANDOM