dnl Process this file with autoconf to produce a configure script. dnl Disable caching. define([AC_CACHE_LOAD], )dnl define([AC_CACHE_SAVE], )dnl AC_INIT(itl/itl.h) AC_CANONICAL_SYSTEM AC_MSG_RESULT([Configure Iterative Template Library for $target]) ################################################################ # Define the current version and release ################################################################ sinclude([VERSION]) ################################################################ AM_INIT_AUTOMAKE(itl, $ITLVERSION-$ITLRELEASE, 'no') AM_CONFIG_HEADER(itl/itl_config.h) AC_PROG_INSTALL dnl Force various things to use c++ compiler AC_LANG_CPLUSPLUS dnl Checks for programs. AC_PROG_CXX AC_ITL_NO_SSTREAM compiler="none" if test "$GXX" = yes; then compiler=gnucc fi if test $compiler = "none"; then AC_PROG_CXX_KAICC ; fi if test $compiler = "none"; then AC_PROG_CXX_SGICC ; fi if test $compiler = "none"; then AC_PROG_CXX_MWERKS ; fi if test $compiler = "none"; then AC_PROG_CXX_INTELCC ; fi if test $compiler = "none"; then AC_PROG_CXX_MSVCPP ; fi BACKEND="" BLASLIB="-lblas" BLAS_INCLUDE="" case "$compiler" in kai*) # KAI C++ http://www.kai.com/ echo "Configuring for KAI C++" CXX_PICKY_FLAGS="--strict_warnings --one_instantiation_per_object" AC_BZ_SET_COMPILER($withval,"KCC","--restrict $CXX_PICKY_FLAGS") CXX_OPTIMIZE_FLAGS="+K3 -O3 -fast --inline_keyword_space_time=10000" CXX_DEBUG_FLAGS="-g +K0 " BACKEND="--backend" CXXLD="$CXX" ;; sgi*) # SGI C++ http://www.sgi.com echo "Configuring for SGI C++" CXX_PICKY_FLAGS= AC_BZ_SET_COMPILER($withval,"$CXX","-LANG:restrict -LANG:std $CXX_PICKY_FLAGS") CXX_OPTIMIZE_FLAGS="-Ofast -LANG:restrict" CXX_DEBUG_FLAGS="-g " CXXLD="$CXX" LDFLAGS= ;; gnu*) # EGCS http://egcs.cygnus.com/ echo "Configuring for GNU C++" CXX_PICKY_FLAGS="-Wall" AC_BZ_SET_COMPILER($withval,"g++","-ftemplate-depth-30 $CXX_PICKY_FLAGS") CXX_OPTIMIZE_FLAGS="-O2 -funroll-loops -fstrict-aliasing -fno-gcse" CXX_DEBUG_FLAGS="-g" CXXLD="$CXX" F77=g77 F77_OPTIMIZE_FLAGS="-O2 -funroll-loops" FORTLIBS=-lg2c CXXFFLAGS= ;; msvc*) # Microsoft Visual C++ echo "Configuring for Microsoft Visual C++" CXX_PICKY_FLAGS="/W0" # VC++ gives warnings for its own headers! AC_BZ_SET_COMPILER($withval,"cl","") # had to move this below AC_PROG_CC # CPPFLAGS="/TP /ML /GX /YX /FD $CXX_PICKY_FLAGS /Fo\$*.o" CXX_OPTIMIZE_FLAGS="/Ox" CXX_DEBUG_FLAGS="/Zi" LDOUT="/out:" CXXLD="link" ;; mwerk*) echo "Configuring for Metrowerks Codewarrior (x86)" CXX_PICKY_FLAGS="-w on" AC_BZ_SET_COMPILER($withval,"mwcc -i-","") # had to move this below AC_PROG_CC # CPPFLAGS="$CXX_PICKY_FLAGS -o \$*.o" CXX_OPTIMIZE_FLAGS="-opt all" CXX_DEBUG_FLAGS="-g" CXXLD="mwld" ;; *) CXXLD="$CXX" AC_MSG_WARN([Compiler not recognized]) ;; esac if test "$GXX" = "yes"; then F77=g77 F77_OPTIMIZE_FLAGS="-O2 -funroll-loops" FORTLIBS=-lg2c MATHLIB="-lm" BLASLIB="-lblas -lg2c" case "$target" in *solaris*) BLASLIB="-L/opt/SUNWspro/lib -lsunperf -lfsu -lF77 -lM77 -lsunmath" ;; esac else case "$target" in *linux*) echo "Linux: assuming g77 fortran compiler" F77=g77 F77_OPTIMIZE_FLAGS="-O2 -funroll-loops" FORTLIBS=-lg2c MATHLIB="-lm" BLASLIB="-lblas -lg2c" ;; *aix*) echo "AIX: assuming f77 and xlf90" F77=f77 F77_OPTIMIZE_FLAGS="-O3 -qhot" F90=xlf90 F90_OPTIMIZE_FLAGS="-O3 -qhot" FORTLIBS=-lxlf90 MATHLIB="-lm" ;; *irix*) echo "IRIX: assuming cc, f77 and f90 native compilers" CC=cc F77=f77 F90=f90 CC_OPTIMIZE_FLAGS="-Ofast" F77_OPTIMIZE_FLAGS="-Ofast" F90_OPTIMIZE_FLAGS="-Ofast" MATHLIB="-lm" CXXFFLAGS= case "$CXX" in KCC) # When using KAI C++ under IRIX, enable some backend optimizations CXX_OPTIMIZE_FLAGS="+K3 -O3 --inline_keyword_space_time=10000 --COMPO_fe --output_restrict --backend -LANG:restrict=on -mips4" CXX_DEBUG_FLAGS="-g +K0 -mips4" ;; esac ;; *solaris*) echo "Solaris: assuming cc as the native C compiler, " echo " and f77 and f90 as the fortran compilers" CC=cc CC_OPTIMIZE_FLAGS="-fast -xO4 -xtarget=native -xdepend -dalign" F77=f77 F77_OPTIMIZE_FLAGS="-fast -xO4 -xtarget=native -xdepend -dalign" F90=f90 F90_OPTIMIZE_FLAGS="-fast -xO4 -xtarget=native -xdepend -dalign" MATHLIB="-L/usr/lib -lm" BLASLIB="-L/opt/SUNWspro/lib -lsunperf -lfsu -lF77 -lM77 -lsunmath" case "$CXX" in KCC) # When using KAI C++ under Solaris, enable some backend optimizations CXX_OPTIMIZE_FLAGS="+K3 -fast --inline_keyword_space_time=10000 --backend -xO4 --backend -xtarget=native --backend -xdepend --backend -dalign " CXX_DEBUG_FLAGS="-g +K0 " ;; esac ;; *osf*) echo "OSF: assuming f77 and f90 fortran compilers" F77=f77 F77_OPTIMIZE_FLAGS="-O4 -tune host" F90=f90 F90_OPTIMIZE_FLAGS="-O4 -tune host" CXXFFLAGS= MATHLIB="-lm" ;; alpha-cray-unicos) echo "Cray T3D/E: Setting special optimization flags" F77=fort77 F77_OPTIMIZE_FLAGS="-O aggress -O 3 -O unroll2 -O pipeline3" F90=f90 F90_OPTIMIZE_FLAGS="-O 3 -O aggress -O unroll2 -O pipeline3" CXXFFLAGS= MATHLIB="-lm" case "$CXX" in KCC) # When using KAI C++ on the T3E, need to enable a bunch of # backend optimizations CXX_OPTIMIZE_FLAGS="+K3 -O3 --backend -hpipeline3 --backend -hunroll \ --backend -haggress --backend -hscalar2" ;; esac ;; *) ;; esac fi AC_PROG_CC AC_PROG_MAKE_SET dnl Checks for header files. AC_MSG_CHECKING(for std::abs) AC_ITL_TRY_COMPILE([#include ], [ double d = std::abs(-3.0); ], [ AC_DEFINE(ITL_HAVE_CMATH) AC_MSG_RESULT(yes) ], [ AC_DEFINE(ITL_NO_STD_ABS) AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for std::sqrt) AC_ITL_TRY_COMPILE([#include ], [ double d = std::sqrt(3.0); ], [ AC_MSG_RESULT(yes) ], [ AC_DEFINE(ITL_NO_STD_SQRT) AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for header) AC_ITL_TRY_COMPILE([#include ], [ double d = std::numeric_limits::max(); ], [ has_limits=yes AC_MSG_RESULT(yes) ], [ has_limits=no AC_DEFINE(ITL_NO_LIMITS) AC_MSG_RESULT(no) ]) LSC_CXX_TEMPLATE_REPOSITORY dnl AC_CHECK_HEADERS(limits.h sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_TYPE_SIZE_T dnl AC_HEADER_TIME dnl The top-level source code directory for the package. dnl top_srcdir dnl Header file search directory (`-IDIR') and any other miscellaneous dnl options for the C preprocessor and compiler. itl_include_dir='$(top_srcdir)' CPPFLAGS="-I$itl_include_dir $CPPFLAGS" AC_SUBST(itl_include_dir) CXXFLAGS="$CXXFLAGS $DEBUGFLAGS $OPTFLAGS" dnl Checks for library functions. AC_MSG_CHECKING(whether to have MTL package) AC_ARG_WITH(mtl, [ --with-mtl[=DIR] use MTL package, DIR is MTL top directory ], [ if test "$withval" != "no"; then if test "$withval" != "yes"; then if test -d $withval/mtl; then CPPFLAGS="-I$withval $CPPFLAGS" else AC_MSG_ERROR(Can not find MTL header directory at $withval/mtl) fi fi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) echo "" echo "" echo "WARNING: You did not use mtl for basic linear operations." echo "WARNING: You need to provide necessary matrix-vector, " echo "WARNING: vector-vector, vector-scalor operations by yourself." echo "WARNING: You could find an example interface in examples/interface." echo "" echo "" fi ], [ AC_MSG_RESULT(no) echo "" echo "" echo "WARNING: You did not use mtl for basic linear operations." echo "WARNING: You need to provide necessary matrix-vector, " echo "WARNING: vector-vector, vector-scalor operations by yourself." echo "WARNING: You could find an example interface in examples/interface." echo "" echo "" ])dnl dnl check blitz package BLITZ_INC="" BLITZ_LIB="" AC_MSG_CHECKING(whether to have blitz package) AC_ARG_WITH(blitz, [ --with-blitz[=DIR] use blitz package, DIR is blitz top directory ], [ if test "$withval" != "no"; then if test "$withval" != "yes"; then if test -d $withval/blitz; then BLITZ_INC="-I$withval" BLITZ_LIB="-L$withval/lib -lblitz" else AC_MSG_ERROR(Can not find blitz header directory at $withval/blitz) fi else BLITZ_LIB="-lblitz" fi AC_SUBST(BLITZ_INC) AC_SUBST(BLITZ_LIB) AC_MSG_RESULT(yes) echo "" echo "" echo "WARNING: Release blitz-05.beta3 or blitz-2000-1213 may not" echo "WARNING: be able to compiled by KCC. Please patch" echo "WARNING: blitz-2000-1213 with kcc_for_blitz-20001213.diff." echo "" echo "" else AC_MSG_RESULT(no) fi ], [ AC_MSG_RESULT(no) ])dnl dnl check for MPI MPI_CXX="$CXX" MPI_LDADD="" AC_MSG_CHECKING(whether to have MPI) AC_ARG_WITH(mpi, [ --with-mpi[=lam or other mpi implementations] ], [ if test "$withval" != "no"; then if test "$withval" = "lam"; then MPI_CXX=hcp #lam use hcp for c++ wrapper else echo "" echo "" echo "WARNING: only LAM/MPI is tested. You may need to modify" echo "WARNING: Makefiles under examples/parallel and its" echo "WARNING: sub-directories." echo "" echo "" MPI_CXX="$CXX" #assume other mpi implementations used $CXX fi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ], [ AC_MSG_RESULT(no) ])dnl AC_SUBST(CXX) AC_SUBST(CXXLD) AC_SUBST(CPPFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(CXX_DEBUG_FLAGS) AC_SUBST(CXX_OPTIMIZE_FLAGS) AC_SUBST(CC) AC_SUBST(CCFLAGS) AC_SUBST(CC_DEBUG_FLAGS) AC_SUBST(CC_OPTIMIZE_FLAGS) AC_SUBST(LDFLAGS) AC_SUBST(MATHLIB) AC_SUBST(BLASLIB) AC_SUBST(BLAS_INCLUDE) AC_SUBST(MPI_CXX) AC_SUBST(MPI_LDADD) AC_OUTPUT(Makefile itl/Makefile examples/Makefile examples/laplacian/Makefile examples/interface/Makefile examples/blitz/Makefile examples/blas/Makefile test/Makefile examples/parallel/Makefile examples/parallel/driven_cavity/Makefile examples/parallel/bratu/Makefile examples/parallel/bratu/mtl/Makefile examples/parallel/bratu/blas/Makefile)