From f4b7f14292df9fe59509a5a1aa996cc26e2607fc Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 18 Jan 2002 23:47:13 +0000 Subject: [PATCH] *** empty log message *** --- m4/ChangeLog | 6 ++++++ m4/strnlen.m4 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 m4/strnlen.m4 diff --git a/m4/ChangeLog b/m4/ChangeLog index 86cbf4e98..a96862046 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,9 @@ +2002-01-19 Jim Meyering + + * jm-macros.m4 (jm_MACROS): Use AC_FUNC_STRNLEN. + Remove useless quotes: DF_PROG="df". + * strnlen.m4: New file. + 2001-12-14 Jim Meyering * jm-macros.m4 (jm_MACROS): Check for iswspace. diff --git a/m4/strnlen.m4 b/m4/strnlen.m4 new file mode 100644 index 000000000..a5bd2ef00 --- /dev/null +++ b/m4/strnlen.m4 @@ -0,0 +1,31 @@ +#serial 1 + +# This is already in cvs autoconf -- what will be 2.52g. +# Define it here for those who aren't on the bleeding edge. +# FIXME: remove this file once the next autoconf release comes out. + +undefine([AC_FUNC_STRNLEN]) + +# 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. */ + int i; + for (i = 0; i < S_LEN + 1; ++i) + { + int result = i <= S_LEN ? i : S_LEN; + if (strnlen (S, i) != result) + 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 -- 2.11.0