about summary refs log tree commit diff homepage
path: root/autoconf/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf/configure.ac')
-rw-r--r--autoconf/configure.ac91
1 files changed, 64 insertions, 27 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 4bd79557..c1b1d2b8 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -161,8 +161,7 @@ AC_ARG_WITH(llvm-build-mode,
 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
+  llvm_configs="`ls -1 $llvm_obj/*/bin/llvm-config 2>/dev/null | head -n 1`"
   if test -x "$llvm_configs" ; then
     llvm_build_mode="`$llvm_configs --build-mode`"
   else
@@ -342,38 +341,52 @@ dnl User option to enable uClibc support.
 
 AC_ARG_WITH(uclibc,
   AS_HELP_STRING([--with-uclibc],
-    [Enable use of the klee uclibc at the given path]),,)
-
-dnl If uclibc wasn't given, check for a uclibc in the current
-dnl directory.
-if (test X${with_uclibc} = X && test -d uclibc); then
-   with_uclibc=uclibc
-fi
+                 [Enable use of the klee uclibc at the given path (klee-uclibc root directory or libc.a file]),,)
 
 dnl Validate uclibc if given.
 
 AC_MSG_CHECKING([uclibc])
 if (test X${with_uclibc} != X); then
-   if test ! -d ${with_uclibc}; then
-       AC_MSG_ERROR([invalid uclibc directory: ${with_uclibc}])
+   if test  -d ${with_uclibc}; then
+      dnl Support the legacy way of configuring with 
+      dnl klee-uclibc, i.e. the root klee-uclibc
+      dnl directory is passed as an argument.
+
+      dnl Make the path absolute
+      with_uclibc=`cd $with_uclibc 2> /dev/null; pwd`
+
+      dnl create path to libc file
+      KLEE_UCLIBC_BCA="${with_uclibc}/lib/libc.a"
+
+      if test ! -e "${KLEE_UCLIBC_BCA}"; then
+      AC_MSG_ERROR([Could not find file ${KLEE_UCLIBC_BCA}])
+      fi
+   elif test -f ${with_uclibc}; then
+      dnl Support the new way of configuring klee-uclibc
+      dnl i.e. the built bitcode archive is passed as the
+      dnl argument.
+
+      dnl Get absolute path to file
+      _kud=`dirname ${with_uclibc}`
+      _kud=`cd ${_kud}; pwd 2> /dev/null`
+      _kuf=`basename ${with_uclibc}`
+
+      KLEE_UCLIBC_BCA="${_kud}/${_kuf}" 
+   else
+      AC_MSG_ERROR([Could not detect klee-uclibc])
    fi
 
-   dnl Make the path absolute
-   with_uclibc=`cd $with_uclibc 2> /dev/null; pwd`
+   dnl FIXME: Validate the libc.a file
 
-   AC_MSG_RESULT([$with_uclibc])
+   AC_MSG_RESULT([$KLEE_UCLIBC_BCA])
+   AC_SUBST(ENABLE_UCLIBC,[[1]])
+   AC_SUBST(KLEE_UCLIBC_BCA)
+   AC_DEFINE(SUPPORT_KLEE_UCLIBC, [[1]], [klee-uclibc is supported])
 else
    AC_MSG_RESULT([no])
+   AC_SUBST(ENABLE_UCLIBC,[[0]])
 fi
 
-AC_DEFINE_UNQUOTED(KLEE_UCLIBC, "$with_uclibc", [Path to KLEE's uClibc])
-AC_SUBST(KLEE_UCLIBC)         
-
-if test X${with_uclibc} != X ; then
-  AC_SUBST(ENABLE_UCLIBC,[[1]])
-else
-  AC_SUBST(ENABLE_UCLIBC,[[0]])
-fi
 
 dnl **************************************************************************
 dnl User option to enable the POSIX runtime
@@ -483,6 +496,14 @@ AC_CHECK_HEADERS([selinux/selinux.h],
         AC_SUBST(HAVE_SELINUX, 0))
 
 dnl **************************************************************************
+dnl Test for features
+dnl **************************************************************************
+AC_SEARCH_LIBS(mallinfo,malloc,
+               AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]),
+               AC_MSG_ERROR([mallinfo() must be supported by your malloc implementation])
+              )
+
+dnl **************************************************************************
 dnl Find an install of STP
 dnl **************************************************************************
 
@@ -510,10 +531,30 @@ else
   ])
   CPPFLAGS="$old_CPPFLAGS"
 
+  STP_NEEDS_BOOST=0
+
+  # Try old STP
   AC_CHECK_LIB(stp, vc_setInterfaceFlags,, [
-         AC_MSG_ERROR([Unable to link with libstp])
+         STP_NEEDS_BOOST=1 ; AC_MSG_RESULT([Could not link with libstp. Checking if newer STP is being used])
   ], -L$stp_root/lib)
 
+  dnl Flags for upstream STP which has boost dependency
+  UPSTREAM_STP_LINK_FLAGS="-lboost_system -lboost_program_options"
+  if test "X$STP_NEEDS_BOOST" != X0 ; then
+    # Need to clear cached result
+    unset ac_cv_lib_stp_vc_setInterfaceFlags
+
+    AC_CHECK_LIB(stp,
+                 vc_setInterfaceFlags,, [
+                 AC_MSG_ERROR([Unable to link with libstp. Check config.log to see what went wrong])
+    ], -L$stp_root/lib $UPSTREAM_STP_LINK_FLAGS )
+
+    AC_SUBST(UPSTREAM_STP_LINK_FLAGS, $UPSTREAM_STP_LINK_FLAGS)
+    AC_SUBST(STP_NEEDS_BOOST, $STP_NEEDS_BOOST)
+  else
+    AC_MSG_RESULT([Using old STP])
+  fi
+
   AC_SUBST(STP_ROOT,$stp_root)
 fi
 
@@ -551,10 +592,6 @@ else
   AC_SUBST(REQUIRES_RTTI,[[1]])
 fi
 
-dnl **************************************************************************
-dnl * Check for dejagnu
-dnl **************************************************************************
-AC_PATH_PROG(RUNTEST, [runtest])
 
 dnl **************************************************************************
 dnl * Create the output files