diff options
author | Eric Blake <ebb9@byu.net> | 2009-12-16 16:20:28 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2010-01-20 07:04:51 -0700 |
commit | cbd5934b1918d73022d1d1d9904112f3d6d7f187 (patch) | |
tree | 0c449fce2fab1e9cdb3bec0d9823e5750a34a633 /m4 | |
parent | b4349b948ba2c352187158e241334abda6e473e9 (diff) | |
download | gnulib-cbd5934b1918d73022d1d1d9904112f3d6d7f187.tar.gz |
warn-on-use: use instead of link-warning
Each *.in.h file serves two purposes - provide enough self-contained
content to serve as a replacement for the system header regardless of
the user's compiler, and offer the developer the ability to detect any
gnulib modules that might have been inadvertantly excluded. The
former requires independence from config.h, and routes everything
through a Makefile.am snippet that uses @@ substitution specific to
the modules that were in use, with details learned at configure time.
The latter works by poisoning anything that gnulib did not replace,
but which the developer had natively available, explaining why their
tests passed during development. Poisoning relies on gcc features,
and requires manual triggering by adding -DGNULIB_POSIXCHECK to
CFLAGS; it assumes that <config.h> is properly included. In fact, we
do not want to use @@ substitution for HAVE_DECL_* during poisoning,
because the warning is only relevant for the gnulib modules which were
not included, and thus where the m4 macros to set proper @@ values
have not been run. Furthermore, we only need to poison interfaces
that already have a declaration; if something is not declared, then
the developer wouldn't have been able to link, so their code won't be
using the problematic interface in the first place.
* modules/stdio (Depends-on, Makefile.am): Drop link-warning.
* modules/unistd (Depends-on, Makefile.am): Likewise.
* modules/arpa_inet (Depends-on): Replace link-warning with
warn-on-use.
(Makefile.am): Update rules accordingly.
* modules/ctype (Depends-on, Makefile.am): Likewise.
* modules/dirent (Depends-on, Makefile.am): Likewise.
* modules/fcntl-h (Depends-on, Makefile.am): Likewise.
* modules/inttypes (Depends-on, Makefile.am): Likewise.
* modules/langinfo (Depends-on, Makefile.am): Likewise.
* modules/locale (Depends-on, Makefile.am): Likewise.
* modules/math (Depends-on, Makefile.am): Likewise.
* modules/search (Depends-on, Makefile.am): Likewise.
* modules/signal (Depends-on, Makefile.am): Likewise.
* modules/spawn (Depends-on, Makefile.am): Likewise.
* modules/stdlib (Depends-on, Makefile.am): Likewise.
* modules/string (Depends-on, Makefile.am): Likewise.
* modules/strings (Depends-on, Makefile.am): Likewise.
* modules/sys_file (Depends-on, Makefile.am): Likewise.
* modules/sys_ioctl (Depends-on, Makefile.am): Likewise.
* modules/sys_select (Depends-on, Makefile.am): Likewise.
* modules/sys_socket (Depends-on, Makefile.am): Likewise.
* modules/sys_stat (Depends-on, Makefile.am): Likewise.
* modules/sys_times (Depends-on, Makefile.am): Likewise.
* modules/sys_utsname (Depends-on, Makefile.am): Likewise.
* modules/wchar (Depends-on, Makefile.am): Likewise.
* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Check which functions
should be poisoned.
* m4/ctype.m4 (gl_CTYPE_H): Likewise.
* m4/dirent_h.m4 (gl_DIRENT_H): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
* m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
* m4/locale_h.m4 (gl_LOCALE_H): Likewise.
* m4/math_h.m4 (gl_MATH_H): Likewise.
* m4/search_h.m4 (gl_SEARCH_H): Likewise.
* m4/signal_h.m4 (gl_SIGNAL_H): Likewise.
* m4/spawn_h.m4 (gl_SPAWN_H): Likewise.
* m4/stdio_h.m4 (gl_STDIO_H): Likewise.
* m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Likewise.
* m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise.
* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
* m4/wchar.m4 (gl_WCHAR_H): Likewise.
* lib/arpa_inet.in.h: Use _GL_WARN_ON_USE instead of
GL_LINK_WARNING.
* lib/ctype.in.h: Likewise.
* lib/dirent.in.h: Likewise.
* lib/fcntl.in.h: Likewise.
* lib/inttypes.in.h: Likewise.
* lib/langinfo.in.h: Likewise.
* lib/locale.in.h: Likewise.
* lib/math.in.h: Likewise.
* lib/search.in.h: Likewise.
* lib/signal.in.h: Likewise.
* lib/spawn.in.h: Likewise.
* lib/stdio.in.h: Likewise.
* lib/stdlib.in.h: Likewise.
* lib/string.in.h: Likewise.
* lib/strings.in.h: Likewise.
* lib/sys_file.in.h: Likewise.
* lib/sys_ioctl.in.h: Likewise.
* lib/sys_select.in.h: Likewise.
* lib/sys_socket.in.h: Likewise.
* lib/sys_stat.in.h: Likewise.
* lib/sys_times.in.h: Likewise.
* lib/sys_utsname.in.h: Likewise.
* lib/unistd.in.h: Likewise.
* lib/wchar.in.h: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/arpa_inet_h.m4 | 12 | ||||
-rw-r--r-- | m4/ctype.m4 | 7 | ||||
-rw-r--r-- | m4/dirent_h.m4 | 7 | ||||
-rw-r--r-- | m4/fcntl_h.m4 | 8 | ||||
-rw-r--r-- | m4/inttypes.m4 | 7 | ||||
-rw-r--r-- | m4/langinfo_h.m4 | 7 | ||||
-rw-r--r-- | m4/locale_h.m4 | 11 | ||||
-rw-r--r-- | m4/math_h.m4 | 8 | ||||
-rw-r--r-- | m4/search_h.m4 | 7 | ||||
-rw-r--r-- | m4/signal_h.m4 | 8 | ||||
-rw-r--r-- | m4/spawn_h.m4 | 16 | ||||
-rw-r--r-- | m4/stdio_h.m4 | 5 | ||||
-rw-r--r-- | m4/stdlib_h.m4 | 16 | ||||
-rw-r--r-- | m4/string_h.m4 | 9 | ||||
-rw-r--r-- | m4/strings_h.m4 | 6 | ||||
-rw-r--r-- | m4/sys_file_h.m4 | 8 | ||||
-rw-r--r-- | m4/sys_ioctl_h.m4 | 11 | ||||
-rw-r--r-- | m4/sys_select_h.m4 | 13 | ||||
-rw-r--r-- | m4/sys_socket_h.m4 | 14 | ||||
-rw-r--r-- | m4/sys_stat_h.m4 | 7 | ||||
-rw-r--r-- | m4/sys_times_h.m4 | 12 | ||||
-rw-r--r-- | m4/sys_utsname_h.m4 | 7 | ||||
-rw-r--r-- | m4/unistd_h.m4 | 15 | ||||
-rw-r--r-- | m4/wchar.m4 | 15 |
24 files changed, 209 insertions, 27 deletions
diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index 07b6871102..4360dd8104 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -1,4 +1,4 @@ -# arpa_inet_h.m4 serial 6 +# arpa_inet_h.m4 serial 7 dnl Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,6 +21,16 @@ AC_DEFUN([gl_HEADER_ARPA_INET], AC_SUBST([HAVE_ARPA_INET_H]) dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([arpa/inet.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* On some systems, this header is not self-consistent. */ +#ifndef __GLIBC__ +# include <sys/socket.h> +#endif +#include <arpa/inet.h> + ]], [inet_ntop inet_pton]) ]) dnl Unconditionally enables the replacement of <arpa/inet.h>. diff --git a/m4/ctype.m4 b/m4/ctype.m4 index f366113744..c23b0e37cb 100644 --- a/m4/ctype.m4 +++ b/m4/ctype.m4 @@ -1,4 +1,4 @@ -# ctype_h.m4 serial 2 +# ctype_h.m4 serial 3 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,11 @@ AC_DEFUN([gl_CTYPE_H], dnl Execute this unconditionally, because CTYPE_H may be set by other dnl modules, after this code is executed. gl_CHECK_NEXT_HEADERS([ctype.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <ctype.h> + ]], [isblank]) ]) AC_DEFUN([gl_CTYPE_MODULE_INDICATOR], diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 index 6452dfe5ed..1328ee3c7b 100644 --- a/m4/dirent_h.m4 +++ b/m4/dirent_h.m4 @@ -1,4 +1,4 @@ -# dirent_h.m4 serial 8 +# dirent_h.m4 serial 9 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,6 +14,11 @@ AC_DEFUN([gl_DIRENT_H], dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([dirent.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <dirent.h> + ]], [alphasort dirfd fdopendir scandir]) ]) dnl Unconditionally enables the replacement of <dirent.h>. diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 048a9fcb9d..ecd8fa33ec 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 9 +# serial 10 # Configure fcntl.h. dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -12,6 +12,12 @@ AC_DEFUN([gl_FCNTL_H], AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_FCNTL_O_FLAGS]) gl_CHECK_NEXT_HEADERS([fcntl.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> + ]], [fcntl openat]) ]) AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 3892e6063a..3ee174dc8b 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 16 +# inttypes.m4 serial 17 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -233,6 +233,11 @@ const char *l = /* implicit string concatenation */ else UINT64_MAX_EQ_ULONG_MAX=-1 fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> + ]], [imaxabs imaxdiv strtoimax strtoumax]) ]) # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. diff --git a/m4/langinfo_h.m4 b/m4/langinfo_h.m4 index 46be299ef3..a4c5409dd0 100644 --- a/m4/langinfo_h.m4 +++ b/m4/langinfo_h.m4 @@ -1,4 +1,4 @@ -# langinfo_h.m4 serial 2 +# langinfo_h.m4 serial 3 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -51,6 +51,11 @@ int a = ERA; AC_SUBST([HAVE_LANGINFO_H]) AC_SUBST([HAVE_LANGINFO_CODESET]) AC_SUBST([HAVE_LANGINFO_ERA]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <langinfo.h> + ]], [nl_langinfo]) ]) AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index e3547b10eb..0b7f4935ba 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,4 +1,4 @@ -# locale_h.m4 serial 6 +# locale_h.m4 serial 7 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -56,6 +56,15 @@ locale_t x;], [], || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then gl_REPLACE_LOCALE_H fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <locale.h> +/* Some systems provide declarations in a non-standard header. */ +#if HAVE_XLOCALE_H +# include <xlocale.h> +#endif + ]], [duplocale]) ]) dnl Unconditionally enables the replacement of <locale.h>. diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 1e4c4803c7..e3b499e8ad 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 16 +# math_h.m4 serial 17 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,6 +35,12 @@ AC_DEFUN([gl_MATH_H], if test $gl_cv_header_math_huge_val_works = no; then REPLACE_HUGE_VAL=1 fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <math.h> + ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl + ldexpl logl round roundf roundl sinl sqrtl tanl trunc truncf truncl]) ]) AC_DEFUN([gl_MATH_MODULE_INDICATOR], diff --git a/m4/search_h.m4 b/m4/search_h.m4 index 0dd0d4bc5a..d9043d9151 100644 --- a/m4/search_h.m4 +++ b/m4/search_h.m4 @@ -1,4 +1,4 @@ -# search_h.m4 serial 4 +# search_h.m4 serial 5 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,6 +15,11 @@ AC_DEFUN([gl_SEARCH_H], HAVE_SEARCH_H=0 fi AC_SUBST([HAVE_SEARCH_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <search.h> + ]], [tdelete tfind tsearch twalk]) ]) AC_DEFUN([gl_SEARCH_MODULE_INDICATOR], diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 7a9d29cf76..7f61e0b401 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 8 +# signal_h.m4 serial 9 dnl Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,6 +15,12 @@ AC_DEFUN([gl_SIGNAL_H], #include <signal.h> ]]) AC_REQUIRE([AC_TYPE_UID_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <signal.h> + ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember + sigpending sigprocmask]) ]) AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4 index 11f399eff6..a9bd161416 100644 --- a/m4/spawn_h.m4 +++ b/m4/spawn_h.m4 @@ -1,4 +1,4 @@ -# spawn_h.m4 serial 5 +# spawn_h.m4 serial 6 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,6 +34,20 @@ AC_DEFUN([gl_SPAWN_H], AC_SUBST([HAVE_SPAWN_H]) AC_REQUIRE([AC_C_RESTRICT]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <spawn.h> + ]], [posix_spawn posix_spawnp posix_spawnattr_init posix_spawnattr_destroy + posix_spawnattr_getsigdefault posix_spawnattr_setsigdefault + posix_spawnattr_getsigmask posix_spawnattr_setsigmask + posix_spawnattr_getflags posix_spawnattr_setflags + posix_spawnattr_getpgroup posix_spawnattr_setpgroup + posix_spawnattr_getschedpolicy posix_spawnattr_setschedpolicy + posix_spawnattr_getschedparam posix_spawnattr_setschedparam + posix_spawn_file_actions_init posix_spawn_file_actions_destroy + posix_spawn_file_actions_addopen posix_spawn_file_actions_addclose + posix_spawwn_file_actions_adddup2]) ]) dnl Unconditionally enables the replacement of <spawn.h>. diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index be79896d57..20af579d14 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 23 +# stdio_h.m4 serial 24 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,7 +36,8 @@ AC_DEFUN([gl_STDIO_H], dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <stdio.h> - ]], [fseeko ftello]) + ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat + snprintf vdprintf vsnprintf]) ]) AC_DEFUN([gl_STDIO_MODULE_INDICATOR], diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index cf41ec0fc0..0693d1a5ec 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 21 +# stdlib_h.m4 serial 22 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,6 +22,20 @@ AC_DEFUN([gl_STDLIB_H], # include <random.h> #endif ]]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <stdlib.h> +#if HAVE_SYS_LOADAVG_H +# include <sys/loadavg.h> +#endif +#if HAVE_RANDOM_H +# include <random.h> +#endif + ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp + mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r + setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], diff --git a/m4/string_h.m4 b/m4/string_h.m4 index f2f64d1935..73c6d83378 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 10 +# serial 11 # Written by Paul Eggert. @@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([string.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <string.h> + ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup + strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], diff --git a/m4/strings_h.m4 b/m4/strings_h.m4 index 135c16c021..26aa1f782a 100644 --- a/m4/strings_h.m4 +++ b/m4/strings_h.m4 @@ -1,4 +1,5 @@ # Configure a replacement for <string.h>. +# serial 2 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -16,6 +17,11 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY], [ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([strings.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <strings.h> + ]], [strcasecmp strncasecmp]) ]) AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], diff --git a/m4/sys_file_h.m4 b/m4/sys_file_h.m4 index f8454f13d0..d864dad3ec 100644 --- a/m4/sys_file_h.m4 +++ b/m4/sys_file_h.m4 @@ -1,4 +1,5 @@ # Configure a replacement for <sys/file.h>. +# serial 3 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -7,8 +8,6 @@ # Written by Richard W.M. Jones. -# serial 2 - AC_DEFUN([gl_HEADER_SYS_FILE_H], [ AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS]) @@ -26,6 +25,11 @@ AC_DEFUN([gl_HEADER_SYS_FILE_H], HAVE_SYS_FILE_H=0 fi AC_SUBST([HAVE_SYS_FILE_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/file.h> + ]], [flock]) ]) AC_DEFUN([gl_HEADER_SYS_FILE_MODULE_INDICATOR], diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4 index bf54a422ca..829dc610dc 100644 --- a/m4/sys_ioctl_h.m4 +++ b/m4/sys_ioctl_h.m4 @@ -1,4 +1,4 @@ -# sys_ioctl_h.m4 serial 4 +# sys_ioctl_h.m4 serial 5 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,6 +33,15 @@ AC_DEFUN([gl_SYS_IOCTL_H], AC_SUBST([HAVE_SYS_IOCTL_H]) dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h> +/* Some platforms declare ioctl in the wrong header. */ +#ifndef __GLIBC__ +# include <unistd.h> +#endif + ]], [ioctl]) ]) dnl Unconditionally enables the replacement of <sys/ioctl.h>. diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4 index 6ce09dbd42..590554a11f 100644 --- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -1,4 +1,4 @@ -# sys_select_h.m4 serial 10 +# sys_select_h.m4 serial 11 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -56,6 +56,17 @@ AC_DEFUN([gl_HEADER_SYS_SELECT], if test $gl_cv_header_sys_select_h_selfcontained != yes; then gl_PREREQ_SYS_H_WINSOCK2 fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require prerequisite headers. */ +#include <sys/types.h> +#if !defined __GLIBC__ && HAVE_SYS_TIME_H +# include <sys/time.h> +#endif +#include <sys/select.h> + ]], [select]) ]) AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR], diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index 34312f5408..1d47656027 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 13 +# sys_socket_h.m4 serial 14 dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -66,6 +66,18 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], gl_PREREQ_SYS_H_WINSOCK2 fi AC_SUBST([SYS_SOCKET_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require prerequisite headers. */ +#include <sys/types.h> +#if !defined __GLIBC__ && HAVE_SYS_TIME_H +# include <sys/time.h> +#endif +#include <sys/select.h> + ]], [socket connect accept bind getpeername getsockname getsockopt + listen recv send recvfrom sendto setsockopt shutdown accept4]) ]) AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 4cec9cdfcc..5a113d02ea 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 21 -*- Autoconf -*- +# sys_stat_h.m4 serial 22 -*- Autoconf -*- dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,6 +27,11 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], [#include <sys/types.h> #include <sys/stat.h>]) + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> + ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat + mknod mknodat stat utimensat]) ]) # gl_HEADER_SYS_STAT_H AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4 index 51b38e326e..c954ed8a1b 100644 --- a/m4/sys_times_h.m4 +++ b/m4/sys_times_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for <sys/times.h>. -# serial 3 +# serial 4 # Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -24,6 +24,16 @@ AC_DEFUN([gl_SYS_TIMES_H], HAVE_STRUCT_TMS=0 fi AC_SUBST([HAVE_SYS_TIMES_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems have incomplete headers. */ +#ifndef __GLIBC__ +# include <time.h> +#endif +#include <sys/times.h> + ]], [times]) ]) AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR], diff --git a/m4/sys_utsname_h.m4 b/m4/sys_utsname_h.m4 index 783353685a..bdb54475b9 100644 --- a/m4/sys_utsname_h.m4 +++ b/m4/sys_utsname_h.m4 @@ -1,4 +1,4 @@ -# sys_utsname_h.m4 serial 3 +# sys_utsname_h.m4 serial 4 dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -24,6 +24,11 @@ AC_DEFUN([gl_SYS_UTSNAME_H], ]]) fi AC_SUBST([HAVE_SYS_UTSNAME_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/utsname.h> + ]], [uname]) ]) AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR], diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index aacec2b15b..31d31c1e93 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 38 +# unistd_h.m4 serial 39 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,11 +26,20 @@ AC_DEFUN([gl_UNISTD_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <unistd.h> -/* Some systems declare environ in the wrong header. */ +/* Some systems declare various items in the wrong headers. */ #ifndef __GLIBC__ +# include <fcntl.h> +# include <stdio.h> # include <stdlib.h> +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include <io.h> +# endif #endif - ]], [environ]) + ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat + fsync ftruncate getcwd getdomainname getdtablesize getgroups + gethostname getlogin getlogin_r getpagesize getusershell setusershell + endusershell lchown link linkat lseek pipe2 pread readlink readlinkat + rmdir sleep symlink symlinkat unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], diff --git a/m4/wchar.m4 b/m4/wchar.m4 index b2055f9258..e81485d01e 100644 --- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar.m4 serial 30 +# wchar.m4 serial 31 AC_DEFUN([gl_WCHAR_H], [ @@ -33,6 +33,19 @@ AC_DEFUN([gl_WCHAR_H], HAVE_WINT_T=0 fi AC_SUBST([HAVE_WINT_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require additional headers. */ +#ifndef __GLIBC__ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +#endif +#include <wchar.h> + ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb + wcsrtombs wcsnrtombs wcwidth]) ]) dnl Check whether <wchar.h> is usable at all. |