configure script does not check for clang/llvm

Added a configure check for clang and llvm-config.  If llvm-config exists
then we check for the libraries in the libdir returned by llvm-config.
All of these must be present for configure to pass.

refs #130
This commit is contained in:
Alex Lin 2015-09-29 14:14:46 -05:00
parent 8b6a4efbad
commit 757f0764f6
2 changed files with 115 additions and 12 deletions

View File

@ -13,10 +13,7 @@ AC_DEFUN([AX_LLVM_HOME],[
[LLVM_HOME="$withval"],
[LLVM_HOME="/usr"]
)
AC_CHECK_FILE([$LLVM_HOME/bin/llvm-config],
[AC_SUBST([LLVM_HOME])],
AC_MSG_ERROR([could not find $LLVM_HOME/bin/llvm-config])
)
AC_SUBST([LLVM_HOME])
])
AC_DEFUN([AX_HDF5_HOME],[
@ -134,7 +131,7 @@ AC_PATH_PROG(PERL, perl, noperl)
AS_IF([test "$ac_cv_path_PERL" = "noperl"],AC_MSG_ERROR([could not find perl]),[])
AC_PATH_PROG(PYTHON, python, nopython)
AS_IF([test "$ac_cv_path_PYTHON" = "nopython"],AC_MSG_ERROR([could not find python]),[])
AC_PATH_PROG(SWIG, swig, noswig, path="/bin:/usr/bin:/usr/local/bin:/sw/bin")
AC_PATH_PROG(SWIG, swig, noswig, "/bin:/usr/bin:/usr/local/bin:/sw/bin")
AS_IF([test "$ac_cv_path_SWIG" = "noswig"],AC_MSG_ERROR([could not find swig]),[])
AC_PATH_PROG(GNUPLOT, gnuplot, nognuplot)
AS_IF([test "$ac_cv_path_GNUPLOT" = "nognuplot"],AC_MSG_NOTICE([could not find gnuplot]),[])
@ -153,8 +150,19 @@ AC_CHECK_HEADER([libxml/tree.h],[],AC_MSG_ERROR([could not find libxml developme
AX_PTHREAD()
AX_PYTHON_DEVEL([>='2.5'])
dnl process the optional command line arguments
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`
AC_CHECK_FILE([$LLVM_LIB_DIR/libLLVMSupport.a],
[],
AC_MSG_ERROR([could not find clang library files in $LLVM_LIB_DIR])
)
dnl process the other optional command line arguments
AX_HDF5_HOME([])
AX_DMTCP_HOME([])
AX_TPRO_HOME([])

107
configure vendored
View File

@ -626,6 +626,8 @@ BC635_HOME
TPROCTE_HOME
DMTCP_HOME
HDF5_HOME
LLVM_CONFIG
CLANG
LLVM_HOME
PYTHON_EXTRA_LDFLAGS
PYTHON_EXTRA_LIBS
@ -3592,7 +3594,7 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="path="/bin:/usr/bin:/usr/local/bin:/sw/bin""
as_dummy=""/bin:/usr/bin:/usr/local/bin:/sw/bin""
for as_dir in $as_dummy
do
IFS=$as_save_IFS
@ -5368,15 +5370,108 @@ else
fi
as_ac_File=`$as_echo "ac_cv_file_$LLVM_HOME/bin/llvm-config" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LLVM_HOME/bin/llvm-config" >&5
$as_echo_n "checking for $LLVM_HOME/bin/llvm-config... " >&6; }
# 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
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_LLVM_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LLVM_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_LLVM_CONFIG="$LLVM_CONFIG" # 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_LLVM_CONFIG="$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_LLVM_CONFIG" && ac_cv_path_LLVM_CONFIG="no-llvm-config"
;;
esac
fi
LLVM_CONFIG=$ac_cv_path_LLVM_CONFIG
if test -n "$LLVM_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
$as_echo "$LLVM_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
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`
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; }
if eval \${$as_ac_File+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "$LLVM_HOME/bin/llvm-config"; then
if test -r "$LLVM_LIB_DIR/libLLVMSupport.a"; then
eval "$as_ac_File=yes"
else
eval "$as_ac_File=no"
@ -5388,7 +5483,7 @@ $as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else
as_fn_error $? "could not find $LLVM_HOME/bin/llvm-config" "$LINENO" 5
as_fn_error $? "could not find clang library files in $LLVM_LIB_DIR" "$LINENO" 5
fi