From: Todd C. Miller Date: Fri, 19 Jun 2015 15:54:12 +0000 (-0600) Subject: Fix check for strnlen() when cross-compiling. X-Git-Tag: SUDO_1_8_14^2~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=048e251ae05dfeca0071bae45978887e834a334b;p=sudo Fix check for strnlen() when cross-compiling. --- diff --git a/configure b/configure index ad5178cb2..d69eb2f12 100755 --- a/configure +++ b/configure @@ -19293,7 +19293,9 @@ esac fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 +ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" +if test "x$ac_cv_func_strnlen" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 $as_echo_n "checking for working strnlen... " >&6; } if ${ac_cv_func_strnlen_working+:} false; then : $as_echo_n "(cached) " >&6 @@ -19350,6 +19352,15 @@ test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in esac +else + case " $LIBOBJS " in + *" strnlen.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" + ;; +esac + +fi + if test X"$ac_cv_func_strnlen_working" = X"yes"; then $as_echo "#define HAVE_STRNLEN 1" >>confdefs.h @@ -19380,7 +19391,7 @@ fi done else - # Broken libc strnlen, use our own. + # Broken or missing strnlen, use our own. for _sym in sudo_strnlen; do COMPAT_EXP="${COMPAT_EXP}${_sym} diff --git a/configure.ac b/configure.ac index d84773b15..2d277c57e 100644 --- a/configure.ac +++ b/configure.ac @@ -2590,7 +2590,7 @@ AC_CHECK_FUNCS([strlcat], [], [ AC_LIBOBJ(strlcat) SUDO_APPEND_COMPAT_EXP(sudo_strlcat) ]) -AC_FUNC_STRNLEN +AC_CHECK_FUNC([strnlen], [AC_FUNC_STRNLEN], [AC_LIBOBJ(strnlen)]) if test X"$ac_cv_func_strnlen_working" = X"yes"; then AC_DEFINE(HAVE_STRNLEN) AC_CHECK_FUNCS([strndup], [], [ @@ -2598,7 +2598,7 @@ if test X"$ac_cv_func_strnlen_working" = X"yes"; then SUDO_APPEND_COMPAT_EXP(sudo_strndup) ]) else - # Broken libc strnlen, use our own. + # Broken or missing strnlen, use our own. SUDO_APPEND_COMPAT_EXP(sudo_strnlen) # Avoid libc strndup() since it is usually implemented using strnlen() AC_LIBOBJ(strndup)