Update autoconf macros
authorBrian Aker <brian@tangent.org>
Tue, 11 Sep 2012 11:03:54 +0000 (07:03 -0400)
committerBrian Aker <brian@tangent.org>
Tue, 11 Sep 2012 11:03:54 +0000 (07:03 -0400)
m4/ax_pthread_timedjoin_np.m4
m4/check_sock_cloexec.m4
m4/have_cinttypes.m4
m4/have_cstdint.m4
m4/uuid.m4

index 833b2846417e5d700fcc52545d63676e039aed83..a0e6c253c168df75ab9322c2837d2e8a870105d7 100644 (file)
@@ -4,7 +4,7 @@
 #
 # SYNOPSIS
 #
-#   AX_LIB_UUID
+#   AX_PTHREAD_TIMEDJOIN_NP
 #
 # DESCRIPTION
 #
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 2
+#serial 3
 
 AC_DEFUN([AX_PTHREAD_TIMEDJOIN_NP], [
-    AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [
-      save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="$PTHREAD_LIBS"
-      AC_LANG_PUSH([C])
-      AC_COMPILE_IFELSE([
-        AC_LANG_PROGRAM([
-#include <uuid/uuid.h>
-      ], [
-      uuid_t out;
-      pthread_timedjoin_np(out);
-      ]), [ax_cv_pthread_timedjoin_np=yes ], [ax_cv_pthread_timedjoin_np=no ]
-      ])
+         AC_REQUIRE([AX_PTHREAD])
+         AC_CACHE_CHECK([check for pthread_timedjoin_np], [ax_cv_pthread_timedjoin_np], [
+                        save_LDFLAGS="$LDFLAGS"
+                        LDFLAGS="$PTHREAD_LIBS"
+                        AC_LANG_PUSH([C])
+                        AC_LINK_IFELSE([
+                                       AC_LANG_PROGRAM([
+#ifndef _GNU_SOURCE 
+#define _GNU_SOURCE 
+#endif
 
-    AC_LANG_POP
-     LDFLAGS="$save_LDFLAGS"
+#include <stdlib.h> 
+#include <pthread.h>
+                                                       ], [
+                                                       pthread_t thread;
+                                                       pthread_timedjoin_np(thread, NULL);
+                                                       ])],
+                                       [ax_cv_pthread_timedjoin_np=yes],
+                                       [])
 
-    ])
+                        AC_LANG_POP
+                        LDFLAGS="$save_LDFLAGS"
 
-    AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],[
-      AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],[
-      AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.])
-    ])
-])
+         ])
+
+         AS_IF([test "$ax_cv_pthread_timedjoin_np" = yes],[
+               AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[1],[Define if pthread_timedjoin_np is present in pthread.h.])],[
+               AC_DEFINE(HAVE_PTHREAD_TIMEDJOIN_NP,[0],[Define if pthread_timedjoin_np is present in pthread.h.])
+               ])
+         ])
 
index 305877454643d261f6fa14e89c97567fa4ca6454..6936ab407d7124a65d88609fc37c4acac24f5959 100644 (file)
@@ -1,18 +1,26 @@
-dnl CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found])
-AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [{
-    AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported)
-    AC_TRY_RUN([/* SOCK_CLOEXEC test */
+# Author?
+# AX_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found])
+#
+
+#serial 1
+
+AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [
+    AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [ax_cv_sock_cloexec], [
+      AC_LANG_PUSH([C])
+      AC_RUN_IFELSE([
+        AC_LANG_PROGRAM([
+
+          /* SOCK_CLOEXEC test */
 #include <sys/types.h>
 #include <sys/socket.h>
 
-int main (int argc, char *argv [])
-{
-    int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
-    return (s == -1);
-}
-    ],
-    [AC_MSG_RESULT(yes) ; ax_cv_sock_cloexec="yes" ; $1],
-    [AC_MSG_RESULT(no)  ; ax_cv_sock_cloexec="no"  ; $2],
-    [AC_MSG_RESULT(not during cross-compile) ; ax_cv_sock_cloexec="no"]
-    )
-}])
+          ], [
+          int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
+          return (s == -1);
+          ])],
+        [ax_cv_sock_cloexec=yes],
+        [ax_cv_sock_cloexec=no])
+      ])
+
+    AS_IF([test x"ax_cv_sock_cloexec" = xyes], [AC_MSG_RESULT([yes]) ; $1], AC_MSG_RESULT([no]) ; $2)
+    ])
index bcfea1c35c91c9303cbf538bcc63db4d06108b5e..6d03cf5d6ceae9126358269be8f4cc8b2d576570 100644 (file)
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 1
+#serial 2
 
-
-AC_DEFUN([AX_CXX_CINTTYPES],
-    [
+AC_DEFUN([AX_CXX_CINTTYPES], [
     AC_REQUIRE([AC_PROG_CXX])
     AC_REQUIRE([AC_PROG_CXXCPP])
     AC_REQUIRE([AX_CXX_CSTDINT])
-    AC_MSG_CHECKING(the location of cinttypes)
-    save_CXXFLAGS="${CXXFLAGS}"
-    CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
-    ac_cv_cxx_cinttypes=""
 
-    AC_LANG_PUSH([C++])
-#    AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes],
-#      [
-# Look for cinttypes
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <cinttypes>], [ uint32_t foo= UINT32_C(1) ])],
-        [ac_cv_cxx_cinttypes="<cinttypes>"],
-        [
+    AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [
+      save_CXXFLAGS="${CXXFLAGS}"
+      CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
+      AC_LANG_PUSH([C++])
+
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <cinttypes>], [
+          uint32_t foo= UINT32_C(1); 
+          ])],
+        [ac_cxx_cinttypes_cinttypes="<cinttypes>"])
+
 # Look for tr1/cinttypes
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <tr1/cinttypes>], [ uint32_t foo= UINT32_C(1) ])],
-          [ac_cv_cxx_cinttypes="<tr1/cinttypes>"],
-          [
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <tr1/cinttypes>], [
+          uint32_t foo= UINT32_C(1);
+          ])],
+        [ac_cxx_cinttypes_tr1_cinttypes="<tr1/cinttypes>"])
+
 # Look for boost/cinttypes.hpp
-          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <boost/cinttypes.hpp>], [ uint32_t foo= UINT32_C(1) ])],
-            [ac_cv_cxx_cinttypes="<boost/cinttypes.hpp>"])
-          ])
-        ])
-#      ])
-  AC_LANG_POP()
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <boost/cinttypes.hpp>], [
+          uint32_t foo= UINT32_C(1); 
+          ])],
+        [ac_cxx_cinttypes_boost_cinttypes_hpp="<boost/cinttypes.hpp>"])
+
+      AC_LANG_POP
+      CXXFLAGS="${save_CXXFLAGS}"
+
+      AS_IF([test -n "$ac_cxx_cinttypes_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes],
+          [test -n "$ac_cxx_cinttypes_tr1_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes],
+          [test -n "$ac_cxx_cinttypes_boost_cinttypes_hpp"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_boost_cinttypes_hpp])
+  ])
 
-  CXXFLAGS="${save_CXXFLAGS}"
-  if test -n "$ac_cv_cxx_cinttypes"; then
-    AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
-  else
-    ac_cv_cxx_cinttypes="<inttypes.h>"
-    AC_MSG_WARN([Could not find a cinttypes header.])
-    AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
-  fi
+  AS_IF([ test -n "$ac_cv_cxx_cinttypes"], [
+      AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
+      ],[
+      ac_cv_cxx_cinttypes="<inttypes.h>"
+      AC_MSG_WARN([Could not find a cinttypes header.])
+      AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
+      ])
 
   AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++])
-  AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes, [the location of <cinttypes>])
+  AC_DEFINE_UNQUOTED([CINTTYPES_H],[$ac_cv_cxx_cinttypes],[the location of <cinttypes>])
   ])
index ef08435221d3508ce830dec55d811e50af16482f..685d4ade4b775e7caf8bf31be9ad36b6314c33f7 100644 (file)
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 1
+#serial 2
 
 
-AC_DEFUN([AX_CXX_CSTDINT],
-    [
+AC_DEFUN([AX_CXX_CSTDINT], [
     AC_REQUIRE([AC_PROG_CXX])
     AC_REQUIRE([AC_PROG_CXXCPP])
 
-    AC_MSG_CHECKING(the location of cstdint)
-    AC_LANG_PUSH([C++])
-    save_CXXFLAGS="${CXXFLAGS}"
-    CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
-    ac_cv_cxx_cstdint=""
+    AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [
+      AC_LANG_PUSH([C++])
+      save_CXXFLAGS="${CXXFLAGS}"
+      CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
 
-    AC_LANG_PUSH([C++])
-#    AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint],
-#      [
-# Look for cstdint
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <cstdint>], [ uint32_t t ])],
-        [ac_cv_cxx_cstdint="<cstdint>"],
-        [
-# Look for tr1/cstdint
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <tr1/cstdint>], [ uint32_t t ])],
-          [ac_cv_cxx_cstdint="<tr1/cstdint>"],
-          [
-# Look for boost/cstdint.hpp
-          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <boost/cstdint.hpp>], [ uint32_t t ])],
-            [ac_cv_cxx_cstdint="<boost/cstdint.hpp>"])
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <cstdint>], [ uint32_t t ])],
+        [ac_cxx_cstdint_cstdint="<cstdint>"])
 
-          ])
-        ])
-#      ])
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <tr1/cstdint>], [ uint32_t t ])],
+        [ac_cxx_cstdint_tr1_cstdint="<tr1/cstdint>"])
 
-  AC_LANG_POP()
+      AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([#include <boost/cstdint.hpp>], [ uint32_t t ])],
+        [ac_cxx_cstdint_boost_cstdint_hpp="<boost/cstdint.hpp>"])
 
-  CXXFLAGS="${save_CXXFLAGS}"
-  if test -n "$ac_cv_cxx_cstdint"; then
-    AC_MSG_RESULT([$ac_cv_cxx_cstdint])
-  else
-    ac_cv_cxx_cstdint="<stdint.h>"
-    AC_MSG_WARN([Could not find a cstdint header.])
-    AC_MSG_RESULT([$ac_cv_cxx_cstdint])
-  fi
+      AC_LANG_POP
+      CXXFLAGS="${save_CXXFLAGS}"
 
-  AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint, [the location of <cstdint>])
+      AS_IF([test -n "$ac_cxx_cstdint_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint],
+        [test -n "$ac_cxx_cstdint_tr1_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint],
+        [test -n "$ac_cxx_cstdint_boost_cstdint_hpp"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp])
+      ])
+
+  AS_IF([test -n "$ac_cv_cxx_cstdint"], [
+      AC_MSG_RESULT([$ac_cv_cxx_cstdint])
+      ],[
+      ac_cv_cxx_cstdint="<stdint.h>"
+      AC_MSG_WARN([Could not find a cstdint header.])
+      AC_MSG_RESULT([$ac_cv_cxx_cstdint])
+      ])
+
+AC_DEFINE_UNQUOTED([CSTDINT_H],[$ac_cv_cxx_cstdint], [the location of <cstdint>])
 
   ])
index 9fc0cf33d7515d20c195b11371beb7f6f1622453..1122bb495998542258c6b4efdda713766a702c02 100644 (file)
@@ -4,7 +4,8 @@
 #
 # SYNOPSIS
 #
-#   AX_LIB_UUID
+#   AX_UUID
+#   AX_UUID_GENERATE_TIME_SAFE
 #
 # DESCRIPTION
 #
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 2
+#serial 3
 
-AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [
-    AC_CACHE_CHECK([check for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [
-      save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="-luuid"
-      AC_LANG_PUSH([C])
-      AC_COMPILE_IFELSE([
-        AC_LANG_PROGRAM([
-#include <uuid/uuid.h>
-      ], [
-      uuid_t out;
-      uuid_generate_time_safe(out);
-      ]), [ax_cv_uuid_generate_time_safe=yes ], [ax_cv_uuid_generate_time_safe=no ]
+AC_DEFUN([AX_UUID], [
+         AC_CHECK_HEADER([uuid/uuid.h], [
+                         AC_CACHE_CHECK([check to see if we need -luuid], [ax_cv_libuuid_is_required], [
+                                        save_LDFLAGS="$LDFLAGS"
+                                        LDFLAGS="-luuid"
+                                        AC_LANG_PUSH([C])
+                                        AC_LINK_IFELSE([
+                                                       AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+                                                                       uuid_t out;
+                                                                       uuid_generate(out);
+                                                                       ])],
+                                                       [ax_cv_libuuid_is_required=yes],
+                                                       [])
+                                        AC_LANG_POP
+                                        LDFLAGS="$save_LDFLAGS"
+                                        ])
+                         AS_IF([test x"ax_cv_libuuid_is_required" = xyes], [
+                               LIBUUID_LDFLAGS="-luuid"
+                               UUID_UUID_H=yes
+                               ],[
+                               AC_CACHE_CHECK([check to see if -luuid is not needed], [ax_cv_libuuid_is_not_required], [
+                                              AC_LANG_PUSH([C])
+                                              AC_COMPILE_IFELSE([
+                                                                AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+                                                                                uuid_t out;
+                                                                                uuid_generate(out);
+                                                                                ])],
+                                                                [ax_cv_libuuid_is_not_required=yes],
+                                                                [ax_cv_libuuid_is_not_required=no])
+                                              AC_LANG_POP
+                                              ])
+                               AS_IF([test x"ax_cv_libuuid_is_not_required" = xyes], [UUID_UUID_H=yes], [UUID_UUID_H=])
+                               ])
+                         ], [UUID_UUID_H=])
+
+AS_IF([test x"$UUID_UUID_H" = xyes], [
+      AC_DEFINE([HAVE_UUID_UUID_H], [ 1 ], [Have uuid/uuid.h])
+      ],[
+      AC_DEFINE([HAVE_UUID_UUID_H], [ 0 ], [Have uuid/uuid.h])
       ])
+])
 
-    AC_LANG_POP
-    LDFLAGS="$save_LDFLAGS"
-    ])
+AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [
+  AC_REQUIRE([AX_UUID])
+  AC_CACHE_CHECK([for uuid_generate_time_safe], [ax_cv_uuid_generate_time_safe], [
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS=$LIBUUID_LDFLAGS
+        AC_LANG_PUSH([C])
+        AC_LINK_IFELSE([
+            AC_LANG_PROGRAM([#include <uuid/uuid.h>], [
+                            uuid_t out;
+                            uuid_generate_time_safe(out);
+                            ])],
+            [ax_cv_uuid_generate_time_safe=yes],
+            [ax_cv_uuid_generate_time_safe=no])
+          AC_LANG_POP
+          LDFLAGS="$save_LDFLAGS"
+          ])
 
   AS_IF([test "$ax_cv_uuid_generate_time_safe" = yes],[
     AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE,[1],[Define if uuid_generate_time_safe is present in uuid/uuid.h.])],[