2009-10-07 16:37:01 +02:00
|
|
|
# -*- Autoconf -*-
|
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
2021-06-25 16:19:27 +02:00
|
|
|
AC_PREREQ([2.69])
|
2021-05-13 15:01:51 +02:00
|
|
|
AC_INIT([libla],[1.1],[jiri@pittnerovi.com])
|
2009-10-07 16:37:01 +02:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2009-11-13 16:14:37 +01:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2019-03-30 18:01:03 +01:00
|
|
|
AM_PROG_AR
|
2009-10-07 16:37:01 +02:00
|
|
|
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
2009-11-13 16:14:37 +01:00
|
|
|
LT_INIT
|
|
|
|
|
2009-10-07 16:37:01 +02:00
|
|
|
|
|
|
|
# Checks for programs.
|
|
|
|
AC_PROG_CXX
|
2021-05-13 15:01:51 +02:00
|
|
|
LT_INIT
|
2009-10-07 16:37:01 +02:00
|
|
|
AC_PROG_CC
|
2009-11-13 16:14:37 +01:00
|
|
|
#AC_PROG_RANLIB obsoleted by libtool
|
2009-10-08 16:01:15 +02:00
|
|
|
AC_LANG(C++)
|
2009-10-07 16:37:01 +02:00
|
|
|
|
2019-11-13 23:22:25 +01:00
|
|
|
# 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 ATLAS next!"
|
|
|
|
fi
|
|
|
|
|
2009-10-07 16:37:01 +02:00
|
|
|
|
2009-11-13 16:14:37 +01:00
|
|
|
# Checks for mandatory libraries.
|
2010-10-22 15:46:59 +02:00
|
|
|
ATLASLIB=""
|
2019-11-13 23:22:25 +01:00
|
|
|
|
|
|
|
if test $mkl_present == 0
|
|
|
|
then
|
2019-03-30 18:01:03 +01:00
|
|
|
AC_CHECK_LIB([atlas], [ATL_zgemv],ATLASLIB="-lblas -latlas", [
|
2019-11-13 23:22:25 +01:00
|
|
|
echo "ATLAS not found, I hope you are using some other efficient BLAS!"
|
2009-11-13 16:14:37 +01:00
|
|
|
])
|
2010-10-22 15:46:59 +02:00
|
|
|
AC_SUBST([ATLASLIB])
|
2009-11-13 16:14:37 +01:00
|
|
|
|
2019-03-30 18:01:03 +01:00
|
|
|
AC_CHECK_LIB([blas], [dgemm_],BLASLIB="-lblas", [
|
2010-10-22 15:46:59 +02:00
|
|
|
echo ERROR: BLAS not found! You have to install the BLAS library.
|
2009-11-13 16:14:37 +01:00
|
|
|
exit
|
2010-10-22 15:46:59 +02:00
|
|
|
],[$ATLASLIB])
|
|
|
|
AC_SUBST([BLASLIB])
|
2019-11-13 23:22:25 +01:00
|
|
|
fi
|
2009-11-13 16:14:37 +01:00
|
|
|
|
2010-09-08 15:30:20 +02:00
|
|
|
MATPTROPT=""
|
|
|
|
AC_ARG_ENABLE([matptr],[ --enable-matptr switch to double** matrix representation (CUDA incompatible) [[default=no]]],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) MATPTROPT="-DMATPTR" ;;
|
|
|
|
no) ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-matptr]) ;;
|
|
|
|
esac],
|
|
|
|
,)
|
|
|
|
|
2010-06-18 14:54:26 +02:00
|
|
|
|
|
|
|
#cblas and clapack available?
|
2019-11-13 23:22:25 +01:00
|
|
|
CBLASLIB=""
|
|
|
|
CBLASOPT=""
|
|
|
|
|
|
|
|
if test $mkl_present == 0
|
|
|
|
then
|
2019-03-30 18:01:03 +01:00
|
|
|
AC_CHECK_LIB([cblas], [cblas_ddot], [CBLASLIB="-lcblas"], [CBLASOPT=-DNONCBLAS],[$ATLASLIB])
|
2010-06-18 14:54:26 +02:00
|
|
|
AC_CHECK_HEADER([cblas.h],,[CBLASOPT=-DNONCBLAS CBLASLIB=""], AC_INCLUDES_DEFAULT)
|
2009-10-07 16:37:01 +02:00
|
|
|
AC_SUBST([CBLASLIB])
|
|
|
|
AC_SUBST([CBLASOPT])
|
|
|
|
|
2010-10-22 15:46:59 +02:00
|
|
|
|
|
|
|
AC_CHECK_LIB([lapack], [dgeev_],, [
|
|
|
|
echo ERROR: LAPACK not found! You have to install the LAPACK library
|
|
|
|
exit
|
|
|
|
],[$CBLASLIB $BLASLIB $ATLASLIB])
|
|
|
|
|
|
|
|
|
|
|
|
AC_CHECK_LIB([lapack], [clapack_dgesv], , [CLAPACKOPT=-DNONCLAPACK],[$CBLASLIB $BLASLIB $ATLASLIB])
|
2010-06-18 14:54:26 +02:00
|
|
|
AC_CHECK_HEADER([clapack.h],,[CLAPACKOPT=-DNONCLAPACK], AC_INCLUDES_DEFAULT)
|
2009-10-07 16:56:32 +02:00
|
|
|
AC_SUBST([CLAPACKOPT])
|
|
|
|
|
2019-11-13 23:22:25 +01:00
|
|
|
fi
|
|
|
|
#MKL end
|
2010-10-22 15:46:59 +02:00
|
|
|
|
2010-06-18 14:54:26 +02:00
|
|
|
#CUDA available? link with cublas and avoid cblas and clapack then...
|
2010-09-08 15:30:20 +02:00
|
|
|
AC_CHECK_LIB([cublas], [cublasInit], [MATPTROPT="" NVCC=nvcc NVCCFLAGS="-O -arch sm_20" CUDALIBS=-lcublas CUDAOPT=-DCUDALA CBLASOPT=-DNONCBLAS CLAPACKOPT=-DNONCLAPACK CBLASLIB=""], [CUDALIB="" CUDAOPT=""])
|
2010-06-18 14:54:26 +02:00
|
|
|
AC_CHECK_HEADER([cublas.h],,[CUDAOPT="" CUDALIBS=""], AC_INCLUDES_DEFAULT)
|
|
|
|
AC_SUBST([CUDALIBS])
|
|
|
|
AC_SUBST([CUDAOPT])
|
2010-09-08 15:30:20 +02:00
|
|
|
AC_SUBST([NVCC])
|
|
|
|
AC_SUBST([NVCCFLAGS])
|
|
|
|
AC_SUBST([MATPTROPT])
|
2010-06-18 14:54:26 +02:00
|
|
|
|
|
|
|
|
2009-11-13 16:14:37 +01:00
|
|
|
#process options
|
2010-06-18 14:54:26 +02:00
|
|
|
FORINTOPT=""
|
|
|
|
AC_ARG_ENABLE([fotran64int],[ --enable-fotran64int to link with 64-bit-integer-BLAS+LAPACK ],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) FORINTOPT="-DLONG_FORTRAN_INT"
|
|
|
|
CBLASLIB=""
|
|
|
|
CBLASOPT=-DNONCBLAS
|
|
|
|
CLAPACKOPT=-DNONCLAPACK
|
|
|
|
;;
|
|
|
|
no) FORINTOPT="" ;;
|
|
|
|
*) FORINTOPT=${enableval}
|
|
|
|
esac],
|
|
|
|
,)
|
|
|
|
AC_SUBST([FORINTOPT])
|
|
|
|
|
|
|
|
|
2009-11-13 16:14:37 +01:00
|
|
|
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])
|
|
|
|
|
|
|
|
DEBUGOPT="-DDEBUG"
|
|
|
|
AC_ARG_ENABLE([debug],[ --disable-debug not to perform some range-checking [[default=yes]]],
|
|
|
|
[case "${enableval}" in
|
|
|
|
yes) ;;
|
|
|
|
no) DEBUGOPT="" ;;
|
|
|
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
|
|
|
esac],
|
|
|
|
,)
|
|
|
|
AC_SUBST([DEBUGOPT])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-07 16:37:01 +02:00
|
|
|
# Checks for header files.
|
|
|
|
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/vfs.h unistd.h])
|
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_HEADER_STDBOOL
|
|
|
|
AC_C_INLINE
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_SSIZE_T
|
|
|
|
AC_CHECK_MEMBERS([struct stat.st_blksize])
|
|
|
|
|
|
|
|
# Checks for library functions.
|
|
|
|
AC_CHECK_FUNCS([getpagesize memset sqrt])
|
|
|
|
|
2010-10-22 15:46:59 +02:00
|
|
|
#Doxygen support
|
|
|
|
DX_INIT_DOXYGEN($PACKAGE_NAME, doxygen.cfg)
|
|
|
|
|
2009-10-07 16:37:01 +02:00
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
2009-11-13 16:14:37 +01:00
|
|
|
echo
|
|
|
|
echo "**********************************************************************************"
|
|
|
|
echo "The LA library has now been configured. You may run make; make check; make install"
|
|
|
|
echo "Please make sure that the generated Makefile employs a proper version of optimized"
|
|
|
|
echo "BLAS/LAPACK library. If not, re-run configure with CXXFLAGS and LDFLAGS options "
|
2019-11-13 23:22:25 +01:00
|
|
|
echo "set to '-I/path' and '-L/path' for your preferred BLAS/LAPACK library version. "
|
|
|
|
echo "Either use export or specify these options on the command line ./configure ..... "
|
2010-06-18 14:54:26 +02:00
|
|
|
echo "In addition, similarly you might set include and link paths for Nvidia CUBLAS. "
|
2010-10-22 15:46:59 +02:00
|
|
|
echo "Use ./configure --disable-optimize CXXFLAGS='' LDFLAGS='' for a fast compile. "
|
|
|
|
echo "Use --enable-fotran64int to link with BLAS and LAPACK using 64-bit integers. "
|
|
|
|
echo "For documentation, 'make doxygen-doc' and see doxygen-doc/html/index.html "
|
2009-11-13 16:14:37 +01:00
|
|
|
echo "For usage examples see file t.cc. Do not forget using copyonwrite() before "
|
2010-10-22 15:46:59 +02:00
|
|
|
echo "changing individual matrix/vector elements via l.h.s. operator() "
|
2009-11-13 16:14:37 +01:00
|
|
|
echo "**********************************************************************************"
|
2010-10-22 15:46:59 +02:00
|
|
|
echo
|
2010-06-18 14:54:26 +02:00
|
|
|
|