* configure.in (GUILE_FUNC_DECLARED): Name the cache variables
authorJim Blandy <jimb@red-bean.com>
Mon, 12 Oct 1998 21:08:17 +0000 (21:08 +0000)
committerJim Blandy <jimb@red-bean.com>
Mon, 12 Oct 1998 21:08:17 +0000 (21:08 +0000)
starting with guile_cv_; ac_cv_ is autoconf's namespace.
The type of the argument to usleep varies from system to system,
as does the return type.  We really shouldn't be redefining usleep
at all, but I don't have time to clean that up before the 1.3
release.  It's on the schedule for afterwards.
* configure.in: Cache results from usleep return value test.
Test for the type of the usleep argument, and cache that too.
* acconfig.h (USLEEP_ARG_TYPE): New macro.

configure.in

index 7bd79f9..4ccaee3 100644 (file)
@@ -119,11 +119,11 @@ AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir
 ### Check for a declaration of FUNCTION in HEADERFILE; if it is
 ### not there, #define MISSING_FUNCTION_DECL.
 AC_DEFUN(GUILE_FUNC_DECLARED, [
-  AC_CACHE_CHECK(for $1 declaration, ac_cv_func_$1_declared,
+  AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
     AC_EGREP_HEADER($1, $2,
-                   ac_cv_func_$1_declared=yes, 
-                   ac_cv_func_$1_declared=no))
-  if test [x$ac_cv_func_]$1[_declared] = xno; then
+                   guile_cv_func_$1_declared=yes, 
+                   guile_cv_func_$1_declared=no))
+  if test [x$guile_cv_func_]$1[_declared] = xno; then
     AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL])
   fi
 ])
@@ -133,12 +133,34 @@ GUILE_FUNC_DECLARED(bzero, string.h)
 GUILE_FUNC_DECLARED(sleep, unistd.h)
 GUILE_FUNC_DECLARED(usleep, unistd.h)
 
-# On some systems usleep has no return value
-AC_EGREP_HEADER(changequote(<, >)<void[        ][      ]*usleep>changequote([, ]),
-  /usr/include/unistd.h,
-  AC_DEFINE(USLEEP_RETURNS_VOID)
-)
+### On some systems usleep has no return value.  Of course, we
+### shouldn't be doing anything like this at all...
+AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
+  [AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
+                   /usr/include/unistd.h,
+                  [guile_cv_func_usleep_return_type=void],
+                  [guile_cv_func_usleep_return_type=int])])
+case "$guile_cv_func_usleep_return_type" in
+  "void" )
+    AC_DEFINE(USLEEP_RETURNS_VOID)
+  ;;
+esac
 
+### To make things even worse, its argument type varies, which we also
+### have to know.  Ahh, complicity...
+AC_CACHE_CHECK([type of usleep argument], guile_cv_func_usleep_arg_type,
+  [AC_EGREP_HEADER(changequote(<, >)<usleep[   ]*([    ]*unsigned[     ]*long[         ]*)>changequote([, ]),
+                   /usr/include/unistd.h,
+                   [guile_cv_func_usleep_arg_type=ulong],
+                   [guile_cv_func_usleep_arg_type=uint])])
+case "$guile_cv_func_usleep_arg_type" in
+  "ulong" ) 
+    AC_DEFINE(USLEEP_ARG_TYPE, unsigned long)
+  ;;
+  "uint" )
+    AC_DEFINE(USLEEP_ARG_TYPE, unsigned)
+  ;;
+esac
 
 dnl <GNU-WIN32 hacks>