Ahem. HEAD -> 1.8cvs not 1.7 (I'm an idiot).
[oota-llvm.git] / autoconf / configure.ac
index 42d38c8dff391a4cb5ac11f2216c2529b2fdab91..c9ec1106975c3deb1818612e7a498b6902953496 100644 (file)
@@ -31,7 +31,7 @@ dnl===
 dnl===-----------------------------------------------------------------------===
 dnl Initialize autoconf and define the package name, version number and
 dnl email address for reporting bugs.
-AC_INIT([[llvm]],[[1.7cvs]],[llvmbugs@cs.uiuc.edu])
+AC_INIT([[llvm]],[[1.8cvs]],[llvmbugs@cs.uiuc.edu])
 
 dnl Provide a copyright substitution and ensure the copyright notice is included
 dnl in the output of --version option of the generated configure script.
@@ -184,6 +184,21 @@ AC_SUBST(ARCH,$llvm_cv_target_arch)
 dnl Check for the endianness of the target
 AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
 
+dnl Check to see if there's a "CVS" directory indicating that this build is
+dnl being done from a CVS checkout. This sets up several defaults for the
+dnl command line switches. When we build with a CVS directory, we get a 
+dnl debug with assertions turned on. Without, we assume a source release and we
+dnl get an optimized build without assertions. See --enable-optimized and
+dnl --enable-assertions below
+if test -d "CVS" -o -d "${srcdir}/CVS"; then
+  cvsbuild="yes"
+  optimize="no"
+  AC_SUBST(CVSBUILD,[[CVSBUILD=1]])
+else
+  cvsbuild="no"
+  optimize="yes"
+fi
+
 dnl===-----------------------------------------------------------------------===
 dnl===
 dnl=== SECTION 3: Command line arguments for the configure script.
@@ -191,14 +206,23 @@ dnl===
 dnl===-----------------------------------------------------------------------===
 
 dnl --enable-optimized : check whether they want to do an optimized build:
-AC_ARG_ENABLE(optimized,
             AS_HELP_STRING([--enable-optimized,Compile with optimizations enabled (default is NO)]),,enableval=no)
+AC_ARG_ENABLE(optimized, AS_HELP_STRING(
[--enable-optimized,Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
 if test ${enableval} = "no" ; then
   AC_SUBST(ENABLE_OPTIMIZED,[[]])
 else
   AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
 fi
 
+dnl --enable-assertions : check whether they want to turn on assertions or not:
+AC_ARG_ENABLE(assertions,AS_HELP_STRING(
+  [--enable-assertions,Compile with assertion checks enabled (default is YES)]),, enableval="yes")
+if test ${enableval} = "yes" ; then
+  AC_SUBST(DISABLE_ASSERTIONS,[[]])
+else
+  AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
+fi
+
 dnl --enable-debug-runtime : should runtime libraries have debug symbols?
 AC_ARG_ENABLE(debug-runtime,
    AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
@@ -218,13 +242,13 @@ then
   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_64)  AC_SUBST(JIT,[[]]) ;;
-    Alpha)   AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
-    IA64)    AC_SUBST(JIT,[[]]) ;;
-    *)       AC_SUBST(JIT,[[]]) ;;
+    x86)     AC_SUBST(TARGET_HAS_JIT,1) ;;
+    Sparc)   AC_SUBST(TARGET_HAS_JIT,1) ;;
+    PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;;
+    x86_64)  AC_SUBST(TARGET_HAS_JIT,0) ;;
+    Alpha)   AC_SUBST(TARGET_HAS_JIT,1) ;;
+    IA64)    AC_SUBST(TARGET_HAS_JIT,0) ;;
+    *)       AC_SUBST(TARGET_HAS_JIT,0) ;;
   esac
 fi
 
@@ -338,6 +362,15 @@ if test "$GV" != "echo gv" ; then
    [Define to path to gv program if found or 'echo gv' otherwise])
 fi
 
+dnl Look for a sufficiently recent version of Perl.
+LLVM_PROG_PERL([5.006])
+AC_SUBST(PERL)
+if test x"$PERL" = xnone; then
+   AC_SUBST(HAVE_PERL,0)
+else
+   AC_SUBST(HAVE_PERL,1)
+fi
+
 dnl Find the install program
 AC_PROG_INSTALL
 
@@ -583,6 +616,10 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
   AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
   llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
   AC_SUBST(LLVMGCCDIR,$llvmgccdir)
+  llvmgccversion=[`"$LLVMGCC" -v 2>&1 | grep '^gcc version' | sed 's/^gcc version \([0-9.]*\).*/\1/'`]
+  llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`]
+  AC_SUBST(LLVMGCC_VERSION,$llvmgccversion)
+  AC_SUBST(LLVMGCC_MAJVERS,$llvmgccmajvers)
 fi
 
 dnl Propagate the shared library extension that the libltdl checks did to