diff --git a/ChangeLog b/ChangeLog index c76a8a5..4bf4eac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-12-12 Ben Elliston + + * config.guess: Speed up detection of x86 Linux systems by using + just the C preprocessor rather than assembling and linking a final + executable. + 2001-12-12 Jason Thorpe * config.guess: Simplify assignment of machine for NetBSD targets, diff --git a/config.guess b/config.guess index 3cb7261..c299504 100755 --- a/config.guess +++ b/config.guess @@ -841,32 +841,24 @@ EOF esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build - cat >$dummy.c < -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-pc-linux-gnu\n", argv[1]); -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-pc-linux-gnuaout\n", argv[1]); -#endif - return 0; -} + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + gnu + # else + gnulibc1 + # endif + # else + gnulibc1 + # endif + #else + gnuaout + #endif EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + libc=`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^gnu` && test -n $libc && rm -f $dummy.c && echo "${UNAME_MACHINE}-pc-linux-$libc" && exit 0 + rm -f $dummy.c test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*)