summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am8
-rw-r--r--m4/d-ino.m422
-rw-r--r--m4/dirname.m45
-rw-r--r--m4/dos.m441
-rw-r--r--m4/double-slash-root.m443
-rw-r--r--m4/exclude.m49
-rw-r--r--m4/extensions.m416
-rw-r--r--m4/fnmatch.m47
-rw-r--r--m4/getcwd-abort-bug.m4106
-rw-r--r--m4/getcwd-path-max.m410
-rw-r--r--m4/getcwd.m412
-rw-r--r--m4/getopt.m44
-rw-r--r--m4/gnulib-cache.m47
-rw-r--r--m4/gnulib-comp.m424
-rw-r--r--m4/longdouble.m47
-rw-r--r--m4/longlong.m439
-rw-r--r--m4/onceonly_2_57.m412
-rw-r--r--m4/regex.m484
-rw-r--r--m4/size_max.m445
-rw-r--r--m4/ssize_t.m421
-rw-r--r--m4/stdbool.m44
-rw-r--r--m4/strerror_r.m41
-rw-r--r--m4/strndup.m451
-rw-r--r--m4/strnlen.m429
-rw-r--r--m4/ulonglong.m438
-rw-r--r--m4/unistd_h.m418
-rw-r--r--m4/wcwidth.m426
-rw-r--r--m4/xstrndup.m415
28 files changed, 542 insertions, 162 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 6b8a6a2..c70178b 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -6,12 +6,14 @@ EXTRA_DIST = \
d-ino.m4 \
dirname.m4 \
dos.m4 \
+ double-slash-root.m4 \
error.m4 \
exclude.m4 \
exitfail.m4 \
extensions.m4 \
fnmatch.m4 \
fpending.m4 \
+ getcwd-abort-bug.m4 \
getcwd-path-max.m4 \
getcwd.m4 \
getopt.m4 \
@@ -57,6 +59,7 @@ EXTRA_DIST = \
restrict.m4 \
signed.m4 \
size_max.m4 \
+ ssize_t.m4 \
stat-macros.m4 \
stdbool.m4 \
stdint_h.m4 \
@@ -64,14 +67,19 @@ EXTRA_DIST = \
strcspn.m4 \
strdup.m4 \
strerror_r.m4 \
+ strndup.m4 \
+ strnlen.m4 \
strpbrk.m4 \
strsep.m4 \
strstr.m4 \
uintmax_t.m4 \
ulonglong.m4 \
+ unistd_h.m4 \
wchar_t.m4 \
+ wcwidth.m4 \
wint_t.m4 \
xalloc.m4 \
xgetcwd.m4 \
xsize.m4 \
+ xstrndup.m4 \
extra_dist.sh
diff --git a/m4/d-ino.m4 b/m4/d-ino.m4
index 4d2c4db..d87b4db 100644
--- a/m4/d-ino.m4
+++ b/m4/d-ino.m4
@@ -1,11 +1,11 @@
-#serial 7
+#serial 8
dnl From Jim Meyering.
dnl
dnl Check whether struct dirent has a member named d_ino.
dnl
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004 Free Software
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2006 Free Software
# Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -13,26 +13,12 @@ dnl
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
- [AC_REQUIRE([AC_HEADER_DIRENT])dnl
- AC_CACHE_CHECK([for d_ino member in directory struct],
+ [AC_CACHE_CHECK([for d_ino member in directory struct],
jm_cv_struct_dirent_d_ino,
[AC_TRY_LINK(dnl
[
#include <sys/types.h>
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#else /* not HAVE_DIRENT_H */
-# define dirent direct
-# ifdef HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif /* HAVE_SYS_NDIR_H */
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif /* HAVE_SYS_DIR_H */
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif /* HAVE_NDIR_H */
-#endif /* HAVE_DIRENT_H */
+#include <dirent.h>
],
[struct dirent dp; dp.d_ino = 0;],
diff --git a/m4/dirname.m4 b/m4/dirname.m4
index e36937d..f3412ad 100644
--- a/m4/dirname.m4
+++ b/m4/dirname.m4
@@ -1,5 +1,5 @@
-# dirname.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#serial 6 -*- autoconf -*-
+dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,7 @@ AC_DEFUN([gl_DIRNAME],
dnl Prerequisites of lib/dirname.h.
AC_REQUIRE([gl_AC_DOS])
+ AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c.
])
diff --git a/m4/dos.m4 b/m4/dos.m4
index 0713cf1..dd59571 100644
--- a/m4/dos.m4
+++ b/m4/dos.m4
@@ -1,9 +1,9 @@
-#serial 9
+#serial 10 -*- autoconf -*-
# Define some macros required for proper operation of code in lib/*.c
# on MSDOS/Windows systems.
-# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,30 +14,38 @@ AC_DEFUN([gl_AC_DOS],
[
AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
[
- AC_TRY_COMPILE([],
- [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
+ AC_TRY_COMPILE([],
+ [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
neither MSDOS nor Windows
#endif],
- [ac_cv_win_or_dos=yes],
- [ac_cv_win_or_dos=no])
+ [ac_cv_win_or_dos=yes],
+ [ac_cv_win_or_dos=no])
])
if test x"$ac_cv_win_or_dos" = xyes; then
ac_fs_accepts_drive_letter_prefix=1
ac_fs_backslash_is_file_name_separator=1
+ AC_CACHE_CHECK([whether drive letter can start relative path],
+ [ac_cv_drive_letter_can_be_relative],
+ [
+ AC_TRY_COMPILE([],
+ [#if defined __CYGWIN__
+drive letters are always absolute
+#endif],
+ [ac_cv_drive_letter_can_be_relative=yes],
+ [ac_cv_drive_letter_can_be_relative=no])
+ ])
+ if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
+ ac_fs_drive_letter_can_be_relative=1
+ else
+ ac_fs_drive_letter_can_be_relative=0
+ fi
else
ac_fs_accepts_drive_letter_prefix=0
ac_fs_backslash_is_file_name_separator=0
+ ac_fs_drive_letter_can_be_relative=0
fi
- AH_VERBATIM(FILE_SYSTEM_PREFIX_LEN,
- [#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
-# define FILE_SYSTEM_PREFIX_LEN(Filename) \
- ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
-#else
-# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
-#endif])
-
AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
$ac_fs_accepts_drive_letter_prefix,
[Define on systems for which file names may have a so-called
@@ -55,4 +63,9 @@ neither MSDOS nor Windows
$ac_fs_backslash_is_file_name_separator,
[Define if the backslash character may also serve as a file name
component separator.])
+
+ AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
+ $ac_fs_drive_letter_can_be_relative,
+ [Define if a drive letter prefix denotes a relative path if it is
+ not followed by a file name component separator.])
])
diff --git a/m4/double-slash-root.m4 b/m4/double-slash-root.m4
new file mode 100644
index 0000000..f8cbd54
--- /dev/null
+++ b/m4/double-slash-root.m4
@@ -0,0 +1,43 @@
+#serial 1 -*- autoconf -*-
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([whether // is distinct from /], [ac_cv_double_slash_root],
+ [ if test x"$cross_compiling" = xyes ; then
+ # When cross-compiling, there is no way to tell whether // is special
+ # short of a list of hosts. However, the only known hosts to date
+ # that have a distinct // are Apollo DomainOS (too old to port to)
+ # and Cygwin. If anyone knows of another system for which // has
+ # special semantics and is distinct from /, please report it to
+ # <bug-coreutils@gnu.org>.
+ case $host in
+ *-cygwin)
+ ac_cv_double_slash_root=yes ;;
+ *)
+ # Be optimistic and assume that / and // are the same when we
+ # don't know.
+ ac_cv_double_slash_root='unknown, assuming no' ;;
+ esac
+ else
+ set x `ls -di / //`
+ if test $[2] = $[4]; then
+ ac_cv_double_slash_root=no
+ else
+ ac_cv_double_slash_root=yes
+ fi
+ fi])
+ if test x"$ac_cv_double_slash_root" = xyes; then
+ ac_double_slash_root=1
+ else
+ ac_double_slash_root=0
+ fi
+
+ AC_DEFINE_UNQUOTED([DOUBLE_SLASH_IS_DISTINCT_ROOT],
+ $ac_double_slash_root,
+ [Define to 1 if // is a file system root distinct from /.])
+])
diff --git a/m4/exclude.m4 b/m4/exclude.m4
index ecb0f54..87acf84 100644
--- a/m4/exclude.m4
+++ b/m4/exclude.m4
@@ -1,5 +1,5 @@
-# exclude.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+# exclude.m4 serial 6
+dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -8,9 +8,4 @@ AC_DEFUN([gl_EXCLUDE],
[
AC_LIBSOURCES([exclude.c, exclude.h])
AC_LIBOBJ([exclude])
-
- dnl Prerequisites of lib/exclude.c.
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([AC_HEADER_STDC])
- AC_CHECK_FUNCS_ONCE(isascii)
])
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index e71845f..4976079 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,10 +1,13 @@
# Enable extensions on systems that normally disable them.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# This file is only needed in autoconf <= 2.59. Newer versions of autoconf
+# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics.
+
# gl_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
@@ -25,6 +28,15 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif])
- AC_DEFINE([__EXTENSIONS__])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
])
diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4
index e879bbd..ce94c84 100644
--- a/m4/fnmatch.m4
+++ b/m4/fnmatch.m4
@@ -3,7 +3,7 @@
# This is a modified version of autoconf's AC_FUNC_FNMATCH.
# This file should be simplified after Autoconf 2.57 is required.
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -61,10 +61,9 @@ AS_IF([test $$2 = yes], [$3], [$4])
# ------------------
# Prepare the replacement of fnmatch.
AC_DEFUN([_AC_LIBOBJ_FNMATCH],
-[AC_REQUIRE([AC_C_CONST])dnl
-AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+[AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
-AC_CHECK_DECLS([getenv])
+AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
AC_CHECK_HEADERS([wchar.h wctype.h])
AC_LIBOBJ([fnmatch])
diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4
new file mode 100644
index 0000000..a431a7c
--- /dev/null
+++ b/m4/getcwd-abort-bug.m4
@@ -0,0 +1,106 @@
+#serial 1
+# Determine whether getcwd aborts when the length of the working directory
+# name is unusually large. Any length between 4k and 16k trigger the bug
+# when using glibc-2.4.90-9 or older.
+
+# Copyright (C) 2006 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# From Jim Meyering
+
+# gl_FUNC_GETCWD_ABORT_BUG([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
+[
+ AC_CHECK_DECLS_ONCE(getcwd)
+ AC_CHECK_FUNCS(getpagesize)
+ AC_CACHE_CHECK([whether getcwd aborts when 4k < cwd_length < 16k],
+ gl_cv_func_getcwd_abort_bug,
+ [# Remove any remnants of a previous test.
+ rm -rf confdir-14B---
+ # Arrange for deletion of the temporary directory this test creates.
+ ac_clean_files="$ac_clean_files confdir-14B---"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <string.h>
+#include <sys/stat.h>
+
+/* Don't get link errors because mkdir is redefined to rpl_mkdir. */
+#undef mkdir
+
+#ifndef S_IRWXU
+# define S_IRWXU 0700
+#endif
+
+/* FIXME: skip the run-test altogether on systems without getpagesize. */
+#if ! HAVE_GETPAGESIZE
+# define getpagesize() 0
+#endif
+
+/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than
+ the 16kB pagesize on ia64 linux. Those conditions make the code below
+ trigger a bug in glibc's getcwd implementation before 2.4.90-10. */
+#define TARGET_LEN (5 * 1024)
+
+int
+main ()
+{
+ char const *dir_name = "confdir-14B---";
+ char *cwd;
+ size_t initial_cwd_len;
+ int fail = 0;
+ size_t desired_depth;
+ size_t d;
+
+ /* The bug is triggered when PATH_MAX < getpagesize (), so skip
+ this relative expensive and invasive test if that's not true. */
+ if (getpagesize () <= PATH_MAX)
+ return 0;
+
+ cwd = getcwd (NULL, 0);
+ if (cwd == NULL)
+ return 0;
+
+ initial_cwd_len = strlen (cwd);
+ free (cwd);
+ desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
+ / (1 + strlen (dir_name)));
+ for (d = 0; d < desired_depth; d++)
+ {
+ if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
+ {
+ fail = 3; /* Unable to construct deep hierarchy. */
+ break;
+ }
+ }
+
+ /* If libc has the bug in question, this invocation of getcwd
+ results in a failed assertion. */
+ cwd = getcwd (NULL, 0);
+ if (cwd == NULL)
+ fail = 4; /* getcwd failed. This is ok, and expected. */
+ free (cwd);
+
+ /* Call rmdir first, in case the above chdir failed. */
+ rmdir (dir_name);
+ while (0 < d--)
+ {
+ if (chdir ("..") < 0)
+ break;
+ rmdir (dir_name);
+ }
+
+ return 0;
+}
+ ]])],
+ [gl_cv_func_getcwd_abort_bug=no],
+ [gl_cv_func_getcwd_abort_bug=yes],
+ [gl_cv_func_getcwd_abort_bug=yes])
+ ])
+ AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2])
+])
diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4
index 5a6c43a..3d0af87 100644
--- a/m4/getcwd-path-max.m4
+++ b/m4/getcwd-path-max.m4
@@ -1,4 +1,4 @@
-#serial 10
+#serial 12
# Check for several getcwd bugs with long file names.
# If so, arrange to compile the wrapper function.
@@ -6,7 +6,7 @@
# I've heard that this is due to a Linux kernel bug, and that it has
# been fixed between 2.4.21-pre3 and 2.4.21-pre4. */
-# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -61,7 +61,7 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
#define BUF_SLOP 20
int
-main (void)
+main ()
{
#ifndef PATH_MAX
/* The Hurd doesn't define this, so getcwd can't exhibit the bug --
@@ -157,8 +157,8 @@ main (void)
{
size_t i;
- /* Unlink first, in case the chdir failed. */
- unlink (DIR_NAME);
+ /* Try rmdir first, in case the chdir failed. */
+ rmdir (DIR_NAME);
for (i = 0; i <= n_chdirs; i++)
{
if (chdir ("..") < 0)
diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
index 35d0b53..2a19a08 100644
--- a/m4/getcwd.m4
+++ b/m4/getcwd.m4
@@ -1,6 +1,6 @@
# getcwd.m4 - check for working getcwd that is compatible with glibc
-# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -40,12 +40,15 @@ AC_DEFUN([gl_FUNC_GETCWD],
[
AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+ gl_abort_bug=no
case $gl_cv_func_getcwd_null in
- yes) gl_FUNC_GETCWD_PATH_MAX;;
+ yes)
+ gl_FUNC_GETCWD_PATH_MAX
+ gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]);;
esac
- case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max in
- yes,yes) ;;
+ case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
+ yes,yes,no) ;;
*)
AC_LIBOBJ([getcwd])
AC_DEFINE([__GETCWD_PREFIX], [[rpl_]],
@@ -58,7 +61,6 @@ AC_DEFUN([gl_FUNC_GETCWD],
AC_DEFUN([gl_PREREQ_GETCWD],
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([AC_HEADER_DIRENT])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
:
])
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index e60b746..c0a73b2 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,11 +1,11 @@
-# getopt.m4 serial 12
+# getopt.m4 serial 13
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# The getopt module assume you want GNU getopt, with getopt_long etc,
-# rather than vanilla POSIX getopt. This means your your code should
+# rather than vanilla POSIX getopt. This means your code should
# always include <getopt.h> for the getopt prototypes.
AC_DEFUN([gl_GETOPT_SUBSTITUTE],
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 2257882..05a05ef 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -1,4 +1,5 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004-2006 Free Software Foundation, Inc.
+#
# This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General
# Public License, this file may be distributed as part of a program
@@ -14,13 +15,15 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --aux-dir=. --macro-prefix=gl alloca alloca-opt atexit closeout dirname error exclude exit exitfail extensions fnmatch fnmatch-gnu fpending getcwd getopt gettext gettext-h havelib inttostr lstat malloc mbchar mbuiter memchr memcpy mempcpy memset obstack pathmax quotearg realloc regex restrict stat-macros stdbool strcase strcspn strdup strnlen1 strpbrk strsep strstr xalloc xalloc-die xgetcwd
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --macro-prefix=gl --assume-autoconf=2.59 alloca alloca-opt atexit closeout dirname error exclude exit exitfail extensions fnmatch fnmatch-gnu fpending getcwd getopt gettext gettext-h havelib inttostr lstat malloc mbchar mbuiter memchr memcpy mempcpy memset obstack pathmax quotearg realloc regex restrict stat-macros stdbool strcase strcspn strdup strnlen1 strpbrk strsep strstr xalloc xalloc-die xgetcwd
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_MODULES([alloca alloca-opt atexit closeout dirname error exclude exit exitfail extensions fnmatch fnmatch-gnu fpending getcwd getopt gettext gettext-h havelib inttostr lstat malloc mbchar mbuiter memchr memcpy mempcpy memset obstack pathmax quotearg realloc regex restrict stat-macros stdbool strcase strcspn strdup strnlen1 strpbrk strsep strstr xalloc xalloc-die xgetcwd])
gl_AVOID([])
gl_SOURCE_BASE([lib])
gl_M4_BASE([m4])
+gl_DOC_BASE([doc])
gl_TESTS_BASE([tests])
gl_LIB([libgnu])
gl_MACRO_PREFIX([gl])
+gl_AUTOCONF_MINVERSION([2.59])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 8a04e09..6e7afd6 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -1,4 +1,5 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004-2006 Free Software Foundation, Inc.
+#
# This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General
# Public License, this file may be distributed as part of a program
@@ -58,16 +59,22 @@ AC_DEFUN([gl_INIT],
AC_FUNC_REALLOC
gl_REGEX
gl_C_RESTRICT
+ gt_TYPE_SSIZE_T
gl_STAT_MACROS
AM_STDBOOL_H
gl_STRCASE
gl_FUNC_STRCSPN
gl_FUNC_STRDUP
+ gl_FUNC_STRNDUP
+ gl_FUNC_STRNLEN
gl_FUNC_STRPBRK
gl_FUNC_STRSEP
gl_FUNC_STRSTR
+ gl_HEADER_UNISTD
+ gl_FUNC_WCWIDTH
gl_XALLOC
gl_XGETCWD
+ gl_XSTRNDUP
])
# This macro records the list of files which have been installed by
@@ -138,6 +145,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/strdup.h
lib/stripslash.c
lib/strncasecmp.c
+ lib/strndup.c
+ lib/strndup.h
+ lib/strnlen.c
+ lib/strnlen.h
lib/strnlen1.c
lib/strnlen1.h
lib/strpbrk.c
@@ -148,11 +159,14 @@ AC_DEFUN([gl_FILE_LIST], [
lib/strstr.h
lib/umaxtostr.c
lib/verify.h
+ lib/wcwidth.h
lib/xalloc-die.c
lib/xalloc.h
lib/xgetcwd.c
lib/xgetcwd.h
lib/xmalloc.c
+ lib/xstrndup.c
+ lib/xstrndup.h
m4/alloca.m4
m4/atexit.m4
m4/closeout.m4
@@ -160,12 +174,14 @@ AC_DEFUN([gl_FILE_LIST], [
m4/d-ino.m4
m4/dirname.m4
m4/dos.m4
+ m4/double-slash-root.m4
m4/error.m4
m4/exclude.m4
m4/exitfail.m4
m4/extensions.m4
m4/fnmatch.m4
m4/fpending.m4
+ m4/getcwd-abort-bug.m4
m4/getcwd-path-max.m4
m4/getcwd.m4
m4/getopt.m4
@@ -208,6 +224,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/restrict.m4
m4/signed.m4
m4/size_max.m4
+ m4/ssize_t.m4
m4/stat-macros.m4
m4/stdbool.m4
m4/stdint_h.m4
@@ -215,14 +232,19 @@ AC_DEFUN([gl_FILE_LIST], [
m4/strcspn.m4
m4/strdup.m4
m4/strerror_r.m4
+ m4/strndup.m4
+ m4/strnlen.m4
m4/strpbrk.m4
m4/strsep.m4
m4/strstr.m4
m4/uintmax_t.m4
m4/ulonglong.m4
+ m4/unistd_h.m4
m4/wchar_t.m4
+ m4/wcwidth.m4
m4/wint_t.m4
m4/xalloc.m4
m4/xgetcwd.m4
m4/xsize.m4
+ m4/xstrndup.m4
])
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4
index 40cd7ce..25590f4 100644
--- a/m4/longdouble.m4
+++ b/m4/longdouble.m4
@@ -1,5 +1,5 @@
-# longdouble.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# longdouble.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,9 @@ dnl From Bruno Haible.
dnl Test whether the compiler supports the 'long double' type.
dnl Prerequisite: AC_PROG_CC
+dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
+dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
+
AC_DEFUN([gt_TYPE_LONGDOUBLE],
[
AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
diff --git a/m4/longlong.m4 b/m4/longlong.m4
index 7b399e0..ea7c485 100644
--- a/m4/longlong.m4
+++ b/m4/longlong.m4
@@ -1,21 +1,42 @@
-# longlong.m4 serial 5
-dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+# longlong.m4 serial 6
+dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
-# Define HAVE_LONG_LONG if 'long long' works.
+# Define HAVE_LONG_LONG_INT if 'long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
+AC_DEFUN([AC_TYPE_LONG_LONG_INT],
+[
+ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ typedef int a[((-9223372036854775807LL < 0
+ && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ int i = 63;]],
+ [[long long int llmax = 9223372036854775807ll;
+ return (ll << 63 | ll >> 63 | ll < i | ll > i
+ | llmax / ll | llmax % ll);]])],
+ [ac_cv_type_long_long_int=yes],
+ [ac_cv_type_long_long_int=no])])
+ if test $ac_cv_type_long_long_int = yes; then
+ AC_DEFINE([HAVE_LONG_LONG_INT], 1,
+ [Define to 1 if the system has the type `long long int'.])
+ fi
+])
+
+# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_LONG_LONG],
[
- AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
- [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
- [long long llmax = (long long) -1;
- return ll << i | ll >> i | llmax / ll | llmax % ll;],
- ac_cv_type_long_long=yes,
- ac_cv_type_long_long=no)])
+ AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+ ac_cv_type_long_long=$ac_cv_type_long_long_int
if test $ac_cv_type_long_long = yes; then
AC_DEFINE(HAVE_LONG_LONG, 1,
[Define if you have the 'long long' type.])
diff --git a/m4/onceonly_2_57.m4 b/m4/onceonly_2_57.m4
index 14d3c0b..15884b3 100644
--- a/m4/onceonly_2_57.m4
+++ b/m4/onceonly_2_57.m4
@@ -1,5 +1,5 @@
-# onceonly_2_57.m4 serial 3
-dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
+# onceonly_2_57.m4 serial 4
+dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
@@ -7,10 +7,10 @@ dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file defines some "once only" variants of standard autoconf macros.
-dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
-dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
-dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
-dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
+dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
+dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
+dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
+dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
dnl The advantage is that the check for each of the headers/functions/decls
dnl will be put only once into the 'configure' file. It keeps the size of
dnl the 'configure' file down, and avoids redundant output when 'configure'
diff --git a/m4/regex.m4 b/m4/regex.m4
index 8ea4fe9..cd71366 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,7 +1,7 @@
-#serial 31
+#serial 37
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
-# Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -14,31 +14,6 @@ AC_PREREQ([2.50])
AC_DEFUN([gl_REGEX],
[
- AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t
-
- AC_CACHE_CHECK([whether off_t can be used in a switch statement],
- [gl_cv_type_off_t_switch],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [AC_INCLUDES_DEFAULT],
- [[off_t o = -1;
- switch (o)
- {
- case -2:
- return 1;
- case -1:
- return 2;
- default:
- return 0;
- }
- ]])],
- [gl_cv_type_off_t_switch=yes],
- [gl_cv_type_off_t_switch=no])])
- if test $gl_cv_type_off_t_switch = yes; then
- AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
- [Define if you want regoff_t to be at least as wide POSIX requires.])
- fi
-
AC_LIBSOURCES(
[regcomp.c, regex.c, regex.h,
regex_internal.c, regex_internal.h, regexec.c])
@@ -49,30 +24,34 @@ AC_DEFUN([gl_REGEX],
systems with recent-enough versions of the GNU C
Library (use with caution on other systems)])])
- case $with_included_regex in
+ case $with_included_regex in #(
yes|no) ac_use_included_regex=$with_included_regex
;;
'')
- # If the system regex support is good enough that it passes the the
+ # If the system regex support is good enough that it passes the
# following run test, then default to *not* using the included regex.c.
# If cross compiling, assume the test would fail and use the included
# regex.c. The first failing regular expression is from `Spencer ere
# test #75' in grep-2.3.
AC_CACHE_CHECK([for working re_compile_pattern],
- [gl_cv_func_re_compile_pattern_broken],
+ [gl_cv_func_re_compile_pattern_working],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT
- #include <regex.h>],
+ #include <limits.h>
+ #include <regex.h>
+ ],
[[static struct re_pattern_buffer regex;
+ unsigned char folded_chars[UCHAR_MAX + 1];
+ int i;
const char *s;
struct re_registers regs;
- /* Use the POSIX-compliant spelling with leading REG_,
- rather than the traditional GNU spelling with leading RE_,
- so that we reject older libc implementations. */
- re_set_syntax (REG_SYNTAX_POSIX_EGREP);
+ re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (&regex, 0, sizeof (regex));
- s = re_compile_pattern ("a[:@:>@:]b\n", 9, &regex);
+ for (i = 0; i <= UCHAR_MAX; i++)
+ folded_chars[i] = i;
+ regex.translate = folded_chars;
+ s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
/* This should fail with _Invalid character class name_ error. */
if (!s)
exit (1);
@@ -106,10 +85,9 @@ AC_DEFUN([gl_REGEX],
exit (1);
/* The version of regex.c in older versions of gnulib
- ignored REG_IGNORE_CASE (which was then called RE_ICASE).
- Detect that problem too. */
+ ignored RE_ICASE. Detect that problem too. */
memset (&regex, 0, sizeof (regex));
- re_set_syntax (REG_SYNTAX_EMACS | REG_IGNORE_CASE);
+ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
s = re_compile_pattern ("x", 1, &regex);
if (s)
exit (1);
@@ -123,24 +101,29 @@ AC_DEFUN([gl_REGEX],
exit (1);
/* Reject hosts whose regoff_t values are too narrow.
- These include glibc 2.3.5 on hosts with 64-bit off_t
- and 32-bit int, and Solaris 10 on hosts with 32-bit int
- and _FILE_OFFSET_BITS=64. */
- if (sizeof (regoff_t) < sizeof (off_t))
+ These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
+ and 32-bit int. */
+ if (sizeof (regoff_t) < sizeof (ptrdiff_t)
+ || sizeof (regoff_t) < sizeof (ssize_t))
exit (1);
exit (0);]])],
- [gl_cv_func_re_compile_pattern_broken=no],
- [gl_cv_func_re_compile_pattern_broken=yes],
- dnl When crosscompiling, assume it is broken.
- [gl_cv_func_re_compile_pattern_broken=yes])])
- ac_use_included_regex=$gl_cv_func_re_compile_pattern_broken
+ [gl_cv_func_re_compile_pattern_working=yes],
+ [gl_cv_func_re_compile_pattern_working=no],
+ dnl When crosscompiling, assume it is not working.
+ [gl_cv_func_re_compile_pattern_working=no])])
+ case $gl_cv_func_re_compile_pattern_working in #(
+ yes) ac_use_included_regex=no;; #(
+ no) ac_use_included_regex=yes;;
+ esac
;;
*) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex])
;;
esac
if test $ac_use_included_regex = yes; then
+ AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
+ [Define if you want regoff_t to be at least as wide POSIX requires.])
AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
[Define to rpl_re_syntax_options if the replacement should be used.])
AC_DEFINE([re_set_syntax], [rpl_re_set_syntax],
@@ -183,5 +166,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
AC_REQUIRE([gl_C_RESTRICT])
AC_REQUIRE([AM_LANGINFO_CODESET])
AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h])
- AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll])
+ AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll])
+ AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
index 0336f3a..029e471 100644
--- a/m4/size_max.m4
+++ b/m4/size_max.m4
@@ -1,5 +1,5 @@
-# size_max.m4 serial 3
-dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# size_max.m4 serial 4
+dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -23,28 +23,29 @@ Found it
], result=yes)
if test -z "$result"; then
dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
- dnl than the type 'unsigned long'.
- dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
- dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
- _AC_COMPUTE_INT([(size_t)~(size_t)0 / 10], res_hi,
- [#include <stddef.h>], result=?)
- _AC_COMPUTE_INT([(size_t)~(size_t)0 % 10], res_lo,
- [#include <stddef.h>], result=?)
+ dnl than the type 'unsigned long'. Try hard to find a definition that can
+ dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
+ _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1,
+ [#include <stddef.h>
+#include <limits.h>], size_t_bits_minus_1=)
_AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
- [#include <stddef.h>], result=?)
- 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)
- fi
- if test -z "$result"; then
- if test "$fits_in_uint" = 1; then
- result="$res_hi$res_lo"U
+ [#include <stddef.h>], fits_in_uint=)
+ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+ 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)
+ fi
+ dnl We cannot use 'expr' to simplify this expression, because 'expr'
+ dnl works only with 'long' integers in the host environment, while we
+ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
+ if test $fits_in_uint = 1; then
+ result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
else
- result="$res_hi$res_lo"UL
+ result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
fi
else
dnl Shouldn't happen, but who knows...
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
new file mode 100644
index 0000000..4eaef93
--- /dev/null
+++ b/m4/ssize_t.m4
@@ -0,0 +1,21 @@
+# ssize_t.m4 serial 4 (gettext-0.15)
+dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether ssize_t is defined.
+
+AC_DEFUN([gt_TYPE_SSIZE_T],
+[
+ AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
+ [AC_TRY_COMPILE([#include <sys/types.h>],
+ [int x = sizeof (ssize_t *) + sizeof (ssize_t);
+ return !x;],
+ [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
+ if test $gt_cv_ssize_t = no; then
+ AC_DEFINE([ssize_t], [int],
+ [Define as a signed type of the same size as size_t.])
+ fi
+])
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
index 43fbe28..2204ecd 100644
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -64,9 +64,9 @@ AC_DEFUN([AC_HEADER_STDBOOL],
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];
+ char d[(bool) 0.5 == true ? 1 : -1];
bool e = &s;
- char f[(_Bool) -0.0 == false ? 1 : -1];
+ char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4
index 28924b1..e3b5d0c 100644
--- a/m4/strerror_r.m4
+++ b/m4/strerror_r.m4
@@ -25,6 +25,7 @@ AC_CACHE_CHECK([whether strerror_r returns char *],
char buf[100];
char x = *strerror_r (0, buf, sizeof buf);
char *p = strerror_r (0, buf, sizeof buf);
+ return !p || x;
]])],
ac_cv_func_strerror_r_char_p=yes)
else
diff --git a/m4/strndup.m4 b/m4/strndup.m4
new file mode 100644
index 0000000..e333f5c
--- /dev/null
+++ b/m4/strndup.m4
@@ -0,0 +1,51 @@
+# strndup.m4 serial 7
+dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STRNDUP],
+[
+ AC_LIBSOURCES([strndup.c, strndup.h])
+
+ dnl Persuade glibc <string.h> to declare strndup().
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_CHECK_DECLS_ONCE([strndup])
+
+ # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
+ AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup,
+ [AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([#include <string.h>], [[
+#ifndef HAVE_DECL_STRNDUP
+ extern char *strndup (const char *, size_t);
+#endif
+ char *s;
+ s = strndup ("some longer string", 15);
+ free (s);
+ s = strndup ("shorter string", 13);
+ return s[13] != '\0';]])],
+ [gl_cv_func_strndup=yes],
+ [gl_cv_func_strndup=no],
+ [AC_CHECK_FUNC([strndup],
+ [AC_EGREP_CPP([too risky], [
+#ifdef _AIX
+ too risky
+#endif
+ ],
+ [gl_cv_func_strndup=no],
+ [gl_cv_func_strndup=yes])],
+ [gl_cv_func_strndup=no])])])
+ if test $gl_cv_func_strndup = yes; then
+ AC_DEFINE([HAVE_STRNDUP], 1,
+ [Define if you have the strndup() function and it works.])
+ else
+ AC_LIBOBJ([strndup])
+ AC_DEFINE(strndup, rpl_strndup,
+ [Define to rpl_strndup if the replacement function should be used,])
+ gl_PREREQ_STRNDUP
+ fi
+])
+
+# Prerequisites of lib/strndup.c.
+AC_DEFUN([gl_PREREQ_STRNDUP], [:])
diff --git a/m4/strnlen.m4 b/m4/strnlen.m4
new file mode 100644
index 0000000..67964c8
--- /dev/null
+++ b/m4/strnlen.m4
@@ -0,0 +1,29 @@
+# strnlen.m4 serial 5
+dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STRNLEN],
+[
+ AC_LIBSOURCES([strnlen.c, strnlen.h])
+
+ dnl Persuade glibc <string.h> to declare strnlen().
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_FUNC_STRNLEN
+ if test $ac_cv_func_strnlen_working = no; then
+ # This is necessary because automake-1.6.1 doens't understand
+ # that the above use of AC_FUNC_STRNLEN means we may have to use
+ # lib/strnlen.c.
+ #AC_LIBOBJ(strnlen)
+ AC_DEFINE(strnlen, rpl_strnlen,
+ [Define to rpl_strnlen if the replacement function should be used.])
+ gl_PREREQ_STRNLEN
+ fi
+])
+
+# Prerequisites of lib/strnlen.c.
+AC_DEFUN([gl_PREREQ_STRNLEN], [
+ AC_CHECK_DECLS_ONCE(strnlen)
+])
diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4
index dee10cc..15fab9f 100644
--- a/m4/ulonglong.m4
+++ b/m4/ulonglong.m4
@@ -1,21 +1,41 @@
-# ulonglong.m4 serial 4
-dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+# ulonglong.m4 serial 5
+dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert.
-# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
+[
+ AC_CACHE_CHECK([for unsigned long long int],
+ [ac_cv_type_unsigned_long_long_int],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[unsigned long long int ull = 18446744073709551615ULL;
+ typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;]],
+ [[unsigned long long int ullmax = 18446744073709551615ull;
+ return (ull << 63 | ull >> 63 | ull << i | ull >> i
+ | ullmax / ull | ullmax % ull);]])],
+ [ac_cv_type_unsigned_long_long_int=yes],
+ [ac_cv_type_unsigned_long_long_int=no])])
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
+ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+ [Define to 1 if the system has the type `unsigned long long int'.])
+ fi
+])
+
+# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
[
- AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
- [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
- [unsigned long long ullmax = (unsigned long long) -1;
- return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
- ac_cv_type_unsigned_long_long=yes,
- ac_cv_type_unsigned_long_long=no)])
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
+ ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
if test $ac_cv_type_unsigned_long_long = yes; then
AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
[Define if you have the 'unsigned long long' type.])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
new file mode 100644
index 0000000..9c77f9b
--- /dev/null
+++ b/m4/unistd_h.m4
@@ -0,0 +1,18 @@
+# unistd_h.m4 serial 2
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Simon Josefsson
+
+AC_DEFUN([gl_HEADER_UNISTD],
+[
+ dnl Prerequisites of lib/unistd.h.
+ AC_CHECK_HEADERS([unistd.h], [
+ UNISTD_H=''
+ ], [
+ UNISTD_H='unistd.h'
+ ])
+ AC_SUBST(UNISTD_H)
+])
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
new file mode 100644
index 0000000..09cf55a
--- /dev/null
+++ b/m4/wcwidth.m4
@@ -0,0 +1,26 @@
+# wcwidth.m4 serial 3
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_WCWIDTH],
+[
+ dnl Persuade glibc <wchar.h> to declare wcwidth().
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_REQUIRE([AC_C_INLINE])
+ AC_REQUIRE([gt_TYPE_WCHAR_T])
+
+ AC_CHECK_HEADERS_ONCE([wchar.h wctype.h])
+ AC_CHECK_FUNCS_ONCE([iswprint wcwidth])
+
+ AC_CHECK_DECLS([wcwidth], [], [], [
+/* AIX 3.2.5 declares wcwidth in <string.h>. */
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+])])
diff --git a/m4/xstrndup.m4 b/m4/xstrndup.m4
new file mode 100644
index 0000000..8a30ab1
--- /dev/null
+++ b/m4/xstrndup.m4
@@ -0,0 +1,15 @@
+# xstrndup.m4 serial 2
+dnl Copyright (C) 2003 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_XSTRNDUP],
+[
+ gl_PREREQ_XSTRNDUP
+])
+
+# Prerequisites of lib/xstrndup.c.
+AC_DEFUN([gl_PREREQ_XSTRNDUP], [
+ :
+])