Compiler issues with ./configure

Hi guys i'm running solaris 7 on an ultra 5 sparc system and for the life of me i keep getting this error when trying to configure apache:

checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

This is my config.log results:

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1648: checking for chosen layout
configure:1650: result: Apache
configure:2446: checking for working mkdir -p
configure:2462: result: yes
configure:2479: checking build system type
configure:2497: result: sparc-sun-solaris2.7
configure:2505: checking host system type
configure:2519: result: sparc-sun-solaris2.7
configure:2527: checking target system type
configure:2541: result: sparc-sun-solaris2.7
configure:2585: checking for APR
configure:2667: result: yes
configure:2913: checking for APR-util
configure:2995: result: yes
configure:3219: checking for gcc
configure:3245: result: gcc
configure:3489: checking for C compiler version
configure:3492: gcc --version </dev/null >&5
gcc (GCC) 3.4.2
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3495: $? = 0
configure:3497: gcc -v </dev/null >&5
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.7/3.4.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nl
Thread model: posix
gcc version 3.4.2
configure:3500: $? = 0
configure:3502: gcc -V </dev/null >&5
gcc: `-V' option must have argument
configure:3505: $? = 1
configure:3528: checking for C compiler default output file name
configure:3531: gcc -g -O2 -pthreads -DSOLARIS2=7 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -D_LARGEFILE64_SOURCE -L/usr/local/li
b conftest.c >&5
ld: fatal: relocation error: R_SPARC_32: file /var/tmp//ccxZ7rDT.o: symbol <unknown>: offset 0xff0b164f is non-aligned

collect2: ld returned 1 exit status
configure:3534: $? = 1
configure: failed program was:
| /* confdefs.h. /
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /
end confdefs.h. */

if u guys have any input for me i could use the help. For reference i've done all the path changes have reinstalled GCC like 3 times and have set LD_LIBRARY_PATH
also in the gcc mkheaders.conf file i added the line #! /bin/sh to the top in the install-tools directory of my gcc libraries

Thanks for any input u can give me because i feel like im taking crazy pills