If you look in your config.log, you should see the source code ofthe problem it failed on. Chances are you're missing some component needed to compile and link a working executable (the library headers, or some part of binutils). Try entering the following program:
into a file called myprog.c and then compile:
gcc myprog.c -o myprog
Do you get any errors? Does running ./myprog print "Hello, world." on your terminal?