Package: src:zeromq
Version: 2.1.7-1
Severity: important
Tags: patch
User: [email protected]
Usertags: kfreebsd-porting

Hi!

Your package failed to build on kfreebsd as the uuid code is
conditionalized on FreeBSD vs Linux while the code is actually GLIBC /
BSDLibC specific. Attached patch fixes this problem and allows zeromq to
build on kfreebsd

Regards

    Christoph

If you have further questions please mail [email protected]

Patch:

--- zeromq-2.1.7.orig/configure
+++ zeromq-2.1.7/configure
@@ -16427,6 +17058,57 @@ $as_echo "#define ZMQ_FORCE_MUTEXES 1" >
         fi
         ;;
     *freebsd*)
+        case "${host_os}" in
+            *kfreebsd*)
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 
uuid_generate in -luuid" >&5
+$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_generate+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_generate ();
+int
+main ()
+{
+return uuid_generate ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uuid_uuid_generate=yes
+else
+  ac_cv_lib_uuid_uuid_generate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_uuid_uuid_generate" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUUID 1
+_ACEOF
+
+  LIBS="-luuid $LIBS"
+
+else
+  as_fn_error $? "cannot link with -luuid, install uuid-dev." "$LINENO" 5
+fi
+
+            ;;
+        esac
         # Define on FreeBSD to enable all library features
         CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
 
--- zeromq-2.1.7.orig/configure.in
+++ zeromq-2.1.7/configure.in
@@ -116,6 +116,12 @@ case "${host_os}" in
         fi
         ;;
     *freebsd*)
+        case "${host_os}" in
+            *kfreebsd*)
+            AC_CHECK_LIB(uuid, uuid_generate, ,
+                [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
+            ;;
+        esac
         # Define on FreeBSD to enable all library features
         CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
         AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
--- zeromq-2.1.7.orig/src/uuid.hpp
+++ zeromq-2.1.7/src/uuid.hpp
@@ -25,7 +25,11 @@
 #include "stdint.hpp"
 
 #if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD
+#if defined __GLIBC__
+#include <uuid/uuid.h>
+#else
 #include <uuid.h>
+#endif
 #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
       defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
 #include <uuid/uuid.h>
--- zeromq-2.1.7.orig/src/uuid.cpp
+++ zeromq-2.1.7/src/uuid.cpp
@@ -44,7 +44,7 @@ const char *zmq::uuid_t::to_string ()
     return (char*) string_buf;
 }
 
-#elif defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD
+#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD) && ! defined 
__GLIBC__
 
 #include <stdlib.h>
 #include <uuid.h>
@@ -71,7 +71,7 @@ const char *zmq::uuid_t::to_string ()
 }
 
 #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
-      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
+      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN || defined __GLIBC__
 
 #include <uuid/uuid.h>
 


-- 
9FED 5C6C E206 B70A 5857  70CA 9655 22B9 D49A E731
Debian Developer | Lisp Hacker | CaCert Assurer



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to