libreplace: move detection of clock_gettime to libreplace
authorBjörn Jacke <bj@sernet.de>
Thu, 19 Aug 2010 16:39:45 +0000 (18:39 +0200)
committerBjörn Jacke <bj@sernet.de>
Tue, 31 Aug 2010 07:07:13 +0000 (09:07 +0200)
lib/replace/libreplace.m4
source3/configure.in
source3/m4/aclocal.m4

index 2303641d94509fb07f7529b73bdedce9895c1b1c..0d716e0abe03310b98a0e74be1f46089aa44072f 100644 (file)
@@ -115,6 +115,12 @@ AC_CHECK_FUNCS(fdatasync,,[
                [libreplace_cv_HAVE_FDATASYNC_IN_LIBRT=yes
                AC_DEFINE(HAVE_FDATASYNC, 1, Define to 1 if there is support for fdatasync)])
 ])
+AC_CHECK_FUNCS(clock_gettime,libreplace_cv_have_clock_gettime=yes,[
+       AC_CHECK_LIB(rt, clock_gettime,
+               [libreplace_cv_HAVE_CLOCK_GETTIME_IN_LIBRT=yes
+               libreplace_cv_have_clock_gettime=yes
+               AC_DEFINE(HAVE_CLOCK_GETTIME, 1, Define to 1 if there is support for clock_gettime)])
+])
 AC_CHECK_FUNCS(get_current_dir_name)
 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
@@ -288,6 +294,12 @@ m4_include(timegm.m4)
 m4_include(repdir.m4)
 m4_include(crypt.m4)
 
+if test x$libreplace_cv_have_clock_gettime = xyes ; then
+       SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
+       SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
+       SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
+fi
+
 AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
 
 echo "LIBREPLACE_BROKEN_CHECKS: END"
@@ -316,4 +328,35 @@ m4_include(libreplace_ld.m4)
 m4_include(libreplace_network.m4)
 m4_include(libreplace_macros.m4)
 
+
+dnl SMB_CHECK_CLOCK_ID(clockid)
+dnl Test whether the specified clock_gettime clock ID is available. If it
+dnl is, we define HAVE_clockid
+AC_DEFUN([SMB_CHECK_CLOCK_ID],
+[
+    AC_MSG_CHECKING(for $1)
+    AC_TRY_LINK([
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+    ],
+    [
+clockid_t clk = $1;
+    ],
+    [
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_$1, 1,
+           [Whether the clock_gettime clock ID $1 is available])
+    ],
+    [
+       AC_MSG_RESULT(no)
+    ])
+])
 m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[m4_include(autoconf-2.60.m4)])
index e0dedb3d074b463b663d875efc52e4243b4ff70c..1f4da24027c576654b62dd603e91b7bf87bfcf23 100644 (file)
@@ -2368,23 +2368,8 @@ if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
     AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
 fi
 
-
-if test x"$samba_cv_WITH_PROFILE" = x"yes"; then
-
-    # On some systems (eg. Linux) librt can pull in libpthread. We
-    # don't want this to happen because libpthreads changes signal delivery
-    # semantics in ways we are not prepared for. This breaks Linux oplocks
-    # which rely on signals.
-
-    AC_LIBTESTFUNC(rt, clock_gettime,
-           [
-                           AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
-                               [Whether clock_gettime is available])
-                           SMB_CHECK_CLOCK_ID(CLOCK_MONOTONIC)
-                           SMB_CHECK_CLOCK_ID(CLOCK_PROCESS_CPUTIME_ID)
-                           SMB_CHECK_CLOCK_ID(CLOCK_REALTIME)
-                       ])
-
+if test x"$libreplace_cv_HAVE_CLOCK_GETTIME_IN_LIBRT" = xyes ; then
+       LIBS="$LIBS -lrt"
 fi
 
 AC_CACHE_CHECK([for broken readdir name],samba_cv_HAVE_BROKEN_READDIR_NAME,[
index 3ca44bd496d27f042e3197689f8d3d6c9c982676..b33658f354527724c184c6d0d8b8217b70ec01bd 100644 (file)
@@ -799,37 +799,6 @@ AC_DEFUN([SMB_CHECK_DMAPI],
 
 ])
 
-dnl SMB_CHECK_CLOCK_ID(clockid)
-dnl Test whether the specified clock_gettime clock ID is available. If it
-dnl is, we define HAVE_clockid
-AC_DEFUN([SMB_CHECK_CLOCK_ID],
-[
-    AC_MSG_CHECKING(for $1)
-    AC_TRY_LINK([
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-    ],
-    [
-clockid_t clk = $1;
-    ],
-    [
-       AC_MSG_RESULT(yes)
-       AC_DEFINE(HAVE_$1, 1,
-           [Whether the clock_gettime clock ID $1 is available])
-    ],
-    [
-       AC_MSG_RESULT(no)
-    ])
-])
-
 dnl SMB_IF_RTSIGNAL_BUG([actions if true],
 dnl                    [actions if false],
 dnl                    [actions if cross compiling])