Search for some optional packages in configure script.

The configure script will check in the standard directories for
HDF5, GSL, and gtest.  The user can skip this automatic check by
adding --without-<feature> while running the configure script.

refs #260
This commit is contained in:
Alex Lin 2016-06-29 17:37:45 -05:00
parent 1731390c98
commit bc9fdb1b71
2 changed files with 134 additions and 36 deletions

View File

@ -10,10 +10,16 @@ AC_CONFIG_AUX_DIR([autoconf])
AC_DEFUN([AX_LLVM_HOME],[
AC_ARG_WITH([llvm],
AS_HELP_STRING([--with-llvm@<:@=DIR@:>@], [LLVM root directory]),
[LLVM_HOME="$withval"],
[LLVM_HOME="/usr"]
[LLVM_HOME="$withval"
AC_PATH_PROG(LLVM_CONFIG, llvm-config, no-llvm-config, "$LLVM_HOME/bin")
AS_IF([test "$ac_cv_path_LLVM_CONFIG" = "no-llvm-config"],AC_MSG_ERROR([could not find llvm-config]),[])
],
[
AC_PATH_PROG(LLVM_CONFIG, llvm-config, no-llvm-config, "/bin:/usr/bin:/usr/local/bin:/sw/bin:/usr/local/opt/llvm/bin")
AS_IF([test "$ac_cv_path_LLVM_CONFIG" = "no-llvm-config"],AC_MSG_ERROR([could not find llvm-config]),[])
LLVM_HOME=`$LLVM_CONFIG --prefix`
]
)
AC_SUBST([LLVM_HOME])
])
dnl Test if clang will link successfully. Some systems like Ubuntu 16.04 shipping with clang that does not work.
@ -40,12 +46,14 @@ AC_DEFUN([AX_HDF5_HOME],[
[HDF5_HOME="$withval"
AS_IF([test "$HDF5_HOME" = "yes"],
AC_CHECK_HEADER(hdf5.h,[HDF5_HOME="/usr"],AC_MSG_ERROR([could not find hdf5.h])),
AC_CHECK_FILE([$HDF5_HOME/include/hdf5.h],
[],
AC_MSG_ERROR([could not find $HDF5_HOME/include/hdf5.h])
)
AS_IF([test "$HDF5_HOME" = "no"],[HDF5_HOME=""],
AC_CHECK_FILE([$HDF5_HOME/include/hdf5.h],
[],
AC_MSG_ERROR([could not find $HDF5_HOME/include/hdf5.h])
)
)
)],
[HDF5_HOME=""]
[AC_CHECK_HEADER(hdf5.h, [HDF5_HOME="/usr"], [HDF5_HOME=""])]
)
AC_SUBST([HDF5_HOME])
])
@ -100,12 +108,14 @@ AC_DEFUN([AX_GSL_HOME],[
[GSL_HOME="$withval"
AS_IF([test "$GSL_HOME" = "yes"],
AC_CHECK_HEADER(gsl/gsl_rng.h,[GSL_HOME="/usr"],AC_MSG_ERROR([could not find gsl/gsl_rng.h])),
AC_CHECK_FILE([$GSL_HOME/include/gsl],
[],
AC_MSG_ERROR([could not find $GSL_HOME/include/gsl])
)
AS_IF([test "$GSL_HOME" = "no"],[GSL_HOME=""],
AC_CHECK_FILE([$GSL_HOME/include/gsl],
[],
AC_MSG_ERROR([could not find $GSL_HOME/include/gsl])
)
)
)],
[GSL_HOME=""]
[AC_CHECK_HEADER(gsl/gsl_rng.h, [GSL_HOME="/usr"], [GSL_HOME=""])]
)
AC_SUBST([GSL_HOME])
])
@ -116,12 +126,14 @@ AC_DEFUN([AX_GTEST_HOME],[
[GTEST_HOME="$withval"
AS_IF([test "$GTEST_HOME" = "yes"],
AC_CHECK_HEADER(gtest/gtest.h,[GTEST_HOME="/usr"],AC_MSG_ERROR([could not find gtest/gtest.h])),
AC_CHECK_FILE([$GTEST_HOME/include/gtest],
[],
AC_MSG_ERROR([could not find $GTEST_HOME/include/gtest])
)
AS_IF([test "$GTEST_HOME" = "no"],[GTEST_HOME=""],
AC_CHECK_FILE([$GTEST_HOME/include/gtest],
[],
AC_MSG_ERROR([could not find $GTEST_HOME/include/gtest])
)
)
)],
[GTEST_HOME=""]
[AC_CHECK_HEADER(gtest/gtest.h, [GTEST_HOME="/usr"], [GTEST_HOME=""])]
)
AC_SUBST([GTEST_HOME])
])
@ -178,8 +190,6 @@ AS_IF([test "x$GCC_VERSION" = "x"],[],
AC_MSG_ERROR([Trick requires gcc version >= 4.8])
])
])
dnl AC_PATH_PROG(CC, $CC, no_cc)
dnl AC_PATH_PROG(CXX, $CXX, no_cxx)
dnl Save the full path of the compiler
CC=`which $CC`
CXX=`which $CXX`
@ -228,16 +238,16 @@ AX_PROG_PERL_MODULES( Digest::MD5,[],AC_MSG_ERROR([could not find perl module Di
dnl process the optional --with-llvm command line arguments
AX_LLVM_HOME([])
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")
AC_PATH_PROG(CLANG, clang, noclang, "$LLVM_BIN_DIR:/bin:/usr/bin:/usr/local/bin:/sw/bin")
AS_IF([test "$ac_cv_path_CLANG" = "noclang"],AC_MSG_ERROR([could not find clang]),[])
AC_SUBST([LLVM_HOME])
dnl does not work under RedHat 6
dnl AX_TEST_CLANG
@ -277,3 +287,5 @@ AX_ER7_UTILS([])
AC_OUTPUT([share/trick/makefiles/config_user.mk])
printf "\033@<:@32mconfigure script successfully completed\033@<:@0m\n"

112
configure vendored
View File

@ -630,9 +630,9 @@ HDF5_HOME
UDUNITS_LDFLAGS
UDUNITS_INCLUDES
UDUNITS_HOME
LLVM_HOME
CLANG
LLVM_CONFIG
LLVM_HOME
PYTHON_EXTRA_LIBS
PYTHON_EXTRA_LDFLAGS
PYTHON_SITE_PKG
@ -7060,14 +7060,7 @@ fi
# Check whether --with-llvm was given.
if test "${with_llvm+set}" = set; then :
withval=$with_llvm; LLVM_HOME="$withval"
else
LLVM_HOME="/usr"
fi
# Extract the first word of "llvm-config", so it can be a program name with args.
# 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; }
@ -7080,7 +7073,54 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy=""$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin""
for as_dir in "$LLVM_HOME/bin"
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 llvm-config" "$LINENO" 5
fi
else
# 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=""/bin:/usr/bin:/usr/local/bin:/sw/bin:/usr/local/opt/llvm/bin""
for as_dir in $as_dummy
do
IFS=$as_save_IFS
@ -7109,9 +7149,15 @@ $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
if test "$ac_cv_path_LLVM_CONFIG" = "no-llvm-config"; then :
as_fn_error $? "could not find llvm-config" "$LINENO" 5
fi
LLVM_HOME=`$LLVM_CONFIG --prefix`
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`
@ -7151,7 +7197,7 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy=""$LLVM_BIN_DIR:$LLVM_HOME/bin:/bin:/usr/bin:/usr/local/bin:/sw/bin""
as_dummy=""$LLVM_BIN_DIR:/bin:/usr/bin:/usr/local/bin:/sw/bin""
for as_dir in $as_dummy
do
IFS=$as_save_IFS
@ -7186,6 +7232,8 @@ fi
# Check whether --with-udunits was given.
if test "${with_udunits+set}" = set; then :
withval=$with_udunits; UDUNITS_HOME="$withval"
@ -7288,6 +7336,9 @@ else
fi
else
if test "$HDF5_HOME" = "no"; then :
HDF5_HOME=""
else
as_ac_File=`$as_echo "ac_cv_file_$HDF5_HOME/include/hdf5.h" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $HDF5_HOME/include/hdf5.h" >&5
@ -7315,8 +7366,17 @@ fi
fi
fi
else
ac_fn_cxx_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default"
if test "x$ac_cv_header_hdf5_h" = xyes; then :
HDF5_HOME="/usr"
else
HDF5_HOME=""
fi
fi
@ -7458,6 +7518,9 @@ else
fi
else
if test "$GSL_HOME" = "no"; then :
GSL_HOME=""
else
as_ac_File=`$as_echo "ac_cv_file_$GSL_HOME/include/gsl" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GSL_HOME/include/gsl" >&5
@ -7485,8 +7548,17 @@ fi
fi
fi
else
ac_fn_cxx_check_header_mongrel "$LINENO" "gsl/gsl_rng.h" "ac_cv_header_gsl_gsl_rng_h" "$ac_includes_default"
if test "x$ac_cv_header_gsl_gsl_rng_h" = xyes; then :
GSL_HOME="/usr"
else
GSL_HOME=""
fi
fi
@ -7506,6 +7578,9 @@ else
fi
else
if test "$GTEST_HOME" = "no"; then :
GTEST_HOME=""
else
as_ac_File=`$as_echo "ac_cv_file_$GTEST_HOME/include/gtest" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTEST_HOME/include/gtest" >&5
@ -7533,8 +7608,17 @@ fi
fi
fi
else
ac_fn_cxx_check_header_mongrel "$LINENO" "gtest/gtest.h" "ac_cv_header_gtest_gtest_h" "$ac_includes_default"
if test "x$ac_cv_header_gtest_gtest_h" = xyes; then :
GTEST_HOME="/usr"
else
GTEST_HOME=""
fi
fi
@ -8715,3 +8799,5 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
printf "\033[32mconfigure script successfully completed\033[0m\n"