diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
commit | bd7029a99b0c2974265c6665638ef14a052f42ab (patch) | |
tree | f5661ba73366d81ef6e91f889ea7fec5ebe07b6b /gl/m4 | |
parent | f99612320d6eda67644c07be04bb21aa4d7789db (diff) | |
download | monitoring-plugins-bd7029a99b0c2974265c6665638ef14a052f42ab.tar.gz |
Sync to latest Gnulib
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1925 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4')
54 files changed, 1612 insertions, 621 deletions
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 index c649df08..5b7a2fc3 100644 --- a/gl/m4/absolute-header.m4 +++ b/gl/m4/absolute-header.m4 @@ -1,5 +1,5 @@ -# absolute-header.m4 serial 6 -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# absolute-header.m4 serial 7 +dnl Copyright (C) 2006, 2007 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. @@ -32,7 +32,12 @@ dnl eval is necessary to expand ac_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. AS_VAR_SET(gl_absolute_header, [`(eval "$ac_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;}'`]) +sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ + s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# + s#^/[^/]#//&# + p + q +}'`]) fi AS_VAR_POPDEF([ac_header_exists])dnl ])dnl diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index eb62e0e7..95f54a6d 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 7 -dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. +# alloca.m4 serial 8 +dnl Copyright (C) 2002-2004, 2006, 2007 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. @@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) - - AC_DEFINE(HAVE_ALLOCA_H, 1, - [Define HAVE_ALLOCA_H for backward compatibility with older code - that includes <alloca.h> only if HAVE_ALLOCA_H is defined.]) ]) # Prerequisites of lib/alloca.c. diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 143a9e54..bcbb3cee 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 @@ -1,14 +1,14 @@ -# serial 4 -*- Autoconf -*- +# serial 5 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -16,26 +16,48 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], -[ - AC_BEFORE([$0], [AC_COMPILE_IFELSE]) - AC_BEFORE([$0], [AC_RUN_IFELSE]) +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_AIX]) - AC_REQUIRE([AC_MINIX]) + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE #endif +/* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE -#endif]) +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( @@ -46,9 +68,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) -]) +])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 new file mode 100644 index 00000000..d36e3a46 --- /dev/null +++ b/gl/m4/float_h.m4 @@ -0,0 +1,19 @@ +# float_h.m4 serial 3 +dnl Copyright (C) 2007 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_FLOAT_H], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + FLOAT_H= + case "$host_os" in + beos* | openbsd*) + FLOAT_H=float.h + gl_CHECK_NEXT_HEADERS([float.h]) + ;; + esac + AC_SUBST([FLOAT_H]) +]) diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 08bf06c9..18eedbca 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 @@ -1,8 +1,7 @@ -#serial 22 +#serial 23 # Obtaining file system usage information. -# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software -# Foundation, Inc. +# Copyright (C) 1997, 1998, 2000, 2001, 2003-2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -55,6 +54,11 @@ one of the corresponding file systems is hard-mounted, but not available. statvfs in GNU libc on BeOS operates differently: it only makes a system call. #endif + +#ifdef __osf__ +"Do not use Tru64's statvfs implementation" +#endif + #include <sys/statvfs.h>], [struct statvfs fsd; statvfs (0, &fsd);], fu_cv_sys_stat_statvfs=yes, diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index db285d94..5d36c195 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,15 +1,31 @@ -# getaddrinfo.m4 serial 11 -dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +# getaddrinfo.m4 serial 15 +dnl Copyright (C) 2004, 2005, 2006, 2007 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_GETADDRINFO], [ + AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) + AC_CHECK_HEADERS_ONCE(netdb.h) + AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) - AC_CHECK_FUNCS(getaddrinfo,, [ + AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ + AC_TRY_LINK([ +#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#include <stddef.h> +], [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=no @@ -19,21 +35,46 @@ AC_DEFUN([gl_GETADDRINFO], #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif -], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) +#include <stddef.h> +], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) LIBS="$am_save_LIBS"]) if test "$gl_cv_w32_getaddrinfo" = "yes"; then LIBS="$LIBS -lws2_32" else AC_LIBOBJ(getaddrinfo) fi - ]) + fi + + # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an + # inline function declared in ws2tcpip.h, so we need to get that + # header included somehow. + AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], + gl_cv_func_gai_strerror, [ + AC_TRY_LINK([ +#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> +#endif +#include <stddef.h> +], [gai_strerror (NULL);], + [gl_cv_func_gai_strerror=yes], + [gl_cv_func_gai_strerror=no])]) + if test $gl_cv_func_gai_strerror = no; then + AC_LIBOBJ(gai_strerror) + fi - AC_REPLACE_FUNCS(gai_strerror) gl_PREREQ_GETADDRINFO ]) # Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. AC_DEFUN([gl_PREREQ_GETADDRINFO], [ + AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_SEARCH_LIBS(gethostbyname, [inet nsl]) AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) AC_CHECK_FUNCS(gethostbyname,, [ @@ -46,7 +87,8 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif -], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes) +#include <stddef.h> +], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes) LIBS="$am_save_LIBS"]) if test "$gl_cv_w32_gethostbyname" = "yes"; then LIBS="$LIBS -lws2_32" @@ -56,7 +98,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 82437291..c1547c74 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 @@ -31,6 +31,10 @@ AC_CHECK_FUNCS(pstat_getdynamic) AC_CHECK_LIB(kstat, kstat_open) test $ac_cv_lib_kstat_kstat_open = yes && gl_have_func=yes +# AIX has libperfstat which does not require root +AC_CHECK_LIB(perfstat, perfstat_cpu_total) +test $ac_cv_lib_perfstat_perfstat_cpu_total = yes && gl_have_func=yes + # Some systems with -lutil have (and need) -lkvm as well, some do not. # On Solaris, -lkvm requires nlist from -lelf, so check that first # to get the right answer into the cache. diff --git a/gl/m4/gettext.m4 b/gl/m4/gettext.m4 index 91c345e9..c9ae1f7d 100644 --- a/gl/m4/gettext.m4 +++ b/gl/m4/gettext.m4 @@ -1,5 +1,5 @@ -# gettext.m4 serial 59 (gettext-0.16.1) -dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. +# gettext.m4 serial 60 (gettext-0.17) +dnl Copyright (C) 1995-2007 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. @@ -362,44 +362,6 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a ]) -dnl Checks for special options needed on MacOS X. -dnl Defines INTL_MACOSX_LIBS. -AC_DEFUN([gt_INTL_MACOSX], -[ - dnl Check for API introduced in MacOS X 10.2. - AC_CACHE_CHECK([for CFPreferencesCopyAppValue], - gt_cv_func_CFPreferencesCopyAppValue, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], - [CFPreferencesCopyAppValue(NULL, NULL)], - [gt_cv_func_CFPreferencesCopyAppValue=yes], - [gt_cv_func_CFPreferencesCopyAppValue=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then - AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, - [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) - fi - dnl Check for API introduced in MacOS X 10.3. - AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, - [gt_save_LIBS="$LIBS" - LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" - AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], - [gt_cv_func_CFLocaleCopyCurrent=yes], - [gt_cv_func_CFLocaleCopyCurrent=no]) - LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, - [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) - fi - INTL_MACOSX_LIBS= - if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then - INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" - fi - AC_SUBST([INTL_MACOSX_LIBS]) -]) - - dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. m4_define([gt_NEEDS_INIT], [ diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index e78c8604..6da4d657 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf +# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --aux-dir=build-aux --no-libtool --macro-prefix=gl dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mountlist regex vasprintf vsnprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -23,8 +23,10 @@ gl_MODULES([dirname fsusage getaddrinfo gethostname getloadavg getopt gettext mo gl_AVOID([]) gl_SOURCE_BASE([gl]) gl_M4_BASE([gl/m4]) +gl_PO_BASE([]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libgnu]) gl_MAKEFILE_NAME([]) gl_MACRO_PREFIX([gl]) +gl_PO_DOMAIN([]) diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index 53980108..9336d726 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 2 +# gnulib-common.m4 serial 3 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' AC_SUBST([MKDIR_P])])]) + +# AC_C_RESTRICT +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ +# works. +# This definition can be removed once autoconf >= 2.62 can be assumed. +AC_DEFUN([AC_C_RESTRICT], +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict, + [ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require 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 s[1]; + 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 + ]) + AH_VERBATIM([restrict], +[/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif]) + case $ac_cv_c_restrict in + restrict) ;; + no) AC_DEFINE([restrict], []) ;; + *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; + esac +]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index ed4da7d9..a17e36ad 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -27,78 +27,94 @@ AC_DEFUN([gl_EARLY], AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_LOCK_EARLY]) ]) # This macro should be invoked from ./configure.in, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ - 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])) AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) gl_cond_libtool=false gl_libdeps= gl_ltlibdeps= + 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])) gl_source_base='gl' gl_FUNC_ALLOCA gl_HEADER_ARPA_INET + AC_PROG_MKDIR_P gl_C_STRTOD gl_CLOEXEC gl_DIRNAME gl_DOUBLE_SLASH_ROOT 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 - dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. gl_FCNTL_SAFER gl_MODULE_INDICATOR([fcntl-safer]) + gl_FLOAT_H gl_FSUSAGE gl_GETADDRINFO gl_FUNC_GETHOSTNAME gl_GETLOADAVG([$gl_source_base]) gl_GETOPT dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. - AM_GNU_GETTEXT_VERSION([0.15]) + AM_GNU_GETTEXT_VERSION([0.17]) + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) gl_INET_NTOP gl_INLINE + gl_LOCALCHARSET + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) AC_FUNC_MALLOC - gl_MBCHAR - gl_MBITER - gl_FUNC_MEMCHR - gl_MINMAX + AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.]) + gl_FUNC_MALLOC_POSIX + gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_MOUNTLIST gl_HEADER_NETINET_IN + AC_PROG_MKDIR_P gl_REGEX gl_SAFE_READ gl_SAFE_WRITE gl_SIZE_MAX gl_FUNC_SNPRINTF + gl_STDIO_MODULE_INDICATOR([snprintf]) gl_TYPE_SOCKLEN_T gt_TYPE_SSIZE_T AM_STDBOOL_H gl_STDINT_H - gl_STRCASE + gl_STDIO_H + gl_STDLIB_H gl_FUNC_STRDUP + gl_STRING_MODULE_INDICATOR([strdup]) + gl_FUNC_STRERROR + gl_STRING_MODULE_INDICATOR([strerror]) + gl_HEADER_STRING_H gl_FUNC_STRNDUP + gl_STRING_MODULE_INDICATOR([strndup]) gl_FUNC_STRNLEN + gl_STRING_MODULE_INDICATOR([strnlen]) gl_HEADER_SYS_SOCKET AC_PROG_MKDIR_P - gl_HEADER_UNISTD + gl_UNISTD_H gl_UNISTD_SAFER gl_FUNC_VASNPRINTF 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])]) gl_FUNC_VSNPRINTF + gl_STDIO_MODULE_INDICATOR([vsnprintf]) gl_WCHAR_H gl_WCTYPE_H - gl_FUNC_WCWIDTH gl_XALLOC gl_XSIZE gl_XSTRNDUP - LIBGNU_LIBDEPS="$gl_libdeps" - AC_SUBST([LIBGNU_LIBDEPS]) - LIBGNU_LTLIBDEPS="$gl_ltlibdeps" - AC_SUBST([LIBGNU_LTLIBDEPS]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) @@ -116,29 +132,112 @@ AC_DEFUN([gl_INIT], AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ]) + gltests_libdeps= + gltests_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) + gl_source_base='tests' + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + gltests_libobjs= + gltests_ltlibobjs= + 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 + gltests_libobjs="$gltests_libobjs $i.$ac_objext" + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" + done + fi + AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) + AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) + ]) + LIBGNU_LIBDEPS="$gl_libdeps" + AC_SUBST([LIBGNU_LIBDEPS]) + LIBGNU_LTLIBDEPS="$gl_ltlibdeps" + AC_SUBST([LIBGNU_LTLIBDEPS]) ]) # Like AC_LIBOBJ, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([gl_LIBOBJ], - [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"]) +AC_DEFUN([gl_LIBOBJ], [ + AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl + gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" +]) + +# m4_foreach_w is provided by autoconf-2.59c and later. +# This definition is to accommodate developers using versions +# of autoconf older than that. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([gl_REPLACE_FUNCS], - [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])]) +AC_DEFUN([gl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r gl/]_gl_NAME[ || test ! -d gl])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing gl/]_gl_NAME)]) + ]) + ]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_LIBOBJ], [ + AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl + gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" +]) + +# m4_foreach_w is provided by autoconf-2.59c and later. +# This definition is to accommodate developers using versions +# of autoconf older than that. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) -# Like AC_LIBSOURCES, except that it does nothing. -# We rely on EXTRA_lib..._SOURCES instead. -AC_DEFUN([gl_LIBSOURCES], - []) +# Like AC_REPLACE_FUNCS, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gltests_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing tests/]_gl_NAME)]) + ]) + ]) +]) # 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/config.rpath + build-aux/link-warning.h lib/alloca.c - lib/alloca_.h + lib/alloca.in.h lib/asnprintf.c lib/asprintf.c lib/basename.c @@ -146,18 +245,20 @@ AC_DEFUN([gl_FILE_LIST], [ lib/c-strtod.h lib/cloexec.c lib/cloexec.h + lib/config.charset lib/creat-safer.c lib/dirname.c lib/dirname.h lib/dup-safer.c lib/error.c lib/error.h - lib/exit.h lib/exitfail.c lib/exitfail.h lib/fcntl--.h lib/fcntl-safer.h lib/fd-safer.c + lib/float+.h + lib/float.in.h lib/fsusage.c lib/fsusage.h lib/full-read.c @@ -170,27 +271,27 @@ AC_DEFUN([gl_FILE_LIST], [ lib/gethostname.c lib/getloadavg.c lib/getopt.c + lib/getopt.in.h lib/getopt1.c - lib/getopt_.h lib/getopt_int.h lib/gettext.h lib/inet_ntop.c lib/inet_ntop.h lib/intprops.h + lib/localcharset.c + lib/localcharset.h lib/malloc.c - lib/mbchar.c - lib/mbchar.h - lib/mbuiter.h - lib/memchr.c - lib/minmax.h lib/mountlist.c lib/mountlist.h + lib/netinet_in.in.h lib/open-safer.c lib/pipe-safer.c lib/printf-args.c lib/printf-args.h lib/printf-parse.c lib/printf-parse.h + lib/ref-add.sin + lib/ref-del.sin lib/regcomp.c lib/regex.c lib/regex.h @@ -203,34 +304,26 @@ AC_DEFUN([gl_FILE_LIST], [ lib/safe-write.h lib/size_max.h lib/snprintf.c - lib/snprintf.h - lib/socket_.h - lib/stdbool_.h - lib/stdint_.h - lib/strcase.h - lib/strcasecmp.c + lib/stdbool.in.h + lib/stdint.in.h + lib/stdio.in.h + lib/stdlib.in.h lib/strdup.c - lib/strdup.h + lib/strerror.c + lib/string.in.h lib/stripslash.c - lib/strncasecmp.c lib/strndup.c - lib/strndup.h lib/strnlen.c - lib/strnlen.h - lib/strnlen1.c - lib/strnlen1.h + lib/sys_socket.in.h lib/unistd--.h lib/unistd-safer.h - lib/unistd_.h + lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c - lib/vasprintf.h lib/vsnprintf.c - lib/vsnprintf.h - lib/wchar_.h - lib/wctype_.h - lib/wcwidth.h + lib/wchar.in.h + lib/wctype.in.h lib/xalloc-die.c lib/xalloc.h lib/xmalloc.c @@ -251,6 +344,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/exitfail.m4 m4/extensions.m4 m4/fcntl-safer.m4 + m4/float_h.m4 m4/fstypename.m4 m4/fsusage.m4 m4/getaddrinfo.m4 @@ -262,11 +356,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/glibc21.m4 m4/gnulib-common.m4 m4/iconv.m4 + m4/include_next.m4 m4/inet_ntop.m4 m4/inline.m4 m4/intdiv0.m4 m4/intl.m4 m4/intldir.m4 + m4/intlmacosx.m4 m4/intmax.m4 m4/intmax_t.m4 m4/inttypes-pri.m4 @@ -275,15 +371,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 + m4/localcharset.m4 m4/lock.m4 - m4/longdouble.m4 m4/longlong.m4 m4/ls-mntd-fs.m4 - m4/mbchar.m4 - m4/mbiter.m4 - m4/mbrtowc.m4 - m4/memchr.m4 - m4/minmax.m4 + m4/malloc.m4 m4/mountlist.m4 m4/netinet_in_h.m4 m4/nls.m4 @@ -302,13 +394,15 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stdbool.m4 m4/stdint.m4 m4/stdint_h.m4 - m4/strcase.m4 + m4/stdio_h.m4 + m4/stdlib_h.m4 m4/strdup.m4 + m4/strerror.m4 + m4/string_h.m4 m4/strndup.m4 m4/strnlen.m4 m4/sys_socket_h.m4 m4/uintmax_t.m4 - m4/ulonglong.m4 m4/unistd-safer.m4 m4/unistd_h.m4 m4/vasnprintf.m4 @@ -318,7 +412,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wchar.m4 m4/wchar_t.m4 m4/wctype.m4 - m4/wcwidth.m4 m4/wint_t.m4 m4/xalloc.m4 m4/xsize.m4 diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4 index 654c4158..66bc76f4 100644 --- a/gl/m4/iconv.m4 +++ b/gl/m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial AM4 (gettext-0.11.3) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +# iconv.m4 serial AM6 (gettext-0.17) +dnl Copyright (C) 2000-2002, 2007 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. @@ -21,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. @@ -33,7 +34,7 @@ AC_DEFUN([AM_ICONV_LINK], am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include <stdlib.h> @@ -56,7 +57,85 @@ AC_DEFUN([AM_ICONV_LINK], fi ]) if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + 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. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include <iconv.h> +#include <string.h> +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + 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_utf8_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. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, + [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 new file mode 100644 index 00000000..7ce472bc --- /dev/null +++ b/gl/m4/include_next.m4 @@ -0,0 +1,107 @@ +# include_next.m4 serial 4 +dnl Copyright (C) 2006, 2007 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 Paul Eggert and Derek Price. + +AC_DEFUN([gl_INCLUDE_NEXT], +[ + AC_LANG_PREPROC_REQUIRE() + AC_CACHE_CHECK([whether the preprocessor supports include_next], + [gl_cv_have_include_next], + [rm -rf conftestd1 conftestd2 + mkdir conftestd1 conftestd2 + cat <<EOF > conftestd1/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next <conftest.h> +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat <<EOF > conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2" + AC_COMPILE_IFELSE([#include <conftest.h>], + [gl_cv_have_include_next=yes], + [gl_cv_have_include_next=no]) + CPPFLAGS="$save_CPPFLAGS" + rm -rf conftestd1 conftestd2 + ]) + if test $gl_cv_have_include_next = yes; then + + dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it + dnl to use @INCLUDE_NEXT@ instead. + AC_DEFINE([HAVE_INCLUDE_NEXT], 1, + [Define if your compiler supports the #include_next directive.]) + + INCLUDE_NEXT=include_next + else + INCLUDE_NEXT=include + fi + AC_SUBST([INCLUDE_NEXT]) +]) + +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------------ +# 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. +# That way, a header file with the following line: +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# behaves (after sed substitution) as if it contained +# #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". +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +AC_DEFUN([gl_CHECK_NEXT_HEADERS], +[ + AC_REQUIRE([gl_INCLUDE_NEXT]) + AC_CHECK_HEADERS_ONCE([$1]) + + AC_FOREACH([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_next_header], + [gl_cv_next_]m4_quote(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 eval is necessary to expand ac_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_next_header], + ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + 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])]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), + [AS_VAR_GET([gl_next_header])]) + AS_VAR_POPDEF([gl_next_header])]) +]) diff --git a/gl/m4/intdiv0.m4 b/gl/m4/intdiv0.m4 index b8d78176..8c8a6708 100644 --- a/gl/m4/intdiv0.m4 +++ b/gl/m4/intdiv0.m4 @@ -1,5 +1,5 @@ -# intdiv0.m4 serial 1 (gettext-0.11.3) -dnl Copyright (C) 2002 Free Software Foundation, Inc. +# intdiv0.m4 serial 2 (gettext-0.17) +dnl Copyright (C) 2002, 2007 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. @@ -14,16 +14,27 @@ AC_DEFUN([gt_INTDIV0], AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], gt_cv_int_divbyzero_sigfpe, [ - AC_TRY_RUN([ + gt_cv_int_divbyzero_sigfpe= +changequote(,)dnl + case "$host_os" in + macos* | darwin[6-9]* | darwin[1-9][0-9]*) + # On MacOS X 10.2 or newer, just assume the same as when cross- + # compiling. If we were to perform the real test, 1 Crash Report + # dialog window would pop up. + case "$host_cpu" in + i[34567]86 | x86_64) + gt_cv_int_divbyzero_sigfpe="guessing yes" ;; + esac + ;; + esac +changequote([,])dnl + if test -z "$gt_cv_int_divbyzero_sigfpe"; then + AC_TRY_RUN([ #include <stdlib.h> #include <signal.h> static void -#ifdef __cplusplus sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif { /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ exit (sig != SIGFPE); @@ -51,15 +62,18 @@ int main () exit (1); } ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, - [ - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i[34567]86 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - ]) + [ + # Guess based on the CPU. +changequote(,)dnl + case "$host_cpu" in + alpha* | i[34567]86 | x86_64 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac +changequote([,])dnl + ]) + fi ]) case "$gt_cv_int_divbyzero_sigfpe" in *yes) value=1;; diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4 index dcefb118..934408bb 100644 --- a/gl/m4/intl.m4 +++ b/gl/m4/intl.m4 @@ -1,5 +1,5 @@ -# intl.m4 serial 3 (gettext-0.16) -dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. +# intl.m4 serial 8 (gettext-0.17) +dnl Copyright (C) 1995-2007 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. @@ -33,7 +33,6 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_REQUIRE([gl_VISIBILITY])dnl AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl - AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl AC_REQUIRE([gt_TYPE_WCHAR_T])dnl AC_REQUIRE([gt_TYPE_WINT_T])dnl AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) @@ -98,7 +97,7 @@ AC_DEFUN([AM_INTL_SUBDIR], dnl exported variables _also_ in the static library. if test "$enable_shared" = yes; then case "$host_os" in - cygwin*) is_woe32dll=yes ;; + mingw* | cygwin*) is_woe32dll=yes ;; *) is_woe32dll=no ;; esac else @@ -107,6 +106,31 @@ AC_DEFUN([AM_INTL_SUBDIR], WOE32DLL=$is_woe32dll AC_SUBST([WOE32DLL]) + dnl On mingw and Cygwin, we can activate special Makefile rules which add + dnl version information to the shared libraries and executables. + case "$host_os" in + mingw* | cygwin*) is_woe32=yes ;; + *) is_woe32=no ;; + esac + WOE32=$is_woe32 + AC_SUBST([WOE32]) + if test $WOE32 = yes; then + dnl Check for a program that compiles Windows resource files. + AC_CHECK_TOOL([WINDRES], [windres]) + fi + + dnl Determine whether when creating a library, "-lc" should be passed to + dnl libtool or not. On many platforms, it is required for the libtool option + dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool + dnl in the *.la files - makes it impossible to create multithreaded programs, + dnl because libtool also reorders the -lc to come before the -pthread, and + dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>. + case "$host_os" in + hpux*) LTLIBC="" ;; + *) LTLIBC="-lc" ;; + esac + AC_SUBST([LTLIBC]) + dnl Rename some macros and functions used for locking. AH_BOTTOM([ #define __libc_lock_t gl_lock_t @@ -197,7 +221,9 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE], AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name, [AC_TRY_LINK([#include <langinfo.h> #include <locale.h>], - [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));], + [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES)); + return !cs; + ], gt_cv_nl_locale_name=yes, gt_cv_nl_locale_name=no) ]) diff --git a/gl/m4/intlmacosx.m4 b/gl/m4/intlmacosx.m4 new file mode 100644 index 00000000..d3f0d904 --- /dev/null +++ b/gl/m4/intlmacosx.m4 @@ -0,0 +1,51 @@ +# intlmacosx.m4 serial 1 (gettext-0.17) +dnl Copyright (C) 2004-2007 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 +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in MacOS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + gt_cv_func_CFPreferencesCopyAppValue, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], + [CFPreferencesCopyAppValue(NULL, NULL)], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, + [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Check for API introduced in MacOS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, + [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 17c7b0ae..50ae35d2 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,5 +1,5 @@ -# intmax_t.m4 serial 5 -dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. +# intmax_t.m4 serial 6 +dnl Copyright (C) 1997-2004, 2006-2007 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,8 +18,8 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T], AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) - test $ac_cv_type_long_long = yes \ + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + test $ac_cv_type_long_long_int = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, @@ -51,8 +51,8 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], AC_DEFINE(HAVE_INTMAX_T, 1, [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) else - AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) - test $ac_cv_type_long_long = yes \ + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + test $ac_cv_type_long_long_int = yes \ && ac_type='long long' \ || ac_type='long' AC_DEFINE_UNQUOTED(intmax_t, $ac_type, diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index f157d983..e3d26fc4 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 13 (gettext-0.16.2) +# lib-link.m4 serial 13 (gettext-0.17) dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 new file mode 100644 index 00000000..b2b77338 --- /dev/null +++ b/gl/m4/localcharset.m4 @@ -0,0 +1,16 @@ +# localcharset.m4 serial 5 +dnl Copyright (C) 2002, 2004, 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_LOCALCHARSET], +[ + dnl Prerequisites of lib/localcharset.c. + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_CHECK_DECLS_ONCE(getc_unlocked) + + dnl Prerequisites of the lib/Makefile.am snippet. + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_GLIBC21]) +]) diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index 0224f2ff..91119335 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 @@ -1,5 +1,5 @@ -# lock.m4 serial 6 (gettext-0.16) -dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. +# lock.m4 serial 7 (gettext-0.17) +dnl Copyright (C) 2005-2007 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. @@ -35,7 +35,12 @@ AC_DEFUN([gl_LOCK_EARLY_BODY], AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes + dnl AC_GNU_SOURCE. + m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], + [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) diff --git a/gl/m4/longdouble.m4 b/gl/m4/longdouble.m4 deleted file mode 100644 index 25590f47..00000000 --- a/gl/m4/longdouble.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# longdouble.m4 serial 2 (gettext-0.15) -dnl Copyright (C) 2002-2003, 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. - -dnl From Bruno Haible. -dnl Test whether the compiler supports the 'long double' type. -dnl Prerequisite: AC_PROG_CC - -dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf -dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics. - -AC_DEFUN([gt_TYPE_LONGDOUBLE], -[ - AC_CACHE_CHECK([for long double], gt_cv_c_long_double, - [if test "$GCC" = yes; then - gt_cv_c_long_double=yes - else - AC_TRY_COMPILE([ - /* The Stardent Vistra knows sizeof(long double), but does not support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - int array [2*(sizeof(long double) >= sizeof(double)) - 1]; - ], , - gt_cv_c_long_double=yes, gt_cv_c_long_double=no) - fi]) - if test $gt_cv_c_long_double = yes; then - AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) - fi -]) diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 index 1f9e862e..15bf9dac 100644 --- a/gl/m4/longlong.m4 +++ b/gl/m4/longlong.m4 @@ -1,5 +1,5 @@ -# longlong.m4 serial 10 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# longlong.m4 serial 13 +dnl Copyright (C) 1999-2007 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,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - typedef int a[((-9223372036854775807LL < 0 - && 0 < 9223372036854775807ll) - ? 1 : -1)]; - int i = 63;]], - [[long long int llmax = 9223372036854775807ll; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll));]])], + [_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_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include <limits.h> @%:@ifndef LLONG_MAX @@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], fi ]) -# This macro is obsolescent and should go away soon. -AC_DEFUN([gl_AC_TYPE_LONG_LONG], +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - ac_cv_type_long_long=$ac_cv_type_long_long_int - if test $ac_cv_type_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG, 1, - [Define if you have the 'long long' type.]) + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +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. */ + /* 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)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -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));]]) +]) diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 new file mode 100644 index 00000000..764f2a9f --- /dev/null +++ b/gl/m4/malloc.m4 @@ -0,0 +1,41 @@ +# malloc.m4 serial 8 +dnl Copyright (C) 2007 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_FUNC_MALLOC_POSIX +# -------------------- +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it +# fails), and replace malloc if it is not. +AC_DEFUN([gl_FUNC_MALLOC_POSIX], +[ + AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) + if test $gl_cv_func_malloc_posix = yes; then + HAVE_MALLOC_POSIX=1 + AC_DEFINE([HAVE_MALLOC_POSIX], 1, + [Define if the 'malloc' function is POSIX compliant.]) + else + AC_LIBOBJ([malloc]) + HAVE_MALLOC_POSIX=0 + fi + AC_SUBST([HAVE_MALLOC_POSIX]) +]) + +# Test whether malloc, realloc, calloc are POSIX compliant, +# Set gl_cv_func_malloc_posix to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_POSIX], +[ + AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], + [gl_cv_func_malloc_posix], + [ + dnl It is too dangerous to try to allocate a large amount of memory: + dnl some systems go to their knees when you do that. So assume that + dnl all Unix implementations of the function are POSIX compliant. + AC_TRY_COMPILE([], + [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no]) + ]) +]) diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4 deleted file mode 100644 index 5380941b..00000000 --- a/gl/m4/mbchar.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# mbchar.m4 serial 5 -dnl Copyright (C) 2005-2007 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 autoconf tests required for use of mbchar.m4 -dnl From Bruno Haible. - -AC_DEFUN([gl_MBCHAR], -[ - AC_REQUIRE([AC_GNU_SOURCE]) - AC_LIBOBJ([mbchar]) -]) diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4 deleted file mode 100644 index 7d51af10..00000000 --- a/gl/m4/mbiter.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# mbiter.m4 serial 2 -dnl Copyright (C) 2005 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 autoconf tests required for use of mbiter.h -dnl From Bruno Haible. - -AC_DEFUN([gl_MBITER], -[ - AC_REQUIRE([AC_TYPE_MBSTATE_T]) - dnl The following line is that so the user can test HAVE_MBRTOWC before - dnl #include "mbiter.h" or "mbuiter.h". - AC_REQUIRE([gl_FUNC_MBRTOWC]) - : -]) diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 deleted file mode 100644 index a3bd9114..00000000 --- a/gl/m4/mbrtowc.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# mbrtowc.m4 serial 8 -dnl Copyright (C) 2001-2002, 2004-2005 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 Paul Eggert - -dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with -dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere. - -AC_DEFUN([gl_FUNC_MBRTOWC], -[ - dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. - AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], - gl_cv_func_mbrtowc, - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <wchar.h>]], - [[wchar_t wc; - char const s[] = ""; - size_t n = 1; - mbstate_t state; - return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], - gl_cv_func_mbrtowc=yes, - gl_cv_func_mbrtowc=no)]) - if test $gl_cv_func_mbrtowc = yes; then - AC_DEFINE([HAVE_MBRTOWC], 1, - [Define to 1 if mbrtowc and mbstate_t are properly declared.]) - fi -]) diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 deleted file mode 100644 index 91b8636e..00000000 --- a/gl/m4/memchr.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# memchr.m4 serial 4 -dnl Copyright (C) 2002, 2003, 2004 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_MEMCHR], -[ - AC_REPLACE_FUNCS(memchr) - if test $ac_cv_func_memchr = no; then - 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/minmax.m4 b/gl/m4/minmax.m4 deleted file mode 100644 index bbd1ba0b..00000000 --- a/gl/m4/minmax.m4 +++ /dev/null @@ -1,41 +0,0 @@ -# minmax.m4 serial 2 -dnl Copyright (C) 2005 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_PREREQ(2.52) - -AC_DEFUN([gl_MINMAX], -[ - AC_REQUIRE([gl_PREREQ_MINMAX]) -]) - -# Prerequisites of lib/minmax.h. -AC_DEFUN([gl_PREREQ_MINMAX], -[ - gl_MINMAX_IN_HEADER([limits.h]) - gl_MINMAX_IN_HEADER([sys/param.h]) -]) - -dnl gl_MINMAX_IN_HEADER(HEADER) -dnl The parameter has to be a literal header name; it cannot be macro, -dnl nor a shell variable. (Because autoheader collects only AC_DEFINE -dnl invocations with a literal macro name.) -AC_DEFUN([gl_MINMAX_IN_HEADER], -[ - m4_pushdef([header], AS_TR_SH([$1])) - m4_pushdef([HEADER], AS_TR_CPP([$1])) - AC_CACHE_CHECK([whether <$1> defines MIN and MAX], - [gl_cv_minmax_in_]header, - [AC_TRY_COMPILE([#include <$1> -int x = MIN (42, 17);], [], - [gl_cv_minmax_in_]header[=yes], - [gl_cv_minmax_in_]header[=no])]) - if test $gl_cv_minmax_in_[]header = yes; then - AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, - [Define to 1 if <$1> defines the MIN and MAX macros.]) - fi - m4_popdef([HEADER]) - m4_popdef([header]) -]) diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index d73531a0..096be740 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,18 +1,30 @@ -# netinet_in_h.m4 serial 1 -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# netinet_in_h.m4 serial 3 +dnl Copyright (C) 2006-2007 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 Simon Josefsson - AC_DEFUN([gl_HEADER_NETINET_IN], [ - AC_CHECK_HEADERS_ONCE([netinet/in.h]) - if test $ac_cv_header_netinet_in_h = yes; then + AC_CACHE_CHECK([whether <netinet/in.h> is self-contained], + [gl_cv_header_netinet_in_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/in.h>], [])], + [gl_cv_header_netinet_in_h_selfcontained=yes], + [gl_cv_header_netinet_in_h_selfcontained=no]) + ]) + if test $gl_cv_header_netinet_in_h_selfcontained = yes; then NETINET_IN_H='' else NETINET_IN_H='netinet/in.h' + AC_CHECK_HEADERS([netinet/in.h]) + gl_CHECK_NEXT_HEADERS([netinet/in.h]) + if test $ac_cv_header_netinet_in_h = yes; then + HAVE_NETINET_IN_H=1 + else + HAVE_NETINET_IN_H=0 + fi + AC_SUBST([HAVE_NETINET_IN_H]) fi - AC_SUBST(NETINET_IN_H) + AC_SUBST([NETINET_IN_H]) ]) diff --git a/gl/m4/po.m4 b/gl/m4/po.m4 index 00133ef3..0734762a 100644 --- a/gl/m4/po.m4 +++ b/gl/m4/po.m4 @@ -1,5 +1,5 @@ -# po.m4 serial 13 (gettext-0.15) -dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. +# po.m4 serial 15 (gettext-0.17) +dnl Copyright (C) 1995-2007 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. @@ -27,6 +27,10 @@ AC_DEFUN([AM_PO_SUBDIRS], AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake AC_REQUIRE([AM_NLS])dnl + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.17]) + dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. @@ -84,6 +88,10 @@ changequote([,])dnl test -n "$localedir" || localedir='${datadir}/locale' AC_SUBST([localedir]) + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + AC_CONFIG_COMMANDS([po-directories], [[ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" @@ -426,3 +434,16 @@ EOF fi mv "$ac_file.tmp" "$ac_file" ]) + +dnl Initializes the accumulator used by AM_XGETTEXT_OPTION. +AC_DEFUN([AM_XGETTEXT_OPTION_INIT], +[ + XGETTEXT_EXTRA_OPTIONS= +]) + +dnl Registers an option to be passed to xgettext in the po subdirectory. +AC_DEFUN([AM_XGETTEXT_OPTION], +[ + AC_REQUIRE([AM_XGETTEXT_OPTION_INIT]) + XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" +]) diff --git a/gl/m4/printf-posix.m4 b/gl/m4/printf-posix.m4 index af10170a..14ba6128 100644 --- a/gl/m4/printf-posix.m4 +++ b/gl/m4/printf-posix.m4 @@ -1,5 +1,5 @@ -# printf-posix.m4 serial 2 (gettext-0.13.1) -dnl Copyright (C) 2003 Free Software Foundation, Inc. +# printf-posix.m4 serial 3 (gettext-0.17) +dnl Copyright (C) 2003, 2007 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. @@ -28,7 +28,7 @@ int main () }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, [ AC_EGREP_CPP(notposix, [ -#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ +#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ notposix #endif ], gt_cv_func_printf_posix="guessing no", diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index 25da645e..7da6efed 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 @@ -1,4 +1,4 @@ -#serial 42 +#serial 48 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007 Free Software Foundation, Inc. @@ -18,9 +18,12 @@ AC_DEFUN([gl_REGEX], AC_ARG_WITH([included-regex], [AC_HELP_STRING([--without-included-regex], - [don't compile regex; this is the default on + [don't compile regex; this is the default on 32-bit systems with recent-enough versions of the GNU C - Library (use with caution on other systems)])]) + Library (use with caution on other systems). + On systems with 64-bit ptrdiff_t and 32-bit int, + --with-included-regex is the default, in case + regex functions operate on very long strings (>2GB)])]) case $with_included_regex in #( yes|no) ac_use_included_regex=$with_included_regex @@ -29,8 +32,7 @@ AC_DEFUN([gl_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. The first failing regular expression is from `Spencer ere - # test #75' in grep-2.3. + # regex.c. AC_CACHE_CHECK([for working re_compile_pattern], [gl_cv_func_re_compile_pattern_working], [AC_RUN_IFELSE( @@ -74,68 +76,91 @@ AC_DEFUN([gl_REGEX], } #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)); + 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) - exit (1); + return 1; - /* This should succeed, but does not for e.g. glibc-2.1.3. */ - memset (®ex, 0, sizeof (regex)); + /* 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) - exit (1); + 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)); + memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) - exit (1); + return 1; - /* This should match, but does not for e.g. glibc-2.2.1. */ + /* This should match, but does not for glibc-2.2.1. */ if (re_match (®ex, "an", 2, 0, ®s) != 2) - exit (1); + return 1; - memset (®ex, 0, sizeof (regex)); + memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - exit (1); + return 1; - /* The version of regex.c in e.g. GNU libc-2.2.93 did not - work with a negative RANGE argument. */ + /* glibc-2.2.93 does not work with a negative RANGE argument. */ if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - exit (1); + return 1; /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ - memset (®ex, 0, sizeof (regex)); re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); + memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - exit (1); + return 1; if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - exit (1); + 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) - exit (1); + 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)) - exit (1); + return 1; - exit (0);]])], + 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. @@ -190,9 +215,8 @@ AC_DEFUN([gl_REGEX], # Prerequisites of lib/regex.c and lib/regex_internal.c. AC_DEFUN([gl_PREREQ_REGEX], [ - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([AM_LANGINFO_CODESET]) - AC_CHECK_FUNCS_ONCE([iswctype mbrtowc mempcpy wcrtomb wcscoll]) + AC_CHECK_FUNCS_ONCE([isblank iswctype mbrtowc wcrtomb wcscoll]) AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>]) ]) diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 432e0375..f21200dc 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 @@ -1,13 +1,29 @@ -# snprintf.m4 serial 2 -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# snprintf.m4 serial 4 +dnl Copyright (C) 2002, 2003, 2004, 2007 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_SNPRINTF], [ - AC_REPLACE_FUNCS(snprintf) - AC_CHECK_DECLS_ONCE(snprintf) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_CHECK_FUNCS([snprintf]) + if test $ac_cv_func_snprintf = no; then + gl_REPLACE_SNPRINTF + fi + AC_CHECK_DECLS_ONCE([snprintf]) + if test $ac_cv_have_decl_snprintf = no; then + HAVE_DECL_SNPRINTF=0 + fi +]) + +AC_DEFUN([gl_REPLACE_SNPRINTF], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_LIBOBJ([snprintf]) + if test $ac_cv_func_snprintf = yes; then + REPLACE_SNPRINTF=1 + fi gl_PREREQ_SNPRINTF ]) diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 5e3765a6..b755757b 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,5 +1,5 @@ -# socklen.m4 serial 4 -dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +# socklen.m4 serial 6 +dnl Copyright (C) 2005, 2006, 2007 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,14 +12,14 @@ dnl types for the argument to getsockopt, getpeername, etc. So we dnl have to test to find something that will work. dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's socket_.h, which +dnl it there first. That file is included by gnulib's sys_socket.in.h, which dnl all users of this module should include. Cygwin must not include dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl AC_CHECK_TYPE([socklen_t], , [AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv], + 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= diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 1a4b4a6a..bb6c34fe 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,5 +1,5 @@ -# stdint.m4 serial 22 -dnl Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. +# stdint.m4 serial 29 +dnl Copyright (C) 2001-2007 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. @@ -45,32 +45,32 @@ AC_DEFUN([gl_STDINT_H], fi AC_SUBST([HAVE_SYS_TYPES_H]) - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h. + gl_CHECK_NEXT_HEADERS([stdint.h]) if test $ac_cv_header_stdint_h = yes; then - gl_ABSOLUTE_HEADER([stdint.h]) - ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\" HAVE_STDINT_H=1 else - ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\" HAVE_STDINT_H=0 fi - AC_SUBST([ABSOLUTE_STDINT_H]) AC_SUBST([HAVE_STDINT_H]) - dnl Now see whether we need a substitute <stdint.h>. Use - dnl ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during - dnl a "config.status --recheck" if a stdint.h has been - dnl created in the build directory. + dnl Now see whether we need a substitute <stdint.h>. if test $ac_cv_header_stdint_h = yes; then AC_CACHE_CHECK([whether stdint.h conforms to C99], [gl_cv_header_working_stdint_h], [gl_cv_header_working_stdint_h=no AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ -#include <stddef.h> #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#include ABSOLUTE_STDINT_H +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include <stdint.h> +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" +#endif +] +gl_STDINT_INCLUDES +[ #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; @@ -142,12 +142,32 @@ uintptr_t h = UINTPTR_MAX; #endif intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; + +#include <limits.h> /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) struct s { - int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; - int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; - int check_SIZE: 0 < SIZE_MAX ? 1 : -1; - int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; - int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ int check_UINT8_C: @@ -202,6 +222,10 @@ struct s { fi AC_SUBST([HAVE_SYS_BITYPES_H]) + dnl Check for <wchar.h> (missing in Linux uClibc when built without wide + dnl character support). + AC_CHECK_HEADERS_ONCE([wchar.h]) + gl_STDINT_TYPE_PROPERTIES STDINT_H=stdint.h fi @@ -337,14 +361,16 @@ AC_DEFUN([gl_STDINT_INCLUDES], included before <wchar.h>. */ #include <stddef.h> #include <signal.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> + #if HAVE_WCHAR_H + # include <stdio.h> + # include <time.h> + # include <wchar.h> + #endif ]]) dnl gl_STDINT_TYPE_PROPERTIES dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t -dnl of interest to stdint_.h. +dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 new file mode 100644 index 00000000..a40d4180 --- /dev/null +++ b/gl/m4/stdio_h.m4 @@ -0,0 +1,85 @@ +# stdio_h.m4 serial 9 +dnl Copyright (C) 2007 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_STDIO_H], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([stdio.h]) +]) + +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 +]) + +AC_DEFUN([gl_STDIO_H_DEFAULTS], +[ + GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) + 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_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) + 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_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) + 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_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) + GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) + dnl Assume proper GNU behavior unless another module says otherwise. + 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_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_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) + REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + 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_FTELL=0; AC_SUBST([REPLACE_FTELL]) + REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) + HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) + HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) +]) + +dnl Code shared by fseeko and ftello. Determine if large files are supported, +dnl but stdin does not start as a large file by default. +AC_DEFUN([gl_STDIN_LARGE_OFFSET], + [ + AC_CACHE_CHECK([whether stdin defaults to large file offsets], + [gl_cv_var_stdin_large_offset], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], +[#if defined __SL64 && defined __SCLE /* cygwin */ + /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making + fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and + it is easier to do a version check than building a runtime test. */ +# include <cygwin/version.h> +# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) + choke me +# endif +#endif])], + [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 new file mode 100644 index 00000000..fe4ce122 --- /dev/null +++ b/gl/m4/stdlib_h.m4 @@ -0,0 +1,42 @@ +# stdlib_h.m4 serial 5 +dnl Copyright (C) 2007 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_STDLIB_H], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([stdlib.h]) +]) + +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 +]) + +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_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) + 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_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV]) +]) diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 deleted file mode 100644 index ae827907..00000000 --- a/gl/m4/strcase.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# strcase.m4 serial 4 -dnl Copyright (C) 2002, 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_STRCASE], -[ - gl_FUNC_STRCASECMP - gl_FUNC_STRNCASECMP -]) - -AC_DEFUN([gl_FUNC_STRCASECMP], -[ - dnl No known system has a strcasecmp() function that works correctly in - dnl multibyte locales. Therefore we use our version always. - AC_LIBOBJ(strcasecmp) - gl_PREREQ_STRCASECMP -]) - -AC_DEFUN([gl_FUNC_STRNCASECMP], -[ - AC_REPLACE_FUNCS(strncasecmp) - AC_CHECK_DECLS(strncasecmp) - if test $ac_cv_func_strncasecmp = no; then - gl_PREREQ_STRNCASECMP - fi -]) - -# Prerequisites of lib/strcasecmp.c. -AC_DEFUN([gl_PREREQ_STRCASECMP], [ - AC_REQUIRE([gl_FUNC_MBRTOWC]) - : -]) - -# Prerequisites of lib/strncasecmp.c. -AC_DEFUN([gl_PREREQ_STRNCASECMP], [ - : -]) diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4 index f7786e94..8796e9e0 100644 --- a/gl/m4/strdup.m4 +++ b/gl/m4/strdup.m4 @@ -1,13 +1,20 @@ -# strdup.m4 serial 7 -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# strdup.m4 serial 9 + +dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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. AC_DEFUN([gl_FUNC_STRDUP], [ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REPLACE_FUNCS(strdup) AC_CHECK_DECLS_ONCE(strdup) + if test $ac_cv_have_decl_strdup = no; then + HAVE_DECL_STRDUP=0 + fi gl_PREREQ_STRDUP ]) diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 new file mode 100644 index 00000000..eb7d45aa --- /dev/null +++ b/gl/m4/strerror.m4 @@ -0,0 +1,47 @@ +# strerror.m4 serial 7 +dnl Copyright (C) 2002, 2007 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_STRERROR], +[ + AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) + if test $gl_cv_func_working_strerror = no; then + AC_LIBOBJ([strerror]) + AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], + [Define this to 1 if strerror is broken.]) + fi +]) + +# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], +[ + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CACHE_CHECK([for working strerror function], + [gl_cv_func_working_strerror], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no], + [dnl Assume crossbuild works if it compiles. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no])])]) + if test $gl_cv_func_working_strerror = no ; then + REPLACE_STRERROR=1 + gl_PREREQ_STRERROR + fi +]) + +# Prerequisites of lib/strerror.c. +AC_DEFUN([gl_PREREQ_STRERROR], [ + AC_CHECK_DECLS([strerror]) +]) diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 new file mode 100644 index 00000000..766d7e98 --- /dev/null +++ b/gl/m4/string_h.m4 @@ -0,0 +1,87 @@ +# Configure a GNU-like replacement for <string.h>. + +# Copyright (C) 2007, 2008 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 4 + +# Written by Paul Eggert. + +AC_DEFUN([gl_HEADER_STRING_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_HEADER_STRING_H_BODY]) +]) + +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]) +]) + +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 +]) + +AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +[ + GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) + GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) + GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) + GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) + GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) + GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) + GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) + GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) + GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) + GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) + GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) + GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) + GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) + GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) + GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) + GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) + GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) + GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) + GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) + GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) + GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) + GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) + GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) + GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) + GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) + GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) + GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) + GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) + GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) + 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_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]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) +]) diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4 index dd5780b6..f7934ef8 100644 --- a/gl/m4/strndup.m4 +++ b/gl/m4/strndup.m4 @@ -1,5 +1,5 @@ -# strndup.m4 serial 11 -dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc. +# strndup.m4 serial 14 +dnl Copyright (C) 2002-2003, 2005-2007 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,15 +7,19 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNDUP], [ dnl Persuade glibc <string.h> to declare strndup(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_CHECK_DECLS_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>], [[ + #include <stdlib.h>], [[ #ifndef HAVE_DECL_STRNDUP extern char *strndup (const char *, size_t); #endif @@ -39,6 +43,7 @@ AC_DEFUN([gl_FUNC_STRNDUP], AC_DEFINE([HAVE_STRNDUP], 1, [Define if you have the strndup() function and it works.]) else + HAVE_STRNDUP=0 AC_LIBOBJ([strndup]) gl_PREREQ_STRNDUP fi diff --git a/gl/m4/strnlen.m4 b/gl/m4/strnlen.m4 index 0213a8ae..d8307eda 100644 --- a/gl/m4/strnlen.m4 +++ b/gl/m4/strnlen.m4 @@ -1,5 +1,5 @@ -# strnlen.m4 serial 6 -dnl Copyright (C) 2002-2003, 2005, 2006 Free Software Foundation, Inc. +# strnlen.m4 serial 9 +dnl Copyright (C) 2002-2003, 2005-2007 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,11 +7,17 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRNLEN], [ dnl Persuade glibc <string.h> to declare strnlen(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_CHECK_DECLS_ONCE([strnlen]) + if test $ac_cv_have_decl_strnlen = no; then + HAVE_DECL_STRNLEN=0 + fi AC_FUNC_STRNLEN if test $ac_cv_func_strnlen_working = no; then - # This is necessary because automake-1.6.1 doens't understand + # This is necessary because automake-1.6.1 doesn't understand # that the above use of AC_FUNC_STRNLEN means we may have to use # lib/strnlen.c. #AC_LIBOBJ(strnlen) @@ -22,6 +28,4 @@ AC_DEFUN([gl_FUNC_STRNLEN], ]) # Prerequisites of lib/strnlen.c. -AC_DEFUN([gl_PREREQ_STRNLEN], [ - AC_CHECK_DECLS_ONCE(strnlen) -]) +AC_DEFUN([gl_PREREQ_STRNLEN], [:]) diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index d3e45b48..d9659c2d 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,5 +1,5 @@ -# sys_socket_h.m4 serial 2 -dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 4 +dnl Copyright (C) 2005, 2006, 2007 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,16 +8,44 @@ dnl From Simon Josefsson. AC_DEFUN([gl_HEADER_SYS_SOCKET], [ - AC_CHECK_HEADERS_ONCE([sys/socket.h]) - if test $ac_cv_header_sys_socket_h = yes; then + AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], + [gl_cv_header_sys_socket_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>], [])], + [gl_cv_header_sys_socket_h_selfcontained=yes], + [gl_cv_header_sys_socket_h_selfcontained=no]) + ]) + if test $gl_cv_header_sys_socket_h_selfcontained = yes; then SYS_SOCKET_H='' else - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([winsock2.h ws2tcpip.h]) SYS_SOCKET_H='sys/socket.h' + + gl_CHECK_NEXT_HEADERS([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_SYS_SOCKET_H=1 + HAVE_WINSOCK2_H=0 + HAVE_WS2TCPIP_H=0 + else + HAVE_SYS_SOCKET_H=0 + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h ws2tcpip.h]) + if test $ac_cv_header_winsock2_h = yes; then + HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_SYS_SOCKET_H]) + AC_SUBST([HAVE_WINSOCK2_H]) + AC_SUBST([HAVE_WS2TCPIP_H]) fi - AC_SUBST(SYS_SOCKET_H) + AC_SUBST([SYS_SOCKET_H]) ]) diff --git a/gl/m4/uintmax_t.m4 b/gl/m4/uintmax_t.m4 index bf83ed74..641c4898 100644 --- a/gl/m4/uintmax_t.m4 +++ b/gl/m4/uintmax_t.m4 @@ -1,5 +1,5 @@ -# uintmax_t.m4 serial 9 -dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. +# uintmax_t.m4 serial 10 +dnl Copyright (C) 1997-2004, 2007 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,8 +16,8 @@ AC_DEFUN([gl_AC_TYPE_UINTMAX_T], AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) - test $ac_cv_type_unsigned_long_long = yes \ + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long' \ || ac_type='unsigned long' AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, diff --git a/gl/m4/ulonglong.m4 b/gl/m4/ulonglong.m4 deleted file mode 100644 index 9fae98e3..00000000 --- a/gl/m4/ulonglong.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# ulonglong.m4 serial 6 -dnl Copyright (C) 1999-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. - -dnl From Paul Eggert. - -# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. - -# Note: If the type 'unsigned long long int' exists but is only 32 bits -# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT -# will not be defined. In this case you can treat 'unsigned long long int' -# like 'unsigned long int'. - -AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for unsigned long long int], - [ac_cv_type_unsigned_long_long_int], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[unsigned long long int ull = 18446744073709551615ULL; - typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63;]], - [[unsigned long long int ullmax = 18446744073709551615ull; - return (ull << 63 | ull >> 63 | ull << i | ull >> i - | ullmax / ull | ullmax % ull);]])], - [ac_cv_type_unsigned_long_long_int=yes], - [ac_cv_type_unsigned_long_long_int=no])]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, - [Define to 1 if the system has the type `unsigned long long int'.]) - fi -]) - -# This macro is obsolescent and should go away soon. -AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], -[ - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_unsigned_long_long = yes; then - AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, - [Define if you have the 'unsigned long long' type.]) - fi -]) diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index 9d499dfe..4b8857ca 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,32 +1,61 @@ -# unistd_h.m4 serial 3 -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# unistd_h.m4 serial 10 +dnl Copyright (C) 2006-2007 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 Simon Josefsson +dnl Written by Simon Josefsson, Bruno Haible. -AC_DEFUN([gl_HEADER_UNISTD], +AC_DEFUN([gl_UNISTD_H], [ - AC_CHECK_HEADERS([unistd.h], [ - UNISTD_H='' - ], [ - UNISTD_H='unistd.h' - ]) - AC_SUBST(UNISTD_H) - dnl This module decides to build unistd.h if it is missing. - dnl The fchdir module decides to build unistd.h if fchdir() is missing. - dnl Therefore check for the prerequisites of lib/unistd.h always. - gl_PREREQ_UNISTD -]) + 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]) + + gl_CHECK_NEXT_HEADERS([unistd.h]) -dnl Prerequisites of lib/unistd.h. -AC_DEFUN([gl_PREREQ_UNISTD], -[ AC_CHECK_HEADERS_ONCE([unistd.h]) if test $ac_cv_header_unistd_h = yes; then - gl_ABSOLUTE_HEADER([unistd.h]) - ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\" + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 fi - AC_SUBST([ABSOLUTE_UNISTD_H]) + AC_SUBST([HAVE_UNISTD_H]) +]) + +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 +]) + +AC_DEFUN([gl_UNISTD_H_DEFAULTS], +[ + GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) + GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) + GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) + GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) + HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + 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_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) + REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) ]) diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 72c9a13e..c4d3f4fa 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,5 +1,5 @@ -# vasnprintf.m4 serial 7 -dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. +# vasnprintf.m4 serial 24 +dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,23 +7,33 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_VASNPRINTF], [ AC_REQUIRE([gl_EOVERFLOW]) - AC_REPLACE_FUNCS(vasnprintf) + AC_CHECK_FUNCS_ONCE([vasnprintf]) if test $ac_cv_func_vasnprintf = no; then - AC_LIBOBJ(printf-args) - AC_LIBOBJ(printf-parse) - AC_LIBOBJ(asnprintf) - gl_PREREQ_PRINTF_ARGS - gl_PREREQ_PRINTF_PARSE - gl_PREREQ_VASNPRINTF - gl_PREREQ_ASNPRINTF + gl_REPLACE_VASNPRINTF fi ]) +AC_DEFUN([gl_REPLACE_VASNPRINTF], +[ + AC_CHECK_FUNCS_ONCE([vasnprintf]) + AC_LIBOBJ([vasnprintf]) + AC_LIBOBJ([printf-args]) + AC_LIBOBJ([printf-parse]) + AC_LIBOBJ([asnprintf]) + if test $ac_cv_func_vasnprintf = yes; then + AC_DEFINE([REPLACE_VASNPRINTF], 1, + [Define if vasnprintf exists but is overridden by gnulib.]) + fi + gl_PREREQ_PRINTF_ARGS + gl_PREREQ_PRINTF_PARSE + gl_PREREQ_VASNPRINTF + gl_PREREQ_ASNPRINTF +]) + # Prequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) @@ -32,11 +42,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) - AC_CHECK_TYPES(ptrdiff_t) + AC_CHECK_TYPE([ptrdiff_t], , + [AC_DEFINE([ptrdiff_t], [long], + [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) + ]) AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) ]) @@ -45,10 +57,202 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_FUNCS(snprintf wcslen) + dnl Use the _snprintf function only if it is declared (because on NetBSD it + dnl is defined as a weak alias of snprintf; we prefer to use the latter). + AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_INFINITE]) + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + infinite 'double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) + dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if + dnl NEED_PRINTF_LONG_DOUBLE is already set. + AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + infinite 'long double' arguments.]) + ;; + esac + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, + [Define if the vasnprintf implementation needs special code for + the 'a' and 'A' directives.]) + AC_CHECK_FUNCS([nl_langinfo]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1, + [Define if the vasnprintf implementation needs special code for + the 'F' directive.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], +[ + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1, + [Define if the vasnprintf implementation needs special code for the + ' flag.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], +[ + AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) + case "$gl_cv_func_printf_flag_leftadjust" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1, + [Define if the vasnprintf implementation needs special code for the + '-' flag.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], +[ + AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1, + [Define if the vasnprintf implementation needs special code for the + 0 flag.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. +AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], +[ + AC_REQUIRE([gl_PRINTF_PRECISION]) + case "$gl_cv_func_printf_precision" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1, + [Define if the vasnprintf implementation needs special code for + supporting large precisions without arbitrary bounds.]) + AC_DEFINE([NEED_PRINTF_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'double' arguments.]) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory +# conditions. +AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], +[ + AC_REQUIRE([gl_PRINTF_ENOMEM]) + case "$gl_cv_func_printf_enomem" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_ENOMEM], 1, + [Define if the vasnprintf implementation needs special code for + surviving out-of-memory conditions.]) + AC_DEFINE([NEED_PRINTF_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'double' arguments.]) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + +# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], +[ + AC_REQUIRE([gl_PREREQ_VASNPRINTF]) + gl_PREREQ_VASNPRINTF_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_DIRECTIVE_A + gl_PREREQ_VASNPRINTF_DIRECTIVE_F + gl_PREREQ_VASNPRINTF_FLAG_GROUPING + gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST + gl_PREREQ_VASNPRINTF_FLAG_ZERO + gl_PREREQ_VASNPRINTF_PRECISION + gl_PREREQ_VASNPRINTF_ENOMEM ]) # Prerequisites of lib/asnprintf.c. diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 18ca6327..074b03cf 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 @@ -1,25 +1,37 @@ -# vasprintf.m4 serial 2 -dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc. +# vasprintf.m4 serial 6 +dnl Copyright (C) 2002-2003, 2006-2007 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_VASPRINTF], [ - AC_REPLACE_FUNCS(vasprintf) + AC_CHECK_FUNCS([vasprintf]) if test $ac_cv_func_vasprintf = no; then - AC_LIBOBJ(asprintf) - gl_PREREQ_VASPRINTF_H - gl_PREREQ_VASPRINTF - gl_PREREQ_ASPRINTF + gl_REPLACE_VASPRINTF fi ]) -# Prerequisites of lib/vasprintf.h. +AC_DEFUN([gl_REPLACE_VASPRINTF], +[ + AC_LIBOBJ([vasprintf]) + AC_LIBOBJ([asprintf]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 + fi + gl_PREREQ_VASPRINTF_H + gl_PREREQ_VASPRINTF + gl_PREREQ_ASPRINTF +]) + +# Prerequisites of the vasprintf portion of lib/stdio.h. AC_DEFUN([gl_PREREQ_VASPRINTF_H], [ dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) # Prerequisites of lib/vasprintf.c. diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index cb8a9b18..accc79f8 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 @@ -1,13 +1,29 @@ -# vsnprintf.m4 serial 2 -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# vsnprintf.m4 serial 4 +dnl Copyright (C) 2002, 2003, 2004, 2007 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_VSNPRINTF], [ - AC_REPLACE_FUNCS(vsnprintf) - AC_CHECK_DECLS_ONCE(vsnprintf) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_CHECK_FUNCS([vsnprintf]) + if test $ac_cv_func_vsnprintf = no; then + gl_REPLACE_VSNPRINTF + fi + AC_CHECK_DECLS_ONCE([vsnprintf]) + if test $ac_cv_have_decl_vsnprintf = no; then + HAVE_DECL_VSNPRINTF=0 + fi +]) + +AC_DEFUN([gl_REPLACE_VSNPRINTF], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_LIBOBJ([vsnprintf]) + if test $ac_cv_func_vsnprintf = yes; then + REPLACE_VSNPRINTF=1 + fi gl_PREREQ_VSNPRINTF ]) diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4 index 068f22d3..70b1248f 100644 --- a/gl/m4/wchar.m4 +++ b/gl/m4/wchar.m4 @@ -7,23 +7,48 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar.m4 serial 1 +# wchar.m4 serial 4 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])]) - if test $gl_cv_header_wchar_h_standalone = yes; then - WCHAR_H= - else - gl_ABSOLUTE_HEADER([wchar.h]) - ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\" + if test $gl_cv_header_wchar_h_standalone != yes; then WCHAR_H=wchar.h fi - AC_SUBST([ABSOLUTE_WCHAR_H]) + + 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 + fi + AC_SUBST([HAVE_WCHAR_H]) + gl_CHECK_NEXT_HEADERS([wchar.h]) +]) + +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 +]) + +AC_DEFUN([gl_WCHAR_H_DEFAULTS], +[ + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) + REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) + WCHAR_H= AC_SUBST([WCHAR_H]) ]) diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4 index 62994c62..7483c4fe 100644 --- a/gl/m4/wctype.m4 +++ b/gl/m4/wctype.m4 @@ -10,6 +10,12 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_WCTYPE_H], [ AC_CHECK_FUNCS_ONCE([iswcntrl]) + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + AC_SUBST([HAVE_ISWCNTRL]) AC_CHECK_HEADERS_ONCE([wctype.h]) AC_REQUIRE([AC_C_INLINE]) @@ -23,19 +29,16 @@ AC_DEFUN([gl_WCTYPE_H], WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then - if test "$ac_cv_func_iswcntrl" = yes; then + if test $ac_cv_func_iswcntrl = yes; then WCTYPE_H= fi - dnl Compute ABSOLUTE_WCTYPE_H even if WCTYPE_H is empty, + dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, dnl for the benefit of builds from non-distclean directories. - gl_ABSOLUTE_HEADER([wctype.h]) - ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\" + gl_CHECK_NEXT_HEADERS([wctype.h]) HAVE_WCTYPE_H=1 else - ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\" HAVE_WCTYPE_H=0 fi - AC_SUBST([ABSOLUTE_WCTYPE_H]) AC_SUBST([HAVE_WCTYPE_H]) AC_SUBST([WCTYPE_H]) ]) diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4 deleted file mode 100644 index b4834991..00000000 --- a/gl/m4/wcwidth.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# wcwidth.m4 serial 8 -dnl Copyright (C) 2006, 2007 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_WCWIDTH], -[ - dnl Persuade glibc <wchar.h> to declare wcwidth(). - AC_REQUIRE([AC_GNU_SOURCE]) - - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) - - AC_CHECK_HEADERS_ONCE([wchar.h]) - AC_CHECK_FUNCS_ONCE([wcwidth]) - - AC_CHECK_DECLS([wcwidth], [], [], [ -/* AIX 3.2.5 declares wcwidth in <string.h>. */ -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -])]) diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index 3706c047..af5ed936 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,4 +1,4 @@ -# wint_t.m4 serial 2 (gettext-0.12) +# wint_t.m4 serial 2 (gettext-0.17) dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, |