Makefile dependencies and configure test fix

Some low-priority fixes to the build system… These can probably wait after 2.2

  1. The current configure script checks for gcc 3.x or later by parsing “gcc --version” output and trying to tokenize it to find the major compiler version. This is pretty fragile and interacts poorly with compilers produced by vendors (like Apple) that modify this string to output target triple (including potentially i686 and darwin9), FSF GCC version, Apple local version. There’s lots of numbers there, and the sed expression doesn’t find any of the right ones. This patch turns the check into a compile-time check for GNUC version. Since autoconf already does this to determine if you’re using GCC or not, it should be pretty safe.

Believe it or not, I dusted off a copy of gcc 2.95.2 for Mac OS X for PowerPC and ran it under Rosetta to verify this fix:

[ssen@virgon]$ gcc-2.95.2 -v
Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs
Apple Computer, Inc. version gcc-926, based on gcc version 2.95.2 19991024 (release)

[ssen@virgon]$ ./configure CC=gcc-2.95.2 CXX=g+±2.95.2

checking for llvm-gcc… no
checking for llvm-g++… no
checking tool compatibility… configure: error: gcc 3.x required, but you have a lower version

  1. Makefile.rules is missing some dependencies for shared library targets, which means if you change core libraries and do a rebuild, things like tools/lto don’t get relinked against the new libraries. Test case is to have a pre-built tree and do “touch lib/System/Unix/Program.inc && make” and make sure you see “Linking Debug Loadable Module LLVMlto.dylib”.

  2. There appears to be a typo for for llvm_cv_no_link_all_option for Darwin, but this never seems to be used anyway. Probably worth fixing in case a new standalone project uses the LLVM makefiles.

I regenerated the configure script with the required versions of autotools on Mac OS X on Intel.

llvm-makefile-and-configure.patch (3.84 KB)

Shantonu,

I just wanted to verify that you used the llvm/autoconf/AutoRegen.sh script to regenerate configure. Is that correct?

Thanks,
Tanya

Yes, I did, the the required versions of autoconf, automake, and libtool in a directory at the front of my PATH.

Shantonu Sen
ssen@apple.com

Some low-priority fixes to the build system.... These can probably wait after 2.2

Very nice Shantonu, applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080204/057939.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080204/057940.html

Thanks!

-Chris

1) The current configure script checks for gcc 3.x or later by parsing "gcc --version" output and trying to tokenize it to find the major compiler version. This is pretty fragile and interacts poorly with compilers produced by vendors (like Apple) that modify this string to output target triple (including potentially i686 and darwin9), FSF GCC version, Apple local version. There's lots of numbers there, and the sed expression doesn't find any of the right ones. This patch turns the check into a compile-time check for __GNUC__ version. Since autoconf already does this to determine if you're using GCC or not, it should be pretty safe.

Believe it or not, I dusted off a copy of gcc 2.95.2 for Mac OS X for PowerPC and ran it under Rosetta to verify this fix:

[ssen@virgon]$ gcc-2.95.2 -v
Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs
Apple Computer, Inc. version gcc-926, based on gcc version 2.95.2 19991024 (release)
[ssen@virgon]$ ./configure CC=gcc-2.95.2 CXX=g++-2.95.2
...
checking for llvm-gcc... no
checking for llvm-g++... no
checking tool compatibility... configure: error: gcc 3.x required, but you have a lower version

2) Makefile.rules is missing some dependencies for shared library targets, which means if you change core libraries and do a rebuild, things like tools/lto don't get relinked against the new libraries. Test case is to have a pre-built tree and do "touch lib/System/Unix/Program.inc && make" and make sure you see "Linking Debug Loadable Module LLVMlto.dylib".

3) There appears to be a typo for for llvm_cv_no_link_all_option for Darwin, but this never seems to be used anyway. Probably worth fixing in case a new standalone project uses the LLVM makefiles.

I regenerated the configure script with the required versions of autotools on Mac OS X on Intel.

Shantonu Sen
ssen@apple.com

Sent from my Mac Pro

-Chris