summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-01-18 23:47:13 +0000
committerJim Meyering <jim@meyering.net>2002-01-18 23:47:13 +0000
commit009e3b99cf85d95796751de9f6e11ccaf112f126 (patch)
treeb331f9ecf0c3ca6c3bc20d7320b68b5685166918 /m4
parent10b3363e2e8104c8bdd790a9808471907d27a9f9 (diff)
downloadcoreutils-009e3b99cf85d95796751de9f6e11ccaf112f126.tar.xz
*** empty log message ***
Diffstat (limited to 'm4')
-rw-r--r--m4/strnlen.m431
1 files changed, 31 insertions, 0 deletions
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