diff --git a/configure b/configure index 707eb12..c363079 100755 --- a/configure +++ b/configure @@ -237,13 +237,49 @@ test -n "$CC" || { echo "$0: cannot find a C compiler" ; exit 1 ; } printf "checking whether C compiler works... " echo "typedef int x;" > "$tmpc" -if output=$($CC $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" 2>&1) ; then +if output=$($CC -c -o /dev/null "$tmpc" 2>&1) ; then printf "yes\n" else printf "no; compiler output follows:\n%s\n" "$output" exit 1 fi +if test x"$shared" != xno ; then + printf "checking whether linker works... " + echo "int main(void) { return 0; }" > "$tmpc" + if output=$($CC -nostdlib -shared -o /dev/null "$tmpc" 2>&1) ; then + printf "yes\n" + else + if test x"$shared" = xyes ; then + printf "no; compiler output follows:\n%s\n" "$output" + exit 1 + else + printf "no; shared library disabled\n" + shared=no + fi + fi +fi + +printf "checking whether CFLAGS and CPPFLAGS are sane... " +echo "typedef int x;" > "$tmpc" +if output=$($CC $CFLAGS $CPPFLAGS -c -o /dev/null "$tmpc" 2>&1) ; then +printf "yes\n" +else +printf "no; compiler output follows:\n%s\n" "$output" +exit 1 +fi + +if test x"$shared" != xno ; then + printf "checking whether LDFLAGS are sane... " + echo "int main(void) { return 0; }" > "$tmpc" + if output=$($CC $LDFLAGS -nostdlib -shared -o /dev/null "$tmpc" 2>&1) ; then + printf "yes\n" + else + printf "no; compiler output follows:\n%s\n" "$output" + exit 1 + fi +fi + # # Figure out options to force errors on unknown flags. #