From b41cf33b6b726fd97e502c5c4818f5feeea0284b Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Wed, 8 Apr 2015 23:29:10 +0100 Subject: Fix very annoying issue where KLEE's configure would completly ignore the C++ compiler detected and just use the compiler detected during the LLVM configure. --- Makefile.config.in | 5 + autoconf/configure.ac | 3 + configure | 2218 ++++++++++++++++++++++--------------------------- 3 files changed, 1024 insertions(+), 1202 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index ee95c4e5..efedd505 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -65,6 +65,11 @@ endif # disable unwind test TEST_FEATURE_LIST += no-unwind +# Deliberately override the host compiler +# so that we use what was detected when KLEE was configured +# and not LLVM. +CC := @KLEE_HOST_C_COMPILER@ +CXX := @KLEE_HOST_CXX_COMPILER@ CFLAGS := @CFLAGS@ -Wall -g CXXFLAGS := @CXXFLAGS@ -g -Wall LDFLAGS := @LDFLAGS@ -g diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 8d4f465c..747f6544 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -34,8 +34,11 @@ AH_BOTTOM([#endif]) dnl We need to check for the compiler up here to avoid anything else dnl starting with a different one. +AC_PROG_CC(gcc clang) AC_PROG_CXX(g++ clang++ ) AC_LANG([C++]) +AC_SUBST(KLEE_HOST_C_COMPILER,$CC) +AC_SUBST(KLEE_HOST_CXX_COMPILER,$CXX) dnl ************************************************************************** dnl Find the host diff --git a/configure b/configure index 85d10756..e4f8ffb6 100755 --- a/configure +++ b/configure @@ -633,9 +633,6 @@ HAVE_SELINUX EGREP GREP CPP -ac_ct_CC -CFLAGS -CC RUNTIME_CONFIGURATION RUNTIME_DEBUG_SYMBOLS RUNTIME_DISABLE_ASSERTIONS @@ -667,13 +664,18 @@ build_os build_vendor build_cpu build +KLEE_HOST_CXX_COMPILER +KLEE_HOST_C_COMPILER +ac_ct_CXX +CXXFLAGS +CXX OBJEXT EXEEXT -ac_ct_CXX +ac_ct_CC CPPFLAGS LDFLAGS -CXXFLAGS -CXX +CFLAGS +CC LLVM_OBJ LLVM_SRC target_alias @@ -733,14 +735,14 @@ with_metasmt ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS +CC +CFLAGS LDFLAGS LIBS CPPFLAGS +CXX +CXXFLAGS CCC -CC -CFLAGS CPP CXXCPP' @@ -1382,15 +1384,15 @@ Optional Packages: --with-metasmt Location of metaSMT installation directory Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor CXXCPP C++ preprocessor @@ -1474,10 +1476,10 @@ fi ## Autoconf initialization. ## ## ------------------------ ## -# ac_fn_cxx_try_compile LINENO -# ---------------------------- +# ac_fn_c_try_compile LINENO +# -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () +ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext @@ -1497,7 +1499,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 @@ -1510,23 +1512,23 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_cxx_try_compile +} # ac_fn_c_try_compile -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err + (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1537,10 +1539,7 @@ $as_echo "$ac_try_echo"; } >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : + } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 @@ -1548,31 +1547,26 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_cxx_try_link +} # ac_fn_cxx_try_compile -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err + (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1581,9 +1575,12 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 @@ -1591,10 +1588,15 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_compile +} # ac_fn_cxx_try_link # ac_fn_c_try_cpp LINENO # ---------------------- @@ -2460,27 +2462,23 @@ ac_config_headers="$ac_config_headers include/klee/Config/config.h" -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ clang++ +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in gcc clang do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2489,7 +2487,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2499,32 +2497,32 @@ IFS=$as_save_IFS fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CXX" && break + test -n "$CC" && break done fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ clang++ +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in gcc clang do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2533,7 +2531,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2543,21 +2541,21 @@ IFS=$as_save_IFS fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ac_ct_CXX" && break + test -n "$ac_ct_CC" && break done - if test "x$ac_ct_CXX" = x; then - CXX="g++" + if test "x$ac_ct_CC" = x; then + CC="" else case $cross_compiling:$ac_tool_warned in yes:) @@ -2565,14 +2563,18 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CXX=$ac_ct_CXX + CC=$ac_ct_CC fi fi - fi -fi + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -2612,8 +2614,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2683,14 +2685,14 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables +as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext @@ -2784,7 +2786,7 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi @@ -2846,9 +2848,9 @@ fi $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2865,33 +2867,33 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu +ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then - GXX=yes + GCC=yes else - GXX= + GCC= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2903,10 +2905,10 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes else - CXXFLAGS="" + CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2918,11 +2920,11 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2934,447 +2936,194 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag + ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" else - CXXFLAGS="-g" + CFLAGS="-g" fi else - if test "$GXX" = yes; then - CXXFLAGS="-O2" + if test "$GCC" = yes; then + CFLAGS="-O2" else - CXXFLAGS= + CFLAGS= fi fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of operating system we're going to host on" >&5 -$as_echo_n "checking type of operating system we're going to host on... " >&6; } -if ${klee_cv_os_type+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else - case $host in - *-*-linux*) - host_supports_posix_runtime=yes ;; - *) - host_supports_posix_runtime=no ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $klee_cv_os_type" >&5 -$as_echo "$klee_cv_os_type" >&6; } - - - -# Check whether --with-llvm was given. -if test "${with_llvm+set}" = set; then : - withval=$with_llvm; -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm source dir" >&5 -$as_echo_n "checking llvm source dir... " >&6; } - -if test X${with_llvm} != X; then - if test X${with_llvmsrc} != X; then - as_fn_error $? "--with-llvmsrc cannot be specified when using --with-llvm" "$LINENO" 5 - fi - if test X${with_llvmobj} != X; then - as_fn_error $? "--with-llvmobj cannot be specified when using --with-llvm" "$LINENO" 5 - fi - with_llvmsrc=$with_llvm - with_llvmobj=$with_llvm -fi - -if (test X${with_llvmsrc} != X || test X${with_llvmobj} != X); then - if test X${with_llvmsrc} = X; then - as_fn_error $? "--with-llvmsrc must be specified when using --with-llvmobj" "$LINENO" 5 - fi - if test X${with_llvmobj} = X; then - as_fn_error $? "--with-llvmobj must be specified when using --with-llvmsrc" "$LINENO" 5 - fi -else - llvm_version=`llvm-config --version` - if test X${llvm_version} = X; then - as_fn_error $? "unable to find llvm, use --with-llvmsrc and --with-llvmobj" "$LINENO" 5 - fi - - with_llvmsrc=`llvm-config --src-root` - with_llvmobj=`llvm-config --obj-root` -fi - -if test ! -f ${with_llvmsrc}/Makefile.rules; then - as_fn_error $? "invalid llvmsrc directory: ${with_llvmsrc}" "$LINENO" 5 -fi -if test ! -f ${with_llvmobj}/Makefile.config; then - as_fn_error $? "invalid llvmobj directory: ${with_llvmobj}" "$LINENO" 5 -fi - -llvm_src=`cd $with_llvmsrc 2> /dev/null; pwd` -llvm_obj=`cd $with_llvmobj 2> /dev/null; pwd` - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_src" >&5 -$as_echo "$llvm_src" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm obj dir" >&5 -$as_echo_n "checking llvm obj dir... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_obj" >&5 -$as_echo "$llvm_obj" >&6; } - -LLVM_SRC=$llvm_src - -LLVM_OBJ=$llvm_obj - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm package version" >&5 -$as_echo_n "checking llvm package version... " >&6; } -llvm_package_version=`grep PACKAGE_VERSION= $with_llvmsrc/configure | cut -d\' -f 2` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_package_version" >&5 -$as_echo "$llvm_package_version" >&6; } - -llvm_version_split=`python -c "import re; print('\t'.join(map(str, re.match('([0-9]+).([0-9]+)(svn)?', \"$llvm_package_version\").groups())))"` - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm version major" >&5 -$as_echo_n "checking llvm version major... " >&6; } -llvm_version_major=`echo "$llvm_version_split" | cut -f 1` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_version_major" >&5 -$as_echo "$llvm_version_major" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm version minor" >&5 -$as_echo_n "checking llvm version minor... " >&6; } -llvm_version_minor=`echo "$llvm_version_split" | cut -f 2` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_version_minor" >&5 -$as_echo "$llvm_version_minor" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm is release version" >&5 -$as_echo_n "checking llvm is release version... " >&6; } -llvm_version_svn=`echo "$llvm_version_split" | cut -f 3` -if test "$llvm_version_svn" == "svn"; then - llvm_is_release=0 -else - llvm_is_release=1 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_is_release" >&5 -$as_echo "$llvm_is_release" >&6; } - - -cat >>confdefs.h <<_ACEOF -#define LLVM_VERSION_MAJOR $llvm_version_major -_ACEOF - -LLVM_VERSION_MAJOR=$llvm_version_major - - -cat >>confdefs.h <<_ACEOF -#define LLVM_VERSION_MINOR $llvm_version_minor -_ACEOF - -LLVM_VERSION_MINOR=$llvm_version_minor - - -cat >>confdefs.h <<_ACEOF -#define LLVM_IS_RELEASE $llvm_is_release -_ACEOF - -LLVM_IS_RELEASE=$llvm_is_release - - -if test $llvm_version_major -eq 2 -a $llvm_version_minor -le 6 ; then - requires_rtti=1 -else - requires_rtti=0 -fi -REQUIRES_RTTI=$requires_rtti - - -# Check whether --enable-cxx11 was given. -if test "${enable_cxx11+set}" = set; then : - enableval=$enable_cxx11; klee_use_cxx11=1 -else - klee_use_cxx11=0 -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if LLVM needs C++11" >&5 -$as_echo_n "checking if LLVM needs C++11... " >&6; } -if test '(' $llvm_version_major -eq 3 -a $llvm_version_minor -ge 5 ')' -o '(' $llvm_version_major -gt 3 ')' ; then - klee_use_cxx11=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -if test X${klee_use_cxx11} = X1; then - klee_old_cxxflags="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=c++11" - + ac_cv_prog_cc_c89=no +ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} -#include -std::atomic x(0.0f); -int main() { return (float)x; } - -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "C++11 not supported" "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS="$klee_old_cxxflags" -fi - -KLEE_USE_CXX11=$klee_use_cxx11 - - - - -# Check whether --with-llvm-build-mode was given. -if test "${with_llvm_build_mode+set}" = set; then : - withval=$with_llvm_build_mode; -else - with_llvm_build_mode=check -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm build mode" >&5 -$as_echo_n "checking llvm build mode... " >&6; } - -if test X${with_llvm_build_mode} = Xcheck ; then - 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 - as_fn_error $? "Could not autodetect build mode" "$LINENO" 5 - 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 - as_fn_error $? "Invalid build mode: $llvm_build_mode" "$LINENO" 5 - fi -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_build_mode" >&5 -$as_echo "$llvm_build_mode" >&6; } -LLVM_BUILD_MODE=$llvm_build_mode - +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm has asserts enabled" >&5 -$as_echo_n "checking llvm has asserts enabled... " >&6; } -if test `expr "$llvm_build_mode" : ".*Asserts.*"` -ne 0; then - llvm_has_asserts_enabled=1 +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -cat >>confdefs.h <<_ACEOF -#define ENABLE_KLEE_DEBUG 1 +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} _ACEOF - -else - llvm_has_asserts_enabled=0 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_has_asserts_enabled" >&5 -$as_echo "$llvm_has_asserts_enabled" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LLVM Bitcode compiler" >&5 -$as_echo_n "checking LLVM Bitcode compiler... " >&6; } -klee_llvm_bc_c_compiler="" -klee_llvm_bc_cxx_compiler="" - - -# Check whether --with-llvmcc was given. -if test "${with_llvmcc+set}" = set; then : - withval=$with_llvmcc; -else - with_llvmcc=none +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Check whether --with-llvmcxx was given. -if test "${with_llvmcxx+set}" = set; then : - withval=$with_llvmcxx; +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 else - with_llvmcxx=none + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi - -if test \( "X$with_llvmcc" != Xnone -a "X$with_llvmcxx" = Xnone \) -o \( "X$with_llvmcxx" != Xnone -a "X$with_llvmcc" = Xnone \) ; then - as_fn_error $? "You must set both --with-llvmcc= and --with-llvmcxx= or set neither" "$LINENO" 5 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -if test X$with_llvmcc = Xnone ; then - - if test -x "$llvm_obj/$llvm_build_mode/bin/clang" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found clang in LLVM Build" >&5 -$as_echo "Found clang in LLVM Build" >&6; } - klee_llvm_bc_c_compiler="$llvm_obj/$llvm_build_mode/bin/clang" - - if test -x "$llvm_obj/$llvm_build_mode/bin/clang++" ; then - klee_llvm_bc_cxx_compiler="$llvm_obj/$llvm_build_mode/bin/clang++" - else - as_fn_error $? "Found clang but could not find clang++" "$LINENO" 5 - fi - fi - if test "X${klee_llvm_bc_c_compiler}" = X ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 -$as_echo "" >&6; } # Force a new line - # Extract the first word of "llvm-gcc", so it can be a program name with args. -set dummy llvm-gcc; ac_word=$2 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_llvm_gcc+:} false; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$llvm_gcc"; then - ac_cv_prog_llvm_gcc="$llvm_gcc" # Let the user override the test. + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -3383,7 +3132,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_llvm_gcc="FOUND" + ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3391,516 +3140,594 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_prog_llvm_gcc" && ac_cv_prog_llvm_gcc="NOT_FOUND" fi fi -llvm_gcc=$ac_cv_prog_llvm_gcc -if test -n "$llvm_gcc"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_gcc" >&5 -$as_echo "$llvm_gcc" >&6; } +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ - if test ${llvm_gcc} = FOUND ; then - klee_llvm_bc_c_compiler=`which llvm-gcc` + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : - # Extract the first word of "llvm-g++", so it can be a program name with args. -set dummy llvm-g++; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_llvm_gxx+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$llvm_gxx"; then - ac_cv_prog_llvm_gxx="$llvm_gxx" # Let the user override the test. else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_llvm_gxx="FOUND" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - test -z "$ac_cv_prog_llvm_gxx" && ac_cv_prog_llvm_gxx="NOT_FOUND" +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -llvm_gxx=$ac_cv_prog_llvm_gxx -if test -n "$llvm_gxx"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_gxx" >&5 -$as_echo "$llvm_gxx" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - if test ${llvm_gxx} = FOUND; then - klee_llvm_bc_cxx_compiler=`which llvm-g++` - else - as_fn_error $? "Found llvm-gcc but could not find llvm-g++ in PATH" "$LINENO" 5 - fi - fi +KLEE_HOST_C_COMPILER=$CC - fi +KLEE_HOST_CXX_COMPILER=$CXX - if test "X${klee_llvm_bc_c_compiler}" = X ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 -$as_echo "" >&6; } # Force a new line - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_clang+:} false; then : + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$clang"; then - ac_cv_prog_clang="$clang" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_clang="FOUND" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - test -z "$ac_cv_prog_clang" && ac_cv_prog_clang="NOT_FOUND" fi -fi -clang=$ac_cv_prog_clang -if test -n "$clang"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang" >&5 -$as_echo "$clang" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - if test ${clang} = FOUND ; then - klee_llvm_bc_c_compiler=`which clang` - # Extract the first word of "clang++", so it can be a program name with args. -set dummy clang++; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_clang_cxx+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$clang_cxx"; then - ac_cv_prog_clang_cxx="$clang_cxx" # Let the user override the test. + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_clang_cxx="FOUND" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_clang_cxx" && ac_cv_prog_clang_cxx="NOT_FOUND" + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi + fi -clang_cxx=$ac_cv_prog_clang_cxx -if test -n "$clang_cxx"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang_cxx" >&5 -$as_echo "$clang_cxx" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of operating system we're going to host on" >&5 +$as_echo_n "checking type of operating system we're going to host on... " >&6; } +if ${klee_cv_os_type+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + case $host in + *-*-linux*) + host_supports_posix_runtime=yes ;; + *) + host_supports_posix_runtime=no ;; +esac fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $klee_cv_os_type" >&5 +$as_echo "$klee_cv_os_type" >&6; } - if test ${clang_cxx} = FOUND; then - klee_llvm_bc_cxx_compiler=`which clang++` - else - as_fn_error $? "Found clang but could not find clang++ in PATH" "$LINENO" 5 - fi - fi - - fi - if test X"${klee_llvm_bc_c_compiler}" = X ; then - as_fn_error $? "Could not find a C LLVM Bitcode compiler. Did you try building Clang in the LLVM Build directory or putting llvm-gcc or clang in your path?" "$LINENO" 5 - fi +# Check whether --with-llvm was given. +if test "${with_llvm+set}" = set; then : + withval=$with_llvm; +fi - if test X"${klee_llvm_bc_cxx_compiler}" = X ; then - as_fn_error $? "Could not find a C++ LLVM Bitcode compiler. Did you try building Clang in the LLVM Build directory or putting llvm-gcc or clang in your path?" "$LINENO" 5 - fi -else - klee_llvm_bc_c_compiler="$with_llvmcc" - klee_llvm_bc_cxx_compiler="$with_llvmcxx" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm source dir" >&5 +$as_echo_n "checking llvm source dir... " >&6; } - if test \! -x "${klee_llvm_bc_c_compiler}"; then - as_fn_error $? "--with-llvmcc= supplied compiler does not exist" "$LINENO" 5 +if test X${with_llvm} != X; then + if test X${with_llvmsrc} != X; then + as_fn_error $? "--with-llvmsrc cannot be specified when using --with-llvm" "$LINENO" 5 fi - - if test \! -x "${klee_llvm_bc_cxx_compiler}"; then - as_fn_error $? "--with-llvmcxx= supplied compiler does not exist" "$LINENO" 5 + if test X${with_llvmobj} != X; then + as_fn_error $? "--with-llvmobj cannot be specified when using --with-llvm" "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using user supplied LLVM bitcode compilers." >&5 -$as_echo "Using user supplied LLVM bitcode compilers." >&6; } + with_llvmsrc=$with_llvm + with_llvmobj=$with_llvm fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using C llvm compiler : $klee_llvm_bc_c_compiler" >&5 -$as_echo "Using C llvm compiler : $klee_llvm_bc_c_compiler" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using C++ llvm compiler : $klee_llvm_bc_cxx_compiler" >&5 -$as_echo "Using C++ llvm compiler : $klee_llvm_bc_cxx_compiler" >&6; } - - -function klee_check_bc() -{ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking ${3} LLVM Bitcode compiler works" >&5 -$as_echo_n "checking ${3} LLVM Bitcode compiler works... " >&6; } - klee_bc_test_file="./.klee_llvm_bitcode_test.${2}" - - echo "int main() { return 0;}" > "${klee_bc_test_file}" - "${1}" -emit-llvm -c "${klee_bc_test_file}" -o "${klee_bc_test_file}.bc" - if test $? -ne 0 ; then - as_fn_error $? "Failed running ${3} LLVM Bitcode compiler" "$LINENO" 5 +if (test X${with_llvmsrc} != X || test X${with_llvmobj} != X); then + if test X${with_llvmsrc} = X; then + as_fn_error $? "--with-llvmsrc must be specified when using --with-llvmobj" "$LINENO" 5 fi - - if test \! -e "${klee_bc_test_file}.bc"; then - as_fn_error $? " ${3} LLVM Bitcode compiler did not produce any output" "$LINENO" 5 + if test X${with_llvmobj} = X; then + as_fn_error $? "--with-llvmobj must be specified when using --with-llvmsrc" "$LINENO" 5 fi - - if test -x "$llvm_obj/$llvm_build_mode/bin/llvm-dis" ; then - "$llvm_obj/$llvm_build_mode/bin/llvm-dis" -o "${klee_bc_test_file}.ll" "${klee_bc_test_file}.bc" - - if test $? -ne 0; then - as_fn_error $? "Failed converting LLVM Bitcode to LLVM assembly. Maybe your LLVM versions do not match?" "$LINENO" 5 - fi - - if test -e "${klee_bc_test_file}.ll" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Success" >&5 -$as_echo "Success" >&6; } - rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" "${klee_bc_test_file}.ll" - else - rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" "${klee_bc_test_file}.ll" - as_fn_error $? "Failed converting LLVM Bitcode to LLVM assembly. Maybe your LLVM versions do not match?" "$LINENO" 5 - fi - - else - rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" - as_fn_error $? "Could not find llvm-dis" "$LINENO" 5 +else + llvm_version=`llvm-config --version` + if test X${llvm_version} = X; then + as_fn_error $? "unable to find llvm, use --with-llvmsrc and --with-llvmobj" "$LINENO" 5 fi -} - -klee_check_bc "${klee_llvm_bc_c_compiler}" "c" "C" -klee_check_bc "${klee_llvm_bc_cxx_compiler}" "cpp" "CXX" - -KLEE_BITCODE_C_COMPILER=$klee_llvm_bc_c_compiler - -KLEE_BITCODE_CXX_COMPILER=$klee_llvm_bc_cxx_compiler - - - -# Check whether --with-uclibc was given. -if test "${with_uclibc+set}" = set; then : - withval=$with_uclibc; + with_llvmsrc=`llvm-config --src-root` + with_llvmobj=`llvm-config --obj-root` fi +if test ! -f ${with_llvmsrc}/Makefile.rules; then + as_fn_error $? "invalid llvmsrc directory: ${with_llvmsrc}" "$LINENO" 5 +fi +if test ! -f ${with_llvmobj}/Makefile.config; then + as_fn_error $? "invalid llvmobj directory: ${with_llvmobj}" "$LINENO" 5 +fi +llvm_src=`cd $with_llvmsrc 2> /dev/null; pwd` +llvm_obj=`cd $with_llvmobj 2> /dev/null; pwd` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking uclibc" >&5 -$as_echo_n "checking uclibc... " >&6; } -if (test X${with_uclibc} != X); then - if test -d ${with_uclibc}; then - - with_uclibc=`cd $with_uclibc 2> /dev/null; pwd` - - KLEE_UCLIBC_BCA="${with_uclibc}/lib/libc.a" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_src" >&5 +$as_echo "$llvm_src" >&6; } - if test ! -e "${KLEE_UCLIBC_BCA}"; then - as_fn_error $? "Could not find file ${KLEE_UCLIBC_BCA}" "$LINENO" 5 - fi - elif test -f ${with_uclibc}; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm obj dir" >&5 +$as_echo_n "checking llvm obj dir... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_obj" >&5 +$as_echo "$llvm_obj" >&6; } - _kud=`dirname ${with_uclibc}` - _kud=`cd ${_kud}; pwd 2> /dev/null` - _kuf=`basename ${with_uclibc}` +LLVM_SRC=$llvm_src - KLEE_UCLIBC_BCA="${_kud}/${_kuf}" - else - as_fn_error $? "Could not detect klee-uclibc" "$LINENO" 5 - fi +LLVM_OBJ=$llvm_obj - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KLEE_UCLIBC_BCA" >&5 -$as_echo "$KLEE_UCLIBC_BCA" >&6; } - ENABLE_UCLIBC=1 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm package version" >&5 +$as_echo_n "checking llvm package version... " >&6; } +llvm_package_version=`grep PACKAGE_VERSION= $with_llvmsrc/configure | cut -d\' -f 2` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_package_version" >&5 +$as_echo "$llvm_package_version" >&6; } +llvm_version_split=`python -c "import re; print('\t'.join(map(str, re.match('([0-9]+).([0-9]+)(svn)?', \"$llvm_package_version\").groups())))"` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm version major" >&5 +$as_echo_n "checking llvm version major... " >&6; } +llvm_version_major=`echo "$llvm_version_split" | cut -f 1` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_version_major" >&5 +$as_echo "$llvm_version_major" >&6; } -$as_echo "#define SUPPORT_KLEE_UCLIBC 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm version minor" >&5 +$as_echo_n "checking llvm version minor... " >&6; } +llvm_version_minor=`echo "$llvm_version_split" | cut -f 2` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_version_minor" >&5 +$as_echo "$llvm_version_minor" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm is release version" >&5 +$as_echo_n "checking llvm is release version... " >&6; } +llvm_version_svn=`echo "$llvm_version_split" | cut -f 3` +if test "$llvm_version_svn" == "svn"; then + llvm_is_release=0 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ENABLE_UCLIBC=0 - + llvm_is_release=1 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_is_release" >&5 +$as_echo "$llvm_is_release" >&6; } +cat >>confdefs.h <<_ACEOF +#define LLVM_VERSION_MAJOR $llvm_version_major +_ACEOF -# Check whether --enable-posix-runtime was given. -if test "${enable_posix_runtime+set}" = set; then : - enableval=$enable_posix_runtime; -else - enableval=default -fi +LLVM_VERSION_MAJOR=$llvm_version_major -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX runtime" >&5 -$as_echo_n "checking POSIX runtime... " >&6; } -if test ${enableval} = "default" ; then - if test X${with_uclibc} != X; then - enableval=$host_supports_posix_runtime - if test ${enableval} = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (enabled)" >&5 -$as_echo "default (enabled)" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (disabled, unsupported target)" >&5 -$as_echo "default (disabled, unsupported target)" >&6; } - fi - else - enableval="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (disabled, no uclibc)" >&5 -$as_echo "default (disabled, no uclibc)" >&6; } - fi -else - if test ${enableval} = "yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi -fi +cat >>confdefs.h <<_ACEOF +#define LLVM_VERSION_MINOR $llvm_version_minor +_ACEOF -if test ${enableval} = "yes" ; then - ENABLE_POSIX_RUNTIME=1 +LLVM_VERSION_MINOR=$llvm_version_minor -else - ENABLE_POSIX_RUNTIME=0 -fi +cat >>confdefs.h <<_ACEOF +#define LLVM_IS_RELEASE $llvm_is_release +_ACEOF +LLVM_IS_RELEASE=$llvm_is_release -# Check whether --with-runtime was given. -if test "${with_runtime+set}" = set; then : - withval=$with_runtime; +if test $llvm_version_major -eq 2 -a $llvm_version_minor -le 6 ; then + requires_rtti=1 else - withval=default -fi - -if test X"${withval}" = Xdefault; then - with_runtime=Release+Asserts + requires_rtti=0 fi +REQUIRES_RTTI=$requires_rtti -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking runtime configuration" >&5 -$as_echo_n "checking runtime configuration... " >&6; } -if test X${with_runtime} = XRelease; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Release" >&5 -$as_echo "Release" >&6; } - RUNTIME_ENABLE_OPTIMIZED=1 - RUNTIME_DISABLE_ASSERTIONS=1 +# Check whether --enable-cxx11 was given. +if test "${enable_cxx11+set}" = set; then : + enableval=$enable_cxx11; klee_use_cxx11=1 +else + klee_use_cxx11=0 +fi - RUNTIME_DEBUG_SYMBOLS= -elif test X${with_runtime} = XRelease+Asserts; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Release+Asserts" >&5 -$as_echo "Release+Asserts" >&6; } - RUNTIME_ENABLE_OPTIMIZED=1 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if LLVM needs C++11" >&5 +$as_echo_n "checking if LLVM needs C++11... " >&6; } +if test '(' $llvm_version_major -eq 3 -a $llvm_version_minor -ge 5 ')' -o '(' $llvm_version_major -gt 3 ')' ; then + klee_use_cxx11=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - RUNTIME_DISABLE_ASSERTIONS=0 +if test X${klee_use_cxx11} = X1; then + klee_old_cxxflags="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++11" - RUNTIME_DEBUG_SYMBOLS= +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -elif test X${with_runtime} = XDebug; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug" >&5 -$as_echo "Debug" >&6; } - RUNTIME_ENABLE_OPTIMIZED=0 +#include +std::atomic x(0.0f); +int main() { return (float)x; } - RUNTIME_DISABLE_ASSERTIONS=1 +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "C++11 not supported" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CXXFLAGS="$klee_old_cxxflags" +fi - RUNTIME_DEBUG_SYMBOLS=1 +KLEE_USE_CXX11=$klee_use_cxx11 -elif test X${with_runtime} = XDebug+Asserts; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug+Asserts" >&5 -$as_echo "Debug+Asserts" >&6; } - RUNTIME_ENABLE_OPTIMIZED=0 - RUNTIME_DISABLE_ASSERTIONS=0 - RUNTIME_DEBUG_SYMBOLS=1 +# Check whether --with-llvm-build-mode was given. +if test "${with_llvm_build_mode+set}" = set; then : + withval=$with_llvm_build_mode; else - as_fn_error $? "invalid configuration: ${with_runtime}" "$LINENO" 5 + with_llvm_build_mode=check fi -cat >>confdefs.h <<_ACEOF -#define RUNTIME_CONFIGURATION "$with_runtime" -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm build mode" >&5 +$as_echo_n "checking llvm build mode... " >&6; } +if test X${with_llvm_build_mode} = Xcheck ; then + 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 + as_fn_error $? "Could not autodetect build mode" "$LINENO" 5 + 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 + as_fn_error $? "Invalid build mode: $llvm_build_mode" "$LINENO" 5 + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_build_mode" >&5 +$as_echo "$llvm_build_mode" >&6; } +LLVM_BUILD_MODE=$llvm_build_mode -case $host in - *-*-linux*) +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking llvm has asserts enabled" >&5 +$as_echo_n "checking llvm has asserts enabled... " >&6; } +if test `expr "$llvm_build_mode" : ".*Asserts.*"` -ne 0; then + llvm_has_asserts_enabled=1 cat >>confdefs.h <<_ACEOF -#define HAVE_CTYPE_EXTERNALS 1 +#define ENABLE_KLEE_DEBUG 1 _ACEOF -esac +else + llvm_has_asserts_enabled=0 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_has_asserts_enabled" >&5 +$as_echo "$llvm_has_asserts_enabled" >&6; } -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LLVM Bitcode compiler" >&5 +$as_echo_n "checking LLVM Bitcode compiler... " >&6; } +klee_llvm_bc_c_compiler="" +klee_llvm_bc_cxx_compiler="" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. +# Check whether --with-llvmcc was given. +if test "${with_llvmcc+set}" = set; then : + withval=$with_llvmcc; else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + with_llvmcc=none fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } +# Check whether --with-llvmcxx was given. +if test "${with_llvmcxx+set}" = set; then : + withval=$with_llvmcxx; else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + with_llvmcxx=none + fi - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" +if test \( "X$with_llvmcc" != Xnone -a "X$with_llvmcxx" = Xnone \) -o \( "X$with_llvmcxx" != Xnone -a "X$with_llvmcc" = Xnone \) ; then + as_fn_error $? "You must set both --with-llvmcc= and --with-llvmcxx= or set neither" "$LINENO" 5 fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 +if test X$with_llvmcc = Xnone ; then + + if test -x "$llvm_obj/$llvm_build_mode/bin/clang" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found clang in LLVM Build" >&5 +$as_echo "Found clang in LLVM Build" >&6; } + klee_llvm_bc_c_compiler="$llvm_obj/$llvm_build_mode/bin/clang" + + if test -x "$llvm_obj/$llvm_build_mode/bin/clang++" ; then + klee_llvm_bc_cxx_compiler="$llvm_obj/$llvm_build_mode/bin/clang++" + else + as_fn_error $? "Found clang but could not find clang++" "$LINENO" 5 + fi + fi + + if test "X${klee_llvm_bc_c_compiler}" = X ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } # Force a new line + # Extract the first word of "llvm-gcc", so it can be a program name with args. +set dummy llvm-gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if ${ac_cv_prog_llvm_gcc+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$llvm_gcc"; then + ac_cv_prog_llvm_gcc="$llvm_gcc" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -3909,7 +3736,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" + ac_cv_prog_llvm_gcc="FOUND" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3917,32 +3744,32 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_prog_llvm_gcc" && ac_cv_prog_llvm_gcc="NOT_FOUND" fi fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } +llvm_gcc=$ac_cv_prog_llvm_gcc +if test -n "$llvm_gcc"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_gcc" >&5 +$as_echo "$llvm_gcc" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 + if test ${llvm_gcc} = FOUND ; then + klee_llvm_bc_c_compiler=`which llvm-gcc` + + # Extract the first word of "llvm-g++", so it can be a program name with args. +set dummy llvm-g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if ${ac_cv_prog_llvm_gxx+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$llvm_gxx"; then + ac_cv_prog_llvm_gxx="$llvm_gxx" # Let the user override the test. else - ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do @@ -3950,11 +3777,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" + ac_cv_prog_llvm_gxx="FOUND" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3962,44 +3785,40 @@ done done IFS=$as_save_IFS -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi + test -z "$ac_cv_prog_llvm_gxx" && ac_cv_prog_llvm_gxx="NOT_FOUND" fi fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } +llvm_gxx=$ac_cv_prog_llvm_gxx +if test -n "$llvm_gxx"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_gxx" >&5 +$as_echo "$llvm_gxx" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 + if test ${llvm_gxx} = FOUND; then + klee_llvm_bc_cxx_compiler=`which llvm-g++` + else + as_fn_error $? "Found llvm-gcc but could not find llvm-g++ in PATH" "$LINENO" 5 + fi + fi + + fi + + if test "X${klee_llvm_bc_c_compiler}" = X ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } # Force a new line + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if ${ac_cv_prog_clang+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$clang"; then + ac_cv_prog_clang="$clang" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4008,7 +3827,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + ac_cv_prog_clang="FOUND" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4016,34 +3835,31 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_prog_clang" && ac_cv_prog_clang="NOT_FOUND" fi fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } +clang=$ac_cv_prog_clang +if test -n "$clang"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang" >&5 +$as_echo "$clang" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + if test ${clang} = FOUND ; then + klee_llvm_bc_c_compiler=`which clang` + + # Extract the first word of "clang++", so it can be a program name with args. +set dummy clang++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if ${ac_cv_prog_clang_cxx+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. + if test -n "$clang_cxx"; then + ac_cv_prog_clang_cxx="$clang_cxx" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4052,7 +3868,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" + ac_cv_prog_clang_cxx="FOUND" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4060,271 +3876,268 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_prog_clang_cxx" && ac_cv_prog_clang_cxx="NOT_FOUND" fi fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } +clang_cxx=$ac_cv_prog_clang_cxx +if test -n "$clang_cxx"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang_cxx" >&5 +$as_echo "$clang_cxx" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ac_ct_CC" && break -done + if test ${clang_cxx} = FOUND; then + klee_llvm_bc_cxx_compiler=`which clang++` + else + as_fn_error $? "Found clang but could not find clang++ in PATH" "$LINENO" 5 + fi + fi - if test "x$ac_ct_CC" = x; then - CC="" + fi + + if test X"${klee_llvm_bc_c_compiler}" = X ; then + as_fn_error $? "Could not find a C LLVM Bitcode compiler. Did you try building Clang in the LLVM Build directory or putting llvm-gcc or clang in your path?" "$LINENO" 5 + fi + + if test X"${klee_llvm_bc_cxx_compiler}" = X ; then + as_fn_error $? "Could not find a C++ LLVM Bitcode compiler. Did you try building Clang in the LLVM Build directory or putting llvm-gcc or clang in your path?" "$LINENO" 5 + fi + +else + klee_llvm_bc_c_compiler="$with_llvmcc" + klee_llvm_bc_cxx_compiler="$with_llvmcxx" + + if test \! -x "${klee_llvm_bc_c_compiler}"; then + as_fn_error $? "--with-llvmcc= supplied compiler does not exist" "$LINENO" 5 + fi + + if test \! -x "${klee_llvm_bc_cxx_compiler}"; then + as_fn_error $? "--with-llvmcxx= supplied compiler does not exist" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using user supplied LLVM bitcode compilers." >&5 +$as_echo "Using user supplied LLVM bitcode compilers." >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using C llvm compiler : $klee_llvm_bc_c_compiler" >&5 +$as_echo "Using C llvm compiler : $klee_llvm_bc_c_compiler" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using C++ llvm compiler : $klee_llvm_bc_cxx_compiler" >&5 +$as_echo "Using C++ llvm compiler : $klee_llvm_bc_cxx_compiler" >&6; } + + +function klee_check_bc() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking ${3} LLVM Bitcode compiler works" >&5 +$as_echo_n "checking ${3} LLVM Bitcode compiler works... " >&6; } + klee_bc_test_file="./.klee_llvm_bitcode_test.${2}" + + echo "int main() { return 0;}" > "${klee_bc_test_file}" + "${1}" -emit-llvm -c "${klee_bc_test_file}" -o "${klee_bc_test_file}.bc" + if test $? -ne 0 ; then + as_fn_error $? "Failed running ${3} LLVM Bitcode compiler" "$LINENO" 5 + fi + + if test \! -e "${klee_bc_test_file}.bc"; then + as_fn_error $? " ${3} LLVM Bitcode compiler did not produce any output" "$LINENO" 5 + fi + + if test -x "$llvm_obj/$llvm_build_mode/bin/llvm-dis" ; then + "$llvm_obj/$llvm_build_mode/bin/llvm-dis" -o "${klee_bc_test_file}.ll" "${klee_bc_test_file}.bc" + + if test $? -ne 0; then + as_fn_error $? "Failed converting LLVM Bitcode to LLVM assembly. Maybe your LLVM versions do not match?" "$LINENO" 5 + fi + + if test -e "${klee_bc_test_file}.ll" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Success" >&5 +$as_echo "Success" >&6; } + rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" "${klee_bc_test_file}.ll" + else + rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" "${klee_bc_test_file}.ll" + as_fn_error $? "Failed converting LLVM Bitcode to LLVM assembly. Maybe your LLVM versions do not match?" "$LINENO" 5 + fi + + else + rm "${klee_bc_test_file}" "${klee_bc_test_file}.bc" + as_fn_error $? "Could not find llvm-dis" "$LINENO" 5 + fi +} + +klee_check_bc "${klee_llvm_bc_c_compiler}" "c" "C" +klee_check_bc "${klee_llvm_bc_cxx_compiler}" "cpp" "CXX" + +KLEE_BITCODE_C_COMPILER=$klee_llvm_bc_c_compiler + +KLEE_BITCODE_CXX_COMPILER=$klee_llvm_bc_cxx_compiler + + + + +# Check whether --with-uclibc was given. +if test "${with_uclibc+set}" = set; then : + withval=$with_uclibc; +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking uclibc" >&5 +$as_echo_n "checking uclibc... " >&6; } +if (test X${with_uclibc} != X); then + if test -d ${with_uclibc}; then + + with_uclibc=`cd $with_uclibc 2> /dev/null; pwd` + + KLEE_UCLIBC_BCA="${with_uclibc}/lib/libc.a" + + if test ! -e "${KLEE_UCLIBC_BCA}"; then + as_fn_error $? "Could not find file ${KLEE_UCLIBC_BCA}" "$LINENO" 5 + fi + elif test -f ${with_uclibc}; then + + _kud=`dirname ${with_uclibc}` + _kud=`cd ${_kud}; pwd 2> /dev/null` + _kuf=`basename ${with_uclibc}` + + KLEE_UCLIBC_BCA="${_kud}/${_kuf}" + else + as_fn_error $? "Could not detect klee-uclibc" "$LINENO" 5 + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KLEE_UCLIBC_BCA" >&5 +$as_echo "$KLEE_UCLIBC_BCA" >&6; } + ENABLE_UCLIBC=1 + + + +$as_echo "#define SUPPORT_KLEE_UCLIBC 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ENABLE_UCLIBC=0 + +fi + + + +# Check whether --enable-posix-runtime was given. +if test "${enable_posix_runtime+set}" = set; then : + enableval=$enable_posix_runtime; +else + enableval=default +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX runtime" >&5 +$as_echo_n "checking POSIX runtime... " >&6; } +if test ${enableval} = "default" ; then + if test X${with_uclibc} != X; then + enableval=$host_supports_posix_runtime + if test ${enableval} = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (enabled)" >&5 +$as_echo "default (enabled)" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (disabled, unsupported target)" >&5 +$as_echo "default (disabled, unsupported target)" >&6; } + fi else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC + enableval="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default (disabled, no uclibc)" >&5 +$as_echo "default (disabled, no uclibc)" >&6; } + fi +else + if test ${enableval} = "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi fi +if test ${enableval} = "yes" ; then + ENABLE_POSIX_RUNTIME=1 + +else + ENABLE_POSIX_RUNTIME=0 + +fi + + + +# Check whether --with-runtime was given. +if test "${with_runtime+set}" = set; then : + withval=$with_runtime; +else + withval=default +fi + +if test X"${withval}" = Xdefault; then + with_runtime=Release+Asserts fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking runtime configuration" >&5 +$as_echo_n "checking runtime configuration... " >&6; } +if test X${with_runtime} = XRelease; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Release" >&5 +$as_echo "Release" >&6; } + RUNTIME_ENABLE_OPTIMIZED=1 -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } + RUNTIME_DISABLE_ASSERTIONS=1 -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + RUNTIME_DEBUG_SYMBOLS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +elif test X${with_runtime} = XRelease+Asserts; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Release+Asserts" >&5 +$as_echo "Release+Asserts" >&6; } + RUNTIME_ENABLE_OPTIMIZED=1 -int -main () -{ -#ifndef __GNUC__ - choke me -#endif + RUNTIME_DISABLE_ASSERTIONS=0 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu + RUNTIME_DEBUG_SYMBOLS= -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +elif test X${with_runtime} = XDebug; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug" >&5 +$as_echo "Debug" >&6; } + RUNTIME_ENABLE_OPTIMIZED=0 -int -main () -{ + RUNTIME_DISABLE_ASSERTIONS=1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + RUNTIME_DEBUG_SYMBOLS=1 -int -main () -{ +elif test X${with_runtime} = XDebug+Asserts; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Debug+Asserts" >&5 +$as_echo "Debug+Asserts" >&6; } + RUNTIME_ENABLE_OPTIMIZED=0 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + RUNTIME_DISABLE_ASSERTIONS=0 + + RUNTIME_DEBUG_SYMBOLS=1 else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + as_fn_error $? "invalid configuration: ${with_runtime}" "$LINENO" 5 +fi -int -main () -{ - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define RUNTIME_CONFIGURATION "$with_runtime" _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} + +case $host in + *-*-linux*) + +cat >>confdefs.h <<_ACEOF +#define HAVE_CTYPE_EXTERNALS 1 _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4333,6 +4146,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -- cgit 1.4.1