]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_FUNC_STRNLEN: more realistic cross-compilation guess
authorBruno Haible <bruno@clisp.org>
Fri, 17 Sep 2010 15:50:34 +0000 (09:50 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 17 Sep 2010 15:51:06 +0000 (09:51 -0600)
* lib/autoconf/functions.m4 (AC_FUNC_STRNLEN): Require
AC_CANONICAL_HOST. When cross-compiling, guess it works everywhere
except on AIX.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/autoconf/functions.m4

index 77103020e67cd75d6ab35b444f6683b5669d1c8b..f89b412650a82d04e33aa113a239b3a30c59c123 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-17  Bruno Haible  <bruno@clisp.org>
+
+       AC_FUNC_STRNLEN: more realistic cross-compilation guess
+       * lib/autoconf/functions.m4 (AC_FUNC_STRNLEN): Require
+       AC_CANONICAL_HOST. When cross-compiling, guess it works everywhere
+       except on AIX.
+
 2010-09-16  Eric Blake  <eblake@redhat.com>
 
        m4sh: fix today's AS_BOX regression
index 235def3f0da1fda58b0569cacc809f8157212cc8..f03991baedc9237b2c19fe3231db262eadfd7d81 100644 (file)
@@ -1673,6 +1673,7 @@ LIBS="-lintl $LIBS"])])dnl
 AN_FUNCTION([strnlen], [AC_FUNC_STRNLEN])
 AC_DEFUN([AC_FUNC_STRNLEN],
 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl
+AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,
 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
 #define S "foobar"
@@ -1692,7 +1693,11 @@ AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,
 ]])],
               [ac_cv_func_strnlen_working=yes],
               [ac_cv_func_strnlen_working=no],
-              [ac_cv_func_strnlen_working=no])])
+              [# Guess no on AIX systems, yes otherwise.
+               case "$host_os" in
+                 aix*) ac_cv_func_strnlen_working=no;;
+                 *)    ac_cv_func_strnlen_working=yes;;
+               esac])])
 test $ac_cv_func_strnlen_working = no && AC_LIBOBJ([strnlen])
 ])# AC_FUNC_STRNLEN