From 32da702aeb0d47f03fcdafdebf1d4422ca096721 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Wed, 16 Dec 2015 16:53:06 -0600 Subject: [PATCH] configure script does not check for clang/llvm We were using "llvm-config --bindir" to set the path for clang. But on some systems clang is not in that directory. Changed the configure script to search for clang in the bindir first, if not found, search the normal locations. refs #130 --- autoconf/configure.ac | 5 +- configure | 95 +++++++++++++------------ share/trick/makefiles/config_user.mk.in | 1 + 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 3de56c38..0041cbfd 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -152,15 +152,16 @@ AX_PYTHON_DEVEL([>='2.5']) dnl process the optional --with-llvm command line arguments AX_LLVM_HOME([]) -AC_PATH_PROG(CLANG, clang, noclang, "$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin") -AS_IF([test "$ac_cv_path_CLANG" = "noclang"],AC_MSG_ERROR([could not find clang]),[]) AC_PATH_PROG(LLVM_CONFIG, llvm-config, no-llvm-config, "$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin") AS_IF([test "$ac_cv_path_LLVM_CONFIG" = "no-llvm-config"],AC_MSG_ERROR([could not find clang]),[]) LLVM_LIB_DIR=`$LLVM_CONFIG --libdir` +LLVM_BIN_DIR=`$LLVM_CONFIG --bindir` AC_CHECK_FILE([$LLVM_LIB_DIR/libLLVMSupport.a], [], AC_MSG_ERROR([could not find clang library files in $LLVM_LIB_DIR]) ) +AC_PATH_PROG(CLANG, clang, noclang, "$LLVM_BIN_DIR:$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin") +AS_IF([test "$ac_cv_path_CLANG" = "noclang"],AC_MSG_ERROR([could not find clang]),[]) dnl process the other optional command line arguments AX_HDF5_HOME([]) diff --git a/configure b/configure index 5dbd9a94..c0afc2ab 100755 --- a/configure +++ b/configure @@ -626,8 +626,8 @@ BC635_HOME TPROCTE_HOME DMTCP_HOME HDF5_HOME -LLVM_CONFIG CLANG +LLVM_CONFIG LLVM_HOME PYTHON_EXTRA_LDFLAGS PYTHON_EXTRA_LIBS @@ -5372,51 +5372,6 @@ fi -# 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_path_CLANG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $CLANG in - [\\/]* | ?:[\\/]*) - ac_cv_path_CLANG="$CLANG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin"" -for as_dir in $as_dummy -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_path_CLANG="$as_dir/$ac_word$ac_exec_ext" - $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_path_CLANG" && ac_cv_path_CLANG="noclang" - ;; -esac -fi -CLANG=$ac_cv_path_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 - - -if test "$ac_cv_path_CLANG" = "noclang"; then : - as_fn_error $? "could not find clang" "$LINENO" 5 -fi # Extract the first word of "llvm-config", so it can be a program name with args. set dummy llvm-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -5463,6 +5418,7 @@ if test "$ac_cv_path_LLVM_CONFIG" = "no-llvm-config"; then : as_fn_error $? "could not find clang" "$LINENO" 5 fi LLVM_LIB_DIR=`$LLVM_CONFIG --libdir` +LLVM_BIN_DIR=`$LLVM_CONFIG --bindir` as_ac_File=`$as_echo "ac_cv_file_$LLVM_LIB_DIR/libLLVMSupport.a" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LLVM_LIB_DIR/libLLVMSupport.a" >&5 $as_echo_n "checking for $LLVM_LIB_DIR/libLLVMSupport.a... " >&6; } @@ -5487,6 +5443,51 @@ else fi +# 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_path_CLANG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $CLANG in + [\\/]* | ?:[\\/]*) + ac_cv_path_CLANG="$CLANG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy=""$LLVM_BIN_DIR:$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin"" +for as_dir in $as_dummy +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_path_CLANG="$as_dir/$ac_word$ac_exec_ext" + $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_path_CLANG" && ac_cv_path_CLANG="noclang" + ;; +esac +fi +CLANG=$ac_cv_path_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 + + +if test "$ac_cv_path_CLANG" = "noclang"; then : + as_fn_error $? "could not find clang" "$LINENO" 5 +fi @@ -5661,7 +5662,7 @@ $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes"; then : else - as_fn_error $? "could not find $GSL_HOME/sample/bcuser.h" "$LINENO" 5 + as_fn_error $? "could not find $GSL_HOME/include/gsl" "$LINENO" 5 fi diff --git a/share/trick/makefiles/config_user.mk.in b/share/trick/makefiles/config_user.mk.in index 92a8b233..43209864 100644 --- a/share/trick/makefiles/config_user.mk.in +++ b/share/trick/makefiles/config_user.mk.in @@ -8,6 +8,7 @@ YACC = @BISON@ SWIG = @SWIG@ PYTHON = @PYTHON@ JAVAC = @JAVA_CC@ +CLANG = @CLANG@ PYTHON_INCLUDES = @PYTHON_CPPFLAGS@ PYTHON_LIB = @PYTHON_LDFLAGS@ @PYTHON_EXTRA_LIBS@