done
test=ztest$$
+
+cat > $test.c <<EOF
+#error error
+EOF
+if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ try()
+ {
+ test "`( $* ) 2>&1`" = ""
+ }
+else
+ try()
+ {
+ ( $* ) 2>/dev/null
+ }
+fi
+
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
if test $shared -eq 1; then
echo Checking for shared library support...
# we must test in two steps (cc then ld), required at least on SunOS 4.x
- if test "`($CC -w -c $SFLAGS $test.c) 2>&1`" = "" &&
- test "`($LDSHARED $SFLAGS -o $test$shared_ext $test.o) 2>&1`" = ""; then
+ if try $CC -w -c $SFLAGS $test.c &&
+ try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
echo Building shared library $SHAREDLIBV with $CC.
elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library support.
#include <sys/types.h>
off64_t dummy = 0;
EOF
-if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then
+if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
ALL="${ALL} all64"
return 0;
}
EOF
- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+ if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for fseeko... Yes."
else
CFLAGS="${CFLAGS} -DNO_FSEEKO"
#include <unistd.h>
int main() { return 0; }
EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h
echo "Checking for unistd.h... Yes."
#include <stdarg.h>
int main() { return 0; }
EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h
echo "Checking for stdarg.h... Yes."
}
EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if try $CC -c $CFLAGS $test.c; then
echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()."
cat > $test.c <<EOF
return (mytest("Hello%d\n", 1));
}
EOF
- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+ if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for vsnprintf() in stdio.h... Yes."
cat >$test.c <<EOF
}
EOF
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of vsnprintf()... Yes."
else
CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
}
EOF
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of vsprintf()... Yes."
else
CFLAGS="$CFLAGS -DHAS_vsprintf_void"
}
EOF
- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+ if try $CC $CFLAGS -o $test $test.c; then
echo "Checking for snprintf() in stdio.h... Yes."
cat >$test.c <<EOF
}
EOF
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of snprintf()... Yes."
else
CFLAGS="$CFLAGS -DHAS_snprintf_void"
}
EOF
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for return value of sprintf()... Yes."
else
CFLAGS="$CFLAGS -DHAS_sprintf_void"
return 0;
}
EOF
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for attribute(visibility) support... Yes."
else
CFLAGS="$CFLAGS -DNO_VIZ"