From: Mark Adler Date: Sat, 18 Feb 2012 21:55:09 +0000 (-0800) Subject: Test for existence of strerror. X-Git-Tag: v1.2.7~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6838df92460eaceaaadd0f13aaea248a6b7c0a1b;p=thirdparty%2Fzlib-ng.git Test for existence of strerror. SunOS 4.1 claims that it is __STDC__, but it does not have strerror in string.h. Instead of using __STDC__, this puts a direct test for strerror in configure, and uses that information in gzguts.h. --- diff --git a/configure b/configure index 060acb724..52a50fb49 100755 --- a/configure +++ b/configure @@ -367,6 +367,21 @@ EOF fi fi +echo >> configure.log + +cat > $test.c < +#include +int main() { return strlen(strerror(errno)); } +EOF +if try $CC $CFLAGS -o $test $test.c; then + echo "Checking for strerror... Yes." | tee -a configure.log +else + CFLAGS="${CFLAGS} -DNO_STRERROR" + SFLAGS="${SFLAGS} -DNO_STRERROR" + echo "Checking for strerror... No." | tee -a configure.log +fi + cp -p zconf.h.in zconf.h echo >> configure.log @@ -435,7 +450,6 @@ int main() return 0; } EOF - if try $CC -c $CFLAGS $test.c; then echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log diff --git a/gzguts.h b/gzguts.h index f8dd9adfc..f16295064 100644 --- a/gzguts.h +++ b/gzguts.h @@ -100,7 +100,7 @@ # include # define zstrerror() gz_strwinerror((DWORD)GetLastError()) #else -# ifdef STDC +# ifndef NO_STRERROR # include # define zstrerror() strerror(errno) # else