summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-08-27 18:22:56 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-08-27 18:22:56 +0000
commitd5d752a1db8ad216db2fe018012d757c080a5927 (patch)
treef59097ac097a98a8c4d67f8c6a5f61584692534c /configure
parentf25d6c1f24e7dcb9d881c820fe5d269259890ace (diff)
Fixed HAVE_STRNLEN (sheesh, we don't have strnlen.o)
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure71
1 files changed, 30 insertions, 41 deletions
diff --git a/configure b/configure
index f716687..675f939 100755
--- a/configure
+++ b/configure
@@ -14368,62 +14368,51 @@ $as_echo "#define PREFER_PORTABLE_SNPRINTF 1" >>confdefs.h
fi
### Check for strnlen
- { $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 "$as_me:${as_lineno-$LINENO}: checking for strnlen in -lc" >&5
+$as_echo_n "checking for strnlen in -lc... " >&6; }
+if ${ac_cv_lib_c_strnlen+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
- # 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
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strnlen ();
int
main ()
{
-
-#define S "foobar"
-#define S_LEN (sizeof S - 1)
-
- /* At least one implementation is buggy: that of AIX 4.3 would
- give strnlen (S, 1) == 3. */
-
- int i;
- for (i = 0; i < S_LEN + 1; ++i)
- {
- int expected = i <= S_LEN ? i : S_LEN;
- if (strnlen (S, i) != expected)
- return 1;
- }
- return 0;
-
+return strnlen ();
;
return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_func_strnlen_working=yes
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_c_strnlen=yes
else
- ac_cv_func_strnlen_working=no
+ ac_cv_lib_c_strnlen=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_strnlen" >&5
+$as_echo "$ac_cv_lib_c_strnlen" >&6; }
+if test "x$ac_cv_lib_c_strnlen" = xyes; then :
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5
-$as_echo "$ac_cv_func_strnlen_working" >&6; }
-test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in
- *" strnlen.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS strnlen.$ac_objext"
- ;;
-esac
+$as_echo "#define HAVE_STRNLEN 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+fi
## Online unit tests