snapshot of Bison didn't build on Solaris 7 due to strnlen problems.
+2003-03-12 Paul Eggert <eggert@twinsun.com>
+
+ Merge changes from gnulib. This was prompted because the CVS
+ snapshot didn't build on Solaris 7 due to strnlen problems.
+
+ These changes need to be merged back into gnulib:
+ * lib/hash.c: Include <stdbool.h> unconditionally.
+ * m4/onceonly.m4 (m4_quote): New macro.
+ (AC_CHECK_HEADERS_ONCE, AC_CHECK_FUNCS_ONCE, AC_CHECK_DECLS_ONCE):
+ Quote AC_FOREACH variable-expansions properly.
+ The 2003-01-03 obstack.h change also needs merging.
+ {end of changes requiring merging}
+
+ * lib/stdbool.h.in, m4/alloca.m4, m4/dirname.m4, m4/dos.m4,
+ m4/getopt.m4, m4/hash.m4, m4/malloc.m4, m4/memchr.m4,
+ m4/memrchr.m4, m4/obstack.m4, m4/onceonly.m4, m4/quote.m4,
+ m4/quotearg.m4, m4/realloc.m4, m4/stpcpy.m4, m4/strnlen.m4,
+ m4/strtol.m4, m4/strtoul.m4, m4/unlocked-io.m4, m4/xalloc.m4:
+ New files, imported from gnulib.
+ * m4/Makefile.am (EXTRA_DIST): Add the new m4/*.m4 files mentioned
+ above.
+
+ * lib/mbswidth.c, m4/error.m4, m4/mbrtowc.m4, m4/mbswidth.m4,
+ m4/memcmp.m4, m4/prereq.m4, m4/stdbool.m4: Update to current
+ gnulib sources.
+
+ * configure.ac (gl_DIRNAME, gl_GETOPT, gl_HASH, gl_QUOTE, gl_XALLOC):
+ Add.
+ (gl_ERROR): New, replacing jm_PREREQ_ERROR.
+ (gl_FUNC_ALLOCA): New, replacing AC_FUNC_ALLOCA.
+ (gl_FUNC_STPCPY): New, replacing AC_REPLACE_FUNCS(stpcpy).
+ (gl_FUNC_STRNLEN): New, replacing AC_FUNC_STRNLEN.
+ (gl_MBSWIDTH): New, replacing jm_PREREQ_MBSWIDTH.
+ (gl_OBSTACK): New, replacing AC_FUNC_OBSTACK.
+ (gl_QUOTEARG): New, replacing jm_PREREQ_QUOTEARG.
+ (jm_FUNC_GLIBC_UNLOCKED_IO, gl_FUNC_STPCPY, gl_FUNC_STRTOL): New.
+ (jm_FUNC_MALLOC): New, replacing AC_FUNC_MALLOC.
+ (jm_FUNC_REALLOC): New, replacing AC_FUNC_REALLOC.
+ (jm_PREREQ_ARGMATCH): Remove.
+ (AC_REPLACE_FUNCS): Remove memchr, memrchr, stpcpy, strtol, strtoul.
+ * lib/Makefile.am (libbison_a_SOURCES): Add argmatch.c, argmatch.h.
+
+ * src/system.h: Include <stdbool.h> unconditionally.
+
+ * lib/bbitset.h: Include <limits.h> unconditionally. We have been
+ assuming at least C89 in the bitset code for some time now.
+
2003-03-03 Akim Demaille <akim@epita.fr>
* ro.po: New.
AC_CHECK_TYPES([uintptr_t])
# Checks for library functions.
-AC_FUNC_ALLOCA
-AC_FUNC_OBSTACK
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_STRNLEN
AC_CHECK_FUNCS(setlocale)
AC_CHECK_DECLS([free, getenv, getopt,
stpcpy, strchr, strspn, strnlen,
malloc, memchr, memrchr])
-AC_REPLACE_FUNCS(memchr memrchr \
- strchr stpcpy strrchr strspn strtol strtoul)
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-jm_PREREQ_MBSWIDTH
-jm_PREREQ_QUOTEARG
-jm_FUNC_ARGMATCH
-jm_PREREQ_ERROR
+AC_REPLACE_FUNCS(strchr strrchr strspn)
+AC_FUNC_ERROR_AT_LINE
AM_WITH_DMALLOC
BISON_PREREQ_SUBPIPE
BISON_PREREQ_TIMEVAR
+gl_DIRNAME
+gl_ERROR
+gl_FUNC_ALLOCA
+gl_FUNC_MEMCHR
+gl_FUNC_MEMRCHR
+gl_FUNC_STPCPY
+gl_FUNC_STRNLEN
+gl_FUNC_STRTOL
+gl_GETOPT
+gl_HASH
+gl_MBSWIDTH
+gl_OBSTACK
+gl_QUOTE
+gl_QUOTEARG
+gl_XALLOC
+jm_FUNC_GLIBC_UNLOCKED_IO
+jm_FUNC_MALLOC
+jm_FUNC_REALLOC
# Gettext.
AM_GNU_GETTEXT(external, need-ngettext)
libbison_a_SOURCES = \
gettext.h \
+ argmatch.c argmatch.h \
basename.c dirname.h dirname.c \
get-errno.h get-errno.c \
getopt.h getopt.c getopt1.c \
# include <stdlib.h>
#endif
-#if HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
-# ifndef __bool_true_false_are_defined
-# if ! HAVE__BOOL
-# ifdef __cplusplus
-typedef bool _Bool;
-# else
-typedef unsigned char _Bool;
-# endif
-# endif
-# define bool _Bool
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
-# endif
-#endif
-
+#include <stdbool.h>
#include <stdio.h>
#ifndef HAVE_DECL_FREE
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2000-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
# include <config.h>
#endif
-/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). This must be
- included before "mbswidth.h", because UnixWare 7.1.1 <wchar.h>
- declares its own mbswidth and we want mbswidth.h's "#define
- mbswidth gnu_mbswidth" to take effect after <wchar.h> is
- included. */
-#if HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-
/* Specification. */
#include "mbswidth.h"
/* Get isprint(). */
#include <ctype.h>
+/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
/* Get iswprint(), iswcntrl(). */
#if HAVE_WCTYPE_H
# include <wctype.h>
--- /dev/null
+/* Copyright (C) 2001-2002 Free Software Foundation, Inc.
+ Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+/* ISO C 99 <stdbool.h> for platforms that lack it. */
+
+/* 7.16. Boolean type and values */
+
+/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
+ definitions below, but temporarily we have to #undef them. */
+#ifdef __BEOS__
+# undef false
+# undef true
+#endif
+
+/* For the sake of symbolic names in gdb, define _Bool as an enum type. */
+#ifndef __cplusplus
+# if !@HAVE__BOOL@
+typedef enum { false = 0, true = 1 } _Bool;
+# endif
+#else
+typedef bool _Bool;
+#endif
+#define bool _Bool
+
+/* The other macros must be usable in preprocessor directives. */
+#define false 0
+#define true 1
+#define __bool_true_false_are_defined 1
+
+#endif /* _STDBOOL_H */
## Process this file with automake to produce Makefile.in -*-Makefile-*-
EXTRA_DIST = \
- dmalloc.m4 error.m4 \
- m4.m4 mbrtowc.m4 mbswidth.m4 memcmp.m4 \
- prereq.m4 stdbool.m4 subpipe.m4 timevar.m4 warning.m4 \
+ alloca.m4 dirname.m4 dmalloc.m4 dos.m4 error.m4 getopt.m4 hash.m4 \
+ m4.m4 malloc.m4 \
+ mbrtowc.m4 mbswidth.m4 memchr.m4 memcmp.m4 memrchr.m4 \
+ obstack.m4 onceonly.m4 \
+ prereq.m4 quote.m4 quotearg.m4 \
+ realloc.m4 stdbool.m4 \
+ stpcpy.m4 strnlen.m4 strtol.m4 strtoul.m4 \
+ subpipe.m4 timevar.m4 unlocked-io.m4 warning.m4 xalloc.m4 \
gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4
--- /dev/null
+# alloca.m4 serial 2
+dnl Copyright (C) 2002-2003 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_ALLOCA],
+[
+ dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
+ AC_REQUIRE([AC_PROG_CPP])
+ AC_REQUIRE([AC_PROG_EGREP])
+
+ AC_REQUIRE([AC_FUNC_ALLOCA])
+ if test $ac_cv_func_alloca_works = no; then
+ gl_PREREQ_ALLOCA
+ fi
+
+ # Define an additional variable used in the Makefile substitution.
+
+ AC_EGREP_CPP([Need own alloca], [
+#if defined __GNUC__ || defined _MSC_VER || !HAVE_ALLOCA_H
+ Need own alloca
+#endif
+ ],
+ ALLOCA_H=alloca.h,
+ ALLOCA_H=)
+ AC_SUBST([ALLOCA_H])
+])
+
+# Prerequisites of lib/alloca.c.
+# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
+AC_DEFUN([gl_PREREQ_ALLOCA], [
+ AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
+])
--- /dev/null
+# dirname.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_DIRNAME],
+[
+ dnl Prerequisites of lib/dirname.h.
+ AC_REQUIRE([jm_AC_DOS])
+
+ dnl Prerequisites of lib/dirname.c.
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(string.h)
+
+ dnl Prerequisites of lib/basename.c.
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(string.h)
+
+ dnl Prerequisites of lib/stripslash.c.
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(string.h)
+])
--- /dev/null
+#serial 5
+
+# Define some macros required for proper operation of code in lib/*.c
+# on MSDOS/Windows systems.
+
+# From Jim Meyering.
+
+AC_DEFUN([jm_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__
+neither MSDOS nor Windows
+#endif],
+ [ac_cv_win_or_dos=yes],
+ [ac_cv_win_or_dos=no])
+ ])
+
+ if test x"$ac_cv_win_or_dos" = xyes; then
+ ac_fs_accepts_drive_letter_prefix=1
+ ac_fs_backslash_is_file_name_separator=1
+ else
+ ac_fs_accepts_drive_letter_prefix=0
+ ac_fs_backslash_is_file_name_separator=0
+ fi
+
+ AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
+ [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
+# define FILESYSTEM_PREFIX_LEN(Filename) \
+ ((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
+#else
+# define FILESYSTEM_PREFIX_LEN(Filename) 0
+#endif])
+
+ AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
+ $ac_fs_accepts_drive_letter_prefix,
+ [Define on systems for which file names may have a so-called
+ `drive letter' prefix, define this to compute the length of that
+ prefix, including the colon.])
+
+ AH_VERBATIM(ISSLASH,
+ [#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#else
+# define ISSLASH(C) ((C) == '/')
+#endif])
+
+ AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
+ $ac_fs_backslash_is_file_name_separator,
+ [Define if the backslash character may also serve as a file name
+ component separator.])
+ ])
-#serial 4
+#serial 5
-dnl FIXME: put these prerequisite-only *.m4 files in a separate
-dnl directory -- otherwise, they'll conflict with existing files.
+AC_DEFUN([gl_ERROR],
+[
+ AC_FUNC_ERROR_AT_LINE
+ dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
+ if test $ac_cv_lib_error_at_line = no; then
+ jm_PREREQ_ERROR
+ fi
+])
-dnl These are the prerequisite macros for GNU's error.c file.
+# Prerequisites of lib/error.c.
AC_DEFUN([jm_PREREQ_ERROR],
[
- AC_CHECK_FUNCS(strerror vprintf doprnt)
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_FUNCS_ONCE(doprnt vprintf)
+ AC_CHECK_FUNCS(strerror)
AC_CHECK_DECLS([strerror])
AC_FUNC_STRERROR_R
- AC_HEADER_STDC
])
--- /dev/null
+# getopt.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_GETOPT],
+[
+ dnl Prerequisites of lib/getopt.c.
+ AC_CHECK_HEADERS_ONCE(string.h)
+])
--- /dev/null
+# hash.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_HASH],
+[
+ dnl Prerequisites of lib/hash.c.
+ AC_CHECK_HEADERS_ONCE(stdlib.h)
+ AC_HEADER_STDBOOL
+ AC_CHECK_DECLS_ONCE(free malloc)
+])
--- /dev/null
+# malloc.m4 serial 7
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Jim Meyering.
+dnl Determine whether malloc accepts 0 as its argument.
+dnl If it doesn't, arrange to use the replacement function.
+
+AC_DEFUN([jm_FUNC_MALLOC],
+[
+ AC_REQUIRE([AC_FUNC_MALLOC])
+ dnl autoconf < 2.57 used the symbol ac_cv_func_malloc_works.
+ if test X"$ac_cv_func_malloc_0_nonnull" = Xno || test X"$ac_cv_func_malloc_works" = Xno; then
+ gl_PREREQ_MALLOC
+ fi
+])
+
+# Prerequisites of lib/malloc.c.
+AC_DEFUN([gl_PREREQ_MALLOC], [
+ :
+])
-# mbrtowc.m4 serial 4 (fileutils-4.1.3)
+# mbrtowc.m4 serial 5
dnl Copyright (C) 2001-2002 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 From Paul Eggert
+dnl This file can be removed, and jm_FUNC_MBRTOWC replaced with
+dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere.
+
AC_DEFUN([jm_FUNC_MBRTOWC],
[
AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
-#serial 8
+#serial 9
dnl autoconf tests required for use of mbswidth.c
dnl From Bruno Haible.
-AC_DEFUN([jm_PREREQ_MBSWIDTH],
+AC_DEFUN([gl_MBSWIDTH],
[
- AC_CHECK_HEADERS(wchar.h wctype.h)
- AC_CHECK_FUNCS(isascii iswcntrl iswprint mbsinit wcwidth)
+ AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+ AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit)
+ AC_CHECK_FUNCS(iswcntrl wcwidth)
jm_FUNC_MBRTOWC
AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
--- /dev/null
+# memchr.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_MEMCHR],
+[
+ AC_REPLACE_FUNCS(memchr)
+ if test $ac_cv_func_memchr = no; then
+ jm_PREREQ_MEMCHR
+ fi
+])
+
+# Prerequisites of lib/memchr.c.
+AC_DEFUN([jm_PREREQ_MEMCHR], [
+ AC_CHECK_HEADERS_ONCE(limits.h stdlib.h)
+ AC_CHECK_HEADERS(bp-sym.h)
+])
-#serial 7
+# memcmp.m4 serial 8
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
AC_DEFUN([jm_FUNC_MEMCMP],
-[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
- if test $ac_cv_func_memcmp_working = no; then
- AC_DEFINE(memcmp, rpl_memcmp,
- [Define to rpl_memcmp if the replacement function should be used.])
- fi
+[
+ AC_REQUIRE([AC_FUNC_MEMCMP])
+ if test $ac_cv_func_memcmp_working = no; then
+ AC_DEFINE(memcmp, rpl_memcmp,
+ [Define to rpl_memcmp if the replacement function should be used.])
+ gl_PREREQ_MEMCMP
+ fi
+])
+
+# Prerequisites of lib/memcmp.c.
+AC_DEFUN([gl_PREREQ_MEMCMP], [
+ AC_CHECK_HEADERS_ONCE(string.h)
])
--- /dev/null
+# memrchr.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_MEMRCHR],
+[
+ dnl Persuade glibc <string.h> to declare memrchr().
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_REPLACE_FUNCS(memrchr)
+ if test $ac_cv_func_memrchr = no; then
+ gl_PREREQ_MEMRCHR
+ fi
+])
+
+# Prerequisites of lib/memrchr.c.
+AC_DEFUN([gl_PREREQ_MEMRCHR], [
+ AC_CHECK_HEADERS_ONCE(limits.h)
+])
--- /dev/null
+# obstack.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_OBSTACK],
+[
+ dnl Prerequisites of lib/obstack.h.
+ AC_CHECK_HEADERS_ONCE(stddef.h string.h)
+
+ AC_FUNC_OBSTACK
+ dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]).
+ if test $ac_cv_func_obstack = no; then
+ gl_PREREQ_OBSTACK
+ fi
+])
+
+# Prerequisites of lib/obstack.c.
+AC_DEFUN([gl_PREREQ_OBSTACK], [
+ AC_CHECK_HEADERS_ONCE(stdlib.h)
+])
--- /dev/null
+# onceonly.m4 serial 1
+dnl Copyright (C) 2002, 2003 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
+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 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'
+dnl is run.
+dnl The drawback is that the checks cannot be conditionalized. If you write
+dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
+dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
+dnl empty, and the check will be inserted before the body of the AC_DEFUNed
+dnl function.
+
+dnl Taken from Autoconf 2.50; can be removed once we assume 2.50 or later.
+define([m4_quote], [[$*]])
+
+# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
+# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
+AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
+ :
+ AC_FOREACH([gl_HEADER_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(defn([gl_HEADER_NAME]),
+ [-./], [___])), [
+ AC_CHECK_HEADERS(gl_HEADER_NAME)
+ ])
+ AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
+ [-./], [___])))
+ ])
+])
+
+# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
+# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
+AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
+ :
+ AC_FOREACH([gl_FUNC_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]), [
+ AC_CHECK_FUNCS(defn([gl_FUNC_NAME]))
+ ])
+ AC_REQUIRE([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]))
+ ])
+])
+
+# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
+# AC_CHECK_DECLS(DECL1, DECL2, ...).
+AC_DEFUN([AC_CHECK_DECLS_ONCE], [
+ :
+ AC_FOREACH([gl_DECL_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_DECL_]defn([gl_DECL_NAME]), [
+ AC_CHECK_DECLS(defn([gl_DECL_NAME]))
+ ])
+ AC_REQUIRE([gl_CHECK_DECL_]defn([gl_DECL_NAME]))
+ ])
+])
-#serial 28 -*- Autoconf -*-
+#serial 27
-dnl We use jm_ for non Autoconf macros.
-m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
-
-# These are the prerequisite macros for files in the lib/
-# directories of the fileutils, sh-utils, and textutils packages.
+dnl These are the prerequisite macros for files in the lib/
+dnl directories of the fileutils, sh-utils, and textutils packages.
AC_DEFUN([jm_PREREQ],
[
- jm_PREREQ_ADDEXT
+ gl_BACKUPFILE
jm_PREREQ_C_STACK
- jm_PREREQ_CANON_HOST
- jm_PREREQ_DIRNAME
+ gl_CANON_HOST
+ gl_DIRNAME
jm_PREREQ_ERROR
- jm_PREREQ_EXCLUDE
- jm_PREREQ_GETPAGESIZE
- jm_PREREQ_HARD_LOCALE
- jm_PREREQ_HASH
- jm_PREREQ_HUMAN
- jm_PREREQ_MBSWIDTH
- jm_PREREQ_MEMCHR
- jm_PREREQ_PHYSMEM
- jm_PREREQ_POSIXVER
- jm_PREREQ_QUOTEARG
- jm_PREREQ_READUTMP
- jm_PREREQ_REGEX
+ gl_EXCLUDE
+ gl_GETPAGESIZE
+ gl_HARD_LOCALE
+ gl_HASH
+ gl_HUMAN
+ gl_MBSWIDTH
+ gl_FUNC_MEMCHR
+ gl_PHYSMEM
+ gl_POSIXVER
+ gl_QUOTEARG
+ gl_READUTMP
+ gl_REGEX
jm_PREREQ_STAT
- jm_PREREQ_STRNLEN
- jm_PREREQ_TEMPNAME # called by mkstemp
- jm_PREREQ_XGETCWD
- jm_PREREQ_XREADLINK
-])
-
-AC_DEFUN([jm_PREREQ_ARGMATCH],
-[
- AC_REQUIRE([jm_PREREQ_QUOTEARG])
- AC_REPLACE_FUNCS(strcasecmp strncasecmp)
-])
-
-# Ask for argmatch.[ch], and set it up.
-AC_DEFUN([jm_FUNC_ARGMATCH],
-[
- AC_REQUIRE([jm_PREREQ_ARGMATCH])
- AC_LIBOBJ([argmatch])
- AC_LIBSOURCES([argmatch.c, argmatch.h])
-])
-
-AC_DEFUN([jm_PREREQ_ADDEXT],
-[
- dnl For addext.c.
- AC_SYS_LONG_FILE_NAMES
- AC_CHECK_FUNCS(pathconf)
- AC_CHECK_HEADERS(limits.h string.h unistd.h)
-])
-
-AC_DEFUN([jm_PREREQ_CANON_HOST],
-[
- dnl Add any libraries as early as possible.
- dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
- dnl so we have to add -lnsl to LIBS before checking for that function.
- AC_SEARCH_LIBS(gethostbyname, [inet nsl])
-
- dnl These come from -lnsl on Solaris5.5.1.
- AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
-
- AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
- AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
- netinet/in.h arpa/inet.h)
-])
-
-AC_DEFUN([jm_PREREQ_DIRNAME],
-[
- AC_HEADER_STDC
- AC_CHECK_HEADERS(string.h)
-])
-
-AC_DEFUN([jm_PREREQ_EXCLUDE],
-[
- AC_FUNC_FNMATCH_GNU
- AC_HEADER_STDBOOL
-])
-
-AC_DEFUN([jm_PREREQ_GETPAGESIZE],
-[
- AC_CHECK_FUNCS(getpagesize)
- AC_CHECK_HEADERS(OS.h unistd.h)
-])
-
-AC_DEFUN([jm_PREREQ_HARD_LOCALE],
-[
- AC_CHECK_HEADERS(locale.h stdlib.h string.h)
- AC_CHECK_FUNCS(setlocale)
- AM_C_PROTOTYPES
-])
-
-# If you use human.c, you need the following files:
-# inttypes.m4 ulonglong.m4
-AC_DEFUN([jm_PREREQ_HUMAN],
-[
- AC_CHECK_HEADERS(limits.h stdlib.h string.h)
- AC_CHECK_DECLS([getenv])
- AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-])
-
-AC_DEFUN([jm_PREREQ_MEMCHR],
-[
- AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
-])
-
-AC_DEFUN([jm_PREREQ_PHYSMEM],
-[
- AC_CHECK_HEADERS(sys/pstat.h unistd.h)
- AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
-])
-
-AC_DEFUN([jm_PREREQ_POSIXVER],
-[
- AC_CHECK_HEADERS(unistd.h)
- AC_CHECK_DECLS([getenv])
-])
-
-AC_DEFUN([jm_PREREQ_QUOTEARG],
-[
- AC_CHECK_FUNCS(isascii iswprint)
- jm_FUNC_MBRTOWC
- jm_FUNC_MEMCMP
- AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
- AC_HEADER_STDC
- AC_C_BACKSLASH_A
- AC_TYPE_MBSTATE_T
- AM_C_PROTOTYPES
-])
-
-AC_DEFUN([jm_PREREQ_READUTMP],
-[
- AC_HEADER_STDC
- AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
- AC_CHECK_FUNCS(utmpname)
- AC_CHECK_FUNCS(utmpxname)
- AM_C_PROTOTYPES
-
- if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
- utmp_includes="\
-$ac_includes_default
-#ifdef HAVE_UTMPX_H
-# include <utmpx.h>
-#endif
-#ifdef HAVE_UTMP_H
-# include <utmp.h>
-#endif
-"
- AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
-
- AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
-
- AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
- AC_LIBOBJ(readutmp)
- fi
-])
-
-AC_DEFUN([jm_PREREQ_REGEX],
-[
- dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
- dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
- dnl to get them.
- AC_CHECK_FUNCS(bzero bcopy isascii btowc)
- AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
- AC_HEADER_STDC
- AC_FUNC_ALLOCA
+ gl_FUNC_STRNLEN
+ gl_XGETCWD
+ gl_XREADLINK
])
AC_DEFUN([jm_PREREQ_STAT],
AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
])
-
-AC_DEFUN([jm_PREREQ_STRNLEN],
-[
- AC_FUNC_STRNLEN
- AC_HEADER_STDC
- AC_CHECK_HEADERS(memory.h)
- AC_CHECK_DECLS([memchr])
-
- # This is necessary because automake-1.6.1 doesn't understand
- # that the above use of AC_FUNC_STRNLEN means we may have to use
- # lib/strnlen.c.
- test $ac_cv_func_strnlen_working = yes \
- && AC_LIBOBJ(strnlen)
-])
-
-AC_DEFUN([jm_PREREQ_TEMPNAME],
-[
- AC_HEADER_STDC
- AC_HEADER_STAT
- AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
- AC_CHECK_FUNCS(__secure_getenv gettimeofday)
- AC_CHECK_DECLS([getenv])
- AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-])
-
-AC_DEFUN([jm_PREREQ_XGETCWD],
-[
- AC_C_PROTOTYPES
- AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
- AC_CHECK_FUNCS(getcwd)
- AC_FUNC_GETCWD_NULL
-])
-
-AC_DEFUN([jm_PREREQ_XREADLINK],
-[
- AC_C_PROTOTYPES
- AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
-])
--- /dev/null
+# quote.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_QUOTE],
+[
+ dnl Prerequisites of lib/quote.c.
+ AC_CHECK_HEADERS_ONCE(stddef.h)
+])
--- /dev/null
+# quotearg.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_QUOTEARG],
+[
+ dnl Prerequisites of lib/quotearg.c.
+ AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+ AC_CHECK_FUNCS_ONCE(iswprint mbsinit)
+ AC_TYPE_MBSTATE_T
+ jm_FUNC_MBRTOWC
+])
--- /dev/null
+# realloc.m4 serial 7
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Jim Meyering.
+dnl Determine whether realloc works when both arguments are 0.
+dnl If it doesn't, arrange to use the replacement function.
+
+AC_DEFUN([jm_FUNC_REALLOC],
+[
+ AC_REQUIRE([AC_FUNC_REALLOC])
+ dnl autoconf < 2.57 used the symbol ac_cv_func_realloc_works.
+ if test X"$ac_cv_func_realloc_0_nonnull" = Xno || test X"$ac_cv_func_realloc_works" = Xno; then
+ gl_PREREQ_REALLOC
+ fi
+])
+
+# Prerequisites of lib/realloc.c.
+AC_DEFUN([gl_PREREQ_REALLOC], [
+ :
+])
# Check for stdbool.h that conforms to C99.
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002-2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
+# Prepare for substituting <stdbool.h> if it is not supported.
+
+AC_DEFUN([AM_STDBOOL_H],
+[
+ AC_REQUIRE([AC_HEADER_STDBOOL])
+
+ # Define two additional variables used in the Makefile substitution.
+
+ if test "$ac_cv_header_stdbool_h" = yes; then
+ STDBOOL_H=''
+ else
+ STDBOOL_H='stdbool.h'
+ fi
+ AC_SUBST([STDBOOL_H])
+
+ if test "$ac_cv_type__Bool" = yes; then
+ HAVE__BOOL=1
+ else
+ HAVE__BOOL=0
+ fi
+ AC_SUBST([HAVE__BOOL])
+])
+
+# This macro is only needed in autoconf <= 2.54. Newer versions of autoconf
+# have this macro built-in.
+
AC_DEFUN([AC_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
[ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
+ AC_CHECK_TYPES([_Bool])
if test $ac_cv_header_stdbool_h = yes; then
AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
fi])
--- /dev/null
+# stpcpy.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STPCPY],
+[
+ dnl Persuade glibc <string.h> to declare stpcpy().
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_REPLACE_FUNCS(stpcpy)
+ if test $ac_cv_func_stpcpy = no; then
+ gl_PREREQ_STPCPY
+ fi
+])
+
+# Prerequisites of lib/stpcpy.c.
+AC_DEFUN([gl_PREREQ_STPCPY], [
+ :
+])
+
--- /dev/null
+# strnlen.m4 serial 2
+dnl Copyright (C) 2002-2003 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRNLEN],
+[
+ 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_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(memory.h string.h)
+ AC_CHECK_DECLS(memchr)
+])
+
--- /dev/null
+# strtol.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRTOL],
+[
+ AC_REPLACE_FUNCS(strtol)
+ if test $ac_cv_func_strtol = no; then
+ gl_PREREQ_STRTOL
+ fi
+])
+
+# Prerequisites of lib/strtol.c.
+AC_DEFUN([gl_PREREQ_STRTOL], [
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(limits.h)
+ AC_CHECK_FUNCS_ONCE(isascii)
+])
--- /dev/null
+# strtoul.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRTOUL],
+[
+ AC_REPLACE_FUNCS(strtoul)
+ if test $ac_cv_func_strtoul = no; then
+ gl_PREREQ_STRTOUL
+ fi
+])
+
+# Prerequisites of lib/strtoul.c.
+AC_DEFUN([gl_PREREQ_STRTOUL], [
+ gl_PREREQ_STRTOL
+])
--- /dev/null
+#serial 7 -*- autoconf -*-
+
+dnl From Jim Meyering.
+dnl
+dnl See if the glibc *_unlocked I/O macros or functions are available.
+dnl Use only those *_unlocked macros or functions that are declared
+dnl (because some of them were declared in Solaris 2.5.1 but were removed
+dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
+dnl on Solaris 2.6).
+
+AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO],
+[
+ dnl Persuade glibc <stdio.h> to declare fgets_unlocked(), fputs_unlocked()
+ dnl etc.
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_CHECK_DECLS_ONCE(
+ [clearerr_unlocked feof_unlocked ferror_unlocked
+ fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
+ fread_unlocked fwrite_unlocked getc_unlocked
+ getchar_unlocked putc_unlocked putchar_unlocked])
+])
--- /dev/null
+# xalloc.m4 serial 1
+dnl Copyright (C) 2002 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
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_XALLOC],
+[
+ gl_PREREQ_XMALLOC
+ gl_PREREQ_XSTRDUP
+])
+
+# Prerequisites of lib/xmalloc.c.
+AC_DEFUN([gl_PREREQ_XMALLOC], [
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_REQUIRE([jm_FUNC_MALLOC])
+ AC_REQUIRE([jm_FUNC_REALLOC])
+])
+
+# Prerequisites of lib/xstrdup.c.
+AC_DEFUN([gl_PREREQ_XSTRDUP], [
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_HEADERS_ONCE(string.h)
+])
| Booleans. |
`-----------*/
-#if HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
-# ifndef __bool_true_false_are_defined
-# if ! HAVE__BOOL
-# ifdef __cplusplus
-typedef bool _Bool;
-# else
-typedef unsigned char _Bool;
-# endif
-# endif
-# define bool _Bool
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
-# endif
-#endif
+#include <stdbool.h>
/*-----------.