small patch for llvm configure.ac

Below you will find a small patch for llvm/autoconf/configure.ac that fixes
wrong AC_SUBST usage and adds AMD64 detection. Please review.

~Markus

--- autoconf/configure.ac 22 Dec 2004 05:56:56 -0000 1.147
+++ autoconf/configure.ac 23 Dec 2004 06:06:04 -0000
@@ -139,7 +139,8 @@
dnl the OS.
AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
[case $target in
- i*86-*) llvm_cv_target_arch="x86" ;;
+ amd64-* | x86_64-*) llvm_cv_target_arch="amd64" ;;
+ i?86-*) llvm_cv_target_arch="x86" ;;

This change looks fine. I'll commit this part.

   sparc*-*) llvm_cv_target_arch="Sparc" ;;
   powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
   *) llvm_cv_target_arch="Unknown" ;;
@@ -167,7 +168,7 @@
if test ${enableval} = "no" ; then
   AC_SUBST(ENABLE_OPTIMIZED,[])
else
- AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
+ AC_SUBST(ENABLE_OPTIMIZED,[[1]])

This is not okay, at least not without other changes. We do some weird
things in Makefile.config.in where these values are used that I've been
meaning to clean up so that the "correct" usage you show above is used.
However, until those changes are made, I can't commit this because it
will break the LLVM makefile system.

fi

dnl --enable-jit: check whether they want to enable the jit
@@ -180,9 +181,9 @@
   AC_SUBST(JIT,[])
else
   case "$llvm_cv_target_arch" in
- x86) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
- Sparc) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
- PowerPC) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
+ x86) AC_SUBST(JIT,[[1]]) ;;
+ Sparc) AC_SUBST(JIT,[[1]]) ;;
+ PowerPC) AC_SUBST(JIT,[[1]]) ;;

I can't make these changes for the same reason as described above. Also,
I think you want to add an amd64 case here, don't you?

Hello Reid,

> > @@ -167,7 +168,7 @@
> > if test ${enableval} = "no" ; then
> > AC_SUBST(ENABLE_OPTIMIZED,[])
> > else
> > - AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
> > + AC_SUBST(ENABLE_OPTIMIZED,[[1]])
>
> This is not okay, at least not without other changes. We do some weird
> things in Makefile.config.in where these values are used that I've been
> meaning to clean up so that the "correct" usage you show above is used.
> However, until those changes are made, I can't commit this because it
> will break the LLVM makefile system.

Please note that this expands to "ENABLE_OPTIMIZED=ENABLE_OPTIMIZED=1".
Is this eval'ed somewhere ?

We use it like this:

@ENABLE_OPTIMZED@

in a makefile so it expands to a line of:

ENABLE_OPTIMIZED=1

Weird, I know, but it works. The point is, we don't want the makefile
variable even defined if it has no value so this strategy works.

Again, this expands to "JIT=TARGET_HAS_JIT=1", and I've grepped over
the llvm source tree and found that "TARGET_HAS_JIT" is never used ??

Same usage in the makefiles as described above.

Yes, but "TARGET_HAS_JIT" seems to be unused, so what is this for ?

projects/llvm-test/Makefile.programs:175:ifdef TARGET_HAS_JIT
projects/llvm-test/Makefile.programs:182:endif#TARGET_HAS_JIT
projects/llvm-test/LLVMSource/Makefile:22:ifdef TARGET_HAS_JIT
projects/llvm-test/SingleSource/CustomChecked/Makefile:27:ifdef TARGET_HAS_JIT

Markus

P.S. please apply this one-line patch

RCS file: /var/cvs/llvm/llvm/autoconf/configure.ac,v
retrieving revision 1.148
diff -u -r1.148 configure.ac
--- configure.ac 23 Dec 2004 06:22:33 -0000 1.148
+++ configure.ac 23 Dec 2004 06:32:35 -0000
@@ -140,7 +140,7 @@
AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
[case $target in
   i?86-*) llvm_cv_target_arch="x86" ;;
- amd64-*) llvm_cv_target_arch="amd64" ;;
+ amd64-* | x86_64-*) llvm_cv_target_arch="AMD64" ;;
   sparc*-*) llvm_cv_target_arch="Sparc" ;;
   powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
   *) llvm_cv_target_arch="Unknown" ;;

Done.

Reid