Meyering.
* doc/autoconf.texi (Function Portability): Document the strnlen
limitation.
(Particular Functions): Document AC_FUNC_STRNLEN.
* lib/autoscan/functions: Adjust.
+2002-01-11 Akim Demaille <akim@epita.fr>
+
+ * lib/autoconf/functions.m4 (AC_FUNC_STRNLEN): New, from Jim
+ Meyering.
+ * doc/autoconf.texi (Function Portability): Document the strnlen
+ limitation.
+ (Particular Functions): Document AC_FUNC_STRNLEN.
+ * lib/autoscan/functions: Adjust.
+
2002-01-06 Akim Demaille <akim@epita.fr>
* lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Don't create
* tests/Makefile.am (package.m4): New.
EXTRA_DIST it since its a source.
-
+
2002-01-06 Akim Demaille <akim@epita.fr>
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Move the AC_SUBST
* tests/tools.at (autoheader): Adjust.
* tests/atspecific.m4 (AT_CHECK_DEFINES): Adjust.
-
+
2002-01-06 Akim Demaille <akim@epita.fr>
* bin/autoscan.in (scan_file): Use `&used'.
- AC_FUNC_STRTOD substitutes POW_LIB.
+- AC_FUNC_STRNLEN
+ New.
+
\f
* Major changes in Autoconf 2.52
** Documentation
Porting the GNU Compiler Collection}). Apparently in some cases even
having format strings read-only can be a problem.
+@item @code{strnlen}
+@c @fuindex strnlen
+@prindex @code{strnlen}
+AIX 4.3 provides a broken version which produces funny results:
+
+@example
+strnlen ("foobar", 0) = 0
+strnlen ("foobar", 1) = 3
+strnlen ("foobar", 2) = 2
+strnlen ("foobar", 3) = 1
+strnlen ("foobar", 4) = 0
+strnlen ("foobar", 5) = 6
+strnlen ("foobar", 6) = 6
+strnlen ("foobar", 7) = 6
+strnlen ("foobar", 8) = 6
+strnlen ("foobar", 9) = 6
+@end example
+
@item @code{unlink}
@c @fuindex unlink
@prindex @code{unlink}
Then, if @code{strftime} is available, define @code{HAVE_STRFTIME}.
@end defmac
+@defmac AC_FUNC_STRNLEN
+@acindex FUNC_STRNLEN
+@cvindex HAVE_STRNLEN
+@c @fuindex strnlen
+@prindex @code{strnlen}
+Check for a working @code{strnlen}, and ask for its replacement. Some
+architectures are know to provide broken versions of @code{strnlen}, such
+as AIX 4.3.
+@end defmac
+
@defmac AC_FUNC_UTIME_NULL
@acindex FUNC_UTIME_NULL
@cvindex HAVE_UTIME_NULL
])# AC_FUNC_STRFTIME
+# AC_FUNC_STRNLEN
+# --------------
+AC_DEFUN([AC_FUNC_STRNLEN],
+[AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[
+#define S "foobar"
+#define S_LEN (sizeof S - 1)
+
+ /* At least one implementation is buggy: that of AIX 4.3 would
+ give strnlen (S, 1) == 3. */
+
+ int i;
+ for (i = 0; i < S_LEN + 1; ++i)
+ {
+ int expected = i <= S_LEN ? i : S_LEN;
+ if (strnlen (S, i) != expected)
+ exit (1);
+ }
+ exit (0);
+]])],
+ [ac_cv_func_strnlen_working=yes],
+ [ac_cv_func_strnlen_working=no],
+ [ac_cv_func_strnlen_working=no])])
+test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])
+])# AC_FUNC_STRNLEN
+
+
# AC_FUNC_SETVBUF_REVERSED
# ------------------------
AC_DEFUN([AC_FUNC_SETVBUF_REVERSED],
-# acfunctions -- autoscan's mapping from functions to Autoconf macros
-# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001
+# functions -- autoscan's mapping from functions to Autoconf macros
+# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
strcoll AC_FUNC_STRCOLL
strerror_r AC_FUNC_STRERROR_R
strftime AC_FUNC_STRFTIME
+strnlen AC_FUNC_STRNLEN
strtod AC_FUNC_STRTOD
utime AC_FUNC_UTIME_NULL
utime AC_CHECK_FUNCS
strerror
strncasecmp
strndup
-strnlen
strpbrk
strrchr
strspn
AT_CHECK_MACRO([AC_FUNC_STRCOLL])
AT_CHECK_MACRO([AC_FUNC_STRERROR_R])
AT_CHECK_MACRO([AC_FUNC_STRFTIME])
+AT_CHECK_MACRO([AC_FUNC_STRNLEN])
AT_CHECK_MACRO([AC_FUNC_STRTOD])
AT_CHECK_MACRO([AC_FUNC_UTIME_NULL])
AT_CHECK_MACRO([AC_FUNC_VPRINTF])