aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-30 10:03:32 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:22 +0100
commit1c3c106f4690a45eedc5304e9c7eea6ce95747e3 (patch)
tree38d545ecfb2077d866cc67afae2403a15adc2705 /configure
parentcc16ae635d42789aaaf24444d0cd45cd824acebe (diff)
indexamajig: Add fallback for clock_gettime()
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure59
1 files changed, 57 insertions, 2 deletions
diff --git a/configure b/configure
index 339d4902..d5f96eb3 100755
--- a/configure
+++ b/configure
@@ -7481,6 +7481,60 @@ fi
+{ $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 test "${ac_cv_lib_rt_clock_gettime+set}" = set; 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" = x""yes; then :
+
+
+$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+
+ TIMER_LIBS="-lrt"
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Falling back on gettimeofday()." >&5
+$as_echo "$as_me: WARNING: Falling back on gettimeofday()." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Time intervals may not be correct in certain circumstances." >&5
+$as_echo "$as_me: WARNING: Time intervals may not be correct in certain circumstances." >&2;}
+
+fi
+
+
+
if test x$have_opencl = xtrue; then
HAVE_OPENCL_TRUE=
HAVE_OPENCL_FALSE='#'
@@ -7574,9 +7628,10 @@ $as_echo "$gl_cv_prog_c_ignore_unused_libraries" >&6; }
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
-LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread -lrt"
+
+LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
-LIBS="$LIBS $GDK_pixbuf_2_LIBS $LDFLAGS"
+LIBS="$LIBS $GDK_pixbuf_2_LIBS $TIMER_LIBS $LDFLAGS"