about summary refs log tree commit diff homepage
path: root/autoconf
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac50
1 files changed, 40 insertions, 10 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 4b2fc948..57f16a2a 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -139,6 +139,40 @@ AC_SUBST(LLVM_VERSION_MINOR,$llvm_version_minor)
 AC_DEFINE_UNQUOTED(LLVM_IS_RELEASE, $llvm_is_release, [LLVM version is release (instead of development)])
 AC_SUBST(LLVM_IS_RELEASE,$llvm_is_release)
 
+dnl LLVM <= 2.6 requires RTTI.
+if test $llvm_version_major -eq 2 -a $llvm_version_minor -le 6 ; then
+  requires_rtti=1
+else
+  requires_rtti=0
+fi
+AC_SUBST(REQUIRES_RTTI,$requires_rtti)
+
+AC_ARG_WITH(llvm-build-mode,
+  AS_HELP_STRING([--with-llvm-build-mode],
+    [LLVM build mode (e.g. Debug or Release, default autodetect)]),,[with_llvm_build_mode=check])
+
+AC_MSG_CHECKING([llvm build mode])
+
+if test X${with_llvm_build_mode} = Xcheck ; then
+  llvm_configs="`echo $llvm_obj/*/bin/llvm-config`"
+  dnl This will be true if the user has exactly 1 build mode built
+  if test -x "$llvm_configs" ; then
+    llvm_build_mode="`$llvm_configs --build-mode`"
+  else
+    AC_MSG_ERROR([Could not autodetect build mode])
+  fi
+else
+  llvm_configs="`echo $llvm_obj/*/bin/llvm-config`"
+  if test -x "$llvm_obj/$with_llvm_build_mode/bin/llvm-config" ; then
+    llvm_build_mode=$with_llvm_build_mode
+  else
+    AC_MSG_ERROR([Invalid build mode: $llvm_build_mode])
+  fi
+fi
+
+AC_MSG_RESULT([$llvm_build_mode])
+AC_SUBST(LLVM_BUILD_MODE,$llvm_build_mode)
+
 dnl **************************************************************************
 dnl User option to enable uClibc support.
 
@@ -217,33 +251,29 @@ dnl User option to select runtime version
 
 AC_ARG_WITH(runtime,
   AS_HELP_STRING([--with-runtime],
-    [Select build configuration for runtime libraries (default [Release])]),,
+    [Select build configuration for runtime libraries (default [Release+Asserts])]),,
     withval=default)
 if test X"${withval}" = Xdefault; then
-   with_runtime=Release
-fi
-
-dnl Before LLVM 2.8, the "optimized with asserts enabled" build was just
-dnl 'Release'; now it's 'Release+Asserts'. See the LLVM 2.8 release notes.
-if !(test $llvm_version_major == 2 &&
-    test $llvm_version_minor -lt 8) &&
-    test "$with_runtime" == "Release"; then
-  with_runtime=Release+Asserts
+   with_runtime=Release+Asserts
 fi
 
 AC_MSG_CHECKING([runtime configuration])
 if test X${with_runtime} = XRelease; then
     AC_MSG_RESULT([Release])
     AC_SUBST(RUNTIME_ENABLE_OPTIMIZED,[[1]])
+    AC_SUBST(RUNTIME_DISABLE_ASSERTIONS,[[1]])
 elif test X${with_runtime} = XRelease+Asserts; then
     AC_MSG_RESULT([Release+Asserts])
     AC_SUBST(RUNTIME_ENABLE_OPTIMIZED,[[1]])
+    AC_SUBST(RUNTIME_DISABLE_ASSERTIONS,[[0]])
 elif test X${with_runtime} = XDebug; then
    AC_MSG_RESULT([Debug])
    AC_SUBST(RUNTIME_ENABLE_OPTIMIZED,[[0]])
+   AC_SUBST(RUNTIME_DISABLE_ASSERTIONS,[[1]])
 elif test X${with_runtime} = XDebug+Asserts; then
    AC_MSG_RESULT([Debug+Asserts])
    AC_SUBST(RUNTIME_ENABLE_OPTIMIZED,[[0]])
+   AC_SUBST(RUNTIME_DISABLE_ASSERTIONS,[[0]])
 else
    AC_MSG_ERROR([invalid configuration: ${with_runtime}])
 fi