--- /dev/null
+#serial 11
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+
+AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+ AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+ AC_CHECK_FUNCS_ONCE([gettimeofday])
+
+ AC_CACHE_CHECK([for gettimeofday with POSIX signature],
+ [gl_cv_func_gettimeofday_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/time.h>
+ struct timeval c;
+ ]],
+ [[
+ int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
+ int x = f (&c, 0);
+ return !(x | c.tv_sec | c.tv_usec);
+ ]])],
+ [gl_cv_func_gettimeofday_posix_signature=yes],
+ [gl_cv_func_gettimeofday_posix_signature=no])])
+
+ gl_FUNC_GETTIMEOFDAY_CLOBBER
+
+ if test $gl_cv_func_gettimeofday_posix_signature != yes; then
+ REPLACE_GETTIMEOFDAY=1
+ SYS_TIME_H=sys/time.h
+ if test $gl_cv_func_gettimeofday_clobber != yes; then
+ AC_LIBOBJ(gettimeofday)
+ gl_PREREQ_GETTIMEOFDAY
+ fi
+ fi
+])
+
+
+dnl See if gettimeofday clobbers the static buffer that localtime uses
+dnl for its return value. The gettimeofday function from Mac OS X 10.0.4
+dnl (i.e., Darwin 1.3.7) has this problem.
+dnl
+dnl If it does, then arrange to use gettimeofday and localtime only via
+dnl the wrapper functions that work around the problem.
+
+AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
+[
+ AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+
+ AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
+ [gl_cv_func_gettimeofday_clobber],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <string.h>
+ #include <sys/time.h>
+ #include <time.h>
+ #include <stdlib.h>
+ ]],
+ [[
+ time_t t = 0;
+ struct tm *lt;
+ struct tm saved_lt;
+ struct timeval tv;
+ lt = localtime (&t);
+ saved_lt = *lt;
+ gettimeofday (&tv, NULL);
+ return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
+ ]])],
+ [gl_cv_func_gettimeofday_clobber=no],
+ [gl_cv_func_gettimeofday_clobber=yes],
+ dnl When crosscompiling, assume it is broken.
+ [gl_cv_func_gettimeofday_clobber=yes])])
+
+ if test $gl_cv_func_gettimeofday_clobber = yes; then
+ REPLACE_GETTIMEOFDAY=1
+ SYS_TIME_H=sys/time.h
+ gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+ AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], 1,
+ [Define if gettimeofday clobbers the localtime buffer.])
+ fi
+])
+
+AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
+ AC_LIBOBJ(gettimeofday)
+ gl_PREREQ_GETTIMEOFDAY
+ AC_DEFINE([gmtime], [rpl_gmtime],
+ [Define to rpl_gmtime if the replacement function should be used.])
+ AC_DEFINE([localtime], [rpl_localtime],
+ [Define to rpl_localtime if the replacement function should be used.])
+])
+
+# Prerequisites of lib/gettimeofday.c.
+AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
+ AC_CHECK_HEADERS([sys/timeb.h])
+ AC_CHECK_FUNCS([_ftime])
+])
m4_pushdef([gltests_LIBSOURCES_DIR], [])
gl_COMMON
gl_source_base='gl/tests'
+ gl_FUNC_GETTIMEOFDAY
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([ioctl])
fi
gl_SYS_IOCTL_MODULE_INDICATOR([ioctl])
gl_MODULE_INDICATOR([ioctl])
+ AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
gl_SOCKETS
gt_TYPE_WCHAR_T
gt_TYPE_WINT_T
m4/getdelim.m4
m4/getline.m4
m4/getpass.m4
+ m4/gettimeofday.m4
m4/gnulib-common.m4
m4/include_next.m4
m4/inet_ntop.m4
tests/test-getaddrinfo.c
tests/test-getdelim.c
tests/test-getline.c
+ tests/test-gettimeofday.c
tests/test-lseek.c
tests/test-lseek.sh
tests/test-netdb.c
tests/test-perror.c
tests/test-perror.sh
tests/test-read-file.c
+ tests/test-select-fd.c
+ tests/test-select-in.sh
+ tests/test-select-out.sh
+ tests/test-select-stdin.c
tests/test-select.c
tests/test-snprintf.c
tests/test-sockets.c
tests/test-unistd.c
tests/test-vasnprintf.c
tests/test-wchar.c
+ tests=lib/gettimeofday.c
tests=lib/ioctl.c
tests=lib/sockets.c
tests=lib/sockets.h
-# sys_ioctl_h.m4 serial 1
+# sys_ioctl_h.m4 serial 2
dnl Copyright (C) 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl header file, such as <unistd.h> or <stropts.h>, is needed for that.
AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl],
[gl_cv_decl_ioctl_in_sys_ioctl_h],
- [AC_CHECK_DECL([ioctl],
+ [dnl We cannot use AC_CHECK_DECL because it produces its own messages.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT([#include <sys/ioctl.h>])],
+ [(void) ioctl;])],
[gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
- [gl_cv_decl_ioctl_in_sys_ioctl_h=no],
- [#include <sys/ioctl.h>])
+ [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
])
if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then
SYS_IOCTL_H='sys/ioctl.h'
## end gnulib module getline-tests
+## begin gnulib module gettimeofday
+
+
+EXTRA_DIST += gettimeofday.c
+
+EXTRA_libtests_a_SOURCES += gettimeofday.c
+
+## end gnulib module gettimeofday
+
+## begin gnulib module gettimeofday-tests
+
+TESTS += test-gettimeofday
+check_PROGRAMS += test-gettimeofday
+
+EXTRA_DIST += test-gettimeofday.c
+
+## end gnulib module gettimeofday-tests
+
## begin gnulib module ioctl
## begin gnulib module select-tests
-TESTS += test-select
-check_PROGRAMS += test-select
+TESTS += test-select test-select-in.sh test-select-out.sh
+# test-select-stdin has to be run by hand.
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
+check_PROGRAMS += test-select test-select-fd test-select-stdin
test_select_LDADD = $(LDADD) @LIBSOCKET@
+test_select_fd_LDADD = $(LDADD) @LIBSOCKET@
+test_select_stdin_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-select.c
+EXTRA_DIST += test-select.c test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c
## end gnulib module select-tests
-# include_next.m4 serial 8
+# include_next.m4 serial 9
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_CHECK_NEXT_HEADERS],
[
AC_REQUIRE([gl_INCLUDE_NEXT])
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_HEADERS_ONCE([$1])
m4_foreach_w([gl_HEADER_NAME], [$1],
[AC_LANG_SOURCE(
[[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
)])
- dnl eval is necessary to expand ac_cpp.
+ dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+ dnl that contain only a #include of other header files and no
+ dnl non-comment tokens of their own. This leads to a failure to
+ dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+ dnl and others. The workaround is to force preservation of comments
+ dnl through option -C. This ensures all necessary #line directives
+ dnl are present. GCC supports option -C as well.
+ case "$host_os" in
+ aix*) gl_absname_cpp="$ac_cpp -C" ;;
+ *) gl_absname_cpp="$ac_cpp" ;;
+ esac
+ dnl eval is necessary to expand gl_absname_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
dnl so use subshell.
AS_VAR_SET([gl_next_header],
- ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+ ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
s#^/[^/]#//&#
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
#if @GNULIB_LSTAT@
# if ! @HAVE_LSTAT@
/* mingw does not support symlinks, therefore it does not have lstat. But
lchmod (f, m))
#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* _GL_SYS_STAT_H */
#endif /* _GL_SYS_STAT_H */
#endif