233 lines
6.8 KiB
Plaintext
Executable File
233 lines
6.8 KiB
Plaintext
Executable File
# -*- Autoconf -*-
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
AC_PREREQ([2.61])
|
|
AC_INIT([tiny], [1.0], [jiri@pittnerovi.com])
|
|
AC_CONFIG_HEADERS([config.h])
|
|
#the programs of the complex version (--enable-complex) are installed with the suffix _complex, unless --program-suffix
|
|
#is given, so that the real and the complex version can be installed together (must precede AM_INIT_AUTOMAKE)
|
|
if test "x$enable_complex" = xyes && test "x$program_suffix" = xNONE; then program_suffix=_complex; fi
|
|
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
|
|
|
# Checks for programs.
|
|
AC_PROG_CXX
|
|
AC_PROG_CC
|
|
AC_PROG_RANLIB
|
|
AM_PROG_AR
|
|
AC_LANG(C++)
|
|
|
|
#check for necessary fortran runtime
|
|
AC_FC_LIBRARY_LDFLAGS(,,,,)
|
|
AC_FC_DUMMY_MAIN(,,)
|
|
AC_SUBST(FLIBS)
|
|
AC_SUBST(FCLIBS)
|
|
|
|
# Check for Intel MKL first
|
|
#user has to e.g. setenv LDFLAGS "-L/opt/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/"
|
|
#and setenv CXXFLAGS "-I /opt/intel/composer_xe_2013_sp1.1.106/mkl/include/"
|
|
MKLLIB=""
|
|
mkl_present=1
|
|
AC_CHECK_LIB([mkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread], [dgemm_], [
|
|
echo "MKL LIBRARY FOUND"
|
|
] , [
|
|
mkl_present=0
|
|
])
|
|
|
|
AC_CHECK_HEADER(mkl_cblas.h, [echo "MKL INCLUDE FOUND"], [mkl_present=0])
|
|
|
|
if test $mkl_present == 1
|
|
then
|
|
MKLLIB="-Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread"
|
|
AC_SUBST([MKLLIB])
|
|
CLAPACKOPT=-DNONCLAPACK
|
|
AC_SUBST([CLAPACKOPT])
|
|
MKLOPT="-DHAS_MKL"
|
|
AC_SUBST([MKLOPT])
|
|
else
|
|
echo "MKL LIBRARY OR HEADER NOT FOUND, will try OpenBLAS next!"
|
|
fi
|
|
|
|
# OpenBLAS (with LAPACK and CBLAS included) is preferred if MKL is not present, as in the LA library
|
|
openblas_present=0
|
|
AC_ARG_WITH([openblas],[ --without-openblas do not use OpenBLAS even if found (use ATLAS or reference BLAS)],[],[with_openblas=yes])
|
|
if test $mkl_present == 0 -a "${with_openblas}" != no
|
|
then
|
|
AC_CHECK_LIB([openblas], [dgeev_], [AC_CHECK_LIB([openblas], [cblas_dgemm], [openblas_present=1])])
|
|
fi
|
|
if test $openblas_present == 1
|
|
then
|
|
echo "OPENBLAS FOUND"
|
|
LIBS="-lopenblas $LIBS"
|
|
CLAPACKOPT=-DNONCLAPACK
|
|
AC_SUBST([CLAPACKOPT])
|
|
AC_CHECK_HEADER([cblas.h],,[CBLASOPT=-DNONCBLAS], AC_INCLUDES_DEFAULT)
|
|
AC_SUBST([CBLASOPT])
|
|
else
|
|
echo "OPENBLAS NOT FOUND OR NOT USED, will try ATLAS next!"
|
|
fi
|
|
|
|
|
|
# Checks for libraries in this order
|
|
if test $mkl_present == 0 -a $openblas_present == 0
|
|
then
|
|
AC_CHECK_LIB([atlas], [ATL_zgemv],, [
|
|
echo "ATLAS not found, I hope you are using some other (more) efficient BLAS!"
|
|
])
|
|
|
|
AC_CHECK_LIB([blas], [dgemm_],, [
|
|
echo ERROR: BLAS not found! You have to install BLAS library
|
|
exit
|
|
])
|
|
|
|
AC_CHECK_LIB([cblas], [cblas_ddot],, [CBLASOPT=-DNONCBLAS])
|
|
AC_SUBST([CBLASOPT])
|
|
|
|
AC_CHECK_LIB([lapack], [dgeev_],, [
|
|
echo ERROR: LAPACK not found! You have to install LAPACK library
|
|
exit
|
|
])
|
|
fi
|
|
#no mkl
|
|
|
|
#GSL takes the CBLAS from MKL, OpenBLAS or libcblas when there is one;
|
|
#libgslcblas in front of them would override their cblas routines by the slow ones
|
|
if test $mkl_present == 1
|
|
then
|
|
AC_CHECK_LIB([gsl], [gsl_sf_zeta],, [
|
|
echo ERROR: GSL not found! You have to install GNU GSL library
|
|
exit
|
|
],[$MKLLIB])
|
|
elif test $openblas_present == 1 -o -z "$CBLASOPT"
|
|
then
|
|
AC_CHECK_LIB([gsl], [gsl_sf_zeta],, [
|
|
echo ERROR: GSL not found! You have to install GNU GSL library
|
|
exit
|
|
])
|
|
else
|
|
AC_CHECK_LIB([gsl -lgslcblas], [gsl_sf_zeta],, [
|
|
echo ERROR: GSL not found! You have to install GNU GSL library
|
|
exit
|
|
])
|
|
fi
|
|
|
|
#optional
|
|
|
|
if test $mkl_present == 0 -a $openblas_present == 0
|
|
then
|
|
AC_CHECK_LIB([lapack], [clapack_dgesv], , [CLAPACKOPT=-DNONCLAPACK])
|
|
AC_SUBST([CLAPACKOPT])
|
|
fi
|
|
|
|
|
|
##switched off - only needed in an unused modification of genccsd
|
|
##check for NLOPT library
|
|
#AC_CHECK_LIB([nlopt], [cobyla], [NLOPTLIB="-lnlopt" NLOPTOPT="-DUSE_NLOPT"],[
|
|
# echo NLOPT library not found, COBYLA optimizer not available
|
|
# ])
|
|
#AC_SUBST([NLOPTOPT])
|
|
#AC_SUBST([NLOPTLIB])
|
|
#
|
|
|
|
|
|
#process options
|
|
COMPLEXOPT=""
|
|
AC_ARG_ENABLE([complex],[ --enable-complex to compile complex-valued version [[default= real]]],
|
|
[case "${enableval}" in
|
|
yes) COMPLEXOPT="-D COMPLEX_VERSION";;
|
|
no) COMPLEXOPT="" ;;
|
|
*) COMPLEXOPT=${enableval}
|
|
esac],
|
|
,)
|
|
AC_SUBST([COMPLEXOPT])
|
|
#in the complex version only the programs which support it are built (Makefile.am)
|
|
AM_CONDITIONAL([COMPLEX],[test -n "$COMPLEXOPT"])
|
|
|
|
|
|
OPTIMIZEOPT="-O3 -finline-limit=1000"
|
|
AC_ARG_ENABLE([optimize],[ --enable-optimize to compile with optimization [[default= -O3 -finline-limit=1000]]],
|
|
[case "${enableval}" in
|
|
yes) ;;
|
|
no) OPTIMIZEOPT="" ;;
|
|
*) OPTIMIZEOPT=${enableval}
|
|
esac],
|
|
,)
|
|
AC_SUBST([OPTIMIZEOPT])
|
|
|
|
LIBERTY=""
|
|
AC_CHECK_LIB([iberty], [setproctitle], [LIBERTY="-liberty"])
|
|
AC_SUBST([LIBERTY])
|
|
|
|
STATICOPT=""
|
|
AC_ARG_ENABLE([static],[ --enable-static to generate statically linked executables [[default=no]]],
|
|
[case "${enableval}" in
|
|
no) ;;
|
|
yes) STATICOPT="-static -ldl -lstdc++ -lz -lpthread -z muldefs" ;;
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;;
|
|
esac],
|
|
,)
|
|
AC_SUBST([STATICOPT])
|
|
|
|
DEBUGOPT=""
|
|
AC_ARG_ENABLE([debug],[ --enable-debug to perform range-checking etc. and link with libla_debug instead of libla [[default=no]]],
|
|
[case "${enableval}" in
|
|
yes) DEBUGOPT="-DDEBUG" ;;
|
|
no) ;;
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
|
esac],
|
|
,)
|
|
AC_SUBST([DEBUGOPT])
|
|
|
|
#link with the LA library built with the same DEBUG setting (libla_debug or libla)
|
|
if test -n "$DEBUGOPT"
|
|
then
|
|
AC_CHECK_LIB([la_debug], [_findme],, [
|
|
echo "ERROR: LA (libla_debug) not found! You have to install the LA library configured with --enable-debug (http://www.pittnerovi.com/la)"
|
|
exit
|
|
])
|
|
else
|
|
AC_CHECK_LIB([la], [_findme],, [
|
|
echo "ERROR: LA not found! You have to install the LA library (http://www.pittnerovi.com/la)"
|
|
exit
|
|
])
|
|
fi
|
|
|
|
PROFILEOPT=""
|
|
AC_ARG_ENABLE([profile],[ --enable-profile to perform performance profiling [[default=no]]],
|
|
[case "${enableval}" in
|
|
yes) PROFILEOPT="-pg";;
|
|
no) ;;
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-profile]) ;;
|
|
esac],
|
|
,)
|
|
AC_SUBST([PROFILEOPT])
|
|
|
|
MATPTROPT=""
|
|
AC_ARG_ENABLE([matptr],[ --enable-matptr switch to double** matrix representation [[default=no]]],
|
|
[case "${enableval}" in
|
|
yes) MATPTROPT="-DMATPTR" ;;
|
|
no) ;;
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-matptr]) ;;
|
|
esac],
|
|
,)
|
|
AC_SUBST([MATPTROPT])
|
|
|
|
|
|
|
|
# Checks for header files.
|
|
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
AC_HEADER_STDBOOL
|
|
AC_C_INLINE
|
|
AC_TYPE_SIZE_T
|
|
AC_TYPE_SSIZE_T
|
|
|
|
# Checks for library functions.
|
|
AC_FUNC_ERROR_AT_LINE
|
|
AC_FUNC_MALLOC
|
|
AC_FUNC_REALLOC
|
|
AC_CHECK_FUNCS([floor memset pow sqrt strchr strdup])
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
AC_OUTPUT
|