### 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
])
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>