From: Florian Forster Date: Sat, 1 May 2010 07:53:12 +0000 (+0200) Subject: Build system: Check for "strtok_r" availability with "-Wall -Werror" when using GCC. X-Git-Tag: collectd-4.10.0~3^2^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c4e077cc77ec31e86baefc4644686a86b39cd460;p=collectd.git Build system: Check for "strtok_r" availability with "-Wall -Werror" when using GCC. Previously, the check was done without "-Werror" which resulted in a warning and success. When the daemon was later built with "-Werror" set, that warning would result in an error and abort the build. Thanks to Aurélien Reynaud for reporting the problem. --- diff --git a/configure.in b/configure.in index 6b66b2ac..c0ffb03c 100644 --- a/configure.in +++ b/configure.in @@ -459,6 +459,13 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr AC_FUNC_STRERROR_R +SAVE_CFLAGS="$CFLAGS" +# Emulate behavior of src/Makefile.am +if test "x$GCC" = "xyes" +then + CFLAGS="$CFLAGS -Wall -Werror" +fi + AC_CACHE_CHECK([for strtok_r], [c_cv_have_strtok_r_default], AC_LINK_IFELSE( @@ -489,7 +496,6 @@ AC_CACHE_CHECK([for strtok_r], if test "x$c_cv_have_strtok_r_default" = "xno" then - SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -D_REENTRANT=1" AC_CACHE_CHECK([if strtok_r needs _REENTRANT], @@ -521,6 +527,12 @@ then ) fi +CFLAGS="$SAVE_CFLAGS" +if test "x$c_cv_have_strtok_r_reentrant" = "xyes" +then + CFLAGS="$CFLAGS -D_REENTRANT=1" +fi + AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree) socket_needs_socket="no"