*** empty log message ***
[pspp] / m4 / strnlen.m4
1 #serial 1
2
3 # This is already in cvs autoconf -- what will be 2.52g.
4 # Define it here for those who aren't on the bleeding edge.
5 # FIXME: remove this file once the next autoconf release comes out.
6
7 undefine([AC_FUNC_STRNLEN])
8
9 # AC_FUNC_STRNLEN
10 # --------------
11 AC_DEFUN([AC_FUNC_STRNLEN],
12 [AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,
13 [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[
14 #define S "foobar"
15 #define S_LEN (sizeof S - 1)
16
17   /* At least one implementation is buggy: that of AIX 4.3.  */
18   int i;
19   for (i = 0; i < S_LEN + 1; ++i)
20     {
21       int result = i <= S_LEN ? i : S_LEN;
22       if (strnlen (S, i) != result)
23         exit (1);
24     }
25   exit (0);
26 ]])],
27                [ac_cv_func_strnlen_working=yes],
28                [ac_cv_func_strnlen_working=no],
29                [ac_cv_func_strnlen_working=no])])
30 test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])
31 ])# AC_FUNC_STRNLEN