]> granicus.if.org Git - check/commitdiff
configure.ac: add option to force Check's replacement of timer_* functions
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 18 Dec 2013 19:46:56 +0000 (19:46 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 18 Dec 2013 19:46:56 +0000 (19:46 +0000)
On OpenBSD 5.4 (and perhaps other BSDs) the timer_* functions
are implemented, but do nothing. Instead, they set errno to
ENOSYS (not available) and return -1. Check would check if
the timer_* functions were missing, and would use its own
replacements if they were. However, because they actually do
exist, Check does not know to replace them.

This adds another configure option, --enable-timer-replacement, which
will force Check's timer replacements instead of detecting the need.
There is still no checking if the replacements are needed or not
for OpenBSD, but at least this gives an option so check will work
properly.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@900 64e312b2-a51f-0410-8e61-82d0ca0eb02a

configure.ac

index ab9b1698e88fd7da2e371322dc25481cb3c9422a..90a9e28d122d51eef13e78c6e04bd38cce8e249a 100644 (file)
@@ -116,6 +116,15 @@ AC_HELP_STRING([--enable-snprintf-replacement],
   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-snprintf-replacement) ;;
 esac], [enable_snprintf_replacement=autodetect ])
 
+AC_ARG_ENABLE(timer-replacement,
+AC_HELP_STRING([--enable-timer-replacement],
+              [enable check timer replacement, (even if the system provides timer_create, timer_settime, and timer_delete) @<:@default=autodetect@:>@]),
+[case "${enableval}" in
+  yes) enable_timer_replacement=true ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for --enable-timer-replacement) ;;
+esac], [enable_timer_replacement=autodetect ])
+
+
 # Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC
@@ -233,8 +242,22 @@ AC_CHECK_SIZEOF(long, 4)
 # Checks for library functions.
 AC_FUNC_MALLOC
 AC_FUNC_REALLOC
-AC_REPLACE_FUNCS([alarm clock_gettime timer_create timer_settime timer_delete fileno localtime_r pipe putenv setenv sleep strdup strsignal unsetenv])
-AC_CHECK_DECLS([alarm, clock_gettime, timer_create, timer_settime, timer_delete, fileno, localtime_r, pipe, putenv, setenv, sleep, strdup, strsignal, unsetenv])
+
+# The timer_create(), timer_settime(), and timer_delete()
+# functions on OpenBSD (and maybe other BSDs) are implemented, but
+# simply set errno=ENOSYS. For this reason, we give the option
+# to use Check's replacement of these functions.
+if test "xtrue" = x"$enable_timer_replacement"; then
+    AC_LIBOBJ([timer_create])
+    AC_LIBOBJ([timer_settime])
+    AC_LIBOBJ([timer_delete])
+else
+    AC_REPLACE_FUNCS([timer_create timer_settime timer_delete])
+    AC_CHECK_DECLS([timer_create, timer_settime, timer_delete])
+fi
+
+AC_REPLACE_FUNCS([alarm clock_gettime fileno localtime_r pipe putenv setenv sleep strdup strsignal unsetenv])
+AC_CHECK_DECLS([alarm, clock_gettime, fileno, localtime_r, pipe, putenv, setenv, sleep, strdup, strsignal, unsetenv])
 
 AC_CHECK_FUNCS([setitimer])