diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-07 21:11:46 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-12 21:26:35 -0400 |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/m4 | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/m4')
129 files changed, 3212 insertions, 1156 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index d4d04d15..301469b3 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index 4b978e13..f3ee3438 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 @@ -1,5 +1,6 @@ # alloca.m4 serial 9 -dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index a6e63df0..15a30e2b 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 @@ -1,5 +1,5 @@ -# arpa_inet_h.m4 serial 5 -dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# arpa_inet_h.m4 serial 8 +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, dnl with or without modifications, as long as this notice is preserved. @@ -16,27 +16,35 @@ AC_DEFUN([gl_HEADER_ARPA_INET], if test $ac_cv_header_arpa_inet_h = yes; then HAVE_ARPA_INET_H=1 else - ARPA_INET_H='arpa/inet.h' HAVE_ARPA_INET_H=0 fi AC_SUBST([HAVE_ARPA_INET_H]) - dnl Execute this unconditionally, because ARPA_INET_H may be set by other - dnl modules, after this code is executed. + 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>. AC_DEFUN([gl_REPLACE_ARPA_INET_H], [ - AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) - ARPA_INET_H='arpa/inet.h' + dnl This is a no-op, because <arpa/inet.h> is always overridden. + : ]) AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], @@ -46,5 +54,4 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) - ARPA_INET_H=''; AC_SUBST([ARPA_INET_H]) ]) diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index 24801efa..d1e13522 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 @@ -1,5 +1,5 @@ # base64.m4 serial 3 -dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2004, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index b46f74fb..c4ee4e41 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 @@ -1,5 +1,5 @@ -# btowc.m4 serial 4 -dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. +# btowc.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, dnl with or without modifications, as long as this notice is preserved. @@ -8,15 +8,49 @@ AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + dnl Check whether <wchar.h> is usable at all, first. Otherwise the test + dnl program below may lead to an endless loop. See + dnl <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. + AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) + AC_CHECK_FUNCS_ONCE([btowc]) if test $ac_cv_func_btowc = no; then HAVE_BTOWC=0 else - dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0. + AC_CACHE_CHECK([whether btowc(0) is correct], + [gl_cv_func_btowc_nul], + [ + AC_TRY_RUN([ +#include <stdio.h> +#include <string.h> +#include <wchar.h> +int main () +{ + if (btowc ('\0') != 0) + return 1; + return 0; +}], + [gl_cv_func_btowc_nul=yes], + [gl_cv_func_btowc_nul=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no on Cygwin. + cygwin*) gl_cv_func_btowc_nul="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_btowc_nul="guessing yes" ;; + esac +changequote([,])dnl + ]) + ]) + + dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF. AC_CACHE_CHECK([whether btowc(EOF) is correct], [gl_cv_func_btowc_eof], [ @@ -50,6 +84,11 @@ int main () [:]) fi ]) + + case "$gl_cv_func_btowc_nul" in + *yes) ;; + *) REPLACE_BTOWC=1 ;; + esac case "$gl_cv_func_btowc_eof" in *yes) ;; *) REPLACE_BTOWC=1 ;; diff --git a/gl/m4/c-strtod.m4 b/gl/m4/c-strtod.m4 index ba954354..41cf18e9 100644 --- a/gl/m4/c-strtod.m4 +++ b/gl/m4/c-strtod.m4 @@ -1,6 +1,6 @@ # c-strtod.m4 serial 11 -# Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 2004-2006, 2009-2010 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. @@ -14,17 +14,17 @@ AC_DEFUN([gl_C99_STRTOLD], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[/* On HP-UX before 11.23, strtold returns a struct instead of - long double. Reject implementations like that, by requiring - compatibility with the C99 prototype. */ - #include <stdlib.h> - static long double (*p) (char const *, char **) = strtold; - static long double - test (char const *nptr, char **endptr) - { - long double r; - r = strtold (nptr, endptr); - return r; - }]], + long double. Reject implementations like that, by requiring + compatibility with the C99 prototype. */ + #include <stdlib.h> + static long double (*p) (char const *, char **) = strtold; + static long double + test (char const *nptr, char **endptr) + { + long double r; + r = strtold (nptr, endptr); + return r; + }]], [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])], [gl_cv_func_c99_strtold=yes], [gl_cv_func_c99_strtold=no])]) diff --git a/gl/m4/cloexec.m4 b/gl/m4/cloexec.m4 index 4c4e26a1..c75595ca 100644 --- a/gl/m4/cloexec.m4 +++ b/gl/m4/cloexec.m4 @@ -1,5 +1,5 @@ #serial 6 -dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index 413217bd..a53c0426 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 @@ -1,5 +1,5 @@ # codeset.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2000-2002, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/dirname.m4 b/gl/m4/dirname.m4 index e35da965..576b5bea 100644 --- a/gl/m4/dirname.m4 +++ b/gl/m4/dirname.m4 @@ -1,18 +1,26 @@ -#serial 7 -*- autoconf -*- -dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. +#serial 8 -*- autoconf -*- +dnl Copyright (C) 2002-2006, 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, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DIRNAME], [ + AC_REQUIRE([gl_DIRNAME_LGPL]) AC_LIBOBJ([basename]) AC_LIBOBJ([dirname]) +]) + +AC_DEFUN([gl_DIRNAME_LGPL], +[ + AC_LIBOBJ([basename-lgpl]) + AC_LIBOBJ([dirname-lgpl]) AC_LIBOBJ([stripslash]) dnl Prerequisites of lib/dirname.h. AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) - dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c. + dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, + dnl lib/stripslash.c. ]) diff --git a/gl/m4/dos.m4 b/gl/m4/dos.m4 index dd59571c..5660542b 100644 --- a/gl/m4/dos.m4 +++ b/gl/m4/dos.m4 @@ -1,9 +1,9 @@ -#serial 10 -*- autoconf -*- +#serial 11 -*- autoconf -*- # Define some macros required for proper operation of code in lib/*.c # on MSDOS/Windows systems. -# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2004-2006, 2009-2010 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. @@ -14,31 +14,31 @@ AC_DEFUN([gl_AC_DOS], [ AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], [ - AC_TRY_COMPILE([], - [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ +#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ neither MSDOS nor Windows -#endif], - [ac_cv_win_or_dos=yes], - [ac_cv_win_or_dos=no]) +#endif]])], + [ac_cv_win_or_dos=yes], + [ac_cv_win_or_dos=no]) ]) if test x"$ac_cv_win_or_dos" = xyes; then ac_fs_accepts_drive_letter_prefix=1 ac_fs_backslash_is_file_name_separator=1 AC_CACHE_CHECK([whether drive letter can start relative path], - [ac_cv_drive_letter_can_be_relative], - [ - AC_TRY_COMPILE([], - [#if defined __CYGWIN__ + [ac_cv_drive_letter_can_be_relative], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ +#if defined __CYGWIN__ drive letters are always absolute -#endif], - [ac_cv_drive_letter_can_be_relative=yes], - [ac_cv_drive_letter_can_be_relative=no]) - ]) +#endif]])], + [ac_cv_drive_letter_can_be_relative=yes], + [ac_cv_drive_letter_can_be_relative=no]) + ]) if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then - ac_fs_drive_letter_can_be_relative=1 + ac_fs_drive_letter_can_be_relative=1 else - ac_fs_drive_letter_can_be_relative=0 + ac_fs_drive_letter_can_be_relative=0 fi else ac_fs_accepts_drive_letter_prefix=0 diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index 8c6841bc..66a79c0f 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 @@ -1,5 +1,5 @@ # double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -9,27 +9,27 @@ AC_DEFUN([gl_DOUBLE_SLASH_ROOT], AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], [ if test x"$cross_compiling" = xyes ; then - # When cross-compiling, there is no way to tell whether // is special - # short of a list of hosts. However, the only known hosts to date - # that have a distinct // are Apollo DomainOS (too old to port to), - # Cygwin, and z/OS. If anyone knows of another system for which // has - # special semantics and is distinct from /, please report it to - # <bug-gnulib@gnu.org>. - case $host in - *-cygwin | i370-ibm-openedition) - gl_cv_double_slash_root=yes ;; - *) - # Be optimistic and assume that / and // are the same when we - # don't know. - gl_cv_double_slash_root='unknown, assuming no' ;; - esac + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # <bug-gnulib@gnu.org>. + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac else - set x `ls -di / // 2>/dev/null` - if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then - gl_cv_double_slash_root=no - else - gl_cv_double_slash_root=yes - fi + set x `ls -di / // 2>/dev/null` + if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi fi]) if test "$gl_cv_double_slash_root" = yes; then AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 new file mode 100644 index 00000000..998d66f8 --- /dev/null +++ b/gl/m4/dup2.m4 @@ -0,0 +1,58 @@ +#serial 10 +dnl Copyright (C) 2002, 2005, 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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_DUP2], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([dup2]) + if test $ac_cv_func_dup2 = no; then + HAVE_DUP2=0 + AC_LIBOBJ([dup2]) + else + AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], + [AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[#include <unistd.h> +#include <errno.h>]], + [if (dup2 (1, 1) == 0) + return 1; + close (0); + if (dup2 (0, 0) != -1) + return 2; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (1, 1000000) == -1 && errno != EBADF) + return 3; + return 0; + ]) + ], + [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], + [case "$host_os" in + mingw*) # on this platform, dup2 always returns 0 for success + gl_cv_func_dup2_works=no;; + cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 + gl_cv_func_dup2_works=no;; + linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a + # closed fd may yield -EBADF instead of -1 / errno=EBADF. + gl_cv_func_dup2_works=no;; + freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF. + gl_cv_func_dup2_works=no;; + *) gl_cv_func_dup2_works=yes;; + esac]) + ]) + if test "$gl_cv_func_dup2_works" = no; then + gl_REPLACE_DUP2 + fi + fi +]) + +AC_DEFUN([gl_REPLACE_DUP2], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + if test $ac_cv_func_dup2 = yes; then + REPLACE_DUP2=1 + fi + AC_LIBOBJ([dup2]) +]) diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 16188d9b..d02a0393 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,5 +1,5 @@ -# errno_h.m4 serial 5 -dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc. +# errno_h.m4 serial 6 +dnl Copyright (C) 2004, 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, dnl with or without modifications, as long as this notice is preserved. @@ -34,6 +34,9 @@ booboo #if !defined ENOTSUP booboo #endif +#if !defined ESTALE +booboo +#endif #if !defined ECANCELED booboo #endif diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 7c7746e2..9f1307a4 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 @@ -1,7 +1,6 @@ -#serial 11 +#serial 12 -# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software -# Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -18,5 +17,6 @@ AC_DEFUN([gl_ERROR], AC_DEFUN([gl_PREREQ_ERROR], [ AC_REQUIRE([AC_FUNC_STRERROR_R]) + AC_REQUIRE([AC_C_INLINE]) : ]) diff --git a/gl/m4/exitfail.m4 b/gl/m4/exitfail.m4 deleted file mode 100644 index b7a691e5..00000000 --- a/gl/m4/exitfail.m4 +++ /dev/null @@ -1,13 +0,0 @@ -# exitfail.m4 serial 6 -dnl Copyright (C) 2002, 2003, 2005, 2006 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 with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_EXITFAIL], -[ - AC_LIBOBJ([exitfail]) - - dnl No prerequisites of lib/exitfail.c. - : -]) diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index ba6d5e19..7d9458a8 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 @@ -1,7 +1,7 @@ -# serial 8 -*- Autoconf -*- +# serial 9 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2010 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. @@ -12,6 +12,20 @@ # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. +# If autoconf reports a warning +# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# the fix is +# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked +# but always AC_REQUIREd, +# 2) to ensure that for each occurrence of +# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) +# or +# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +# the corresponding gnulib module description has 'extensions' among +# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS +# invocation occurs in gl_EARLY, not in gl_INIT. + # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, @@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ -# define __EXTENSIONS__ 1 - ]AC_INCLUDES_DEFAULT])], +# define __EXTENSIONS__ 1 + ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 new file mode 100644 index 00000000..d416a61c --- /dev/null +++ b/gl/m4/fcntl-o.m4 @@ -0,0 +1,81 @@ +# fcntl-o.m4 serial 1 +dnl Copyright (C) 2006, 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, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. +# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. +# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. +AC_DEFUN([gl_FCNTL_O_FLAGS], +[ + dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> + #include <fcntl.h> + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + ]], + [[ + int status = !constants; + { + static char const sym[] = "conftest.sym"; + if (symlink (".", sym) != 0 + || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) + status |= 32; + unlink (sym); + } + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + char c; + struct stat st0, st1; + if (fd < 0 + || fstat (fd, &st0) != 0 + || sleep (1) != 0 + || read (fd, &c, 1) != 1 + || close (fd) != 0 + || stat (file, &st1) != 0 + || st0.st_atime != st1.st_atime) + status |= 64; + } + return status;]])], + [gl_cv_header_working_fcntl_h=yes], + [case $? in #( + 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac], + [gl_cv_header_working_fcntl_h=cross-compiling])]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], + [Define to 1 if O_NOATIME works.]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], + [Define to 1 if O_NOFOLLOW works.]) +]) diff --git a/gl/m4/fcntl-safer.m4 b/gl/m4/fcntl-safer.m4 index 3475b0a7..1a739b09 100644 --- a/gl/m4/fcntl-safer.m4 +++ b/gl/m4/fcntl-safer.m4 @@ -1,5 +1,5 @@ -#serial 5 -dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. +#serial 7 +dnl Copyright (C) 2005-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, dnl with or without modifications, as long as this notice is preserved. @@ -8,4 +8,12 @@ AC_DEFUN([gl_FCNTL_SAFER], [ AC_LIBOBJ([open-safer]) AC_LIBOBJ([creat-safer]) + # Prerequisites of lib/open-safer.c. + AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) +]) + +AC_DEFUN([gl_OPENAT_SAFER], +[ + AC_REQUIRE([gl_FCNTL_SAFER]) + AC_LIBOBJ([openat-safer]) ]) diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 new file mode 100644 index 00000000..fcb5f447 --- /dev/null +++ b/gl/m4/fcntl.m4 @@ -0,0 +1,83 @@ +# fcntl.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, +dnl with or without modifications, as long as this notice is preserved. + +# For now, this module ensures that fcntl() +# - supports F_DUPFD correctly +# - supports or emulates F_DUPFD_CLOEXEC +# - supports F_GETFD +# Still to be ported to mingw: +# - F_SETFD +# - F_GETFL, F_SETFL +# - F_GETOWN, F_SETOWN +# - F_GETLK, F_SETLK, F_SETLKW +AC_DEFUN([gl_FUNC_FCNTL], +[ + dnl Persuade glibc to expose F_DUPFD_CLOEXEC. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + gl_REPLACE_FCNTL + else + dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target + AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], + [gl_cv_func_fcntl_f_dupfd_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <fcntl.h> +]], [[return fcntl (0, F_DUPFD, -1) != -1; + ]])], + [gl_cv_func_fcntl_f_dupfd_works=yes], + [gl_cv_func_fcntl_f_dupfd_works=no], + [# Guess that it works on glibc systems + case $host_os in #(( + *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";; + *) gl_cv_func_fcntl_f_dupfd_works="guessing no";; + esac])]) + case $gl_cv_func_fcntl_f_dupfd_works in + *yes) ;; + *) gl_REPLACE_FCNTL + AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD + behavior does not match POSIX]) ;; + esac + + dnl Many systems lack F_DUPFD_CLOEXEC + AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], + [gl_cv_func_fcntl_f_dupfd_cloexec], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <fcntl.h> +#ifndef F_DUPFD_CLOEXEC +choke me +#endif + ]])], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef __linux__ +/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace + it to support the semantics on older kernels that failed with EINVAL. */ +choke me +#endif + ]])], + [gl_cv_func_fcntl_f_dupfd_cloexec=yes], + [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"])], + [gl_cv_func_fcntl_f_dupfd_cloexec=no])]) + if test "$gl_cv_func_fcntl_f_dupfd_cloexec" != yes; then + gl_REPLACE_FCNTL + dnl No witness macro needed for this bug. + fi + fi +]) + +AC_DEFUN([gl_REPLACE_FCNTL], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi + AC_LIBOBJ([fcntl]) +]) diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 1ae0b15a..e41915c3 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 @@ -1,5 +1,6 @@ +# serial 12 # Configure fcntl.h. -dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -9,88 +10,34 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_FCNTL_H], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <sys/stat.h> - #include <unistd.h> - #include <fcntl.h> - #ifndef O_NOATIME - #define O_NOATIME 0 - #endif - #ifndef O_NOFOLLOW - #define O_NOFOLLOW 0 - #endif - static int const constants[] = - { - O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, - O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY - }; - ]], - [[ - int status = !constants; - { - static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0 - || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) - status |= 32; - } - { - static char const file[] = "confdefs.h"; - int fd = open (file, O_RDONLY | O_NOATIME); - char c; - struct stat st0, st1; - if (fd < 0 - || fstat (fd, &st0) != 0 - || sleep (1) != 0 - || read (fd, &c, 1) != 1 - || close (fd) != 0 - || stat (file, &st1) != 0 - || st0.st_atime != st1.st_atime) - status |= 64; - } - return status;]])], - [gl_cv_header_working_fcntl_h=yes], - [case $? in #( - 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac], - [gl_cv_header_working_fcntl_h=cross-compiling])]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], - [Define to 1 if O_NOATIME works.]) - - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], - [Define to 1 if O_NOFOLLOW works.]) - + AC_REQUIRE([gl_FCNTL_O_FLAGS]) gl_CHECK_NEXT_HEADERS([fcntl.h]) - FCNTL_H='fcntl.h' - AC_SUBST([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], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) + GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) + GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) + GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) dnl Assume proper GNU behavior unless another module says otherwise. - REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) + HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) + HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) + REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) + REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) ]) diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index d36e3a46..a74a0d95 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 @@ -1,5 +1,5 @@ # float_h.m4 serial 3 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index 915e5664..fb17a5ea 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 @@ -1,5 +1,5 @@ -# floorf.m4 serial 4 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +# floorf.m4 serial 6 +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, dnl with or without modifications, as long as this notice is preserved. @@ -20,13 +20,12 @@ AC_DEFUN([gl_FUNC_FLOORF], REPLACE_FLOORF=1 fi else - REPLACE_FLOORF=1 + HAVE_DECL_FLOORF=0 fi - if test $REPLACE_FLOORF = 1; then + if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then AC_LIBOBJ([floorf]) FLOORF_LIBM= fi - AC_SUBST([REPLACE_FLOORF]) AC_SUBST([FLOORF_LIBM]) ]) diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index aa676f3a..9e81efe3 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 @@ -6,7 +6,8 @@ dnl See if struct statfs has the f_fstypename member. dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. dnl -# Copyright (C) 1998, 1999, 2001, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2010 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. diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 8b8cbf72..216b9dd8 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 @@ -1,7 +1,7 @@ -# serial 24 +# serial 25 # Obtaining file system usage information. -# Copyright (C) 1997-1998, 2000-2001, 2003-2009 Free Software Foundation, Inc. +# Copyright (C) 1997-1998, 2000-2001, 2003-2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -46,7 +46,7 @@ ac_fsusage_space=no if test $ac_fsusage_space = no; then # SVR4 AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], - [AC_TRY_LINK([#include <sys/types.h> + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #if defined __GLIBC__ && defined __linux__ Do not use statvfs on systems with GNU libc on Linux, because that function stats all preceding entries in /proc/mounts, and that makes df hang if even @@ -59,14 +59,14 @@ a system call. "Do not use Tru64's statvfs implementation" #endif -#include <sys/statvfs.h>], - [struct statvfs fsd; statvfs (0, &fsd);], - fu_cv_sys_stat_statvfs=yes, - fu_cv_sys_stat_statvfs=no)]) +#include <sys/statvfs.h>]], + [[struct statvfs fsd; statvfs (0, &fsd);]])], + [fu_cv_sys_stat_statvfs=yes], + [fu_cv_sys_stat_statvfs=no])]) if test $fu_cv_sys_stat_statvfs = yes; then ac_fsusage_space=yes AC_DEFINE([STAT_STATVFS], [1], - [ Define if there is a function named statvfs. (SVR4)]) + [ Define if there is a function named statvfs. (SVR4)]) fi fi @@ -74,7 +74,7 @@ if test $ac_fsusage_space = no; then # DEC Alpha running OSF/1 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1], - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <sys/param.h> #include <sys/types.h> #include <sys/mount.h> @@ -84,15 +84,15 @@ if test $ac_fsusage_space = no; then struct statfs fsd; fsd.f_fsize = 0; return statfs (".", &fsd, sizeof (struct statfs)) != 0; - }], - fu_cv_sys_stat_statfs3_osf1=yes, - fu_cv_sys_stat_statfs3_osf1=no, - fu_cv_sys_stat_statfs3_osf1=no)]) + }]])], + [fu_cv_sys_stat_statfs3_osf1=yes], + [fu_cv_sys_stat_statfs3_osf1=no], + [fu_cv_sys_stat_statfs3_osf1=no])]) AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1]) if test $fu_cv_sys_stat_statfs3_osf1 = yes; then ac_fsusage_space=yes AC_DEFINE([STAT_STATFS3_OSF1], [1], - [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) + [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) fi fi @@ -101,7 +101,7 @@ if test $ac_fsusage_space = no; then AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl member (AIX, 4.3BSD)]) AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize], - [AC_TRY_RUN([ + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif @@ -117,10 +117,10 @@ member (AIX, 4.3BSD)]) struct statfs fsd; fsd.f_bsize = 0; return statfs (".", &fsd) != 0; - }], - fu_cv_sys_stat_statfs2_bsize=yes, - fu_cv_sys_stat_statfs2_bsize=no, - fu_cv_sys_stat_statfs2_bsize=no)]) + }]])], + [fu_cv_sys_stat_statfs2_bsize=yes], + [fu_cv_sys_stat_statfs2_bsize=no], + [fu_cv_sys_stat_statfs2_bsize=no])]) AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize]) if test $fu_cv_sys_stat_statfs2_bsize = yes; then ac_fsusage_space=yes @@ -134,22 +134,23 @@ if test $ac_fsusage_space = no; then # SVR3 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) AC_CACHE_VAL([fu_cv_sys_stat_statfs4], - [AC_TRY_RUN([#include <sys/types.h> + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> #include <sys/statfs.h> int main () { struct statfs fsd; return statfs (".", &fsd, sizeof fsd, 0) != 0; - }], - fu_cv_sys_stat_statfs4=yes, - fu_cv_sys_stat_statfs4=no, - fu_cv_sys_stat_statfs4=no)]) + }]])], + [fu_cv_sys_stat_statfs4=yes], + [fu_cv_sys_stat_statfs4=no], + [fu_cv_sys_stat_statfs4=no])]) AC_MSG_RESULT([$fu_cv_sys_stat_statfs4]) if test $fu_cv_sys_stat_statfs4 = yes; then ac_fsusage_space=yes AC_DEFINE([STAT_STATFS4], [1], - [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)]) + [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)]) fi fi @@ -158,7 +159,8 @@ if test $ac_fsusage_space = no; then AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl member (4.4BSD and NetBSD)]) AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize], - [AC_TRY_RUN([#include <sys/types.h> + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif @@ -171,10 +173,10 @@ member (4.4BSD and NetBSD)]) struct statfs fsd; fsd.f_fsize = 0; return statfs (".", &fsd) != 0; - }], - fu_cv_sys_stat_statfs2_fsize=yes, - fu_cv_sys_stat_statfs2_fsize=no, - fu_cv_sys_stat_statfs2_fsize=no)]) + }]])], + [fu_cv_sys_stat_statfs2_fsize=yes], + [fu_cv_sys_stat_statfs2_fsize=no], + [fu_cv_sys_stat_statfs2_fsize=no])]) AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize]) if test $fu_cv_sys_stat_statfs2_fsize = yes; then ac_fsusage_space=yes @@ -188,7 +190,8 @@ if test $ac_fsusage_space = no; then # Ultrix AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) AC_CACHE_VAL([fu_cv_sys_stat_fs_data], - [AC_TRY_RUN([#include <sys/types.h> + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif @@ -205,10 +208,10 @@ if test $ac_fsusage_space = no; then /* Ultrix's statfs returns 1 for success, 0 for not mounted, -1 for failure. */ return statfs (".", &fsd) != 1; - }], - fu_cv_sys_stat_fs_data=yes, - fu_cv_sys_stat_fs_data=no, - fu_cv_sys_stat_fs_data=no)]) + }]])], + [fu_cv_sys_stat_fs_data=yes], + [fu_cv_sys_stat_fs_data=no], + [fu_cv_sys_stat_fs_data=no])]) AC_MSG_RESULT([$fu_cv_sys_stat_fs_data]) if test $fu_cv_sys_stat_fs_data = yes; then ac_fsusage_space=yes @@ -220,12 +223,12 @@ fi if test $ac_fsusage_space = no; then # SVR2 - AC_TRY_CPP([#include <sys/filsys.h> - ], - AC_DEFINE([STAT_READ_FILSYS], [1], + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h> + ]])], + [AC_DEFINE([STAT_READ_FILSYS], [1], [Define if there is no specific function for reading file systems usage information and you have the <sys/filsys.h> header file. (SVR2)]) - ac_fsusage_space=yes) + ac_fsusage_space=yes]) fi AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) @@ -246,8 +249,8 @@ choke -- this is a workaround for a Sun-specific problem #endif #include <sys/types.h> #include <sys/vfs.h>]], - [[struct statfs t; long c = *(t.f_spare); - if (c) return 0;]])], + [[struct statfs t; long c = *(t.f_spare); + if (c) return 0;]])], [fu_cv_sys_truncating_statfs=yes], [fu_cv_sys_truncating_statfs=no])]) if test $fu_cv_sys_truncating_statfs = yes; then diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 40886719..bc3066db 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,5 +1,5 @@ -# getaddrinfo.m4 serial 20 -dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. +# getaddrinfo.m4 serial 23 +dnl Copyright (C) 2004-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, dnl with or without modifications, as long as this notice is preserved. @@ -25,7 +25,7 @@ AC_DEFUN([gl_GETADDRINFO], LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -34,21 +34,21 @@ AC_DEFUN([gl_GETADDRINFO], #include <netdb.h> #endif #include <stddef.h> -], [getaddrinfo("", "", NULL, NULL);], +]], [[getaddrinfo("", "", NULL, NULL);]])], [gl_cv_func_getaddrinfo=yes], [gl_cv_func_getaddrinfo=no])]) if test $gl_cv_func_getaddrinfo = no; then AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], - gl_cv_w32_getaddrinfo, [ + gl_cv_w32_getaddrinfo, [ gl_cv_w32_getaddrinfo=no am_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif #include <stddef.h> -], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) +]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) LIBS="$am_save_LIBS" ]) if test "$gl_cv_w32_getaddrinfo" = "yes"; then @@ -64,7 +64,7 @@ AC_DEFUN([gl_GETADDRINFO], # header included somehow. AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], gl_cv_func_gai_strerror, [ - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> @@ -76,7 +76,7 @@ AC_DEFUN([gl_GETADDRINFO], #include <ws2tcpip.h> #endif #include <stddef.h> -], [gai_strerror (NULL);], +]], [[gai_strerror (NULL);]])], [gl_cv_func_gai_strerror=yes], [gl_cv_func_gai_strerror=no])]) if test $gl_cv_func_gai_strerror = no; then @@ -96,6 +96,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB + AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([gl_HEADER_SYS_SOCKET]) @@ -163,4 +164,10 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ *" $SERVENT_LIB "*) ;; *) GETADDRINFO_LIB="$GETADDRINFO_LIB $SERVENT_LIB" ;; esac + + dnl Append $INET_NTOP_LIB to GETADDRINFO_LIB, avoiding gratuitous duplicates. + case " $GETADDRINFO_LIB " in + *" $INET_NTOP_LIB "*) ;; + *) GETADDRINFO_LIB="$GETADDRINFO_LIB $INET_NTOP_LIB" ;; + esac ]) diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 new file mode 100644 index 00000000..d2386284 --- /dev/null +++ b/gl/m4/getdtablesize.m4 @@ -0,0 +1,15 @@ +# getdtablesize.m4 serial 1 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETDTABLESIZE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([getdtablesize]) + if test $ac_cv_func_getdtablesize != yes; then + HAVE_GETDTABLESIZE=0 + AC_LIBOBJ([getdtablesize]) + fi +]) diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 6b6fca95..ef0b43ef 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 @@ -1,21 +1,101 @@ -# gethostname.m4 serial 5 -dnl Copyright (C) 2002, 2008, 2009 Free Software Foundation, Inc. +# gethostname.m4 serial 9 +dnl Copyright (C) 2002, 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, dnl with or without modifications, as long as this notice is preserved. +# Ensure +# - the gethostname() function, +# - the HOST_NAME_MAX macro in <limits.h>. AC_DEFUN([gl_FUNC_GETHOSTNAME], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_PREREQ_SYS_H_WINSOCK2 - AC_REPLACE_FUNCS([gethostname]) - if test $ac_cv_func_gethostname = no; then + + dnl Where is gethostname() defined? + dnl - On native Windows, it is in ws2_32.dll. + dnl - Otherwise is is in libc. + GETHOSTNAME_LIB= + AC_CHECK_FUNCS([gethostname], , [ + AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], + [gl_cv_w32_gethostname], + [gl_cv_w32_gethostname=no + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lws2_32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif +#include <stddef.h> +]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) + LIBS="$gl_save_LIBS" + ]) + if test "$gl_cv_w32_gethostname" = "yes"; then + GETHOSTNAME_LIB="-lws2_32" + fi + ]) + AC_SUBST([GETHOSTNAME_LIB]) + + if test "$ac_cv_func_gethostname" = no; then + AC_LIBOBJ([gethostname]) HAVE_GETHOSTNAME=0 gl_PREREQ_GETHOSTNAME fi + + dnl Also provide HOST_NAME_MAX when <limits.h> lacks it. + dnl - On most Unix systems, use MAXHOSTNAMELEN from <sys/param.h> instead. + dnl - On Solaris, Cygwin, BeOS, use MAXHOSTNAMELEN from <netdb.h> instead. + dnl - On mingw, use 256, because + dnl <http://msdn.microsoft.com/en-us/library/ms738527.aspx> says: + dnl "if a buffer of 256 bytes is passed in the name parameter and + dnl the namelen parameter is set to 256, the buffer size will always + dnl be adequate." + dnl With this, there is no need to use sysconf (_SC_HOST_NAME_MAX), which + dnl is not a compile-time constant. + dnl We cannot override <limits.h> using the usual technique, because + dnl gl_CHECK_NEXT_HEADERS does not work for <limits.h>. Therefore retrieve + dnl the value of HOST_NAME_MAX at configure time. + AC_CHECK_HEADERS_ONCE([sys/param.h]) + AC_CHECK_HEADERS_ONCE([sys/socket.h]) + AC_CHECK_HEADERS_ONCE([netdb.h]) + AC_CACHE_CHECK([for HOST_NAME_MAX], [gl_cv_decl_HOST_NAME_MAX], [ + gl_cv_decl_HOST_NAME_MAX= + AC_EGREP_CPP([lucky], [ +#include <limits.h> +#ifdef HOST_NAME_MAX +lucky +#endif + ], [gl_cv_decl_HOST_NAME_MAX=yes]) + if test -z "$gl_cv_decl_HOST_NAME_MAX"; then + dnl It's not defined in <limits.h>. Substitute it. + if test "$gl_cv_w32_gethostname" = yes; then + dnl mingw. + gl_cv_decl_HOST_NAME_MAX=256 + else + _AC_COMPUTE_INT([MAXHOSTNAMELEN], [gl_cv_decl_HOST_NAME_MAX], [ +#include <sys/types.h> +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#if HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#if HAVE_NETDB_H +# include <netdb.h> +#endif +]) + fi + fi + ]) + if test "$gl_cv_decl_HOST_NAME_MAX" != yes; then + AC_DEFINE_UNQUOTED([HOST_NAME_MAX], [$gl_cv_decl_HOST_NAME_MAX], + [Define HOST_NAME_MAX when <limits.h> does not define it.]) + fi ]) # Prerequisites of lib/gethostname.c. AC_DEFUN([gl_PREREQ_GETHOSTNAME], [ - AC_CHECK_FUNCS([uname]) + if test "$gl_cv_w32_gethostname" != "yes"; then + AC_CHECK_FUNCS([uname]) + fi ]) diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 015bcac2..0a731c4f 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 @@ -1,7 +1,7 @@ # Check for getloadavg. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2003, -# 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2010 Free Software +# Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -60,17 +60,17 @@ if test $gl_have_func = no; then gl_getloadavg_LIBS=$LIBS LIBS="-L/usr/local/lib $LIBS" AC_CHECK_LIB([getloadavg], [getloadavg], - [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS]) + [LIBS="-lgetloadavg $LIBS"], [LIBS=$gl_getloadavg_LIBS]) fi # Make sure it is really in the library, if we think we found it, # otherwise set up the replacement function. AC_CHECK_FUNCS([getloadavg], [], - [gl_PREREQ_GETLOADAVG]) + [gl_PREREQ_GETLOADAVG]) # Some definitions of getloadavg require that the program be installed setgid. AC_CACHE_CHECK([whether getloadavg requires setgid], - gl_cv_func_getloadavg_setgid, + gl_cv_func_getloadavg_setgid, [AC_EGREP_CPP([Yowza Am I SETGID yet], [#define CONFIGURING_GETLOADAVG #include "$srcdir/$1/getloadavg.c" @@ -78,13 +78,13 @@ AC_CACHE_CHECK([whether getloadavg requires setgid], Yowza Am I SETGID yet #endif ], - gl_cv_func_getloadavg_setgid=yes, - gl_cv_func_getloadavg_setgid=no)]) + gl_cv_func_getloadavg_setgid=yes, + gl_cv_func_getloadavg_setgid=no)]) if test $gl_cv_func_getloadavg_setgid = yes; then NEED_SETGID=true AC_DEFINE([GETLOADAVG_PRIVILEGED], [1], - [Define to 1 if the `getloadavg' function needs to be run setuid - or setgid.]) + [Define to 1 if the `getloadavg' function needs to be run setuid + or setgid.]) else NEED_SETGID=false fi @@ -98,8 +98,8 @@ if test $gl_cv_func_getloadavg_setgid = yes; then test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` gl_cv_group_kmem=`echo $ac_ls_output \ | sed -ne ['s/[ ][ ]*/ /g - s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/ - / /s/.* //;p']` + s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/ + / /s/.* //;p']` ]) AC_SUBST([KMEM_GROUP], [$gl_cv_group_kmem])dnl fi @@ -154,8 +154,8 @@ if test $gl_have_func = no; then [gl_have_func=yes AC_DEFINE([UMAX], [1], [Define to 1 for Encore UMAX.]) AC_DEFINE([UMAX4_3], [1], - [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> - instead of <sys/cpustats.h>.])]) + [Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> + instead of <sys/cpustats.h>.])]) fi if test $gl_have_func = no; then @@ -169,10 +169,19 @@ fi AC_CHECK_HEADERS([nlist.h], [AC_CHECK_MEMBERS([struct nlist.n_un.n_name], - [AC_DEFINE([NLIST_NAME_UNION], [1], - [Define to 1 if your `struct nlist' has an - `n_un' member. Obsolete, depend on - `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], - [@%:@include <nlist.h>]) + [AC_DEFINE([NLIST_NAME_UNION], [1], + [Define to 1 if your `struct nlist' has an + `n_un' member. Obsolete, depend on + `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], + [@%:@include <nlist.h>]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]], + [[struct nlist x; + #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME + x.n_un.n_name = ""; + #else + x.n_name = ""; + #endif]])], + [AC_DEFINE([N_NAME_POINTER], [1], + [Define to 1 if the nlist n_name member is a pointer])]) ])dnl ])# gl_PREREQ_GETLOADAVG diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 9b683c2f..a19805ea 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 @@ -1,82 +1,272 @@ -# getopt.m4 serial 14 -dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc. +# getopt.m4 serial 24 +dnl Copyright (C) 2002-2006, 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, dnl with or without modifications, as long as this notice is preserved. -# The getopt module assume you want GNU getopt, with getopt_long etc, -# rather than vanilla POSIX getopt. This means your code should -# always include <getopt.h> for the getopt prototypes. +# Request a POSIX compliant getopt function. +AC_DEFUN([gl_FUNC_GETOPT_POSIX], +[ + m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + gl_GETOPT_IFELSE([ + gl_REPLACE_GETOPT + ], + []) +]) + +# Request a POSIX compliant getopt function with GNU extensions (such as +# options with optional arguments) and the functions getopt_long, +# getopt_long_only. +AC_DEFUN([gl_FUNC_GETOPT_GNU], +[ + m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) + + AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) +]) -AC_DEFUN([gl_GETOPT_SUBSTITUTE], +# Request the gnulib implementation of the getopt functions unconditionally. +# argp.m4 uses this. +AC_DEFUN([gl_REPLACE_GETOPT], [ + dnl Arrange for getopt.h to be created. + gl_GETOPT_SUBSTITUTE_HEADER + dnl Arrange for unistd.h to include getopt.h. + GNULIB_UNISTD_H_GETOPT=1 + dnl Arrange to compile the getopt implementation. AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1]) - gl_GETOPT_SUBSTITUTE_HEADER gl_PREREQ_GETOPT ]) -AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], +# emacs' configure.in uses this. +AC_DEFUN([gl_GETOPT_IFELSE], [ - GETOPT_H=getopt.h - AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], - [Define to rpl_ if the getopt replacement functions and variables - should be used.]) - AC_SUBST([GETOPT_H]) + AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) + AS_IF([test -n "$gl_replace_getopt"], [$1], [$2]) ]) +# Determine whether to replace the entire getopt facility. AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ - if test -z "$GETOPT_H"; then - AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + gl_CHECK_NEXT_HEADERS([getopt.h]) + AC_CHECK_HEADERS_ONCE([getopt.h]) + if test $ac_cv_header_getopt_h = yes; then + HAVE_GETOPT_H=1 + else + HAVE_GETOPT_H=0 + fi + AC_SUBST([HAVE_GETOPT_H]) + + gl_replace_getopt= + + dnl Test whether <getopt.h> is available. + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes]) + fi + + dnl Test whether the function getopt_long is available. + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) fi - if test -z "$GETOPT_H"; then - AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) + dnl BSD getopt_long uses an incompatible method to reset option processing. + dnl Existence of the variable, in and of itself, is not a reason to replace + dnl getopt, but knowledge of the variable is needed to determine how to + dnl reset and whether a reset reparses the environment. + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + AC_CHECK_DECLS([optreset], [], [], + [[#include <getopt.h>]]) fi - dnl BSD getopt_long uses an incompatible method to reset option processing, - dnl and (as of 2004-10-15) mishandles optional option-arguments. - if test -z "$GETOPT_H"; then - AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) + dnl mingw's getopt (in libmingwex.a) does weird things when the options + dnl strings starts with '+' and it's not the first call. Some internal state + dnl is left over from earlier calls, and neither setting optind = 0 nor + dnl setting optreset = 1 get rid of this internal state. + dnl POSIX is silent on optind vs. optreset, so we allow either behavior. + if test -z "$gl_replace_getopt"; then + AC_CACHE_CHECK([whether getopt is POSIX compatible], + [gl_cv_func_getopt_posix], + [ + dnl This test fails on mingw and succeeds on all other platforms. + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#if !HAVE_DECL_OPTRESET +# define OPTIND_MIN 0 +#else +# define OPTIND_MIN 1 +#endif + +int +main () +{ + { + int argc = 0; + char *argv[10]; + int c; + + argv[argc++] = "program"; + argv[argc++] = "-a"; + argv[argc++] = "foo"; + argv[argc++] = "bar"; + argv[argc] = NULL; + optind = OPTIND_MIN; + opterr = 0; + + c = getopt (argc, argv, "ab"); + if (!(c == 'a')) + return 1; + c = getopt (argc, argv, "ab"); + if (!(c == -1)) + return 2; + if (!(optind == 2)) + return 3; + } + /* Some internal state exists at this point. */ + { + int argc = 0; + char *argv[10]; + int c; + + argv[argc++] = "program"; + argv[argc++] = "donald"; + argv[argc++] = "-p"; + argv[argc++] = "billy"; + argv[argc++] = "duck"; + argv[argc++] = "-a"; + argv[argc++] = "bar"; + argv[argc] = NULL; + optind = OPTIND_MIN; + opterr = 0; + + c = getopt (argc, argv, "+abp:q:"); + if (!(c == -1)) + return 4; + if (!(strcmp (argv[0], "program") == 0)) + return 5; + if (!(strcmp (argv[1], "donald") == 0)) + return 6; + if (!(strcmp (argv[2], "-p") == 0)) + return 7; + if (!(strcmp (argv[3], "billy") == 0)) + return 8; + if (!(strcmp (argv[4], "duck") == 0)) + return 9; + if (!(strcmp (argv[5], "-a") == 0)) + return 10; + if (!(strcmp (argv[6], "bar") == 0)) + return 11; + if (!(optind == 1)) + return 12; + } + + return 0; +} +]])], + [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no], + [case "$host_os" in + mingw*) gl_cv_func_getopt_posix="guessing no";; + *) gl_cv_func_getopt_posix="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_getopt_posix" in + *no) gl_replace_getopt=yes ;; + esac fi - dnl Solaris 10 getopt doesn't handle `+' as a leading character in an - dnl option string (as of 2005-05-05). - if test -z "$GETOPT_H"; then - AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM([[#include <getopt.h>]], - [[ - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; - return getopt (2, myargv, "+a") != '?'; - ]])], - [gl_cv_func_gnu_getopt=yes], - [gl_cv_func_gnu_getopt=no], - [dnl cross compiling - pessimistically guess based on decls - dnl Solaris 10 getopt doesn't handle `+' as a leading character in an - dnl option string (as of 2005-05-05). - AC_CHECK_DECL([getopt_clip], - [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], - [#include <getopt.h>])])]) - if test "$gl_cv_func_gnu_getopt" = "no"; then - GETOPT_H=getopt.h + if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then + AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu], + [# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the + # optstring is necessary for programs like m4 that have POSIX-mandated + # semantics for supporting options interspersed with files. + # Also, since getopt_long is a GNU extension, we require optind=0. + gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes} + POSIXLY_CORRECT=1 + export POSIXLY_CORRECT + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include <getopt.h> + #include <stddef.h> + #include <string.h> + ]], [[ + /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, + and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, + OSF/1 5.1, Solaris 10. */ + { + char *myargv[3]; + myargv[0] = "conftest"; + myargv[1] = "-+"; + myargv[2] = 0; + opterr = 0; + if (getopt (2, myargv, "+a") != '?') + return 1; + } + /* This code succeeds on glibc 2.8, mingw, + and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, + IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ + { + char *argv[] = { "program", "-p", "foo", "bar", NULL }; + + optind = 1; + if (getopt (4, argv, "p::") != 'p') + return 2; + if (optarg != NULL) + return 3; + if (getopt (4, argv, "p::") != -1) + return 4; + if (optind != 2) + return 5; + } + /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ + { + char *argv[] = { "program", "foo", "-p", NULL }; + optind = 0; + if (getopt (3, argv, "-p") != 1) + return 6; + if (getopt (3, argv, "-p") != 'p') + return 7; + } + return 0; + ]])], + [gl_cv_func_getopt_gnu=yes], + [gl_cv_func_getopt_gnu=no], + [dnl Cross compiling. Guess based on host and declarations. + case $host_os:$ac_cv_have_decl_optreset in + *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; + *:yes) gl_cv_func_getopt_gnu=no;; + *) gl_cv_func_getopt_gnu=yes;; + esac + ]) + if test "$gl_had_POSIXLY_CORRECT" != yes; then + AS_UNSET([POSIXLY_CORRECT]) + fi + ]) + if test "$gl_cv_func_getopt_gnu" = "no"; then + gl_replace_getopt=yes fi fi ]) -AC_DEFUN([gl_GETOPT_IFELSE], +# emacs' configure.in uses this. +AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ - AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) - AS_IF([test -n "$GETOPT_H"], [$1], [$2]) + GETOPT_H=getopt.h + AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], + [Define to rpl_ if the getopt replacement functions and variables + should be used.]) + AC_SUBST([GETOPT_H]) ]) -AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) - # Prerequisites of lib/getopt*. +# emacs' configure.in uses this. AC_DEFUN([gl_PREREQ_GETOPT], [ AC_CHECK_DECLS_ONCE([getenv]) diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4 index d90c8500..d6dc3fe2 100644 --- a/gl/m4/gettext.m4 +++ b/gl/m4/gettext.m4 @@ -1,5 +1,5 @@ # gettext.m4 serial 62 (gettext-0.18) -dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. +dnl Copyright (C) 1995-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/glibc2.m4 b/gl/m4/glibc2.m4 index fe58a0f3..f148c12c 100644 --- a/gl/m4/glibc2.m4 +++ b/gl/m4/glibc2.m4 @@ -1,5 +1,5 @@ # glibc2.m4 serial 2 -dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2004, 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, dnl with or without modifications, as long as this notice is preserved. @@ -12,16 +12,16 @@ AC_DEFUN([gt_GLIBC2], AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], [ac_cv_gnu_library_2], [AC_EGREP_CPP([Lucky GNU user], - [ + [ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ >= 2) Lucky GNU user #endif #endif - ], - [ac_cv_gnu_library_2=yes], - [ac_cv_gnu_library_2=no]) + ], + [ac_cv_gnu_library_2=yes], + [ac_cv_gnu_library_2=no]) ] ) AC_SUBST([GLIBC2]) diff --git a/gl/m4/glibc21.m4 b/gl/m4/glibc21.m4 index 93fbf474..68ada9d4 100644 --- a/gl/m4/glibc21.m4 +++ b/gl/m4/glibc21.m4 @@ -1,5 +1,5 @@ # glibc21.m4 serial 4 -dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2004, 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, dnl with or without modifications, as long as this notice is preserved. @@ -12,16 +12,16 @@ AC_DEFUN([gl_GLIBC21], AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], [ac_cv_gnu_library_2_1], [AC_EGREP_CPP([Lucky GNU user], - [ + [ #include <features.h> #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) + ], + [ac_cv_gnu_library_2_1=yes], + [ac_cv_gnu_library_2_1=no]) ] ) AC_SUBST([GLIBC21]) diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 385f5432..0ac6b969 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index c8fda203..9cc519e7 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 11 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# gnulib-common.m4 serial 18 +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, dnl with or without modifications, as long as this notice is preserved. @@ -23,23 +23,77 @@ AC_DEFUN([gl_COMMON_BODY], [ # define __GNUC_STDC_INLINE__ 1 #endif]) AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to function parameter declarations - for parameters that are not used. This helps to reduce warnings, such as - from GCC -Wunused-parameter. */ +[/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _UNUSED_PARAMETER_ __attribute__ ((__unused__)) +# define _GL_UNUSED __attribute__ ((__unused__)) #else -# define _UNUSED_PARAMETER_ +# define _GL_UNUSED #endif +/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name + is a misnomer outside of parameter lists. */ +#define _UNUSED_PARAMETER_ _GL_UNUSED ]) ]) +# gl_MODULE_INDICATOR_CONDITION +# expands to a C preprocessor expression that evaluates to 1 or 0, depending +# whether a gnulib module that has been requested shall be considered present +# or not. +AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) + +# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) +# sets the shell variable that indicates the presence of the given module to +# a C preprocessor expression that will evaluate to 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], +[ + GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION +]) + # gl_MODULE_INDICATOR([modulename]) -# defines a C macro indicating the presence of the given module. +# defines a C macro indicating the presence of the given module +# in a location where it can be used. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 0 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ AC_DEFUN([gl_MODULE_INDICATOR], [ - AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], - [Define to 1 when using the gnulib module ]$1[.]) + AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), + [gl_MODULE_INDICATOR_CONDITION], + [Define to a C preprocessor expression that evaluates to 1 or 0, + depending whether the gnulib module $1 shall be considered present.]) +]) + +# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) +# defines a C macro indicating the presence of the given module +# in lib or tests. This is useful to determine whether the module +# should be tested. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ +AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], +[ + AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], + [Define to 1 when the gnulib module $1 should be tested.]) ]) # m4_foreach_w @@ -49,10 +103,25 @@ m4_ifndef([m4_foreach_w], [m4_define([m4_foreach_w], [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) +# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) +# ---------------------------------------------------- +# Backport of autoconf-2.63b's macro. +# Remove this macro when we can assume autoconf >= 2.64. +m4_ifndef([AS_VAR_IF], +[m4_define([AS_VAR_IF], +[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) + # AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifdef([AC_PROG_MKDIR_P], [], [ +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix +# for interoperability with automake-1.9.6 from autoconf-2.62. +# Remove this macro when we can assume autoconf >= 2.62 or +# autoconf >= 2.60 && automake >= 1.10. +m4_ifdef([AC_PROG_MKDIR_P], [ + dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. + m4_define([AC_PROG_MKDIR_P], + m4_defn([AC_PROG_MKDIR_P])[ + AC_SUBST([MKDIR_P])])], [ + dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. AC_DEFUN_ONCE([AC_PROG_MKDIR_P], [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' @@ -70,13 +139,13 @@ AC_DEFUN([AC_C_RESTRICT], for ac_kw in __restrict __restrict__ _Restrict restrict; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; + int foo (int_ptr $ac_kw ip) { + return ip[0]; }]], [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], + int * $ac_kw t = s; + t[0] = 0; + return foo(t)]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 005cc4eb..4a956e44 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -25,7 +25,108 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) + # Code from module alignof: + # Code from module alloca: + # Code from module alloca-opt: + # Code from module arg-nonnull: + # Code from module arpa_inet: + # Code from module base64: + # Code from module btowc: + # Code from module c++defs: + # Code from module c-strtod: + # Code from module cloexec: + # Code from module close-hook: + # Code from module configmake: + # Code from module dirname: + # Code from module dirname-lgpl: + # Code from module double-slash-root: + # Code from module dup2: + # Code from module errno: + # Code from module error: + # Code from module exitfail: + # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module fcntl: + # Code from module fcntl-h: + # Code from module fcntl-safer: + # Code from module float: + # Code from module floorf: + # Code from module fsusage: + # Code from module full-read: + # Code from module full-write: + # Code from module getaddrinfo: + # Code from module getdtablesize: + # Code from module gethostname: + # Code from module getloadavg: + # Code from module getopt: + # Code from module getopt-gnu: + # Code from module getopt-posix: + # Code from module gettext: + # Code from module gettext-h: + # Code from module havelib: + # Code from module hostent: + # Code from module include_next: + # Code from module inet_ntop: + # Code from module inline: + # Code from module intprops: + # Code from module langinfo: + # Code from module localcharset: + # Code from module locale: + # Code from module malloc: + # Code from module malloc-posix: + # Code from module math: + # Code from module mbrtowc: + # Code from module mbsinit: + # Code from module memchr: + # Code from module mktime: + # Code from module mountlist: + # Code from module multiarch: + # Code from module netdb: + # Code from module netinet_in: + # Code from module nl_langinfo: + # Code from module open: + # Code from module regex: + # Code from module safe-read: + # Code from module safe-write: + # Code from module servent: + # Code from module size_max: + # Code from module snprintf: + # Code from module sockets: + # Code from module socklen: + # Code from module ssize_t: + # Code from module stat: + # Code from module stdbool: + # Code from module stddef: + # Code from module stdint: + # Code from module stdio: + # Code from module stdlib: + # Code from module strdup-posix: + # Code from module streq: + # Code from module strerror: + # Code from module string: + # Code from module strndup: + # Code from module strnlen: + # Code from module strstr-simple: + # Code from module sys_socket: + # Code from module sys_stat: + # Code from module time: + # Code from module time_r: + # Code from module timegm: + # Code from module unistd: + # Code from module unistd-safer: + # Code from module vasnprintf: + # Code from module vasprintf: + # Code from module verify: + # Code from module vsnprintf: + # Code from module warn-on-use: + # Code from module wchar: + # Code from module wcrtomb: + # Code from module wctype: + # Code from module write: + # Code from module xalloc: + # Code from module xalloc-die: + # Code from module xsize: + # Code from module xstrndup: ]) # This macro should be invoked from ./configure.in, in the section @@ -36,6 +137,7 @@ AC_DEFUN([gl_INIT], gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= + gl_m4_base='gl/m4' m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) @@ -43,111 +145,239 @@ AC_DEFUN([gl_INIT], m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='gl' + # Code from module alignof: + # Code from module alloca: + # Code from module alloca-opt: gl_FUNC_ALLOCA + # Code from module arg-nonnull: + # Code from module arpa_inet: gl_HEADER_ARPA_INET AC_PROG_MKDIR_P + # Code from module base64: gl_FUNC_BASE64 + # Code from module btowc: gl_FUNC_BTOWC gl_WCHAR_MODULE_INDICATOR([btowc]) + # Code from module c++defs: + # Code from module c-strtod: gl_C_STRTOD + # Code from module cloexec: gl_CLOEXEC + gl_MODULE_INDICATOR_FOR_TESTS([cloexec]) + # Code from module close-hook: + # Code from module configmake: + # Code from module dirname: gl_DIRNAME + gl_MODULE_INDICATOR([dirname]) + # Code from module dirname-lgpl: + gl_DIRNAME_LGPL + # Code from module double-slash-root: gl_DOUBLE_SLASH_ROOT + # Code from module dup2: + gl_FUNC_DUP2 + gl_UNISTD_MODULE_INDICATOR([dup2]) + # Code from module errno: gl_HEADER_ERRNO_H + # Code from module error: gl_ERROR m4_ifdef([AM_XGETTEXT_OPTION], - [AM_XGETTEXT_OPTION([--flag=error:3:c-format]) - AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) - gl_EXITFAIL + [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) + AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) + # Code from module exitfail: + # Code from module extensions: + # Code from module fcntl: + gl_FUNC_FCNTL + gl_FCNTL_MODULE_INDICATOR([fcntl]) + # Code from module fcntl-h: gl_FCNTL_H + # Code from module fcntl-safer: gl_FCNTL_SAFER gl_MODULE_INDICATOR([fcntl-safer]) + # Code from module float: gl_FLOAT_H + # Code from module floorf: gl_FUNC_FLOORF gl_MATH_MODULE_INDICATOR([floorf]) + # Code from module fsusage: gl_FSUSAGE + # Code from module full-read: + # Code from module full-write: + # Code from module getaddrinfo: gl_GETADDRINFO gl_NETDB_MODULE_INDICATOR([getaddrinfo]) + # Code from module getdtablesize: + gl_FUNC_GETDTABLESIZE + gl_UNISTD_MODULE_INDICATOR([getdtablesize]) + # Code from module gethostname: gl_FUNC_GETHOSTNAME gl_UNISTD_MODULE_INDICATOR([gethostname]) + # Code from module getloadavg: gl_GETLOADAVG([$gl_source_base]) gl_STDLIB_MODULE_INDICATOR([getloadavg]) - gl_GETOPT + # Code from module getopt: + # Code from module getopt-gnu: + gl_FUNC_GETOPT_GNU + gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) + # Code from module getopt-posix: + gl_FUNC_GETOPT_POSIX + # Code from module gettext: dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. AM_GNU_GETTEXT_VERSION([0.17]) + # Code from module gettext-h: AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) + # Code from module havelib: + # Code from module hostent: gl_HOSTENT - gl_INET_NTOP + # Code from module include_next: + # Code from module inet_ntop: + gl_FUNC_INET_NTOP gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) + # Code from module inline: gl_INLINE + # Code from module intprops: + # Code from module langinfo: + gl_LANGINFO_H + # Code from module localcharset: gl_LOCALCHARSET LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) + # Code from module locale: + gl_LOCALE_H + # Code from module malloc: AC_FUNC_MALLOC AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) + # Code from module malloc-posix: gl_FUNC_MALLOC_POSIX gl_STDLIB_MODULE_INDICATOR([malloc-posix]) + # Code from module math: gl_MATH_H + # Code from module mbrtowc: gl_FUNC_MBRTOWC gl_WCHAR_MODULE_INDICATOR([mbrtowc]) + # Code from module mbsinit: gl_FUNC_MBSINIT gl_WCHAR_MODULE_INDICATOR([mbsinit]) + # Code from module memchr: + gl_FUNC_MEMCHR + gl_STRING_MODULE_INDICATOR([memchr]) + # Code from module mktime: gl_FUNC_MKTIME + gl_TIME_MODULE_INDICATOR([mktime]) + # Code from module mountlist: gl_MOUNTLIST + # Code from module multiarch: gl_MULTIARCH + # Code from module netdb: gl_HEADER_NETDB + # Code from module netinet_in: gl_HEADER_NETINET_IN AC_PROG_MKDIR_P + # Code from module nl_langinfo: + gl_FUNC_NL_LANGINFO + gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) + # Code from module open: gl_FUNC_OPEN - gl_MODULE_INDICATOR([open]) gl_FCNTL_MODULE_INDICATOR([open]) + # Code from module regex: gl_REGEX + # Code from module safe-read: gl_SAFE_READ + # Code from module safe-write: gl_SAFE_WRITE + # Code from module servent: gl_SERVENT + # Code from module size_max: gl_SIZE_MAX + # Code from module snprintf: gl_FUNC_SNPRINTF gl_STDIO_MODULE_INDICATOR([snprintf]) + # Code from module sockets: + gl_SOCKETS + # Code from module socklen: gl_TYPE_SOCKLEN_T + # Code from module ssize_t: gt_TYPE_SSIZE_T + # Code from module stat: + gl_FUNC_STAT + gl_SYS_STAT_MODULE_INDICATOR([stat]) + # Code from module stdbool: AM_STDBOOL_H + # Code from module stddef: + gl_STDDEF_H + # Code from module stdint: gl_STDINT_H + # Code from module stdio: gl_STDIO_H + # Code from module stdlib: gl_STDLIB_H + # Code from module strdup-posix: gl_FUNC_STRDUP_POSIX gl_STRING_MODULE_INDICATOR([strdup]) + # Code from module streq: + # Code from module strerror: gl_FUNC_STRERROR gl_STRING_MODULE_INDICATOR([strerror]) + # Code from module string: gl_HEADER_STRING_H + # Code from module strndup: gl_FUNC_STRNDUP gl_STRING_MODULE_INDICATOR([strndup]) + # Code from module strnlen: gl_FUNC_STRNLEN gl_STRING_MODULE_INDICATOR([strnlen]) + # Code from module strstr-simple: + gl_FUNC_STRSTR_SIMPLE + gl_STRING_MODULE_INDICATOR([strstr]) + # Code from module sys_socket: gl_HEADER_SYS_SOCKET AC_PROG_MKDIR_P + # Code from module sys_stat: + gl_HEADER_SYS_STAT_H + AC_PROG_MKDIR_P + # Code from module time: gl_HEADER_TIME_H + # Code from module time_r: gl_TIME_R + gl_TIME_MODULE_INDICATOR([time_r]) + # Code from module timegm: gl_FUNC_TIMEGM + gl_TIME_MODULE_INDICATOR([timegm]) + # Code from module unistd: gl_UNISTD_H + # Code from module unistd-safer: gl_UNISTD_SAFER + # Code from module vasnprintf: gl_FUNC_VASNPRINTF + # Code from module vasprintf: gl_FUNC_VASPRINTF gl_STDIO_MODULE_INDICATOR([vasprintf]) m4_ifdef([AM_XGETTEXT_OPTION], - [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format]) - AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) + [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) + AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) + # Code from module verify: + # Code from module vsnprintf: gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) + # Code from module warn-on-use: + # Code from module wchar: gl_WCHAR_H + # Code from module wcrtomb: gl_FUNC_WCRTOMB gl_WCHAR_MODULE_INDICATOR([wcrtomb]) + # Code from module wctype: gl_WCTYPE_H + # Code from module write: gl_FUNC_WRITE gl_UNISTD_MODULE_INDICATOR([write]) + # Code from module xalloc: gl_XALLOC + # Code from module xalloc-die: + # Code from module xsize: gl_XSIZE + # Code from module xstrndup: gl_XSTRNDUP + # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || for gl_file in ]gl_LIBSOURCES_LIST[ ; do @@ -170,7 +400,7 @@ AC_DEFUN([gl_INIT], if test -n "$gl_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" done @@ -187,6 +417,13 @@ AC_DEFUN([gl_INIT], m4_pushdef([gltests_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='tests' +changequote(,)dnl + gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS +changequote([, ])dnl + AC_SUBST([gltests_WITNESS]) + gl_module_indicator_condition=$gltests_WITNESS + m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) + m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || for gl_file in ]gltests_LIBSOURCES_LIST[ ; do @@ -209,7 +446,7 @@ AC_DEFUN([gl_INIT], if test -n "$gltests_LIBOBJS"; then # Remove the extension. sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" done @@ -280,8 +517,10 @@ AC_DEFUN([gltests_LIBSOURCES], [ # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ + build-aux/arg-nonnull.h + build-aux/c++defs.h build-aux/config.rpath - build-aux/link-warning.h + build-aux/warn-on-use.h lib/alignof.h lib/alloca.c lib/alloca.in.h @@ -290,17 +529,22 @@ AC_DEFUN([gl_FILE_LIST], [ lib/asprintf.c lib/base64.c lib/base64.h + lib/basename-lgpl.c lib/basename.c lib/btowc.c lib/c-strtod.c lib/c-strtod.h lib/cloexec.c lib/cloexec.h + lib/close-hook.c + lib/close-hook.h lib/config.charset lib/creat-safer.c + lib/dirname-lgpl.c lib/dirname.c lib/dirname.h lib/dup-safer.c + lib/dup2.c lib/errno.in.h lib/error.c lib/error.h @@ -308,6 +552,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/exitfail.h lib/fcntl--.h lib/fcntl-safer.h + lib/fcntl.c lib/fcntl.in.h lib/fd-safer.c lib/float+.h @@ -322,6 +567,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/full-write.h lib/gai_strerror.c lib/getaddrinfo.c + lib/getdtablesize.c lib/gethostname.c lib/getloadavg.c lib/getopt.c @@ -331,17 +577,23 @@ AC_DEFUN([gl_FILE_LIST], [ lib/gettext.h lib/inet_ntop.c lib/intprops.h + lib/langinfo.in.h lib/localcharset.c lib/localcharset.h + lib/locale.in.h lib/malloc.c lib/math.in.h lib/mbrtowc.c lib/mbsinit.c + lib/memchr.c + lib/memchr.valgrind + lib/mktime-internal.h lib/mktime.c lib/mountlist.c lib/mountlist.h lib/netdb.in.h lib/netinet_in.in.h + lib/nl_langinfo.c lib/open-safer.c lib/open.c lib/pipe-safer.c @@ -363,11 +615,16 @@ AC_DEFUN([gl_FILE_LIST], [ lib/safe-write.h lib/size_max.h lib/snprintf.c + lib/sockets.c + lib/sockets.h + lib/stat.c lib/stdbool.in.h + lib/stddef.in.h lib/stdint.in.h lib/stdio-write.c lib/stdio.in.h lib/stdlib.in.h + lib/str-two-way.h lib/strdup.c lib/streq.h lib/strerror.c @@ -375,7 +632,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stripslash.c lib/strndup.c lib/strnlen.c + lib/strstr.c lib/sys_socket.in.h + lib/sys_stat.in.h lib/time.in.h lib/time_r.c lib/timegm.c @@ -387,6 +646,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/vasprintf.c lib/verify.h lib/vsnprintf.c + lib/w32sock.h lib/wchar.in.h lib/wcrtomb.c lib/wctype.in.h @@ -408,17 +668,20 @@ AC_DEFUN([gl_FILE_LIST], [ m4/dirname.m4 m4/dos.m4 m4/double-slash-root.m4 + m4/dup2.m4 m4/errno_h.m4 m4/error.m4 - m4/exitfail.m4 m4/extensions.m4 + m4/fcntl-o.m4 m4/fcntl-safer.m4 + m4/fcntl.m4 m4/fcntl_h.m4 m4/float_h.m4 m4/floorf.m4 m4/fstypename.m4 m4/fsusage.m4 m4/getaddrinfo.m4 + m4/getdtablesize.m4 m4/gethostname.m4 m4/getloadavg.m4 m4/getopt.m4 @@ -439,6 +702,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/intmax_t.m4 m4/inttypes-pri.m4 m4/inttypes_h.m4 + m4/langinfo_h.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 @@ -447,6 +711,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-zh.m4 + m4/locale_h.m4 m4/lock.m4 m4/longlong.m4 m4/ls-mntd-fs.m4 @@ -455,11 +720,15 @@ AC_DEFUN([gl_FILE_LIST], [ m4/mbrtowc.m4 m4/mbsinit.m4 m4/mbstate_t.m4 + m4/memchr.m4 m4/mktime.m4 + m4/mmap-anon.m4 + m4/mode_t.m4 m4/mountlist.m4 m4/multiarch.m4 m4/netdb_h.m4 m4/netinet_in_h.m4 + m4/nl_langinfo.m4 m4/nls.m4 m4/onceonly.m4 m4/open.m4 @@ -473,10 +742,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/servent.m4 m4/size_max.m4 m4/snprintf.m4 + m4/sockets.m4 m4/socklen.m4 m4/sockpfaf.m4 m4/ssize_t.m4 + m4/stat.m4 m4/stdbool.m4 + m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 @@ -486,7 +758,9 @@ AC_DEFUN([gl_FILE_LIST], [ m4/string_h.m4 m4/strndup.m4 m4/strnlen.m4 + m4/strstr.m4 m4/sys_socket_h.m4 + m4/sys_stat_h.m4 m4/threadlib.m4 m4/time_h.m4 m4/time_r.m4 @@ -498,10 +772,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/vasprintf.m4 m4/visibility.m4 m4/vsnprintf.m4 - m4/wchar.m4 + m4/warn-on-use.m4 + m4/wchar_h.m4 m4/wchar_t.m4 m4/wcrtomb.m4 - m4/wctype.m4 + m4/wctype_h.m4 m4/wint_t.m4 m4/write.m4 m4/xalloc.m4 diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index 4438d488..69e7733b 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 4a96af7a..11110411 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 @@ -1,5 +1,5 @@ # hostent.m4 serial 1 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4 index 3cc62682..f46ff142 100644 --- a/gl/m4/iconv.m4 +++ b/gl/m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial AM7 (gettext-0.18) -dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. +# iconv.m4 serial 9 (gettext-0.18) +dnl Copyright (C) 2000-2002, 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, dnl with or without modifications, as long as this notice is preserved. @@ -58,7 +58,7 @@ AC_DEFUN([AM_ICONV_LINK], ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" @@ -87,6 +87,25 @@ int main () return 1; } } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { @@ -172,8 +191,8 @@ size_t iconv(); ], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([${ac_t:- - }$am_cv_proto_iconv]) + AC_MSG_RESULT([ + $am_cv_proto_iconv]) AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) fi diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index d6101fe3..c7e0672f 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 12 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +# include_next.m4 serial 14 +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, dnl with or without modifications, as long as this notice is preserved. @@ -104,10 +104,16 @@ EOF # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be # '<foo.h>'; otherwise define it to be # '"///usr/include/foo.h"', or whatever other absolute file name is suitable. +# Also, if #include_next works as first preprocessing directive in a file, +# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to +# be +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. # That way, a header file with the following line: -# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# or +# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ # behaves (after sed substitution) as if it contained -# #include_next <foo.h> +# #include_next <foo.h> # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". @@ -123,49 +129,59 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS], m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], - [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) + [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( - [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], - m4_quote(m4_defn([gl_next_header])), - [AS_VAR_PUSHDEF([gl_header_exists], - [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME]))) - if test AS_VAR_GET(gl_header_exists) = yes; then - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - 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 "$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#^/[^/]#//&# - p - q - }'`'"']) - else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - fi - AS_VAR_POPDEF([gl_header_exists])]) + [absolute name of <]m4_defn([gl_HEADER_NAME])[>], + m4_defn([gl_next_header]), + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME])) + if test AS_VAR_GET(gl_header_exists) = yes; then + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + 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 "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ + s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"']) + else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + AS_VAR_POPDEF([gl_header_exists])]) fi AC_SUBST( - AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), + AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), [AS_VAR_GET([gl_next_header])]) + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'gl_HEADER_NAME'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), + [$gl_next_as_first_directive]) AS_VAR_POPDEF([gl_next_header])]) ]) diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 2bbdca10..a6d219c2 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 @@ -1,27 +1,28 @@ -# inet_ntop.m4 serial 9 -dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# inet_ntop.m4 serial 12 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_INET_NTOP], +AC_DEFUN([gl_FUNC_INET_NTOP], [ dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) gl_REPLACE_ARPA_INET_H - dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to - dnl find inet_ntop. - dnl - dnl It is the responsibility of gl_INET_NTOP's caller to arrange for - dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8, - dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo - dnl isn't built on Solaris 8. + dnl Most platforms that provide inet_ntop define it in libc. + dnl Solaris 8..10 provide inet_ntop in libnsl instead. gl_save_LIBS=$LIBS AC_SEARCH_LIBS([inet_ntop], [nsl], [], [AC_REPLACE_FUNCS([inet_ntop])]) LIBS=$gl_save_LIBS + INET_NTOP_LIB= + if test "$ac_cv_search_inet_ntop" != "no" && + test "$ac_cv_search_inet_ntop" != "none required"; then + INET_NTOP_LIB="$ac_cv_search_inet_ntop" + fi + AC_SUBST([INET_NTOP_LIB]) gl_PREREQ_INET_NTOP ]) diff --git a/gl/m4/inline.m4 b/gl/m4/inline.m4 index cee51099..4ef768de 100644 --- a/gl/m4/inline.m4 +++ b/gl/m4/inline.m4 @@ -1,5 +1,5 @@ # inline.m4 serial 4 -dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4 index 29e6e0aa..289c4df5 100644 --- a/gl/m4/intdiv0.m4 +++ b/gl/m4/intdiv0.m4 @@ -1,5 +1,5 @@ # intdiv0.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4 index 934408bb..5e17fea9 100644 --- a/gl/m4/intl.m4 +++ b/gl/m4/intl.m4 @@ -1,5 +1,5 @@ # intl.m4 serial 8 (gettext-0.17) -dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl Copyright (C) 1995-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intldir.m4 b/gl/m4/intldir.m4 index 0980e6f2..ebae76d3 100644 --- a/gl/m4/intldir.m4 +++ b/gl/m4/intldir.m4 @@ -1,5 +1,5 @@ # intldir.m4 serial 2 (gettext-0.18) -dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4 index c24837c4..dd910259 100644 --- a/gl/m4/intlmacosx.m4 +++ b/gl/m4/intlmacosx.m4 @@ -1,5 +1,5 @@ # intlmacosx.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2004-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intmax.m4 b/gl/m4/intmax.m4 index a3785e99..74aaaf5e 100644 --- a/gl/m4/intmax.m4 +++ b/gl/m4/intmax.m4 @@ -1,5 +1,5 @@ # intmax.m4 serial 5 (gettext-0.18) -dnl Copyright (C) 2002-2005, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 264cb571..975caac5 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,5 +1,6 @@ # intmax_t.m4 serial 7 -dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/inttypes-pri.m4 b/gl/m4/inttypes-pri.m4 index 98fec7bc..718a4f4e 100644 --- a/gl/m4/inttypes-pri.m4 +++ b/gl/m4/inttypes-pri.m4 @@ -1,5 +1,5 @@ # inttypes-pri.m4 serial 6 (gettext-0.18) -dnl Copyright (C) 1997-2002, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2002, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index f4ca1602..782d77ed 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 @@ -1,5 +1,5 @@ # inttypes_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 new file mode 100644 index 00000000..11a56980 --- /dev/null +++ b/gl/m4/langinfo_h.m4 @@ -0,0 +1,77 @@ +# langinfo_h.m4 serial 6 +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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_LANGINFO_H], +[ + AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) + + dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([langinfo.h]) + + dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. + HAVE_LANGINFO_CODESET=0 + HAVE_LANGINFO_ERA=0 + AC_CHECK_HEADERS_ONCE([langinfo.h]) + if test $ac_cv_header_langinfo_h = yes; then + HAVE_LANGINFO_H=1 + dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing + dnl on OpenBSD 3.8. + AC_CACHE_CHECK([whether langinfo.h defines CODESET], + [gl_cv_header_langinfo_codeset], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <langinfo.h> +int a = CODESET; +]])], + [gl_cv_header_langinfo_codeset=yes], + [gl_cv_header_langinfo_codeset=no]) + ]) + if test $gl_cv_header_langinfo_codeset = yes; then + HAVE_LANGINFO_CODESET=1 + fi + AC_CACHE_CHECK([whether langinfo.h defines ERA], + [gl_cv_header_langinfo_era], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <langinfo.h> +int a = ERA; +]])], + [gl_cv_header_langinfo_era=yes], + [gl_cv_header_langinfo_era=no]) + ]) + if test $gl_cv_header_langinfo_era = yes; then + HAVE_LANGINFO_ERA=1 + fi + else + HAVE_LANGINFO_H=0 + fi + 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], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_LANGINFO_H_DEFAULTS], +[ + GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) + REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) +]) diff --git a/gl/m4/lcmessage.m4 b/gl/m4/lcmessage.m4 index fa8e4167..1a705431 100644 --- a/gl/m4/lcmessage.m4 +++ b/gl/m4/lcmessage.m4 @@ -1,5 +1,6 @@ # lcmessage.m4 serial 6 (gettext-0.18) -dnl Copyright (C) 1995-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4 index e4863f2c..ebb30528 100644 --- a/gl/m4/lib-ld.m4 +++ b/gl/m4/lib-ld.m4 @@ -1,5 +1,5 @@ # lib-ld.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 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, dnl with or without modifications, as long as this notice is preserved. @@ -59,7 +59,7 @@ if test "$GCC" = yes; then # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD], # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; + test "$with_gnu_ld" != no && break ;; *) - test "$with_gnu_ld" != yes && break ;; + test "$with_gnu_ld" != yes && break ;; esac fi done diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index 21442033..90e1ac91 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 @@ -1,5 +1,5 @@ -# lib-link.m4 serial 19 (gettext-0.18) -dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. +# lib-link.m4 serial 20 (gettext-0.18) +dnl Copyright (C) 2001-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, dnl with or without modifications, as long as this notice is preserved. @@ -82,7 +82,7 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.]) + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else @@ -210,6 +210,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4 index 4b7ee335..1601ceae 100644 --- a/gl/m4/lib-prefix.m4 +++ b/gl/m4/lib-prefix.m4 @@ -1,5 +1,5 @@ # lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index e9601041..ee2e801b 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 @@ -1,5 +1,5 @@ -# localcharset.m4 serial 6 -dnl Copyright (C) 2002, 2004, 2006, 2009 Free Software Foundation, Inc. +# localcharset.m4 serial 7 +dnl Copyright (C) 2002, 2004, 2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -8,6 +8,7 @@ AC_DEFUN([gl_LOCALCHARSET], [ dnl Prerequisites of lib/localcharset.c. AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) AC_CHECK_DECLS_ONCE([getc_unlocked]) dnl Prerequisites of the lib/Makefile.am snippet. diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index 653a5bc2..001f5390 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 @@ -1,5 +1,5 @@ # locale-fr.m4 serial 11 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 93605764..0eedaf14 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 @@ -1,5 +1,5 @@ # locale-ja.m4 serial 7 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index 36a5f1df..777fd141 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 @@ -1,5 +1,5 @@ # locale-zh.m4 serial 6 -dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 new file mode 100644 index 00000000..18a119b8 --- /dev/null +++ b/gl/m4/locale_h.m4 @@ -0,0 +1,92 @@ +# locale_h.m4 serial 10 +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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_LOCALE_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + + dnl Persuade glibc <locale.h> to define locale_t. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. + AC_REQUIRE([gl_STDDEF_H]) + + AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001], + [gl_cv_header_locale_h_posix2001], + [AC_TRY_COMPILE([#include <locale.h> +int x = LC_MESSAGES;], [], + [gl_cv_header_locale_h_posix2001=yes], + [gl_cv_header_locale_h_posix2001=no])]) + + dnl Check for <xlocale.h>. + AC_CHECK_HEADERS_ONCE([xlocale.h]) + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + dnl Check whether use of locale_t requires inclusion of <xlocale.h>, + dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by + dnl itself, we assume that <xlocale.h> will do so. + AC_CACHE_CHECK([whether locale.h defines locale_t], + [gl_cv_header_locale_has_locale_t], + [AC_TRY_COMPILE([#include <locale.h> +locale_t x;], [], + [gl_cv_header_locale_has_locale_t=yes], + [gl_cv_header_locale_has_locale_t=no]) + ]) + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi + else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + fi + AC_SUBST([HAVE_XLOCALE_H]) + + dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([locale.h]) + + if test -n "$STDDEF_H" \ + || test $gl_cv_header_locale_h_posix2001 = no \ + || 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>. +AC_DEFUN([gl_REPLACE_LOCALE_H], +[ + dnl This is a no-op, because <locale.h> is always overridden. + : +]) + +AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_LOCALE_H_DEFAULTS], +[ + GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) +]) diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index b416e31a..9da8465e 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 @@ -1,5 +1,5 @@ # lock.m4 serial 10 (gettext-0.18) -dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 index eedc8d56..cca3c1a9 100644 --- a/gl/m4/longlong.m4 +++ b/gl/m4/longlong.m4 @@ -1,5 +1,5 @@ # longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1999-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, dnl with or without modifications, as long as this notice is preserved. @@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [AC_LINK_IFELSE( [_AC_TYPE_LONG_LONG_SNIPPET], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug isn't important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include <limits.h> - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [ac_cv_type_long_long_int=yes], - [ac_cv_type_long_long_int=no], - [ac_cv_type_long_long_int=yes])], + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include <limits.h> + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=yes])], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], [1], @@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], [ AC_LANG_PROGRAM( [[/* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ /* Test literals. */ long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; unsigned long long int ull = 18446744073709551615ULL; /* Test constant expressions. */ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; + ? 1 : -1)]; typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; + ? 1 : -1)]; int i = 63;]], [[/* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; unsigned long long int ullmax = 18446744073709551615ull; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull));]]) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) ]) diff --git a/gl/m4/ls-mntd-fs.m4 b/gl/m4/ls-mntd-fs.m4 index 32ccb984..40b93366 100644 --- a/gl/m4/ls-mntd-fs.m4 +++ b/gl/m4/ls-mntd-fs.m4 @@ -1,7 +1,7 @@ -# serial 27 +# serial 28 # How to list mounted file systems. -# Copyright (C) 1998-2004, 2006, 2009 Free Software Foundation, Inc. +# Copyright (C) 1998-2004, 2006, 2009-2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -84,7 +84,7 @@ if test -z "$ac_list_mounted_fs"; then yes #endif ], [test $ac_cv_func_listmntent = yes \ - && fu_cv_sys_mounted_cray_listmntent=yes] + && fu_cv_sys_mounted_cray_listmntent=yes] ) ] ) @@ -101,14 +101,14 @@ if test -z "$ac_list_mounted_fs"; then # AIX. AC_MSG_CHECKING([for mntctl function and struct vmount]) AC_CACHE_VAL([fu_cv_sys_mounted_vmount], - [AC_TRY_CPP([#include <fshelp.h>], - fu_cv_sys_mounted_vmount=yes, - fu_cv_sys_mounted_vmount=no)]) + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])], + [fu_cv_sys_mounted_vmount=yes], + [fu_cv_sys_mounted_vmount=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_vmount]) if test $fu_cv_sys_mounted_vmount = yes; then ac_list_mounted_fs=found AC_DEFINE([MOUNTED_VMOUNT], [1], - [Define if there is a function named mntctl that can be used to read + [Define if there is a function named mntctl that can be used to read the list of mounted file systems, and there is a system header file that declares `struct vmount.' (AIX)]) fi @@ -123,27 +123,27 @@ if test $ac_cv_func_getmntent = yes; then # 4.3BSD, SunOS, HP-UX, Dynix, Irix AC_MSG_CHECKING([for one-argument getmntent function]) AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ #include <stdio.h> #include <mntent.h> #if !defined MOUNTED -# if defined _PATH_MOUNTED /* GNU libc */ +# if defined _PATH_MOUNTED /* GNU libc */ # define MOUNTED _PATH_MOUNTED # endif -# if defined MNT_MNTTAB /* HP-UX. */ +# if defined MNT_MNTTAB /* HP-UX. */ # define MOUNTED MNT_MNTTAB # endif -# if defined MNTTABNAME /* Dynix. */ +# if defined MNTTABNAME /* Dynix. */ # define MOUNTED MNTTABNAME # endif #endif -], - [ struct mntent *mnt = 0; char *table = MOUNTED; - if (sizeof mnt && sizeof table) return 0;], - fu_cv_sys_mounted_getmntent1=yes, - fu_cv_sys_mounted_getmntent1=no)]) +]], + [[ struct mntent *mnt = 0; char *table = MOUNTED; + if (sizeof mnt && sizeof table) return 0;]])], + [fu_cv_sys_mounted_getmntent1=yes], + [fu_cv_sys_mounted_getmntent1=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1]) if test $fu_cv_sys_mounted_getmntent1 = yes; then ac_list_mounted_fs=found @@ -179,25 +179,25 @@ if test -z "$ac_list_mounted_fs"; then AC_MSG_CHECKING([for getfsstat function]) AC_CACHE_VAL([fu_cv_sys_mounted_getfsstat], - [AC_TRY_LINK([ + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME # define FS_TYPE(Ent) ((Ent).f_fstypename) #else # define FS_TYPE(Ent) mnt_names[(Ent).f_type] #endif -]$getfsstat_includes +$getfsstat_includes]] , - [struct statfs *stats; - int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); - char *t = FS_TYPE (*stats); ], - fu_cv_sys_mounted_getfsstat=yes, - fu_cv_sys_mounted_getfsstat=no)]) + [[struct statfs *stats; + int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); + char *t = FS_TYPE (*stats); ]])], + [fu_cv_sys_mounted_getfsstat=yes], + [fu_cv_sys_mounted_getfsstat=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_getfsstat]) if test $fu_cv_sys_mounted_getfsstat = yes; then ac_list_mounted_fs=found AC_DEFINE([MOUNTED_GETFSSTAT], [1], - [Define if there is a function named getfsstat for reading the + [Define if there is a function named getfsstat for reading the list of mounted file systems. (DEC Alpha running OSF/1)]) fi fi @@ -206,12 +206,12 @@ if test -z "$ac_list_mounted_fs"; then # SVR3 AC_MSG_CHECKING([for FIXME existence of three headers]) AC_CACHE_VAL([fu_cv_sys_mounted_fread_fstyp], - [AC_TRY_CPP([ + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include <sys/statfs.h> #include <sys/fstyp.h> -#include <mnttab.h>], - fu_cv_sys_mounted_fread_fstyp=yes, - fu_cv_sys_mounted_fread_fstyp=no)]) +#include <mnttab.h>]])], + [fu_cv_sys_mounted_fread_fstyp=yes], + [fu_cv_sys_mounted_fread_fstyp=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp]) if test $fu_cv_sys_mounted_fread_fstyp = yes; then ac_list_mounted_fs=found @@ -228,15 +228,15 @@ if test -z "$ac_list_mounted_fs"; then AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo], [ test "$ac_cv_func_getmntinfo" = yes \ - && fu_cv_sys_mounted_getmntinfo=yes \ - || fu_cv_sys_mounted_getmntinfo=no + && fu_cv_sys_mounted_getmntinfo=yes \ + || fu_cv_sys_mounted_getmntinfo=no ]) AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo]) if test $fu_cv_sys_mounted_getmntinfo = yes; then AC_MSG_CHECKING([whether getmntinfo returns statvfs structures]) AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo2], [ - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #if HAVE_SYS_PARAM_H # include <sys/param.h> #endif @@ -248,7 +248,7 @@ if test -z "$ac_list_mounted_fs"; then # include <sys/statvfs.h> #endif extern int getmntinfo (struct statfs **, int); - ], [], + ]], [])], [fu_cv_sys_mounted_getmntinfo2=no], [fu_cv_sys_mounted_getmntinfo2=yes]) ]) @@ -256,13 +256,13 @@ extern int getmntinfo (struct statfs **, int); if test $fu_cv_sys_mounted_getmntinfo2 = no; then ac_list_mounted_fs=found AC_DEFINE([MOUNTED_GETMNTINFO], [1], - [Define if there is a function named getmntinfo for reading the + [Define if there is a function named getmntinfo for reading the list of mounted file systems and it returns an array of 'struct statfs'. (4.4BSD, Darwin)]) else ac_list_mounted_fs=found AC_DEFINE([MOUNTED_GETMNTINFO2], [1], - [Define if there is a function named getmntinfo for reading the + [Define if there is a function named getmntinfo for reading the list of mounted file systems and it returns an array of 'struct statvfs'. (NetBSD 3.0)]) fi @@ -273,11 +273,11 @@ if test -z "$ac_list_mounted_fs"; then # Ultrix AC_MSG_CHECKING([for getmnt function]) AC_CACHE_VAL([fu_cv_sys_mounted_getmnt], - [AC_TRY_CPP([ + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include <sys/fs_types.h> -#include <sys/mount.h>], - fu_cv_sys_mounted_getmnt=yes, - fu_cv_sys_mounted_getmnt=no)]) +#include <sys/mount.h>]])], + [fu_cv_sys_mounted_getmnt=yes], + [fu_cv_sys_mounted_getmnt=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt]) if test $fu_cv_sys_mounted_getmnt = yes; then ac_list_mounted_fs=found @@ -294,7 +294,7 @@ if test -z "$ac_list_mounted_fs"; then AC_MSG_CHECKING([for BEOS mounted file system support functions]) if test $ac_cv_header_fs_info_h = yes \ && test $ac_cv_func_next_dev = yes \ - && test $ac_cv_func_fs_stat_dev = yes; then + && test $ac_cv_func_fs_stat_dev = yes; then fu_result=yes else fu_result=no @@ -312,14 +312,14 @@ if test -z "$ac_list_mounted_fs"; then # SVR2 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) AC_CACHE_VAL([fu_cv_sys_mounted_fread], - [AC_TRY_CPP([#include <mnttab.h>], - fu_cv_sys_mounted_fread=yes, - fu_cv_sys_mounted_fread=no)]) + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <mnttab.h>]])], + [fu_cv_sys_mounted_fread=yes], + [fu_cv_sys_mounted_fread=no])]) AC_MSG_RESULT([$fu_cv_sys_mounted_fread]) if test $fu_cv_sys_mounted_fread = yes; then ac_list_mounted_fs=found AC_DEFINE([MOUNTED_FREAD], [1], - [Define if there is no specific function for reading the list of + [Define if there is no specific function for reading the list of mounted file systems. fread will be used to read /etc/mnttab. (SVR2) ]) fi diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 80701716..910ac922 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 serial 9 -dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index d941bc33..2d89ca3f 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 @@ -1,5 +1,5 @@ -# math_h.m4 serial 14 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +# math_h.m4 serial 21 +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, dnl with or without modifications, as long as this notice is preserved. @@ -8,6 +8,8 @@ AC_DEFUN([gl_MATH_H], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([math.h]) + AC_REQUIRE([AC_C_INLINE]) + AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], [[/* Solaris 10 has a broken definition of NAN. Other platforms @@ -15,9 +17,9 @@ AC_DEFUN([gl_MATH_H], test only needs to fail when NAN is provided but wrong. */ float f = 1.0f; #ifdef NAN - f = NAN; + f = NAN; #endif - return f == 0;]])], + return f == 0;]])], [gl_cv_header_math_nan_works=yes], [gl_cv_header_math_nan_works=no])]) if test $gl_cv_header_math_nan_works = no; then @@ -26,26 +28,39 @@ AC_DEFUN([gl_MATH_H], AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], [[/* Solaris 10 has a broken definition of HUGE_VAL. */ - double d = HUGE_VAL; - return d == 0;]])], + double d = HUGE_VAL; + return d == 0;]])], [gl_cv_header_math_huge_val_works=yes], [gl_cv_header_math_huge_val_works=no])]) 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 logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl]) ]) AC_DEFUN([gl_MATH_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_MATH_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_MATH_H_DEFAULTS], [ + GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) + GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) + GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) + GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) + GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) @@ -57,31 +72,53 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) - GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) + GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) + GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) + GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) + GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) + HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) + HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) + HAVE_COSL=1; AC_SUBST([HAVE_COSL]) + HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) + HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) + HAVE_SINL=1; AC_SUBST([HAVE_SINL]) + HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) + HAVE_TANL=1; AC_SUBST([HAVE_TANL]) HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) + HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) + HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) + HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) + HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) + HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index 11d7d23e..606de5c9 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 @@ -1,5 +1,6 @@ -# mbrtowc.m4 serial 15 -dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. +# mbrtowc.m4 serial 17 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,38 +11,39 @@ AC_DEFUN([gl_FUNC_MBRTOWC], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBRTOWC=1 - fi + AC_CHECK_FUNCS_ONCE([mbrtowc]) if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 - fi - if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then - gl_MBRTOWC_NULL_ARG - gl_MBRTOWC_RETVAL - gl_MBRTOWC_NUL_RETVAL - case "$gl_cv_func_mbrtowc_null_arg" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], - [Define if the mbrtowc function has the NULL string argument bug.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], - [Define if the mbrtowc function returns a wrong return value.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_nul_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], - [Define if the mbrtowc function does not return 0 for a NUL character.]) - REPLACE_MBRTOWC=1 - ;; - esac + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOWC=1 + else + gl_MBRTOWC_NULL_ARG + gl_MBRTOWC_RETVAL + gl_MBRTOWC_NUL_RETVAL + case "$gl_cv_func_mbrtowc_null_arg" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], + [Define if the mbrtowc function has the NULL string argument bug.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], + [Define if the mbrtowc function returns a wrong return value.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_nul_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], + [Define if the mbrtowc function does not return 0 for a NUL character.]) + REPLACE_MBRTOWC=1 + ;; + esac + fi fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then gl_REPLACE_WCHAR_H @@ -156,6 +158,7 @@ changequote([,])dnl if test $LOCALE_ZH_CN != none; then AC_TRY_RUN([ #include <locale.h> +#include <stdlib.h> #include <string.h> #include <wchar.h> int main () diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index 03b055cd..46c106fc 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 @@ -1,5 +1,5 @@ -# mbsinit.m4 serial 3 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +# mbsinit.m4 serial 4 +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, dnl with or without modifications, as long as this notice is preserved. @@ -10,12 +10,14 @@ AC_DEFUN([gl_FUNC_MBSINIT], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBSINIT=1 - fi + AC_CHECK_FUNCS_ONCE([mbsinit]) if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBSINIT=1 + fi fi if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then gl_REPLACE_WCHAR_H diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index d4ec6f0f..3e2df29f 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 @@ -1,5 +1,5 @@ # mbstate_t.m4 serial 12 -dnl Copyright (C) 2000-2002, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 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, dnl with or without modifications, as long as this notice is preserved. @@ -18,17 +18,17 @@ AC_DEFUN([AC_TYPE_MBSTATE_T], AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT[ -# include <wchar.h>]], - [[mbstate_t x; return sizeof x;]])], - [ac_cv_type_mbstate_t=yes], - [ac_cv_type_mbstate_t=no])]) + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT[ +# include <wchar.h>]], + [[mbstate_t x; return sizeof x;]])], + [ac_cv_type_mbstate_t=yes], + [ac_cv_type_mbstate_t=no])]) if test $ac_cv_type_mbstate_t = yes; then AC_DEFINE([HAVE_MBSTATE_T], [1], - [Define to 1 if <wchar.h> declares mbstate_t.]) + [Define to 1 if <wchar.h> declares mbstate_t.]) else AC_DEFINE([mbstate_t], [int], - [Define to a type if <wchar.h> does not define.]) + [Define to a type if <wchar.h> does not define.]) fi ]) diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 new file mode 100644 index 00000000..ab773b81 --- /dev/null +++ b/gl/m4/memchr.m4 @@ -0,0 +1,85 @@ +# memchr.m4 serial 8 +dnl Copyright (C) 2002-2004, 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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_FUNC_MEMCHR], +[ + dnl Check for prerequisites for memory fence checks. + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + + dnl These days, we assume memchr is present. But just in case... + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([memchr]) + if test $ac_cv_func_memchr = yes; then + # Detect platform-specific bugs in some versions of glibc: + # memchr should not dereference anything with length 0 + # http://bugzilla.redhat.com/499689 + # memchr should not dereference overestimated length after a match + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # http://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # Assume that memchr works on platforms that lack mprotect. + AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <string.h> +#if HAVE_SYS_MMAN_H +# include <fcntl.h> +# include <unistd.h> +# include <sys/types.h> +# include <sys/mman.h> +# ifndef MAP_FILE +# define MAP_FILE 0 +# endif +#endif +]], [[ + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +# if HAVE_MAP_ANONYMOUS + const int flags = MAP_ANONYMOUS | MAP_PRIVATE; + const int fd = -1; +# else /* !HAVE_MAP_ANONYMOUS */ + const int flags = MAP_FILE | MAP_PRIVATE; + int fd = open ("/dev/zero", O_RDONLY, 0666); + if (fd >= 0) +# endif + { + int pagesize = getpagesize (); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + if (memchr (fence, 0, 0)) + return 1; + strcpy (fence - 9, "12345678"); + if (memchr (fence - 9, 0, 79) != fence - 1) + return 2; + } + return 0; +]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], + [dnl Be pessimistic for now. + gl_cv_func_memchr_works="guessing no"])]) + if test "$gl_cv_func_memchr_works" != yes; then + REPLACE_MEMCHR=1 + fi + else + HAVE_MEMCHR=0 + fi + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + AC_LIBOBJ([memchr]) + gl_PREREQ_MEMCHR + fi +]) + +# Prerequisites of lib/memchr.c. +AC_DEFUN([gl_PREREQ_MEMCHR], [ + AC_CHECK_HEADERS([bp-sym.h]) +]) diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index 1e926e86..44b8d878 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 @@ -1,5 +1,6 @@ # serial 15 -dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -85,8 +86,8 @@ static int mktime_test (time_t now) { return (mktime_test1 (now) - && mktime_test1 ((time_t) (time_t_max - now)) - && mktime_test1 ((time_t) (time_t_min + now))); + && mktime_test1 ((time_t) (time_t_max - now)) + && mktime_test1 ((time_t) (time_t_min + now))); } static int @@ -116,17 +117,17 @@ bigtime_test (int j) { struct tm *lt = localtime (&now); if (! (lt - && lt->tm_year == tm.tm_year - && lt->tm_mon == tm.tm_mon - && lt->tm_mday == tm.tm_mday - && lt->tm_hour == tm.tm_hour - && lt->tm_min == tm.tm_min - && lt->tm_sec == tm.tm_sec - && lt->tm_yday == tm.tm_yday - && lt->tm_wday == tm.tm_wday - && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) - == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) - return 0; + && lt->tm_year == tm.tm_year + && lt->tm_mon == tm.tm_mon + && lt->tm_mday == tm.tm_mday + && lt->tm_hour == tm.tm_hour + && lt->tm_min == tm.tm_min + && lt->tm_sec == tm.tm_sec + && lt->tm_yday == tm.tm_yday + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) + return 0; } return 1; } @@ -158,7 +159,7 @@ year_2050_test () to the correct answer that we can assume the discrepancy is due to leap seconds. */ return (t == (time_t) -1 - || (0 < t && answer - 120 <= t && t <= answer + 120)); + || (0 < t && answer - 120 <= t && t <= answer + 120)); } int @@ -176,7 +177,7 @@ main () { t = (time_t_max << 1) + 1; if (t <= time_t_max) - break; + break; time_t_max = t; } time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; @@ -185,29 +186,29 @@ main () for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) - putenv (tz_strings[i]); + putenv (tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) - if (! mktime_test (t)) - return 1; + if (! mktime_test (t)) + return 1; if (! (mktime_test ((time_t) 1) - && mktime_test ((time_t) (60 * 60)) - && mktime_test ((time_t) (60 * 60 * 24)))) - return 1; + && mktime_test ((time_t) (60 * 60)) + && mktime_test ((time_t) (60 * 60 * 24)))) + return 1; for (j = 1; ; j <<= 1) - if (! bigtime_test (j)) - return 1; - else if (INT_MAX / 2 < j) - break; + if (! bigtime_test (j)) + return 1; + else if (INT_MAX / 2 < j) + break; if (! bigtime_test (INT_MAX)) - return 1; + return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); }]])], - [ac_cv_func_working_mktime=yes], - [ac_cv_func_working_mktime=no], - [ac_cv_func_working_mktime=no])]) + [ac_cv_func_working_mktime=yes], + [ac_cv_func_working_mktime=no], + [ac_cv_func_working_mktime=no])]) if test $ac_cv_func_working_mktime = no; then AC_LIBOBJ([mktime]) fi @@ -215,12 +216,14 @@ fi AC_DEFUN([gl_FUNC_MKTIME], [ + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_FUNC_MKTIME dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]). if test $ac_cv_func_working_mktime = no; then - AC_DEFINE([mktime], [rpl_mktime], - [Define to rpl_mktime if the replacement function should be used.]) + REPLACE_MKTIME=1 gl_PREREQ_MKTIME + else + REPLACE_MKTIME=0 fi ]) diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 new file mode 100644 index 00000000..a6b7b9ac --- /dev/null +++ b/gl/m4/mmap-anon.m4 @@ -0,0 +1,59 @@ +# mmap-anon.m4 serial 8 +dnl Copyright (C) 2005, 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, +dnl with or without modifications, as long as this notice is preserved. + +# Detect how mmap can be used to create anonymous (not file-backed) memory +# mappings. +# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS +# and MAP_ANON exist and have the same value. +# - On HP-UX, only MAP_ANONYMOUS exists. +# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. +# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be +# used. + +AC_DEFUN([gl_FUNC_MMAP_ANON], +[ + dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. + AC_REQUIRE([AC_PROG_CPP]) + AC_REQUIRE([AC_PROG_EGREP]) + + dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + AC_MSG_CHECKING([for MAP_ANONYMOUS]) + AC_EGREP_CPP([I cant identify this map.], [ +#include <sys/mman.h> +#ifdef MAP_ANONYMOUS + I cant identify this map. +#endif +], + [gl_have_mmap_anonymous=yes]) + if test $gl_have_mmap_anonymous != yes; then + AC_EGREP_CPP([I cant identify this map.], [ +#include <sys/mman.h> +#ifdef MAP_ANON + I cant identify this map. +#endif +], + [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], + [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) + gl_have_mmap_anonymous=yes]) + fi + AC_MSG_RESULT([$gl_have_mmap_anonymous]) + if test $gl_have_mmap_anonymous = yes; then + AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], + [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including + config.h and <sys/mman.h>.]) + fi + fi +]) diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 new file mode 100644 index 00000000..3178dfd3 --- /dev/null +++ b/gl/m4/mode_t.m4 @@ -0,0 +1,26 @@ +# mode_t.m4 serial 2 +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, +dnl with or without modifications, as long as this notice is preserved. + +# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and +# include <sys/types.h>. + +# Define PROMOTED_MODE_T to the type that is the result of "default argument +# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. +AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], +[ + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ + dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', + dnl and to itself otherwise. This assumption is not guaranteed by the ISO C + dnl standard, but we don't know of any real-world counterexamples. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], + [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], + [gl_cv_promoted_mode_t='int'], + [gl_cv_promoted_mode_t='mode_t']) + ]) + AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], + [Define to the type that is the result of default argument promotions of type mode_t.]) +]) diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index f62c57a2..f2d59501 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 @@ -1,5 +1,5 @@ # serial 10 -dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_MOUNTLIST], [ gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes], - [gl_cv_list_mounted_fs=no]) + [gl_cv_list_mounted_fs=no]) if test $gl_cv_list_mounted_fs = yes; then AC_LIBOBJ([mountlist]) gl_PREREQ_MOUNTLIST_EXTRA diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index ec377bac..389bd2bb 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 @@ -1,5 +1,5 @@ # multiarch.m4 serial 5 -dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index 5a12251f..40ba8f66 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 @@ -1,5 +1,5 @@ -# netdb_h.m4 serial 5 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +# netdb_h.m4 serial 7 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_HEADER_NETDB], [ AC_REQUIRE([gl_NETDB_H_DEFAULTS]) + AC_CHECK_HEADERS_ONCE([netdb.h]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then AC_COMPILE_IFELSE( @@ -30,7 +31,7 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) AC_DEFUN([gl_NETDB_H_DEFAULTS], diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 47fd9cc3..cc7a44cc 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,5 +1,5 @@ # netinet_in_h.m4 serial 4 -dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 new file mode 100644 index 00000000..ad456a26 --- /dev/null +++ b/gl/m4/nl_langinfo.m4 @@ -0,0 +1,25 @@ +# nl_langinfo.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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_NL_LANGINFO], +[ + AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) + AC_REQUIRE([gl_LANGINFO_H]) + AC_CHECK_FUNCS_ONCE([nl_langinfo]) + if test $ac_cv_func_nl_langinfo = yes; then + if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then + : + else + REPLACE_NL_LANGINFO=1 + AC_DEFINE([REPLACE_NL_LANGINFO], [1], + [Define if nl_langinfo exists but is overridden by gnulib.]) + AC_LIBOBJ([nl_langinfo]) + fi + else + HAVE_NL_LANGINFO=0 + AC_LIBOBJ([nl_langinfo]) + fi +]) diff --git a/gl/m4/nls.m4 b/gl/m4/nls.m4 index 0b364342..003704c4 100644 --- a/gl/m4/nls.m4 +++ b/gl/m4/nls.m4 @@ -1,5 +1,6 @@ # nls.m4 serial 5 (gettext-0.18) -dnl Copyright (C) 1995-2003, 2005-2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/onceonly.m4 b/gl/m4/onceonly.m4 index 108cd6c1..4a3cd84d 100644 --- a/gl/m4/onceonly.m4 +++ b/gl/m4/onceonly.m4 @@ -1,5 +1,6 @@ # onceonly.m4 serial 6 -dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 6e286c96..d705b3a1 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 @@ -1,5 +1,5 @@ -# open.m4 serial 5 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# open.m4 serial 8 +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, dnl with or without modifications, as long as this notice is preserved. @@ -13,10 +13,15 @@ AC_DEFUN([gl_FUNC_OPEN], ;; *) dnl open("foo/") should not create a file when the file name has a - dnl trailing slash. + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) AC_CACHE_CHECK([whether open recognizes a trailing slash], [gl_cv_func_open_slash], - [ + [# Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi AC_TRY_RUN([ #include <fcntl.h> #if HAVE_UNISTD_H @@ -24,18 +29,22 @@ AC_DEFUN([gl_FUNC_OPEN], #endif int main () { +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) return 2; +#endif return open ("conftest.sl/", O_CREAT, 0600) >= 0; }], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], [ changequote(,)dnl case "$host_os" in + freebsd*) gl_cv_func_open_slash="guessing no" ;; solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; hpux*) gl_cv_func_open_slash="guessing no" ;; *) gl_cv_func_open_slash="guessing yes" ;; esac changequote([,])dnl ]) - rm -f conftest.sl + rm -f conftest.sl conftest.tmp conftest.lnk ]) case "$gl_cv_func_open_slash" in *no) @@ -51,16 +60,15 @@ changequote([,])dnl AC_DEFUN([gl_REPLACE_OPEN], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - if test $REPLACE_OPEN != 1; then - AC_LIBOBJ([open]) - gl_PREREQ_OPEN - fi REPLACE_OPEN=1 + AC_LIBOBJ([open]) + gl_PREREQ_OPEN ]) # Prerequisites of lib/open.c. AC_DEFUN([gl_PREREQ_OPEN], [ AC_REQUIRE([AC_C_INLINE]) + AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) : ]) diff --git a/gl/m4/po.m4 b/gl/m4/po.m4 index 2284fa50..960efe15 100644 --- a/gl/m4/po.m4 +++ b/gl/m4/po.m4 @@ -1,5 +1,5 @@ # po.m4 serial 17 (gettext-0.18) -dnl Copyright (C) 1995-2009 Free Software Foundation, Inc. +dnl Copyright (C) 1995-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4 index 5922d278..1eacf95a 100644 --- a/gl/m4/printf-posix.m4 +++ b/gl/m4/printf-posix.m4 @@ -1,5 +1,5 @@ # printf-posix.m4 serial 5 (gettext-0.18) -dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 87aa45c5..ebca5364 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,5 +1,5 @@ # printf.m4 serial 33 -dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/progtest.m4 b/gl/m4/progtest.m4 index e1d445d2..2d804ac9 100644 --- a/gl/m4/progtest.m4 +++ b/gl/m4/progtest.m4 @@ -1,5 +1,5 @@ # progtest.m4 serial 6 (gettext-0.18) -dnl Copyright (C) 1996-2003, 2005, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index aef53d29..95784e4b 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 @@ -1,7 +1,7 @@ -# serial 54 +# serial 56 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -18,146 +18,154 @@ AC_DEFUN([gl_REGEX], AC_ARG_WITH([included-regex], [AS_HELP_STRING([--without-included-regex], - [don't compile regex; this is the default on systems - with recent-enough versions of the GNU C Library - (use with caution on other systems).])]) + [don't compile regex; this is the default on systems + with recent-enough versions of the GNU C Library + (use with caution on other systems).])]) case $with_included_regex in #( yes|no) ac_use_included_regex=$with_included_regex - ;; + ;; '') # If the system regex support is good enough that it passes the # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. AC_CACHE_CHECK([for working re_compile_pattern], - [gl_cv_func_re_compile_pattern_working], + [gl_cv_func_re_compile_pattern_working], [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT[ - #if HAVE_LOCALE_H - #include <locale.h> - #endif - #include <limits.h> - #include <regex.h> - ]], - [[static struct re_pattern_buffer regex; - unsigned char folded_chars[UCHAR_MAX + 1]; - int i; - const char *s; - struct re_registers regs; - - #if HAVE_LOCALE_H - /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html - This test needs valgrind to catch the bug on Debian - GNU/Linux 3.1 x86, but it might catch the bug better - on other platforms and it shouldn't hurt to try the - test here. */ - if (setlocale (LC_ALL, "en_US.UTF-8")) - { - static char const pat[] = "insert into"; - static char const data[] = - "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; - re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE - | RE_ICASE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern (pat, sizeof pat - 1, ®ex); - if (s) - return 1; - if (re_search (®ex, data, sizeof data - 1, - 0, sizeof data - 1, ®s) - != -1) - return 1; - if (! setlocale (LC_ALL, "C")) - return 1; - } - #endif - - /* This test is from glibc bug 3957, reported by Andrew Mackey. */ - re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("a[^x]b", 6, ®ex); - if (s) - return 1; - - /* This should fail, but succeeds for glibc-2.5. */ - if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) - return 1; - - /* This regular expression is from Spencer ere test number 75 - in grep-2.3. */ - re_set_syntax (RE_SYNTAX_POSIX_EGREP); - memset (®ex, 0, sizeof regex); - for (i = 0; i <= UCHAR_MAX; i++) - folded_chars[i] = i; - regex.translate = folded_chars; - s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); - /* This should fail with _Invalid character class name_ error. */ - if (!s) - return 1; - - /* This should succeed, but does not for glibc-2.1.3. */ - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("{1", 2, ®ex); - - if (s) - return 1; - - /* The following example is derived from a problem report - against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("[an\371]*n", 7, ®ex); - if (s) - return 1; - - /* This should match, but does not for glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - return 1; - - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - return 1; - - /* glibc-2.2.93 does not work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - return 1; - - /* The version of regex.c in older versions of gnulib - ignored RE_ICASE. Detect that problem too. */ - re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - return 1; - - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - return 1; - - /* Catch a bug reported by Vin Shelton in - http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html - */ - re_set_syntax (RE_SYNTAX_POSIX_BASIC - & ~RE_CONTEXT_INVALID_DUP - & ~RE_NO_EMPTY_RANGES); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); - if (s) - return 1; - - /* REG_STARTEND was added to glibc on 2004-01-15. - Reject older versions. */ - if (! REG_STARTEND) - return 1; - - /* Reject hosts whose regoff_t values are too narrow. - These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t - and 32-bit int. */ - if (sizeof (regoff_t) < sizeof (ptrdiff_t) - || sizeof (regoff_t) < sizeof (ssize_t)) - return 1; - - return 0;]])], + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT[ + #if HAVE_LOCALE_H + #include <locale.h> + #endif + #include <limits.h> + #include <regex.h> + ]], + [[static struct re_pattern_buffer regex; + unsigned char folded_chars[UCHAR_MAX + 1]; + int i; + const char *s; + struct re_registers regs; + + #if HAVE_LOCALE_H + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ + if (setlocale (LC_ALL, "en_US.UTF-8")) + { + static char const pat[] = "insert into"; + static char const data[] = + "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; + re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE + | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + return 1; + if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + return 1; + if (! setlocale (LC_ALL, "C")) + return 1; + } + #endif + + /* This test is from glibc bug 3957, reported by Andrew Mackey. */ + re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("a[^x]b", 6, ®ex); + if (s) + return 1; + + /* This should fail, but succeeds for glibc-2.5. */ + if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) + return 1; + + /* This regular expression is from Spencer ere test number 75 + in grep-2.3. */ + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + memset (®ex, 0, sizeof regex); + for (i = 0; i <= UCHAR_MAX; i++) + folded_chars[i] = i; + regex.translate = folded_chars; + s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + return 1; + + /* Ensure that [b-a] is diagnosed as invalid, when + using RE_NO_EMPTY_RANGES. */ + re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("a[b-a]", 6, ®ex); + if (s == 0) + return 1; + + /* This should succeed, but does not for glibc-2.1.3. */ + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("{1", 2, ®ex); + + if (s) + return 1; + + /* The following example is derived from a problem report + against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("[an\371]*n", 7, ®ex); + if (s) + return 1; + + /* This should match, but does not for glibc-2.2.1. */ + if (re_match (®ex, "an", 2, 0, ®s) != 2) + return 1; + + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + return 1; + + /* glibc-2.2.93 does not work with a negative RANGE argument. */ + if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + return 1; + + /* The version of regex.c in older versions of gnulib + ignored RE_ICASE. Detect that problem too. */ + re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + return 1; + + if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + return 1; + + /* Catch a bug reported by Vin Shelton in + http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html + */ + re_set_syntax (RE_SYNTAX_POSIX_BASIC + & ~RE_CONTEXT_INVALID_DUP + & ~RE_NO_EMPTY_RANGES); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); + if (s) + return 1; + + /* REG_STARTEND was added to glibc on 2004-01-15. + Reject older versions. */ + if (! REG_STARTEND) + return 1; + + /* Reject hosts whose regoff_t values are too narrow. + These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t + and 32-bit int. */ + if (sizeof (regoff_t) < sizeof (ptrdiff_t) + || sizeof (regoff_t) < sizeof (ssize_t)) + return 1; + + return 0;]])], [gl_cv_func_re_compile_pattern_working=yes], [gl_cv_func_re_compile_pattern_working=no], dnl When crosscompiling, assume it is not working. @@ -213,6 +221,7 @@ AC_DEFUN([gl_REGEX], AC_DEFUN([gl_PREREQ_REGEX], [ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_HEADERS([libintl.h]) diff --git a/gl/m4/safe-read.m4 b/gl/m4/safe-read.m4 index 7a89d0a6..d087bd30 100644 --- a/gl/m4/safe-read.m4 +++ b/gl/m4/safe-read.m4 @@ -1,5 +1,6 @@ # safe-read.m4 serial 5 -dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/safe-write.m4 b/gl/m4/safe-write.m4 index db119ffa..2ff11d27 100644 --- a/gl/m4/safe-write.m4 +++ b/gl/m4/safe-write.m4 @@ -1,5 +1,5 @@ # safe-write.m4 serial 3 -dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 242f9e36..2ed961a4 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 @@ -1,5 +1,5 @@ # servent.m4 serial 1 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index e0e7b3ff..ce992db1 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 @@ -1,5 +1,5 @@ -# size_max.m4 serial 7 -dnl Copyright (C) 2003, 2005-2006, 2008 Free Software Foundation, Inc. +# size_max.m4 serial 9 +dnl Copyright (C) 2003, 2005-2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -10,8 +10,7 @@ AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS([stdint.h]) dnl First test whether the system already has SIZE_MAX. - AC_MSG_CHECKING([for SIZE_MAX]) - AC_CACHE_VAL([gl_cv_size_max], [ + AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ gl_cv_size_max= AC_EGREP_CPP([Found it], [ #include <limits.h> @@ -54,11 +53,19 @@ Found it fi fi ]) - AC_MSG_RESULT([$gl_cv_size_max]) if test "$gl_cv_size_max" != yes; then AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], [Define as the maximum value of type 'size_t', if the system doesn't define it.]) fi + dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after + dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with + dnl #define by AC_DEFINE_UNQUOTED. + AH_VERBATIM([SIZE_MAX], +[/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +#ifndef SIZE_MAX +# undef SIZE_MAX +#endif]) ]) dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 6021786e..522b107b 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 @@ -1,5 +1,5 @@ # snprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 new file mode 100644 index 00000000..aefb9360 --- /dev/null +++ b/gl/m4/sockets.m4 @@ -0,0 +1,90 @@ +# sockets.m4 serial 6 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SOCKETS], +[ + AC_REQUIRE([AC_C_INLINE]) + + gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H + LIBSOCKET= + if test $HAVE_WINSOCK2_H = 1; then + dnl Native Windows API (not Cygwin). + AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], + [gl_cv_func_wsastartup], [ + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lws2_32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif]], [[ + WORD wVersionRequested = MAKEWORD(1, 1); + WSADATA wsaData; + int err = WSAStartup(wVersionRequested, &wsaData); + WSACleanup ();]])], + gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) + LIBS="$gl_save_LIBS" + ]) + if test "$gl_cv_func_wsastartup" = "yes"; then + AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) + LIBSOCKET='-lws2_32' + fi + else + dnl Unix API. + dnl Solaris has most socket functions in libsocket. + dnl Haiku has most socket functions in libnetwork. + dnl BeOS has most socket functions in libnet. + AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ + gl_cv_lib_socket= + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [], + [gl_save_LIBS="$LIBS" + LIBS="$gl_save_LIBS -lsocket" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lsocket"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnetwork" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnetwork"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnet" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnet"]) + fi + fi + LIBS="$gl_save_LIBS" + ]) + if test -z "$gl_cv_lib_socket"; then + gl_cv_lib_socket="none needed" + fi + ]) + if test "$gl_cv_lib_socket" != "none needed"; then + LIBSOCKET="$gl_cv_lib_socket" + fi + fi + AC_SUBST([LIBSOCKET]) + gl_PREREQ_SOCKETS +]) + +# Prerequisites of lib/sockets.c. +AC_DEFUN([gl_PREREQ_SOCKETS], [ + : +]) diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index b755757b..2933d4b8 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,5 +1,5 @@ -# socklen.m4 serial 6 -dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +# socklen.m4 serial 7 +dnl Copyright (C) 2005, 2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -20,30 +20,30 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T], AC_CHECK_TYPE([socklen_t], , [AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([gl_cv_socklen_t_equiv], - [# Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - gl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t "unsigned int" "long int" "unsigned long int"; do - AC_TRY_COMPILE( - [#include <sys/types.h> - #include <sys/socket.h> + [# Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t "unsigned int" "long int" "unsigned long int"; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/socket.h> - int getpeername (int, $arg2 *, $t *);], - [$t len; - getpeername (0, 0, &len);], - [gl_cv_socklen_t_equiv="$t"]) - test "$gl_cv_socklen_t_equiv" != "" && break - done - test "$gl_cv_socklen_t_equiv" != "" && break - done + int getpeername (int, $arg2 *, $t *);]], + [[$t len; + getpeername (0, 0, &len);]])], + [gl_cv_socklen_t_equiv="$t"]) + test "$gl_cv_socklen_t_equiv" != "" && break + done + test "$gl_cv_socklen_t_equiv" != "" && break + done ]) if test "$gl_cv_socklen_t_equiv" = ""; then - AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) fi AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], - [type to use in place of socklen_t if not defined])], + [type to use in place of socklen_t if not defined])], [#include <sys/types.h> #if HAVE_SYS_SOCKET_H # include <sys/socket.h> diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 99ea06f9..8a0c2360 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 @@ -1,5 +1,5 @@ -# sockpfaf.m4 serial 6 -dnl Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc. +# sockpfaf.m4 serial 7 +dnl Copyright (C) 2004, 2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -18,7 +18,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES], AC_MSG_CHECKING([for IPv4 sockets]) AC_CACHE_VAL([gl_cv_socket_ipv4], - [AC_TRY_COMPILE([#include <sys/types.h> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif @@ -27,9 +27,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES], #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> -#endif], -[int x = AF_INET; struct in_addr y; struct sockaddr_in z; - if (&x && &y && &z) return 0;], +#endif]], +[[int x = AF_INET; struct in_addr y; struct sockaddr_in z; + if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) AC_MSG_RESULT([$gl_cv_socket_ipv4]) if test $gl_cv_socket_ipv4 = yes; then @@ -38,7 +38,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES], AC_MSG_CHECKING([for IPv6 sockets]) AC_CACHE_VAL([gl_cv_socket_ipv6], - [AC_TRY_COMPILE([#include <sys/types.h> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif @@ -47,9 +47,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES], #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> -#endif], -[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; - if (&x && &y && &z) return 0;], +#endif]], +[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; + if (&x && &y && &z) return 0;]])], gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) AC_MSG_RESULT([$gl_cv_socket_ipv6]) if test $gl_cv_socket_ipv6 = yes; then diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 4eaef93c..e0ccee3a 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 @@ -1,5 +1,5 @@ # ssize_t.m4 serial 4 (gettext-0.15) -dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 new file mode 100644 index 00000000..acd32d86 --- /dev/null +++ b/gl/m4/stat.m4 @@ -0,0 +1,63 @@ +# serial 4 + +# Copyright (C) 2009, 2010 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. + +AC_DEFUN([gl_FUNC_STAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_AC_DOS]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([lstat]) + dnl mingw is the only known platform where stat(".") and stat("./") differ + AC_CACHE_CHECK([whether stat handles trailing slashes on directories], + [gl_cv_func_stat_dir_slash], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], + [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], + [case $host_os in + mingw*) gl_cv_func_stat_dir_slash="guessing no";; + *) gl_cv_func_stat_dir_slash="guessing yes";; + esac])]) + dnl Solaris 9 mistakenly succeeds on stat("file/") + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/") + AC_CACHE_CHECK([whether stat handles trailing slashes on files], + [gl_cv_func_stat_file_slash], + [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[struct stat st; + if (!stat ("conftest.tmp/", &st)) return 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) return 2; +#endif + ]])], + [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], + [gl_cv_func_stat_file_slash="guessing no"]) + rm -f conftest.tmp conftest.lnk]) + case $gl_cv_func_stat_dir_slash in + *no) REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs + help when passed a directory name with a trailing slash]);; + esac + case $gl_cv_func_stat_file_slash in + *no) REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs + help when passed a file name with a trailing slash]);; + esac + if test $REPLACE_STAT = 1; then + AC_LIBOBJ([stat]) + dnl Prerequisites of lib/stat.c. + AC_REQUIRE([AC_C_INLINE]) + fi +]) diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4 index 57c804a8..3d672d74 100644 --- a/gl/m4/stdbool.m4 +++ b/gl/m4/stdbool.m4 @@ -1,6 +1,6 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 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, dnl with or without modifications, as long as this notice is preserved. @@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_TRY_COMPILE( - [ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif + [ + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { _Bool s: 1; _Bool t; } s; - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - #if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a run-time - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); - #endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - ], - [ - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - ], - [ac_cv_header_stdbool_h=yes], - [ac_cv_header_stdbool_h=no])]) + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + #if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); + #endif + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + ], + [ + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) if test $ac_cv_header_stdbool_h = yes; then AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 new file mode 100644 index 00000000..c3ae5694 --- /dev/null +++ b/gl/m4/stddef_h.m4 @@ -0,0 +1,45 @@ +dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. +# stddef_h.m4 serial 2 +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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDDEF_H], +[ + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], + [gl_cv_decl_null_works], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> + int test[2 * (sizeof NULL == sizeof (void *)) -1]; +]])], + [gl_cv_decl_null_works=yes], + [gl_cv_decl_null_works=no])]) + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h + fi + if test -n "$STDDEF_H"; then + gl_CHECK_NEXT_HEADERS([stddef.h]) + fi +]) + +AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) +]) + +AC_DEFUN([gl_STDDEF_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) + HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) + STDDEF_H=''; AC_SUBST([STDDEF_H]) +]) diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index a2e8bdd6..1cc57e6e 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,5 +1,5 @@ # stdint.m4 serial 34 -dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2001-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, dnl with or without modifications, as long as this notice is preserved. @@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do case $glsuf in '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; ui64)gltype1='unsigned __int64';; esac AC_COMPILE_IFELSE( diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 82f0c244..b8e3c6cc 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 @@ -1,5 +1,5 @@ # stdint_h.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 846b65d3..1d1d95e5 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,5 +1,5 @@ -# stdio_h.m4 serial 15 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# stdio_h.m4 serial 30 +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, dnl with or without modifications, as long as this notice is preserved. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([stdio.h]) dnl No need to create extra modules for these functions. Everyone who uses dnl <stdio.h> likely needs them. @@ -30,86 +31,110 @@ AC_DEFUN([gl_STDIO_H], AC_LIBOBJ([stdio-write]) fi ]) + + 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 <stdio.h> + ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat + snprintf tmpfile vdprintf vsnprintf]) ]) AC_DEFUN([gl_STDIO_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_STDIO_H_DEFAULTS], [ - GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) - GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) - GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) - GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) - GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) - GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) - GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) - GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) - GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) - GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) - GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) - GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) - GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) - GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) - GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) - GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) + GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) + GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) + GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) + GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) + GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) + GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) + GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) - GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) - GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) - GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) - GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) - GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) - GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) - GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) + GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) + GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) + GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) + GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) + GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) + GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) + GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) + GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) + GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) + GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) + GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) + GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) + GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) + GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) + GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) + GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) + GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) + GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) + GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) + GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) + GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) dnl Assume proper GNU behavior unless another module says otherwise. - REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) - REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) - REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) - REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) - REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) - REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) + HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) + HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) + HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) - REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) - REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) - REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) - REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) - HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) - REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) + HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) + HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) + HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) - REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) - HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) - REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) + HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) + REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) + REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) + REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) + REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) - HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) - REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) - HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) - REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) - REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) - REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) - HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) - HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) + REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) + REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) + REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) + REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) + REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) + REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) + REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) + REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) + REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) + REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) + REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) + REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) + REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) + REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) + REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) ]) dnl Code shared by fseeko and ftello. Determine if large files are supported, @@ -128,6 +153,6 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], choke me # endif #endif]])], - [gl_cv_var_stdin_large_offset=yes], - [gl_cv_var_stdin_large_offset=no])]) + [gl_cv_var_stdin_large_offset=yes], + [gl_cv_var_stdin_large_offset=no])]) ]) diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index b295f16b..dd84796d 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 15 -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +# stdlib_h.m4 serial 28 +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, dnl with or without modifications, as long as this notice is preserved. @@ -22,41 +22,75 @@ 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 grantpt mkdtemp + mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r + setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt + unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) - GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) - GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) + GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) + GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) + GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) + GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) + HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) - HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) + HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) + HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) + HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) + HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) + HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) @@ -64,10 +98,13 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) + HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) - HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) + REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) - VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) + REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) ]) diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4 index d7daac2b..ce40c215 100644 --- a/gl/m4/strdup.m4 +++ b/gl/m4/strdup.m4 @@ -1,6 +1,6 @@ -# strdup.m4 serial 11 +# strdup.m4 serial 12 -dnl Copyright (C) 2002-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-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, @@ -9,29 +9,36 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRDUP], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([strdup]) + AC_CHECK_FUNCS_ONCE([strdup]) + if test $ac_cv_func_strdup != yes; then + AC_LIBOBJ([strdup]) + gl_PREREQ_STRDUP + fi AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi - gl_PREREQ_STRDUP ]) AC_DEFUN([gl_FUNC_STRDUP_POSIX], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix != yes; then - REPLACE_STRDUP=1 - AC_LIBOBJ([strdup]) + AC_CHECK_FUNCS_ONCE([strdup]) + if test $ac_cv_func_strdup = yes; then + if test $gl_cv_func_malloc_posix != yes; then + REPLACE_STRDUP=1 + AC_LIBOBJ([strdup]) + gl_PREREQ_STRDUP + fi else - AC_REPLACE_FUNCS([strdup]) + AC_LIBOBJ([strdup]) + gl_PREREQ_STRDUP fi AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 fi - gl_PREREQ_STRDUP ]) # Prerequisites of lib/strdup.c. diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 8c16ca9a..1649b245 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 @@ -1,5 +1,5 @@ # strerror.m4 serial 9 -dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index 2d5553c3..cf26123e 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2007-2010 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. -# serial 6 +# serial 16 # Written by Paul Eggert. @@ -21,17 +21,29 @@ 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 + strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal + strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], [ + GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) @@ -40,6 +52,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) @@ -63,30 +76,36 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) + HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) - HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) - HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) - HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) - HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) - HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) - HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) - HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) - HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP]) - HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) - HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) - HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) - HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) - HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) - HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) - HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) - HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) - HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) - REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) - REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) - REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) - REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) - REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) - REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) + UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4 index 4fa7d5a7..810313cd 100644 --- a/gl/m4/strndup.m4 +++ b/gl/m4/strndup.m4 @@ -1,5 +1,5 @@ -# strndup.m4 serial 16 -dnl Copyright (C) 2002-2003, 2005-2009 Free Software Foundation, Inc. +# strndup.m4 serial 17 +dnl Copyright (C) 2002-2003, 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, dnl with or without modifications, as long as this notice is preserved. @@ -9,17 +9,20 @@ AC_DEFUN([gl_FUNC_STRNDUP], dnl Persuade glibc <string.h> to declare strndup(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([strndup]) + AC_CHECK_FUNCS_ONCE([strndup]) if test $ac_cv_have_decl_strndup = no; then HAVE_DECL_STRNDUP=0 fi - # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. - AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup], - [AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[#include <string.h> - #include <stdlib.h>]], [[ + if test $ac_cv_func_strndup = yes; then + # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. + AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], + [AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[#include <string.h> + #include <stdlib.h>]], [[ #ifndef HAVE_DECL_STRNDUP extern char *strndup (const char *, size_t); #endif @@ -28,26 +31,19 @@ AC_DEFUN([gl_FUNC_STRNDUP], free (s); s = strndup ("shorter string", 13); return s[13] != '\0';]])], - [gl_cv_func_strndup=yes], - [gl_cv_func_strndup=no], - [AC_CHECK_FUNC([strndup], - [AC_EGREP_CPP([too risky], [ -#ifdef _AIX - too risky -#endif - ], - [gl_cv_func_strndup=no], - [gl_cv_func_strndup=yes])], - [gl_cv_func_strndup=no])])]) - if test $gl_cv_func_strndup = yes; then - AC_DEFINE([HAVE_STRNDUP], [1], - [Define if you have the strndup() function and it works.]) + [gl_cv_func_strndup_works=yes], + [gl_cv_func_strndup_works=no], + [case $host_os in + aix*) gl_cv_func_strndup_works="guessing no";; + *) gl_cv_func_strndup_works="guessing yes";; + esac])]) + case $gl_cv_func_strndup_works in + *no) + REPLACE_STRNDUP=1 + AC_LIBOBJ([strndup]) + ;; + esac else - HAVE_STRNDUP=0 AC_LIBOBJ([strndup]) - gl_PREREQ_STRNDUP fi ]) - -# Prerequisites of lib/strndup.c. -AC_DEFUN([gl_PREREQ_STRNDUP], [:]) diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4 index 1c97859d..cd48948f 100644 --- a/gl/m4/strnlen.m4 +++ b/gl/m4/strnlen.m4 @@ -1,5 +1,6 @@ # strnlen.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 new file mode 100644 index 00000000..779957aa --- /dev/null +++ b/gl/m4/strstr.m4 @@ -0,0 +1,79 @@ +# strstr.m4 serial 7 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check that strstr works. +AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MEMCHR]) + if test "$gl_cv_func_memchr_works" != yes; then + REPLACE_STRSTR=1 + AC_LIBOBJ([strstr]) + fi +]) # gl_FUNC_STRSTR_SIMPLE + +dnl Additionally, check that strstr is efficient. +AC_DEFUN([gl_FUNC_STRSTR], +[ + AC_REQUIRE([gl_FUNC_STRSTR_SIMPLE]) + if test $REPLACE_STRSTR = 0; then + AC_CACHE_CHECK([whether strstr works in linear time], + [gl_cv_func_strstr_linear], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <signal.h> /* for signal */ +#include <string.h> /* for memmem */ +#include <stdlib.h> /* for malloc */ +#include <unistd.h> /* for alarm */ +]], [[size_t m = 1000000; + char *haystack = (char *) malloc (2 * m + 2); + char *needle = (char *) malloc (m + 2); + void *result = 0; + /* Failure to compile this test due to missing alarm is okay, + since all such platforms (mingw) also have quadratic strstr. */ + signal (SIGALRM, SIG_DFL); + alarm (5); + /* Check for quadratic performance. */ + if (haystack && needle) + { + memset (haystack, 'A', 2 * m); + haystack[2 * m] = 'B'; + haystack[2 * m + 1] = 0; + memset (needle, 'A', m); + needle[m] = 'B'; + needle[m + 1] = 0; + result = strstr (haystack, needle); + } + return !result;]])], + [gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no], + [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a + dnl strstr that works in linear time. + AC_EGREP_CPP([Lucky user], + [ +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2) + Lucky user + #endif +#endif +#ifdef __CYGWIN__ + #include <cygwin/version.h> + #if CYGWIN_VERSION_DLL_MAJOR >= 1007 + Lucky user + #endif +#endif + ], + [gl_cv_func_strstr_linear=yes], + [gl_cv_func_strstr_linear="guessing no"]) + ]) + ]) + if test "$gl_cv_func_strstr_linear" != yes; then + REPLACE_STRSTR=1 + fi + fi + if test $REPLACE_STRSTR = 1; then + AC_LIBOBJ([strstr]) + fi +]) # gl_FUNC_STRSTR diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index d1cb9c20..9f4db562 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,5 +1,5 @@ -# sys_socket_h.m4 serial 12 -dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 17 +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, dnl with or without modifications, as long as this notice is preserved. @@ -19,7 +19,6 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], [gl_cv_header_sys_socket_h_selfcontained=no]) ]) if test $gl_cv_header_sys_socket_h_selfcontained = yes; then - SYS_SOCKET_H='' dnl If the shutdown function exists, <sys/socket.h> should define dnl SHUT_RD, SHUT_WR, SHUT_RDWR. AC_CHECK_FUNCS([shutdown]) @@ -37,12 +36,10 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], SYS_SOCKET_H='sys/socket.h' fi fi - else - SYS_SOCKET_H='sys/socket.h' fi # We need to check for ws2tcpip.h now. gl_PREREQ_SYS_H_SOCKET - AC_CHECK_TYPES([struct sockaddr_storage],,,[ + AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ @@ -56,12 +53,23 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], ]) if test $ac_cv_type_struct_sockaddr_storage = no; then HAVE_STRUCT_SOCKADDR_STORAGE=0 - SYS_SOCKET_H='sys/socket.h' fi - if test -n "$SYS_SOCKET_H"; then - gl_PREREQ_SYS_H_WINSOCK2 + if test $ac_cv_type_sa_family_t = no; then + HAVE_SA_FAMILY_T=0 fi - AC_SUBST([SYS_SOCKET_H]) + gl_PREREQ_SYS_H_WINSOCK2 + + 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], @@ -88,7 +96,7 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], AC_SUBST([HAVE_WS2TCPIP_H]) ]) -# Common prerequisites of of the <sys/socket.h> replacement and of the +# Common prerequisites of the <sys/socket.h> replacement and of the # <sys/select.h> replacement. # Sets and substitutes HAVE_WINSOCK2_H. AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], @@ -117,7 +125,9 @@ AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], @@ -136,5 +146,8 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) + GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) + HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) + HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) ]) diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 new file mode 100644 index 00000000..7181c253 --- /dev/null +++ b/gl/m4/sys_stat_h.m4 @@ -0,0 +1,82 @@ +# sys_stat_h.m4 serial 24 -*- 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, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Eric Blake. +dnl Provide a GNU-like <sys/stat.h>. + +AC_DEFUN([gl_HEADER_SYS_STAT_H], +[ + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + dnl For the mkdir substitute. + AC_REQUIRE([AC_C_INLINE]) + + dnl Check for broken stat macros. + AC_REQUIRE([AC_HEADER_STAT]) + + gl_CHECK_NEXT_HEADERS([sys/stat.h]) + + dnl Define types that are supposed to be defined in <sys/types.h> or + dnl <sys/stat.h>. + AC_CHECK_TYPE([nlink_t], [], + [AC_DEFINE([nlink_t], [int], + [Define to the type of st_nlink in struct stat, or a supertype.])], + [#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], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR + GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) + GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) + GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) + GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) + GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) + GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) + GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) + GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) + GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) + GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) + GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) + GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) + HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) + HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) + HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) + HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) + HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) + HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) + HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) + HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) + REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) + REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) + REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) + REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) + REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) + REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) +]) diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index 3dd38aa8..05cc4ffa 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 @@ -1,5 +1,5 @@ -# threadlib.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. +# threadlib.m4 serial 5 (gettext-0.18) +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, dnl with or without modifications, as long as this notice is preserved. @@ -52,13 +52,24 @@ AC_HELP_STRING([--disable-threads], [build without multithread safety]), [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else +changequote(,)dnl case "$host_os" in dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). + dnl Disable multithreading by default on Cygwin 1.5.x, because it has + dnl bugs that lead to endless loops or crashes. See + dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. osf*) gl_use_threads=no ;; + cygwin*) + case `uname -r` in + 1.[0-5].*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + ;; *) gl_use_threads=yes ;; esac +changequote([,])dnl fi ]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then @@ -96,11 +107,34 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then dnl Check whether the compiler and linker support weak declarations. - AC_MSG_CHECKING([whether imported symbols can be declared weak]) - gl_have_weak=no - AC_TRY_LINK([extern void xyzzy (); -#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes]) - AC_MSG_RESULT([$gl_have_weak]) + AC_CACHE_CHECK([whether imported symbols can be declared weak], + [gl_cv_have_weak], + [gl_cv_have_weak=no + dnl First, test whether the compiler accepts it syntactically. + AC_TRY_LINK([extern void xyzzy (); +#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe]) + if test $gl_cv_have_weak = maybe; then + dnl Second, test whether it actually works. On Cygwin 1.7.2, with + dnl gcc 4.3, symbols declared weak always evaluate to the address 0. + AC_TRY_RUN([ +#include <stdio.h> +#pragma weak fputs +int main () +{ + return (fputs == NULL); +}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no], + [dnl When cross-compiling, assume that only ELF platforms support + dnl weak symbols. + AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_have_weak="guessing yes"], + [gl_cv_have_weak="guessing no"]) + ]) + fi + ]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. @@ -154,7 +188,7 @@ AC_DEFUN([gl_THREADLIB_BODY], AC_DEFINE([USE_POSIX_THREADS], [1], [Define if the POSIX multithreading library can be used.]) if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if test $gl_have_weak = yes; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], [Define if references to the POSIX multithreading library should be made weak.]) LIBTHREAD= @@ -182,7 +216,7 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBMULTITHREAD="$LTLIBTHREAD" AC_DEFINE([USE_SOLARIS_THREADS], [1], [Define if the old Solaris multithreading library can be used.]) - if test $gl_have_weak = yes; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], [Define if references to the old Solaris multithreading library should be made weak.]) LIBTHREAD= @@ -208,7 +242,7 @@ AC_DEFUN([gl_THREADLIB_BODY], AC_DEFINE([USE_PTH_THREADS], [1], [Define if the GNU Pth multithreading library can be used.]) if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if test $gl_have_weak = yes; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_PTH_THREADS_WEAK], [1], [Define if references to the GNU Pth multithreading library should be made weak.]) LIBTHREAD= diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index d42a635e..b88ba94d 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -1,7 +1,6 @@ # Configure a more-standard replacement for <time.h>. -# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software -# Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -24,17 +23,6 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY], AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) ]) -AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], -[ - dnl If another module says to replace or to not replace, do that. - dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; - dnl this lets maintainers check for portability. - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) - REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME]) - REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) -]) - dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared dnl in time.h or sys/time.h. @@ -45,9 +33,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [gl_cv_sys_struct_timespec_in_time_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[#include <time.h> - ]], - [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [[#include <time.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], [gl_cv_sys_struct_timespec_in_time_h=yes], [gl_cv_sys_struct_timespec_in_time_h=no])]) @@ -59,12 +47,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], AC_CACHE_CHECK([for struct timespec in <sys/time.h>], [gl_cv_sys_struct_timespec_in_sys_time_h], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/time.h> - ]], - [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], - [gl_cv_sys_struct_timespec_in_sys_time_h=yes], - [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) + [AC_LANG_PROGRAM( + [[#include <sys/time.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_sys_time_h=yes], + [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 fi @@ -72,3 +60,33 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) ]) + +AC_DEFUN([gl_TIME_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], +[ + GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) + GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) + GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) + GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) + GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_LOCALTIME_R=1; AC_SUBST([HAVE_LOCALTIME_R]) + HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) + HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) + HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) + dnl If another module says to replace or to not replace, do that. + dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; + dnl this lets maintainers check for portability. + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) +]) diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index c871b56d..9e82d39f 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 @@ -1,6 +1,6 @@ -dnl Reentrant time functions like localtime_r. +dnl Reentrant time functions: localtime_r, gmtime_r. -dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. @@ -9,29 +9,40 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_R], [ - dnl Persuade glibc and Solaris <time.h> to declare localtime_r. + dnl Persuade glibc and Solaris <time.h> to declare localtime_r. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], - [gl_cv_time_r_posix], - [AC_TRY_COMPILE( - [#include <time.h>], - [/* We don't need to append 'restrict's to the argument types, - even though the POSIX signature has the 'restrict's, - since C99 says they can't affect type compatibility. */ - struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; - if (ptr) return 0; - /* Check the return type is a pointer. On HP-UX 10 it is 'int'. */ - *localtime_r (0, 0);], - [gl_cv_time_r_posix=yes], - [gl_cv_time_r_posix=no])]) - if test $gl_cv_time_r_posix = yes; then - REPLACE_LOCALTIME_R=0 + AC_CHECK_FUNCS_ONCE([localtime_r]) + if test $ac_cv_func_localtime_r = yes; then + AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature], + [gl_cv_time_r_posix], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <time.h>]], + [[/* We don't need to append 'restrict's to the argument types, + even though the POSIX signature has the 'restrict's, + since C99 says they can't affect type compatibility. */ + struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r; + if (ptr) return 0; + /* Check the return type is a pointer. + On HP-UX 10 it is 'int'. */ + *localtime_r (0, 0);]]) + ], + [gl_cv_time_r_posix=yes], + [gl_cv_time_r_posix=no]) + ]) + if test $gl_cv_time_r_posix = yes; then + REPLACE_LOCALTIME_R=0 + else + REPLACE_LOCALTIME_R=1 + fi else - REPLACE_LOCALTIME_R=1 + HAVE_LOCALTIME_R=0 + fi + if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then AC_LIBOBJ([time_r]) gl_PREREQ_TIME_R fi diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index be323c9b..bdaafbff 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 @@ -1,5 +1,5 @@ -# timegm.m4 serial 6 -dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc. +# timegm.m4 serial 8 +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. @@ -8,18 +8,18 @@ AC_DEFUN([gl_FUNC_TIMEGM], [ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME]) - if test $ac_cv_func_working_mktime = no; then - # Assume that timegm is buggy if mktime is. - AC_LIBOBJ([timegm]) - ac_cv_func_timegm=no - else - AC_REPLACE_FUNCS([timegm]) - fi - REPLACE_TIMEGM=1 + REPLACE_TIMEGM=0 + AC_CHECK_FUNCS_ONCE([timegm]) if test $ac_cv_func_timegm = yes; then - AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include <time.h>]) + if test $ac_cv_func_working_mktime = no; then + # Assume that timegm is buggy if mktime is. + REPLACE_TIMEGM=1 + fi + else + HAVE_TIMEGM=0 fi - if test $REPLACE_TIMEGM = 1; then + if test $HAVE_TIMEGM = 0 || test $REPLACE_TIMEGM = 1; then + AC_LIBOBJ([timegm]) gl_PREREQ_TIMEGM fi ]) @@ -34,7 +34,7 @@ AC_DEFUN([gl_PREREQ_TIMEGM], [ # so we need to substitute our own mktime implementation. AC_LIBOBJ([mktime]) AC_DEFINE([mktime], [rpl_mktime], - [Define to rpl_mktime if the replacement function should be used.]) + [Define to rpl_mktime if the replacement function should be used.]) gl_PREREQ_MKTIME]) fi ]) diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4 index 734b6933..03b51bcf 100644 --- a/gl/m4/uintmax_t.m4 +++ b/gl/m4/uintmax_t.m4 @@ -1,5 +1,5 @@ # uintmax_t.m4 serial 12 -dnl Copyright (C) 1997-2004, 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/unistd-safer.m4 b/gl/m4/unistd-safer.m4 index 09adf931..74c3ce60 100644 --- a/gl/m4/unistd-safer.m4 +++ b/gl/m4/unistd-safer.m4 @@ -1,5 +1,5 @@ #serial 8 -dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index ff9a4ea0..8c2eec64 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 17 -dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. +# unistd_h.m4 serial 45 +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, dnl with or without modifications, as long as this notice is preserved. @@ -11,6 +11,7 @@ AC_DEFUN([gl_UNISTD_H], dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -21,13 +22,33 @@ AC_DEFUN([gl_UNISTD_H], HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_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 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 + ]], [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 ttyname_r unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_UNISTD_H_DEFAULTS], @@ -35,49 +56,99 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) + GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) + GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) + GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) + GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) + GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) + GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) + GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) + GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) + HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) + HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) + HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) + HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) - HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) + HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) + HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) + HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) + HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) + HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) + HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) + HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) + HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) - REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) + REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) + REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) + REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) + REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) + REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) + REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) + REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) + REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) ]) diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 3a1d1e01..50a20cca 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,5 +1,5 @@ # vasnprintf.m4 serial 29 -dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 074b03cf..b142bc0f 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 @@ -1,5 +1,6 @@ # vasprintf.m4 serial 6 -dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2006-2007, 2009-2010 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index 70bca564..6d3f9c9d 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 @@ -1,5 +1,5 @@ # visibility.m4 serial 2 (gettext-0.18) -dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 3b37d460..ed189c23 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 @@ -1,5 +1,5 @@ # vsnprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 new file mode 100644 index 00000000..42daae87 --- /dev/null +++ b/gl/m4/warn-on-use.m4 @@ -0,0 +1,45 @@ +# warn-on-use.m4 serial 2 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. + +# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) +# --------------------------------------- +# For each whitespace-separated element in the list of NAMES, define +# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES +# even after being undefined as a macro. +# +# See warn-on-use.h for some hints on how to poison function names, as +# well as ideas on poisoning global variables and macros. NAMES may +# include global variables, but remember that only functions work with +# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single +# header, but if the replacement header pulls in other headers because +# some systems declare functions in the wrong header, then INCLUDES +# should do likewise. +# +# If you assume C89, then it is generally safe to assume declarations +# for functions declared in that standard (such as gets) without +# needing gl_WARN_ON_USE_PREPARE. +AC_DEFUN([gl_WARN_ON_USE_PREPARE], +[ + m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + gl_Symbol, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], +[@%:@undef $gl_func + (void) $gl_func;])], + [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) + AS_VAR_IF(gl_Symbol, [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done +]) diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar_h.m4 index 2e52a82a..8cae82dd 100644 --- a/gl/m4/wchar.m4 +++ b/gl/m4/wchar_h.m4 @@ -1,23 +1,30 @@ dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. -dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar.m4 serial 23 +# wchar_h.m4 serial 33 AC_DEFUN([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - AC_CACHE_CHECK([whether <wchar.h> is standalone], - [gl_cv_header_wchar_h_standalone], - [AC_COMPILE_IFELSE([[#include <wchar.h> -wchar_t w;]], - [gl_cv_header_wchar_h_standalone=yes], - [gl_cv_header_wchar_h_standalone=no])]) + AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) + dnl Prepare for creating substitute <wchar.h>. + dnl Check for <wchar.h> (missing in Linux uClibc when built without wide + dnl character support). + dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. + AC_CHECK_HEADERS_ONCE([wchar.h]) + gl_CHECK_NEXT_HEADERS([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then @@ -27,36 +34,82 @@ wchar_t w;]], fi AC_SUBST([HAVE_WINT_T]) - if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then - WCHAR_H=wchar.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([[ +/* 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 Prepare for creating substitute <wchar.h>. - dnl Do it always: WCHAR_H may be empty here but can be set later. - dnl Check for <wchar.h> (missing in Linux uClibc when built without wide - dnl character support). - AC_CHECK_HEADERS_ONCE([wchar.h]) - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 +dnl Check whether <wchar.h> is usable at all. +AC_DEFUN([gl_WCHAR_H_INLINE_OK], +[ + dnl Test whether <wchar.h> suffers due to the transition from '__inline' to + dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022> + dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, + dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and + dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. + AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], + [gl_cv_header_wchar_h_correct_inline], + [gl_cv_header_wchar_h_correct_inline=yes + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod +#include <wchar.h> +extern int zero (void); +int main () { return zero(); } +]])]) + if AC_TRY_EVAL([ac_compile]); then + mv conftest.$ac_objext conftest1.$ac_objext + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod +#include <wchar.h> +int zero (void) { return 0; } +]])]) + if AC_TRY_EVAL([ac_compile]); then + mv conftest.$ac_objext conftest2.$ac_objext + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi + fi + rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + ]) + if test $gl_cv_header_wchar_h_correct_inline = no; then + AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). +This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in +C99 mode. You have four options: + - Add the flag -fgnu89-inline to CC and reconfigure, or + - Fix your include files, using parts of + <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or + - Use a gcc version older than 4.3, or + - Don't use the flags -std=c99 or -std=gnu99. +Configuration aborted.]) fi - AC_SUBST([HAVE_WCHAR_H]) - gl_CHECK_NEXT_HEADERS([wchar.h]) ]) dnl Unconditionally enables the replacement of <wchar.h>. AC_DEFUN([gl_REPLACE_WCHAR_H], [ - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - WCHAR_H=wchar.h + dnl This is a no-op, because <wchar.h> is always overridden. + : ]) AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) AC_DEFUN([gl_WCHAR_H_DEFAULTS], @@ -96,5 +149,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) - WCHAR_H=''; AC_SUBST([WCHAR_H]) ]) diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index fb27a7f6..ed804e66 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 3 (gettext-0.18) -dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index cb7d9263..6a2d772a 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 @@ -1,5 +1,5 @@ -# wcrtomb.m4 serial 4 -dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. +# wcrtomb.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, dnl with or without modifications, as long as this notice is preserved. @@ -10,37 +10,37 @@ AC_DEFUN([gl_FUNC_WCRTOMB], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_WCRTOMB=1 - fi + AC_CHECK_FUNCS_ONCE([wcrtomb]) if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 - fi - if test $HAVE_WCRTOMB != 0 && test $REPLACE_WCRTOMB != 1; then - dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes - dnl returns 0 instead of 1. - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) - AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([gt_LOCALE_ZH_CN]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_CACHE_CHECK([whether wcrtomb return value is correct], - [gl_cv_func_wcrtomb_retval], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_WCRTOMB=1 + else + dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes + dnl returns 0 instead of 1. + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gt_LOCALE_FR]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether wcrtomb return value is correct], + [gl_cv_func_wcrtomb_retval], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. changequote(,)dnl - case "$host_os" in - # Guess no on AIX 4, OSF/1 and Solaris. - aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_wcrtomb_retval="guessing yes" ;; - esac + case "$host_os" in + # Guess no on AIX 4, OSF/1 and Solaris. + aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_wcrtomb_retval="guessing yes" ;; + esac changequote([,])dnl - if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then - AC_TRY_RUN([ + if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then + AC_TRY_RUN([ #include <locale.h> #include <stdio.h> #include <string.h> @@ -69,15 +69,16 @@ int main () } return 0; }], - [gl_cv_func_wcrtomb_retval=yes], - [gl_cv_func_wcrtomb_retval=no], - [:]) - fi - ]) - case "$gl_cv_func_wcrtomb_retval" in - *yes) ;; - *) REPLACE_WCRTOMB=1 ;; - esac + [gl_cv_func_wcrtomb_retval=yes], + [gl_cv_func_wcrtomb_retval=no], + [:]) + fi + ]) + case "$gl_cv_func_wcrtomb_retval" in + *yes) ;; + *) REPLACE_WCRTOMB=1 ;; + esac + fi fi if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then gl_REPLACE_WCHAR_H diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype_h.m4 index 6a1b6f07..32924514 100644 --- a/gl/m4/wctype.m4 +++ b/gl/m4/wctype_h.m4 @@ -1,8 +1,8 @@ -# wctype.m4 serial 2 +# wctype_h.m4 serial 6 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. -dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. +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, dnl with or without modifications, as long as this notice is preserved. @@ -12,6 +12,7 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_WCTYPE_H], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([iswcntrl]) if test $ac_cv_func_iswcntrl = yes; then HAVE_ISWCNTRL=1 @@ -19,6 +20,13 @@ AC_DEFUN([gl_WCTYPE_H], HAVE_ISWCNTRL=0 fi AC_SUBST([HAVE_ISWCNTRL]) + AC_CHECK_FUNCS_ONCE([iswblank]) + if test $ac_cv_func_iswblank = yes; then + HAVE_ISWBLANK=1 + else + HAVE_ISWBLANK=0 + fi + AC_SUBST([HAVE_ISWBLANK]) AC_CHECK_HEADERS_ONCE([wctype.h]) AC_REQUIRE([AC_C_INLINE]) @@ -30,40 +38,34 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WINT_T]) - WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then dnl Linux libc5 has an iswprint function that returns 0 for all arguments. dnl The other functions are likely broken in the same way. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], [ - AC_TRY_RUN([#include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> - #include <wctype.h> - int main () { return iswprint ('x') == 0; }], + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <stddef.h> + #include <stdio.h> + #include <time.h> + #include <wchar.h> + #include <wctype.h> + int main () { return iswprint ('x') == 0; }]])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], - [AC_TRY_COMPILE([#include <stdlib.h> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. - #endif], [], + #endif]], [])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) ]) ]) - if test $gl_cv_func_iswcntrl_works = yes; then - WCTYPE_H= - fi fi - dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, - dnl for the benefit of builds from non-distclean directories. gl_CHECK_NEXT_HEADERS([wctype.h]) HAVE_WCTYPE_H=1 else HAVE_WCTYPE_H=0 fi AC_SUBST([HAVE_WCTYPE_H]) - AC_SUBST([WCTYPE_H]) if test "$gl_cv_func_iswcntrl_works" = no; then REPLACE_ISWCNTRL=1 diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index 47a4363d..a6c7d15c 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,5 +1,5 @@ # wint_t.m4 serial 4 (gettext-0.18) -dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/write.m4 b/gl/m4/write.m4 index 812b19b3..56325aba 100644 --- a/gl/m4/write.m4 +++ b/gl/m4/write.m4 @@ -1,5 +1,5 @@ # write.m4 serial 1 -dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index 837a948c..83247fe3 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 @@ -1,5 +1,6 @@ # xalloc.m4 serial 16 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index 631893cf..b653693a 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 @@ -1,5 +1,5 @@ # xsize.m4 serial 4 -dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xstrndup.m4 b/gl/m4/xstrndup.m4 index 8a30ab15..74302cc9 100644 --- a/gl/m4/xstrndup.m4 +++ b/gl/m4/xstrndup.m4 @@ -1,5 +1,5 @@ # xstrndup.m4 serial 2 -dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. |