diff options
author | Simon Josefsson <simon@josefsson.org> | 2010-10-14 15:52:47 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2010-10-14 15:52:47 +0200 |
commit | dbe767085787f5fdec183749a86c279a28676cc8 (patch) | |
tree | f618faa5de5488463a8715a410915cb0ddfec04a /gl/m4 | |
parent | 9b3338ea218a58adb2f573f023718be1f0372da4 (diff) | |
download | gnutls-dbe767085787f5fdec183749a86c279a28676cc8.tar.gz |
Update gnulib files.
Diffstat (limited to 'gl/m4')
-rw-r--r-- | gl/m4/errno_h.m4 | 7 | ||||
-rw-r--r-- | gl/m4/error.m4 | 19 | ||||
-rw-r--r-- | gl/m4/float_h.m4 | 4 | ||||
-rw-r--r-- | gl/m4/ftello.m4 | 130 | ||||
-rw-r--r-- | gl/m4/getpagesize.m4 | 33 | ||||
-rw-r--r-- | gl/m4/gnulib-cache.m4 | 4 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 40 | ||||
-rw-r--r-- | gl/m4/hostent.m4 | 12 | ||||
-rw-r--r-- | gl/m4/include_next.m4 | 36 | ||||
-rw-r--r-- | gl/m4/intmax_t.m4 | 13 | ||||
-rw-r--r-- | gl/m4/inttypes_h.m4 | 17 | ||||
-rw-r--r-- | gl/m4/lib-ld.m4 | 19 | ||||
-rw-r--r-- | gl/m4/lib-link.m4 | 39 | ||||
-rw-r--r-- | gl/m4/lseek.m4 | 14 | ||||
-rw-r--r-- | gl/m4/malloc.m4 | 45 | ||||
-rw-r--r-- | gl/m4/memchr.m4 | 4 | ||||
-rw-r--r-- | gl/m4/minmax.m4 | 13 | ||||
-rw-r--r-- | gl/m4/printf.m4 | 736 | ||||
-rw-r--r-- | gl/m4/realloc.m4 | 31 | ||||
-rw-r--r-- | gl/m4/servent.m4 | 12 | ||||
-rw-r--r-- | gl/m4/size_max.m4 | 14 | ||||
-rw-r--r-- | gl/m4/socketlib.m4 | 86 | ||||
-rw-r--r-- | gl/m4/sockets.m4 | 77 | ||||
-rw-r--r-- | gl/m4/socklen.m4 | 7 | ||||
-rw-r--r-- | gl/m4/sockpfaf.m4 | 3 | ||||
-rw-r--r-- | gl/m4/stdarg.m4 | 22 | ||||
-rw-r--r-- | gl/m4/stdbool.m4 | 128 | ||||
-rw-r--r-- | gl/m4/stdint.m4 | 14 | ||||
-rw-r--r-- | gl/m4/stdint_h.m4 | 15 | ||||
-rw-r--r-- | gl/m4/stdlib_h.m4 | 13 | ||||
-rw-r--r-- | gl/m4/time_h.m4 | 19 | ||||
-rw-r--r-- | gl/m4/wchar_t.m4 | 12 | ||||
-rw-r--r-- | gl/m4/wint_t.m4 | 12 |
33 files changed, 1029 insertions, 621 deletions
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index d02a039363..e4325ac660 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,5 +1,5 @@ -# errno_h.m4 serial 6 -dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. +# errno_h.m4 serial 7 +dnl Copyright (C) 2004, 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -37,6 +37,9 @@ booboo #if !defined ESTALE booboo #endif +#if !defined EDQUOT +booboo +#endif #if !defined ECANCELED booboo #endif diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 9f1307a428..dd5a197b6e 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 @@ -1,4 +1,4 @@ -#serial 12 +#serial 13 # Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. # @@ -13,6 +13,23 @@ AC_DEFUN([gl_ERROR], gl_PREREQ_ERROR ]) +# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in +# Autoconf. +AC_DEFUN([AC_FUNC_ERROR_AT_LINE], +[ + AC_LIBSOURCES([error.h, error.c])dnl + AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <error.h>]], + [[error_at_line (0, 0, "", 0, "an error occurred");]])], + [ac_cv_lib_error_at_line=yes], + [ac_cv_lib_error_at_line=no])]) + if test $ac_cv_lib_error_at_line = no; then + AC_LIBOBJ([error]) + fi +]) + # Prerequisites of lib/error.c. AC_DEFUN([gl_PREREQ_ERROR], [ diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index a74a0d957f..f6099db405 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 @@ -1,4 +1,4 @@ -# float_h.m4 serial 3 +# float_h.m4 serial 4 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H], AC_REQUIRE([AC_CANONICAL_HOST]) FLOAT_H= case "$host_os" in - beos* | openbsd*) + beos* | openbsd* | mirbsd*) FLOAT_H=float.h gl_CHECK_NEXT_HEADERS([float.h]) ;; diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 new file mode 100644 index 0000000000..33201a0107 --- /dev/null +++ b/gl/m4/ftello.m4 @@ -0,0 +1,130 @@ +# ftello.m4 serial 8 +dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FTELLO], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + + dnl Persuade glibc <stdio.h> to declare ftello(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], + [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdio.h>]], + [[ftello (stdin);]])], + [gl_cv_func_ftello=yes], + [gl_cv_func_ftello=no]) + ]) + if test $gl_cv_func_ftello = no; then + HAVE_FTELLO=0 + else + if test $gl_cv_var_stdin_large_offset = no; then + REPLACE_FTELLO=1 + else + dnl Detect bug on Solaris. + dnl ftell and ftello produce incorrect results after putc that followed a + dnl getc call that reached EOF on Solaris. This is because the _IOREAD + dnl flag does not get cleared in this case, even though _IOWRT gets set, + dnl and ftell and ftello look whether the _IOREAD flag is set. + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether ftello works], + [gl_cv_func_ftello_works], + [ + dnl Initial guess, used when cross-compiling or when /dev/tty cannot + dnl be opened. +changequote(,)dnl + case "$host_os" in + # Guess no on Solaris. + solaris*) gl_cv_func_ftello_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_ftello_works="guessing yes" ;; + esac +changequote([,])dnl + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#define TESTFILE "conftest.tmp" +int +main (void) +{ + FILE *fp; + + /* Create a file with some contents. */ + fp = fopen (TESTFILE, "w"); + if (fp == NULL) + return 70; + if (fwrite ("foogarsh", 1, 8, fp) < 8) + return 71; + if (fclose (fp)) + return 72; + + /* The file's contents is now "foogarsh". */ + + /* Try writing after reading to EOF. */ + fp = fopen (TESTFILE, "r+"); + if (fp == NULL) + return 73; + if (fseek (fp, -1, SEEK_END)) + return 74; + if (!(getc (fp) == 'h')) + return 1; + if (!(getc (fp) == EOF)) + return 2; + if (!(ftell (fp) == 8)) + return 3; + if (!(ftell (fp) == 8)) + return 4; + if (!(putc ('!', fp) == '!')) + return 5; + if (!(ftell (fp) == 9)) + return 6; + if (!(fclose (fp) == 0)) + return 7; + fp = fopen (TESTFILE, "r"); + if (fp == NULL) + return 75; + { + char buf[10]; + if (!(fread (buf, 1, 10, fp) == 9)) + return 10; + if (!(memcmp (buf, "foogarsh!", 9) == 0)) + return 11; + } + if (!(fclose (fp) == 0)) + return 12; + + /* The file's contents is now "foogarsh!". */ + + return 0; +}]])], + [gl_cv_func_ftello_works=yes], + [gl_cv_func_ftello_works=no], [:]) + ]) + case "$gl_cv_func_ftello_works" in + *yes) ;; + *) + REPLACE_FTELLO=1 + AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1], + [Define to 1 if the system's ftello function has the Solaris bug.]) + ;; + esac + fi + fi + if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then + gl_REPLACE_FTELLO + fi +]) + +AC_DEFUN([gl_REPLACE_FTELLO], +[ + AC_LIBOBJ([ftello]) +]) diff --git a/gl/m4/getpagesize.m4 b/gl/m4/getpagesize.m4 new file mode 100644 index 0000000000..313ad7fa26 --- /dev/null +++ b/gl/m4/getpagesize.m4 @@ -0,0 +1,33 @@ +# getpagesize.m4 serial 8 +dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2010 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETPAGESIZE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS([getpagesize]) + if test $ac_cv_func_getpagesize = no; then + HAVE_GETPAGESIZE=0 + AC_CHECK_HEADERS([OS.h]) + if test $ac_cv_header_OS_h = yes; then + HAVE_OS_H=1 + fi + AC_CHECK_HEADERS([sys/param.h]) + if test $ac_cv_header_sys_param_h = yes; then + HAVE_SYS_PARAM_H=1 + fi + fi + case "$host_os" in + mingw*) + REPLACE_GETPAGESIZE=1 + AC_LIBOBJ([getpagesize]) + ;; + esac + dnl Also check whether it's declared. + dnl mingw has getpagesize() in libgcc.a but doesn't declare it. + AC_CHECK_DECL([getpagesize], , [HAVE_DECL_GETPAGESIZE=0]) +]) diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index a9cec83bc5..0987814cfe 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -10,8 +10,8 @@ # # This file represents the specification of how gnulib-tool is used. # It acts as a cache: It is written and read by gnulib-tool. -# In projects using CVS, this file is meant to be stored in CVS, -# like the configure.ac and various Makefile.am files. +# In projects that use version control, this file is meant to be put under +# version control, like the configure.ac and various Makefile.am files. # Specification in the form of a command-line invocation: diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 3db9b2553b..201ec0f99a 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -12,7 +12,8 @@ # This file represents the compiled summary of the specification in # gnulib-cache.m4. It lists the computed macro invocations that need # to be invoked from configure.ac. -# In projects using CVS, this file can be treated like other built files. +# In projects that use version control, this file can be treated like +# other built files. # This macro should be invoked from ./configure.ac, in the section @@ -36,6 +37,8 @@ AC_DEFUN([gl_EARLY], # Code from module arpa_inet-tests: # Code from module autobuild: AB_INIT + # Code from module binary-io: + # Code from module binary-io-tests: # Code from module bind: # Code from module c++defs: # Code from module c-ctype: @@ -55,6 +58,9 @@ AC_DEFUN([gl_EARLY], # Code from module fseeko: AC_REQUIRE([AC_FUNC_FSEEKO]) # Code from module fseeko-tests: + # Code from module ftello: + AC_REQUIRE([AC_FUNC_FSEEKO]) + # Code from module ftello-tests: # Code from module gendocs: # Code from module getaddrinfo: # Code from module getaddrinfo-tests: @@ -62,6 +68,7 @@ AC_DEFUN([gl_EARLY], # Code from module getdelim-tests: # Code from module getline: # Code from module getline-tests: + # Code from module getpagesize: # Code from module getpass-gnu: # Code from module gettext-h: # Code from module gettime: @@ -84,6 +91,7 @@ AC_DEFUN([gl_EARLY], # Code from module lseek: # Code from module lseek-tests: # Code from module maintainer-makefile: + # Code from module malloc-posix: # Code from module manywarnings: # Code from module memchr: # Code from module memchr-tests: @@ -112,6 +120,7 @@ AC_DEFUN([gl_EARLY], # Code from module snprintf: # Code from module snprintf-tests: # Code from module socket: + # Code from module socketlib: # Code from module sockets: # Code from module sockets-tests: # Code from module socklen: @@ -240,6 +249,9 @@ AC_SUBST([LTALLOCA]) # Code from module fseeko: gl_FUNC_FSEEKO gl_STDIO_MODULE_INDICATOR([fseeko]) + # Code from module ftello: + gl_FUNC_FTELLO + gl_STDIO_MODULE_INDICATOR([ftello]) # Code from module gendocs: # Code from module getaddrinfo: gl_GETADDRINFO @@ -297,6 +309,9 @@ AC_SUBST([LTALLOCA]) # Code from module maintainer-makefile: AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER], [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])]) + # Code from module malloc-posix: + gl_FUNC_MALLOC_POSIX + gl_STDLIB_MODULE_INDICATOR([malloc-posix]) # Code from module manywarnings: # Code from module memchr: gl_FUNC_MEMCHR @@ -374,6 +389,8 @@ AC_SUBST([LTALLOCA]) SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 fi gl_SYS_SOCKET_MODULE_INDICATOR([socket]) + # Code from module socketlib: + gl_SOCKETLIB # Code from module sockets: gl_SOCKETS # Code from module socklen: @@ -477,10 +494,17 @@ changequote([, ])dnl gl_module_indicator_condition=$gltests_WITNESS m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) gl_FUNC_UNGETC_WORKS + gl_FUNC_UNGETC_WORKS + gl_FUNC_GETPAGESIZE + gl_UNISTD_MODULE_INDICATOR([getpagesize]) AC_C_BIGENDIAN AC_C_BIGENDIAN gl_FUNC_IOCTL gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) + dnl Check for prerequisites for memory fence checks. + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h]) gt_TYPE_WCHAR_T gt_TYPE_WINT_T @@ -619,6 +643,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/float+.h lib/float.in.h lib/fseeko.c + lib/ftello.c lib/gai_strerror.c lib/getaddrinfo.c lib/getdelim.c @@ -633,6 +658,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/intprops.h lib/listen.c lib/lseek.c + lib/malloc.c lib/memchr.c lib/memchr.valgrind lib/minmax.h @@ -698,9 +724,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/fclose.m4 m4/float_h.m4 m4/fseeko.m4 + m4/ftello.m4 m4/getaddrinfo.m4 m4/getdelim.m4 m4/getline.m4 + m4/getpagesize.m4 m4/getpass.m4 m4/gettime.m4 m4/gettimeofday.m4 @@ -734,6 +762,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/servent.m4 m4/size_max.m4 m4/snprintf.m4 + m4/socketlib.m4 m4/sockets.m4 m4/socklen.m4 m4/sockpfaf.m4 @@ -770,11 +799,17 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-alignof.c tests/test-alloca-opt.c tests/test-arpa_inet.c + tests/test-binary-io.c + tests/test-binary-io.sh tests/test-c-ctype.c tests/test-errno.c tests/test-fseeko.c tests/test-fseeko.sh tests/test-fseeko2.sh + tests/test-ftello.c + tests/test-ftello.sh + tests/test-ftello2.sh + tests/test-ftello3.c tests/test-getaddrinfo.c tests/test-getdelim.c tests/test-getline.c @@ -808,6 +843,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-sys_socket.c tests/test-sys_stat.c tests/test-sys_time.c + tests/test-sys_wait.h tests/test-time.c tests/test-unistd.c tests/test-update-copyright.sh @@ -820,7 +856,9 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-version-etc.sh tests/test-wchar.c tests/zerosize-ptr.h + tests=lib/binary-io.h tests=lib/dummy.c + tests=lib/getpagesize.c tests=lib/ioctl.c tests=lib/sys_ioctl.in.h tests=lib/verify.h diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 1111041129..7104b3089a 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 @@ -1,5 +1,5 @@ -# hostent.m4 serial 1 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# hostent.m4 serial 2 +dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -28,12 +28,16 @@ AC_DEFUN([gl_HOSTENT], [gl_cv_w32_gethostbyname=no gl_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" - AC_TRY_LINK([ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #include <stddef.h> -], [gethostbyname(NULL);], [gl_cv_w32_gethostbyname=yes]) + ]], + [[gethostbyname(NULL);]])], + [gl_cv_w32_gethostbyname=yes]) LIBS="$gl_save_LIBS" ]) if test "$gl_cv_w32_gethostbyname" = "yes"; then diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index c7e0672f60..e37eb0567d 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,4 +1,4 @@ -# include_next.m4 serial 14 +# include_next.m4 serial 16 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -24,6 +24,13 @@ dnl does not warn about some things, and on some systems (Solaris and Interix) dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead dnl of plain '__STDC__'. +dnl +dnl PRAGMA_COLUMNS can be used in files that override system header files, so +dnl as to avoid compilation errors on HP NonStop systems when the gnulib file +dnl is included by a system header file that does a "#pragma COLUMNS 80" (which +dnl has the effect of truncating the lines of that file and all files that it +dnl includes to 80 columns) and the gnulib file has lines longer than 80 +dnl columns. AC_DEFUN([gl_INCLUDE_NEXT], [ @@ -68,10 +75,11 @@ EOF EOF gl_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" - AC_COMPILE_IFELSE([#include <conftest.h>], +dnl We intentionally avoid using AC_LANG_SOURCE here. + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], [gl_cv_have_include_next=yes], [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" - AC_COMPILE_IFELSE([#include <conftest.h>], + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]], [gl_cv_have_include_next=buggy], [gl_cv_have_include_next=no]) ]) @@ -97,6 +105,24 @@ EOF AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) + AC_CACHE_CHECK([whether system header files limit the line length], + [gl_cv_pragma_columns], + [dnl HP NonStop systems, which define __TANDEM, have this misfeature. + AC_EGREP_CPP([choke me], + [ +#ifdef __TANDEM +choke me +#endif + ], + [gl_cv_pragma_columns=yes], + [gl_cv_pragma_columns=no]) + ]) + if test $gl_cv_pragma_columns = yes; then + PRAGMA_COLUMNS="#pragma COLUMNS 10000" + else + PRAGMA_COLUMNS= + fi + AC_SUBST([PRAGMA_COLUMNS]) ]) # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) @@ -185,3 +211,7 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS], [$gl_next_as_first_directive]) AS_VAR_POPDEF([gl_next_header])]) ]) + +# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; +# this fallback is safe for all earlier autoconf versions. +m4_define_default([AC_LANG_DEFINES_PROVIDED]) diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 975caac506..493e4a9328 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,4 +1,4 @@ -# intmax_t.m4 serial 7 +# intmax_t.m4 serial 8 dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. -AC_PREREQ([2.13]) +AC_PREREQ([2.53]) # Define intmax_t to 'long' or 'long long' # if it is not already defined in <stdint.h> or <inttypes.h>. @@ -38,7 +38,9 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ #include <stddef.h> #include <stdlib.h> #if HAVE_STDINT_H_WITH_UINTMAX @@ -47,7 +49,10 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], #if HAVE_INTTYPES_H_WITH_UINTMAX #include <inttypes.h> #endif -], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) + ]], + [[intmax_t x = -1; return !x;]])], + [gt_cv_c_intmax_t=yes], + [gt_cv_c_intmax_t=no])]) if test $gt_cv_c_intmax_t = yes; then AC_DEFINE([HAVE_INTMAX_T], [1], [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 782d77ed8b..9d8f926926 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 @@ -1,4 +1,4 @@ -# inttypes_h.m4 serial 9 +# inttypes_h.m4 serial 10 dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,12 +12,15 @@ dnl From Paul Eggert. AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [ AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], - [AC_TRY_COMPILE( - [#include <sys/types.h> -#include <inttypes.h>], - [uintmax_t i = (uintmax_t) -1; return !i;], - [gl_cv_header_inttypes_h=yes], - [gl_cv_header_inttypes_h=no])]) + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include <sys/types.h> +#include <inttypes.h> + ]], + [[uintmax_t i = (uintmax_t) -1; return !i;]])], + [gl_cv_header_inttypes_h=yes], + [gl_cv_header_inttypes_h=no])]) if test $gl_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, diff --git a/gl/m4/lib-ld.m4 b/gl/m4/lib-ld.m4 index ebb30528bd..294db72e13 100644 --- a/gl/m4/lib-ld.m4 +++ b/gl/m4/lib-ld.m4 @@ -1,4 +1,4 @@ -# lib-ld.m4 serial 4 (gettext-0.18) +# lib-ld.m4 serial 5 (gettext-0.18.2) dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,15 +31,14 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } fi ac_prog=ld if test "$GCC" = yes; then diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index c73bd8e3a4..2ea9d6d073 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 21 (gettext-0.18) +# lib-link.m4 serial 25 (gettext-0.18.2) dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,9 +18,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[translit([$1],[./-], [___])]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([Name],[m4_translit([$1],[./+-], [____])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" @@ -58,9 +58,9 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[translit([$1],[./-], [___])]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([Name],[m4_translit([$1],[./+-], [____])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. @@ -85,7 +85,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; *) LIBS="$LIB[]NAME $LIBS" ;; esac - AC_TRY_LINK([$3], [$4], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[$3]], [[$4]])], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) LIBS="$ac_save_LIBS" @@ -157,15 +158,15 @@ dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) - pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) @@ -178,14 +179,14 @@ dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ @@ -242,7 +243,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index 9bf4dc2d04..b0612c7e17 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,4 +1,4 @@ -# lseek.m4 serial 5 +# lseek.m4 serial 6 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,15 +10,13 @@ AC_DEFUN([gl_FUNC_LSEEK], AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], [if test $cross_compiling = no; then - AC_LINK_IFELSE([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> /* for off_t */ #include <stdio.h> /* for SEEK_CUR */ -#include <unistd.h> -int main () -{ +#include <unistd.h>]], [[ /* Exit with success only if stdin is seekable. */ return lseek (0, (off_t)0, SEEK_CUR) < 0; -}], +]])], [if test -s conftest$ac_exeext \ && ./conftest$ac_exeext < conftest.$ac_ext \ && test 1 = "`echo hi \ @@ -29,11 +27,11 @@ int main () fi], [gl_cv_func_lseek_pipe=no]) else - AC_COMPILE_IFELSE([ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__ /* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */ Choke me. -#endif], +#endif]])], [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) fi]) if test $gl_cv_func_lseek_pipe = no; then diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 910ac92292..7a749254a1 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 @@ -1,25 +1,40 @@ -# malloc.m4 serial 9 +# malloc.m4 serial 12 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +# gl_FUNC_MALLOC_GNU +# ------------------ +# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if +# it is not. +AC_DEFUN([gl_FUNC_MALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. + _AC_FUNC_MALLOC_IF( + [AC_DEFINE([HAVE_MALLOC_GNU], [1], + [Define to 1 if your system has a GNU libc compatible 'malloc' + function, and to 0 otherwise.])], + [AC_DEFINE([HAVE_MALLOC_GNU], [0]) + gl_REPLACE_MALLOC + ]) +]) + # 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_STDLIB_H_DEFAULTS]) 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 + gl_REPLACE_MALLOC fi - AC_SUBST([HAVE_MALLOC_POSIX]) ]) # Test whether malloc, realloc, calloc are POSIX compliant, @@ -32,10 +47,20 @@ AC_DEFUN([gl_CHECK_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]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[]], + [[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + choke me + #endif + ]])], + [gl_cv_func_malloc_posix=yes], + [gl_cv_func_malloc_posix=no]) ]) ]) + +AC_DEFUN([gl_REPLACE_MALLOC], +[ + AC_LIBOBJ([malloc]) + REPLACE_MALLOC=1 +]) diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index ab773b8129..b05a79a026 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 8 +# memchr.m4 serial 9 dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -62,6 +62,8 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], strcpy (fence - 9, "12345678"); if (memchr (fence - 9, 0, 79) != fence - 1) return 2; + if (memchr (fence - 1, 0, 3) != fence - 1) + return 3; } return 0; ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index d9e9cecfd7..a5c42dea0f 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 @@ -1,10 +1,10 @@ -# minmax.m4 serial 3 -dnl Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. +# minmax.m4 serial 4 +dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_PREREQ([2.52]) +AC_PREREQ([2.53]) AC_DEFUN([gl_MINMAX], [ @@ -28,8 +28,11 @@ AC_DEFUN([gl_MINMAX_IN_HEADER], 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);], [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#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 diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index ebca5364c4..e850862c01 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 33 +# printf.m4 serial 35 dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,8 @@ AC_DEFUN([gl_PRINTF_SIZES_C99], AC_CACHE_CHECK([whether printf supports size specifiers as in C99], [gl_cv_func_printf_sizes_c99], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stddef.h> #include <stdio.h> #include <string.h> @@ -50,34 +51,36 @@ int main () || strcmp (buf, "1.5 33") != 0) return 1; return 0; -}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], - [ +}]])], + [gl_cv_func_printf_sizes_c99=yes], + [gl_cv_func_printf_sizes_c99=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; - darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_printf_sizes_c99="guessing no";; - openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; - solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_sizes_c99="guessing no";; - netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_sizes_c99="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; + solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_sizes_c99="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -92,7 +95,8 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE], AC_CACHE_CHECK([whether printf supports 'long double' arguments], [gl_cv_func_printf_long_double], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[10000]; @@ -111,16 +115,18 @@ int main () || strcmp (buf, "1.75 33") != 0) return 1; return 0; -}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], - [ +}]])], + [gl_cv_func_printf_long_double=yes], + [gl_cv_func_printf_long_double=no], + [ changequote(,)dnl - case "$host_os" in - beos*) gl_cv_func_printf_long_double="guessing no";; - mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; - *) gl_cv_func_printf_long_double="guessing yes";; - esac + case "$host_os" in + beos*) gl_cv_func_printf_long_double="guessing no";; + mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; + *) gl_cv_func_printf_long_double="guessing yes";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -136,7 +142,8 @@ AC_DEFUN([gl_PRINTF_INFINITE], AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], [gl_cv_func_printf_infinite], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static int @@ -201,32 +208,34 @@ int main () || strcmp (buf, "-0") != 0) return 1; return 0; -}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], - [ +}]])], + [gl_cv_func_printf_infinite=yes], + [gl_cv_func_printf_infinite=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; - darwin*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; - hpux*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite="guessing no";; - netbsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_infinite="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -252,7 +261,8 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], [gl_cv_func_printf_infinite_long_double], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ ]GL_NOCRASH[ #include <float.h> #include <stdio.h> @@ -414,38 +424,38 @@ int main () } #endif return 0; -}], - [gl_cv_func_printf_infinite_long_double=yes], - [gl_cv_func_printf_infinite_long_double=no], - [ +}]])], + [gl_cv_func_printf_infinite_long_double=yes], + [gl_cv_func_printf_infinite_long_double=no], + [ changequote(,)dnl - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; - *) - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; - darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; - hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite_long_double="guessing no";; - netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite_long_double="guessing no";; - esac - ;; - esac + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; + darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite_long_double="guessing no";; + netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite_long_double="guessing no";; + esac + ;; + esac changequote([,])dnl - ]) + ]) ]) ;; *) @@ -466,7 +476,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A], AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], [gl_cv_func_printf_directive_a], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -512,26 +523,28 @@ int main () && strcmp (buf, "0x8.0p-2") != 0)) return 1; return 0; -}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], - [ - case "$host_os" in - # Guess yes on glibc >= 2.5 systems. - *-gnu*) - AC_EGREP_CPP([BZ2908], [ - #include <features.h> - #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) - BZ2908 - #endif - #endif - ], - [gl_cv_func_printf_directive_a="guessing yes"], - [gl_cv_func_printf_directive_a="guessing no"]) - ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_a="guessing no";; - esac - ]) +}]])], + [gl_cv_func_printf_directive_a=yes], + [gl_cv_func_printf_directive_a=no], + [ + case "$host_os" in + # Guess yes on glibc >= 2.5 systems. + *-gnu*) + AC_EGREP_CPP([BZ2908], [ + #include <features.h> + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + BZ2908 + #endif + #endif + ], + [gl_cv_func_printf_directive_a="guessing yes"], + [gl_cv_func_printf_directive_a="guessing no"]) + ;; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_a="guessing no";; + esac + ]) ]) ]) @@ -546,7 +559,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F], AC_CACHE_CHECK([whether printf supports the 'F' directive], [gl_cv_func_printf_directive_f], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -563,26 +577,28 @@ int main () || strcmp (buf, "1234") != 0) return 1; return 0; -}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], - [ +}]])], + [gl_cv_func_printf_directive_f=yes], + [gl_cv_func_printf_directive_f=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; - darwin*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; - solaris*) gl_cv_func_printf_directive_f="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_f="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; + solaris*) gl_cv_func_printf_directive_f="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_f="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -597,7 +613,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], AC_CACHE_CHECK([whether printf supports the 'n' directive], [gl_cv_func_printf_directive_n], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char fmtstring[10]; @@ -614,14 +631,16 @@ int main () || count != 4) return 1; return 0; -}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], - [ +}]])], + [gl_cv_func_printf_directive_n=yes], + [gl_cv_func_printf_directive_n=no], + [ changequote(,)dnl - case "$host_os" in - *) gl_cv_func_printf_directive_n="guessing yes";; - esac + case "$host_os" in + *) gl_cv_func_printf_directive_n="guessing yes";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -639,7 +658,8 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], AC_CACHE_CHECK([whether printf supports the 'ls' directive], [gl_cv_func_printf_directive_ls], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ /* 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 @@ -687,19 +707,21 @@ int main () return 1; } return 0; -}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], - [ +}]])], + [gl_cv_func_printf_directive_ls=yes], + [gl_cv_func_printf_directive_ls=no], + [ changequote(,)dnl - case "$host_os" in - openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - *) gl_cv_func_printf_directive_ls="guessing yes";; - esac + case "$host_os" in + openbsd*) gl_cv_func_printf_directive_ls="guessing no";; + irix*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; + cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + *) gl_cv_func_printf_directive_ls="guessing yes";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -714,7 +736,8 @@ AC_DEFUN([gl_PRINTF_POSITIONS], AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], [gl_cv_func_printf_positions], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> /* The string "%2$d %1$d", with dollar characters protected from the shell's @@ -725,18 +748,20 @@ int main () { sprintf (buf, format, 33, 55); return (strcmp (buf, "55 33") != 0); -}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no], - [ +}]])], + [gl_cv_func_printf_positions=yes], + [gl_cv_func_printf_positions=no], + [ changequote(,)dnl - case "$host_os" in - netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; - esac + case "$host_os" in + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -751,7 +776,8 @@ AC_DEFUN([gl_PRINTF_FLAG_GROUPING], AC_CACHE_CHECK([whether printf supports the grouping flag], [gl_cv_func_printf_flag_grouping], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -761,17 +787,19 @@ int main () || buf[strlen (buf) - 1] != '9') return 1; return 0; -}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no], - [ +}]])], + [gl_cv_func_printf_flag_grouping=yes], + [gl_cv_func_printf_flag_grouping=no], + [ changequote(,)dnl - case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; - esac + case "$host_os" in + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -787,7 +815,8 @@ AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], [gl_cv_func_printf_flag_leftadjust], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -798,7 +827,7 @@ int main () || strcmp (buf, "ab c") != 0) return 1; return 0; -}], +}]])], [gl_cv_func_printf_flag_leftadjust=yes], [gl_cv_func_printf_flag_leftadjust=no], [ @@ -828,7 +857,8 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO], AC_CACHE_CHECK([whether printf supports the zero flag correctly], [gl_cv_func_printf_flag_zero], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -839,19 +869,21 @@ int main () && strcmp (buf, " infinity") != 0)) return 1; return 0; -}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no], - [ +}]])], + [gl_cv_func_printf_flag_zero=yes], + [gl_cv_func_printf_flag_zero=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_flag_zero="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_flag_zero="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -868,7 +900,8 @@ AC_DEFUN([gl_PRINTF_PRECISION], AC_CACHE_CHECK([whether printf supports large precisions], [gl_cv_func_printf_precision], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[5000]; @@ -881,17 +914,19 @@ int main () if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) return 1; return 0; -}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], - [ +}]])], + [gl_cv_func_printf_precision=yes], + [gl_cv_func_printf_precision=no], + [ changequote(,)dnl - case "$host_os" in - # Guess no only on native Win32 and BeOS systems. - mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; - esac + case "$host_os" in + # Guess no only on native Win32 and BeOS systems. + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -1031,7 +1066,8 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], AC_CACHE_CHECK([whether snprintf truncates the result as in C99], [gl_cv_func_snprintf_truncation_c99], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -1042,47 +1078,49 @@ int main () if (memcmp (buf, "45\0DEF", 6) != 0) return 1; return 0; -}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no], - [ +}]])], + [gl_cv_func_snprintf_truncation_c99=yes], + [gl_cv_func_snprintf_truncation_c99=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; - darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; - hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; - osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_truncation_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_truncation_c99="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; + darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; + hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_truncation_c99="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -1101,14 +1139,15 @@ dnl } dnl --------------------------------------------------------------------- dnl Result is gl_cv_func_snprintf_retval_c99. -AC_DEFUN([gl_SNPRINTF_RETVAL_C99], +AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], [gl_cv_func_snprintf_retval_c99], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char buf[100]; @@ -1118,39 +1157,41 @@ int main () if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; return 0; -}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no], - [ +}]])], + [gl_cv_func_snprintf_retval_c99=yes], + [gl_cv_func_snprintf_retval_c99=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; - darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_retval_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; - solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; - aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_retval_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_retval_c99="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; + darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_retval_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; + solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; + aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_retval_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_retval_c99="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -1165,7 +1206,8 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], [gl_cv_func_snprintf_directive_n], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> #include <string.h> static char fmtstring[10]; @@ -1181,40 +1223,42 @@ int main () if (count != 6) return 1; return 0; -}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], - [ +}]])], + [gl_cv_func_snprintf_directive_n=yes], + [gl_cv_func_snprintf_directive_n=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; - darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; - solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; - aix*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on OSF/1 >= 5. - osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; - osf*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_directive_n="guessing no";; - netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_directive_n="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_directive_n="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; + darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; + solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; + aix*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + osf*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_directive_n="guessing no";; + netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_directive_n="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_directive_n="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -1229,17 +1273,18 @@ AC_DEFUN([gl_SNPRINTF_SIZE1], AC_CACHE_CHECK([whether snprintf respects a size of 1], [gl_cv_func_snprintf_size1], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdio.h> int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; snprintf (buf, 1, "%d", 12345); return buf[1] != 'E'; -}], - [gl_cv_func_snprintf_size1=yes], - [gl_cv_func_snprintf_size1=no], - [gl_cv_func_snprintf_size1="guessing yes"]) +}]])], + [gl_cv_func_snprintf_size1=yes], + [gl_cv_func_snprintf_size1=no], + [gl_cv_func_snprintf_size1="guessing yes"]) ]) ]) @@ -1286,7 +1331,8 @@ AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], [gl_cv_func_vsnprintf_zerosize_c99], [ - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include <stdarg.h> #include <stdio.h> static int my_snprintf (char *buf, int size, const char *format, ...) @@ -1303,43 +1349,43 @@ int main() static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; my_snprintf (buf, 0, "%d", 12345); return buf[0] != 'D'; -}], - [gl_cv_func_vsnprintf_zerosize_c99=yes], - [gl_cv_func_vsnprintf_zerosize_c99=no], - [ +}]])], + [gl_cv_func_vsnprintf_zerosize_c99=yes], + [gl_cv_func_vsnprintf_zerosize_c99=no], + [ changequote(,)dnl - case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on mingw. - mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - esac + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on mingw. + mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + esac changequote([,])dnl - ]) + ]) ]) ]) @@ -1401,7 +1447,7 @@ dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . dnl Solaris 10 . . # # # . . # . . . # . . . . . . . . dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # -dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . +dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . . dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index dc30235c17..01c1234f7e 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 @@ -1,23 +1,44 @@ -# realloc.m4 serial 9 +# realloc.m4 serial 11 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +# gl_FUNC_REALLOC_GNU +# ------------------- +# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace +# realloc if it is not. +AC_DEFUN([gl_FUNC_REALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + dnl _AC_FUNC_REALLOC_IF is defined in Autoconf. + _AC_FUNC_REALLOC_IF( + [AC_DEFINE([HAVE_REALLOC_GNU], [1], + [Define to 1 if your system has a GNU libc compatible 'realloc' + function, and to 0 otherwise.])], + [AC_DEFINE([HAVE_REALLOC_GNU], [0]) + gl_REPLACE_REALLOC + ]) +])# gl_FUNC_REALLOC_GNU + # gl_FUNC_REALLOC_POSIX # --------------------- # Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it # fails), and replace realloc if it is not. AC_DEFUN([gl_FUNC_REALLOC_POSIX], [ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) if test $gl_cv_func_malloc_posix = yes; then - HAVE_REALLOC_POSIX=1 AC_DEFINE([HAVE_REALLOC_POSIX], [1], [Define if the 'realloc' function is POSIX compliant.]) else - AC_LIBOBJ([realloc]) - HAVE_REALLOC_POSIX=0 + gl_REPLACE_REALLOC fi - AC_SUBST([HAVE_REALLOC_POSIX]) +]) + +AC_DEFUN([gl_REPLACE_REALLOC], +[ + AC_LIBOBJ([realloc]) + REPLACE_REALLOC=1 ]) diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 2ed961a439..2486511aad 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 @@ -1,5 +1,5 @@ -# servent.m4 serial 1 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# servent.m4 serial 2 +dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -30,12 +30,16 @@ AC_DEFUN([gl_SERVENT], [gl_cv_w32_getservbyname=no gl_save_LIBS="$LIBS" LIBS="$LIBS -lws2_32" - AC_TRY_LINK([ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #include <stddef.h> -], [getservbyname(NULL,NULL);], [gl_cv_w32_getservbyname=yes]) + ]], + [[getservbyname(NULL,NULL);]])], + [gl_cv_w32_getservbyname=yes]) LIBS="$gl_save_LIBS" ]) if test "$gl_cv_w32_getservbyname" = "yes"; then diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index ce992db1f1..f3b1a9dfb2 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 @@ -1,4 +1,4 @@ -# size_max.m4 serial 9 +# size_max.m4 serial 10 dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,10 +34,14 @@ Found it if test $fits_in_uint = 1; then dnl Even though SIZE_MAX fits in an unsigned int, it must be of type dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. - AC_TRY_COMPILE([#include <stddef.h> - extern size_t foo; - extern unsigned long foo; - ], [], [fits_in_uint=0]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stddef.h> + extern size_t foo; + extern unsigned long foo; + ]], + [[]])], + [fits_in_uint=0]) fi dnl We cannot use 'expr' to simplify this expression, because 'expr' dnl works only with 'long' integers in the host environment, while we diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 new file mode 100644 index 0000000000..7bf02b5aee --- /dev/null +++ b/gl/m4/socketlib.m4 @@ -0,0 +1,86 @@ +# socketlib.m4 serial 1 +dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl gl_SOCKETLIB +dnl Determines the library to use for socket functions. +dnl Sets and AC_SUBSTs LIBSOCKET. + +AC_DEFUN([gl_SOCKETLIB], +[ + gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H + LIBSOCKET= + if test $HAVE_WINSOCK2_H = 1; then + dnl Native Windows API (not Cygwin). + AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], + [gl_cv_func_wsastartup], [ + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lws2_32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif]], [[ + WORD wVersionRequested = MAKEWORD(1, 1); + WSADATA wsaData; + int err = WSAStartup(wVersionRequested, &wsaData); + WSACleanup ();]])], + gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) + LIBS="$gl_save_LIBS" + ]) + if test "$gl_cv_func_wsastartup" = "yes"; then + AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) + LIBSOCKET='-lws2_32' + fi + else + dnl Unix API. + dnl Solaris has most socket functions in libsocket. + dnl Haiku has most socket functions in libnetwork. + dnl BeOS has most socket functions in libnet. + AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ + gl_cv_lib_socket= + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [], + [gl_save_LIBS="$LIBS" + LIBS="$gl_save_LIBS -lsocket" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lsocket"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnetwork" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnetwork"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnet" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnet"]) + fi + fi + LIBS="$gl_save_LIBS" + ]) + if test -z "$gl_cv_lib_socket"; then + gl_cv_lib_socket="none needed" + fi + ]) + if test "$gl_cv_lib_socket" != "none needed"; then + LIBSOCKET="$gl_cv_lib_socket" + fi + fi + AC_SUBST([LIBSOCKET]) +]) diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index aefb936079..ba9a563d8e 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 @@ -1,4 +1,4 @@ -# sockets.m4 serial 6 +# sockets.m4 serial 7 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,80 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SOCKETS], [ AC_REQUIRE([AC_C_INLINE]) - - gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H - LIBSOCKET= - if test $HAVE_WINSOCK2_H = 1; then - dnl Native Windows API (not Cygwin). - AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32], - [gl_cv_func_wsastartup], [ - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lws2_32" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#ifdef HAVE_WINSOCK2_H -# include <winsock2.h> -#endif]], [[ - WORD wVersionRequested = MAKEWORD(1, 1); - WSADATA wsaData; - int err = WSAStartup(wVersionRequested, &wsaData); - WSACleanup ();]])], - gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no) - LIBS="$gl_save_LIBS" - ]) - if test "$gl_cv_func_wsastartup" = "yes"; then - AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) - LIBSOCKET='-lws2_32' - fi - else - dnl Unix API. - dnl Solaris has most socket functions in libsocket. - dnl Haiku has most socket functions in libnetwork. - dnl BeOS has most socket functions in libnet. - AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ - gl_cv_lib_socket= - AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern -#ifdef __cplusplus -"C" -#endif -char setsockopt();]], [[setsockopt();]])], - [], - [gl_save_LIBS="$LIBS" - LIBS="$gl_save_LIBS -lsocket" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern -#ifdef __cplusplus -"C" -#endif -char setsockopt();]], [[setsockopt();]])], - [gl_cv_lib_socket="-lsocket"]) - if test -z "$gl_cv_lib_socket"; then - LIBS="$gl_save_LIBS -lnetwork" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern -#ifdef __cplusplus -"C" -#endif -char setsockopt();]], [[setsockopt();]])], - [gl_cv_lib_socket="-lnetwork"]) - if test -z "$gl_cv_lib_socket"; then - LIBS="$gl_save_LIBS -lnet" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern -#ifdef __cplusplus -"C" -#endif -char setsockopt();]], [[setsockopt();]])], - [gl_cv_lib_socket="-lnet"]) - fi - fi - LIBS="$gl_save_LIBS" - ]) - if test -z "$gl_cv_lib_socket"; then - gl_cv_lib_socket="none needed" - fi - ]) - if test "$gl_cv_lib_socket" != "none needed"; then - LIBSOCKET="$gl_cv_lib_socket" - fi - fi - AC_SUBST([LIBSOCKET]) + AC_REQUIRE([gl_SOCKETLIB]) gl_PREREQ_SOCKETS ]) diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 2933d4b890..d0d6baab55 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 7 +# socklen.m4 serial 8 dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,8 +8,9 @@ dnl From Albert Chin, Windows fixes from Simon Josefsson. dnl Check for socklen_t: historically on BSD it is an int, and in dnl POSIX 1g it is a type of its own, but some platforms use different -dnl types for the argument to getsockopt, getpeername, etc. So we -dnl have to test to find something that will work. +dnl types for the argument to getsockopt, getpeername, etc.: +dnl HP-UX 10.20, IRIX 6.5, Interix 3.5, BeOS. +dnl So we 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 sys_socket.in.h, which diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 8a0c236038..8806705ae2 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 @@ -47,6 +47,9 @@ AC_DEFUN([gl_SOCKET_FAMILIES], #endif #ifdef HAVE_WINSOCK2_H #include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> #endif]], [[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; if (&x && &y && &z) return 0;]])], diff --git a/gl/m4/stdarg.m4 b/gl/m4/stdarg.m4 index 5c87bd8b5f..8a62f2e844 100644 --- a/gl/m4/stdarg.m4 +++ b/gl/m4/stdarg.m4 @@ -1,4 +1,4 @@ -# stdarg.m4 serial 3 +# stdarg.m4 serial 4 dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,12 +13,16 @@ AC_DEFUN([gl_STDARG_H], NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H]) AC_MSG_CHECKING([for va_copy]) AC_CACHE_VAL([gl_cv_func_va_copy], [ - AC_TRY_COMPILE([#include <stdarg.h>], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdarg.h>]], + [[ #ifndef va_copy void (*func) (va_list, va_list) = va_copy; #endif -], - [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])]) + ]])], + [gl_cv_func_va_copy=yes], + [gl_cv_func_va_copy=no])]) AC_MSG_RESULT([$gl_cv_func_va_copy]) if test $gl_cv_func_va_copy = no; then dnl Provide a substitute. @@ -47,12 +51,16 @@ void (*func) (va_list, va_list) = va_copy; dnl Provide a substitute in <config.h>, either __va_copy or as a simple dnl assignment. gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [ - AC_TRY_COMPILE([#include <stdarg.h>], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdarg.h>]], + [[ #ifndef __va_copy error, bail out #endif -], - [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])]) + ]])], + [gl_cv_func___va_copy=yes], + [gl_cv_func___va_copy=no])]) if test $gl_cv_func___va_copy = yes; then AC_DEFINE([va_copy], [__va_copy], [Define as a macro for copying va_list variables.]) diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4 index 3d672d7476..1efe59ea1c 100644 --- a/gl/m4/stdbool.m4 +++ b/gl/m4/stdbool.m4 @@ -5,6 +5,8 @@ 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. +#serial 3 + # Prepare for substituting <stdbool.h> if it is not supported. AC_DEFUN([AM_STDBOOL_H], @@ -31,82 +33,68 @@ AC_DEFUN([AM_STDBOOL_H], # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) -# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf -# have this macro built-in. +# This version of the macro is needed in autoconf <= 2.67. Autoconf has +# it built in since 2.60, but we want the tweaks from the 2.68 version +# to avoid rejecting xlc and clang due to relying on extensions. AC_DEFUN([AC_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], - [AC_TRY_COMPILE( - [ - #include <stdbool.h> - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { _Bool s: 1; _Bool t; } s; - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - #if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a run-time - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); - #endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - ], - [ - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - ], + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + ]], + [[ + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + ]])], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 1cc57e6e96..c5e813a96d 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 34 +# stdint.m4 serial 35 dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -309,7 +309,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF], dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], - [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [Define to the number of bits in type ']gltype['.])]) for gltype in $1 ; do AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], @@ -334,7 +334,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF], eval BITSIZEOF_${GLTYPE}=\$result done m4_foreach_w([gltype], [$1], - [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) + [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ]) dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) @@ -347,7 +347,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED], dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], - [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [Define to 1 if ']gltype[' is a signed integer type.])]) for gltype in $1 ; do AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], @@ -367,7 +367,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED], fi done m4_foreach_w([gltype], [$1], - [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) + [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ]) dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) @@ -380,7 +380,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], dnl config.h.in, dnl - extra AC_SUBST calls, so that the right substitutions are made. m4_foreach_w([gltype], [$1], - [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], + [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], [Define to l, ll, u, ul, ull, etc., as suitable for constants of type ']gltype['.])]) for gltype in $1 ; do @@ -419,7 +419,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) done m4_foreach_w([gltype], [$1], - [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) + [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) ]) dnl gl_STDINT_INCLUDES diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index b8e3c6cc71..670c0cc2bf 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 @@ -1,4 +1,4 @@ -# stdint_h.m4 serial 8 +# stdint_h.m4 serial 9 dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,12 +12,13 @@ dnl From Paul Eggert. AC_DEFUN([gl_AC_HEADER_STDINT_H], [ AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], - [AC_TRY_COMPILE( - [#include <sys/types.h> -#include <stdint.h>], - [uintmax_t i = (uintmax_t) -1; return !i;], - [gl_cv_header_stdint_h=yes], - [gl_cv_header_stdint_h=no])]) + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <stdint.h>]], + [[uintmax_t i = (uintmax_t) -1; return !i;]])], + [gl_cv_header_stdint_h=yes], + [gl_cv_header_stdint_h=no])]) if test $gl_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index dd84796d2c..e4697ce213 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 28 +# stdlib_h.m4 serial 31 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,7 @@ AC_DEFUN([gl_STDLIB_H], #if HAVE_RANDOM_H # include <random.h> #endif - ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp + ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt unsetenv]) @@ -50,6 +50,7 @@ AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ + GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) @@ -72,16 +73,16 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) - HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX]) HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) - HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) @@ -89,7 +90,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) - HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) @@ -100,9 +100,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) + REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index b88ba94da1..a45a10a9ee 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -2,6 +2,8 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc. +# serial 2 + # 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. @@ -24,7 +26,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY], ]) dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared -dnl in time.h or sys/time.h. +dnl in time.h, sys/time.h, or pthread.h. AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [ @@ -41,6 +43,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else @@ -55,10 +58,24 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in <pthread.h>], + [gl_cv_sys_struct_timespec_in_pthread_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_pthread_h=yes], + [gl_cv_sys_struct_timespec_in_pthread_h=no])]) + if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + fi fi fi AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) ]) AC_DEFUN([gl_TIME_MODULE_INDICATOR], diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index ed804e664b..a133e6ad58 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 @@ -1,4 +1,4 @@ -# wchar_t.m4 serial 3 (gettext-0.18) +# wchar_t.m4 serial 4 (gettext-0.18.2) dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,9 +11,13 @@ dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WCHAR_T], [ AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_TRY_COMPILE([#include <stddef.h> - wchar_t foo = (wchar_t)'\0';], , - [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])]) + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stddef.h> + wchar_t foo = (wchar_t)'\0';]], + [[]])], + [gt_cv_c_wchar_t=yes], + [gt_cv_c_wchar_t=no])]) if test $gt_cv_c_wchar_t = yes; then AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) fi diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index a6c7d15cb5..58ef865565 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,4 +1,4 @@ -# wint_t.m4 serial 4 (gettext-0.18) +# wint_t.m4 serial 5 (gettext-0.18.2) dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,9 @@ dnl Prerequisite: AC_PROG_CC AC_DEFUN([gt_TYPE_WINT_T], [ AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], - [AC_TRY_COMPILE([ + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ /* 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 @@ -20,8 +22,10 @@ AC_DEFUN([gt_TYPE_WINT_T], #include <stdio.h> #include <time.h> #include <wchar.h> - wint_t foo = (wchar_t)'\0';], , - [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])]) + wint_t foo = (wchar_t)'\0';]], + [[]])], + [gt_cv_c_wint_t=yes], + [gt_cv_c_wint_t=no])]) if test $gt_cv_c_wint_t = yes; then AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) fi |