Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumpuser check for clock_gettime from librt too



details:   https://anonhg.NetBSD.org/src/rev/b940bd87d2c5
branches:  trunk
changeset: 333464:b940bd87d2c5
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Nov 05 01:40:30 2014 +0000

description:
check for clock_gettime from librt too

diffstat:

 lib/librumpuser/configure            |  70 +++++++++++++++++++++++++++++++++++-
 lib/librumpuser/configure.ac         |   6 ++-
 lib/librumpuser/rumpuser_config.h.in |   2 +-
 3 files changed, 75 insertions(+), 3 deletions(-)

diffs (120 lines):

diff -r cccb0c5c99fc -r b940bd87d2c5 lib/librumpuser/configure
--- a/lib/librumpuser/configure Wed Nov 05 01:39:40 2014 +0000
+++ b/lib/librumpuser/configure Wed Nov 05 01:40:30 2014 +0000
@@ -3793,7 +3793,7 @@
 
 
 for ac_func in kqueue chflags strsuftoll setprogname getprogname       \
-       clock_gettime getenv_r posix_memalign memalign aligned_alloc    \
+       getenv_r posix_memalign memalign aligned_alloc  \
        arc4random_buf getsubopt fsync_range __quotactl
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -3877,6 +3877,74 @@
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
+if ${ac_cv_lib_rt_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt  $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 clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_rt_clock_gettime=yes
+else
+  ac_cv_lib_rt_clock_gettime=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_rt_clock_gettime" >&5
+$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
+
+$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+else
+  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 clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_nanosleep in -lrt" >&5
 $as_echo_n "checking for clock_nanosleep in -lrt... " >&6; }
 if ${ac_cv_lib_rt_clock_nanosleep+:} false; then :
diff -r cccb0c5c99fc -r b940bd87d2c5 lib/librumpuser/configure.ac
--- a/lib/librumpuser/configure.ac      Wed Nov 05 01:39:40 2014 +0000
+++ b/lib/librumpuser/configure.ac      Wed Nov 05 01:40:30 2014 +0000
@@ -27,12 +27,16 @@
 AC_CHECK_TYPES([clockid_t, register_t])
 
 AC_CHECK_FUNCS([kqueue chflags strsuftoll setprogname getprogname      \
-       clock_gettime getenv_r posix_memalign memalign aligned_alloc    \
+       getenv_r posix_memalign memalign aligned_alloc  \
        arc4random_buf getsubopt fsync_range __quotactl])
 
 AC_TRY_LINK_FUNC([clock_nanosleep],,
         AC_CHECK_LIB([rt], [clock_nanosleep])
 )
+AC_CHECK_LIB([rt], [clock_gettime],
+       AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime]),
+       AC_TRY_LINK_FUNC([clock_gettime],
+           AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime])))
 AC_CHECK_LIB([rt], [clock_nanosleep],
        AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep]),
        AC_TRY_LINK_FUNC([clock_nanosleep],
diff -r cccb0c5c99fc -r b940bd87d2c5 lib/librumpuser/rumpuser_config.h.in
--- a/lib/librumpuser/rumpuser_config.h.in      Wed Nov 05 01:39:40 2014 +0000
+++ b/lib/librumpuser/rumpuser_config.h.in      Wed Nov 05 01:40:30 2014 +0000
@@ -12,7 +12,7 @@
 /* Define to 1 if the system has the type `clockid_t'. */
 #undef HAVE_CLOCKID_T
 
-/* Define to 1 if you have the `clock_gettime' function. */
+/* clock_gettime */
 #undef HAVE_CLOCK_GETTIME
 
 /* clock_nanosleep */



Home | Main Index | Thread Index | Old Index