[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FUNC_* cross-compilation guesses
From: |
Bruno Haible |
Subject: |
Re: AC_FUNC_* cross-compilation guesses |
Date: |
Sat, 28 Aug 2010 15:08:04 +0200 |
User-agent: |
KMail/1.9.9 |
Ralf Wildenhues wrote:
> > In particular, it's bad to guess "no" for embedded glibc
> > systems because that increases the size of compiled executables.
>
> But that holds for Autoconf's AC_FUNC_STRNLEN as well. Shouldn't it
> have a more optimistic cross compilation guess, too?
Autoconf has traditionally used a pessimistic approach to cross compilation
guesses. If the AC_FUNC_STRNLEN macro in Autoconf was to use a more precise
cross compilation guess, there would indeed be no need to duplicate this code
in gnulib. Here is a proposed patch.
2010-08-28 Bruno Haible <address@hidden>
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.
--- lib/autoconf/functions.m4.orig Sat Aug 28 15:05:43 2010
+++ lib/autoconf/functions.m4 Sat Aug 28 15:04:59 2010
@@ -1673,6 +1673,7 @@
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_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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: AC_FUNC_* cross-compilation guesses,
Bruno Haible <=