#!/bin/sh # # This is the configuration file creator. # # configure,v 1.21 2003/06/27 23:19:01 frenger Exp # args="$0 $*" unset debug unset prof unset optimized unset shared matlab=0 cblas=1 lapack=1 fftw=1 mkl=0 use_cc=0 it_dir=`pwd` exceptions=0 ar="ar" if [ -n "$MATLAB" ]; then matlab=1 fi cpu="`uname -m`" case "$cpu" in sun4*) cxx_extraflag=-mv8 ;; i?86) cxx_extraflag=-mcpu="$cpu" ;; esac os="`uname`" # check if we are running Darwin, if so, check if we have an altivec # processor and are using Apples gcc, then enable altivec applecc=0 if [ "$os"="Darwin" ]; then cxx_extraflag=-D__unix applecc="`g++ -dN -E - ln -s /libmkl_def.a ./libmkl_def.a" echo " > ln -s /libmkl_def.so ./libmkl_def.so" echo "" echo "* Pentium III (Choose .a for static and .so for dynamic linking):" echo " > ln -s /libmkl_p3.a ./libmkl_p3.a" echo " > ln -s /libmkl_p3.so ./libmkl_p3.so" echo "" echo "* Pentium 4 (Choose .a for static and .so for dynamic linking):" echo " > ln -s /libmkl_p4.a ./libmkl_p4.a" echo " > ln -s /libmkl_p4.so ./libmkl_p4.so" echo "" echo "If you choose to ignore this warning, the it-config script in the $itpp_dir/bin folder" echo "may not work properly." echo "" fi #Searching for the other MKL libraries: libmkl_lapack.a and libguide.a if [ -f "$it_dir/lib/libmkl_lapack.a" -a -f "$it_dir/lib/libguide.a" ]; then ext_libs="-lmkl_lapack $mkl_processor_specific_lib -lguide -lpthread -lit++external -lg2c" echo "The following additional MKL libraries were found in $it_dir/lib:" echo "libmkl_lapack.a and libguide.a" echo "The following libraries are added to the it-config script in the $it_dir/bin folder:" echo "-lmkl_lapack $mkl_processor_specific_lib -lguide -lpthread -g2c" else echo "WARNING:" echo "All required MKL libraries can not be found in the folder $it_dir/lib." echo "To fix this, you can make symbolic links by issuing the following commands" echo "in the $it_dir/lib folder:" echo "" echo "> ln -s /libmkl_.a ./libmkl_.a" echo "> ln -s /libmkl_lapack.a ./libmkl_lapack.a" echo "> ln -s /libguide.a ./libguide.a" echo "" echo "If you choose to ignore this warning, the it-config script in the $itpp_dir/bin folder" echo "may not work properly. For more information, please read the sections about installation" echo "and linking in the IT++ getting started manual." echo "" echo "Note: Use the .so library files instead of the .a library files for dynamic linking." fi else # ---------------------------------------------------------------------------- # Try to detect ATLAS and LAPACK in it++/lib # ---------------------------------------------------------------------------- if [ $cblas = 1 ]; then if [ $lapack = 1 ]; then if [ $applecc = 0 ]; then echo "" echo "Trying to detect if ATLAS and LAPACK libraries are present in the folder $it_dir/lib..." echo "" if [ -f "$it_dir/lib/libit++external.a" ]; then ext_libs="-lit++external -lg2c" echo "Found libit++external.a in $it_dir/lib:" echo "This library (and -lg2c) is added to the it-config script in the $it_dir/bin folder." else echo "WARNING:" echo "The ATLAS, LAPACK and FFTW libraries can not be found in the folder $it_dir/lib." echo "Note that the it-config script in the $it_dir/bin folder may not function properly." echo ""; echo "If you choose to ignore this warning, the it-config script in the $itpp_dir/bin folder" echo "may not work properly. For more information, please read the sections about installation" echo "and linking in the IT++ getting started manual." fi else echo "You appear to be using Apple's gcc compiler, and to get BLAS and LAPACK support," echo "the vecLib framework will be used." ext_libs="-framework vecLib -lit++external" fi fi fi fi echo "" if [ $cblas = 0 ]; then cblas_flags="-DNO_CBLAS" fi if [ $lapack = 0 ]; then lapack_flags="-DNO_LAPACK" fi if [ $fftw = 0 ]; then lapack_flags="-DNO_FFTW" fi it_version="`cat version`" # ---------------------------------------------------------------------------- # Create MakeConfig # ---------------------------------------------------------------------------- echo Creating MakeConfig cat < MakeConfig # # This file was automatically generated by configure using # $args # .SUFFIXES: .h .c .hpp .cpp .o .a IT_VERSION = $it_version OPT_LIB = \$(LIB_PATH)\$(LIB_BASE).a DEBUG_LIB = \$(LIB_PATH)\$(LIB_BASE)_d.a PROF_LIB = \$(LIB_PATH)\$(LIB_BASE)_p.a SHARED_LIB = \$(LIB_PATH)\$(LIB_BASE)_s.so LIBTARGETS = $libtargets HAVE_MATLAB = $matlab HAVE_CBLAS = $cblas HAVE_LAPACK = $lapack HAVE_FFTW = $fftw OS = $os IT_DIR = $it_dir #CXX = $compiler PROF_FLAGS = -pg \$(OPTIMIZED_FLAGS) DEBUG_FLAGS = -g -DASSERT_LEVEL=2 CXXFLAGS = -Wall -pipe $cxx_extraflag ifeq (\$(HAVE_MATLAB),1) MATLAB_PATH = $matlab_path endif ifeq (\$(HAVE_CBLAS),0) CXXFLAGS += -DNO_CBLAS endif ifeq (\$(HAVE_LAPACK),0) CXXFLAGS += -DNO_LAPACK endif ifeq (\$(HAVE_FFTW),0) CXXFLAGS += -DNO_FFTW endif ifeq (\$(CXX),CC) SHARED_FLAGS = -PIC -O3 -DNDEBUG -DASSERT_LEVEL=1 OPTIMIZED_FLAGS = -fast -cg92 -DNDEBUG -DASSERT_LEVEL=1 else SHARED_FLAGS = -fPIC -O3 -DNDEBUG -DASSERT_LEVEL=1 OPTIMIZED_FLAGS = -O3 -DNDEBUG -DASSERT_LEVEL=1 endif DEPEND = makedepend LD = ld LDFLAGS = AR = $ar include $it_dir/MakeRules EOF # ---------------------------------------------------------------------------- # Create ./bin/it-config # ---------------------------------------------------------------------------- eof="EOF" echo Creating ./bin/it-config cat < ./bin/it-config #!/bin/sh # # This file was automatically generated by configure using # $args # itpp_libs_opt="-L/usr/local/lib -lit++ $ext_libs" itpp_libs_debug="-L/usr/local/lib -lit++_d $ext_libs" itpp_libs_prof="-L/usr/local/lib -lit++_p $ext_libs" itpp_libs_shared="-L/usr/local/lib -lit++ $ext_libs" itpp_flags_opt="-I/usr/local/include -O3 -DNDEBUG -DASSERT_LEVEL=1 $cblas_flags $lapack_flags $cxx_extraflag" itpp_flags_debug="-I/usr/local/include -g -DASSERT_LEVEL=2 $cblas_flags $lapack_flags $cxx_extraflag" itpp_flags_prof="-I/usr/local/include -pg -O3 -DNDEBUG -DASSERT_LEVEL=1 $cblas_flags $lapack_flags $cxx_extraflag" itpp_flags_shared="-I/usr/local/include -fpic -O3 -DNDEBUG -DASSERT_LEVEL=1 $cblas_flags $lapack_flags $cxx_extraflag" flags=\$itpp_flags_opt libs=\$itpp_libs_opt usage() { cat < it-config --libs --debug Display the compiler flags that should be used when using a profiler (e.g. gprof): > it-config --flags --prof $eof exit $1 } if test \$# -eq 0; then usage 1 1>&2 fi while test \$# -gt 0; do case "\$1" in -*=*) optarg=\`echo "\$1" | sed 's/[-_a-zA-Z0-9]*=//'\` ;; *) optarg= ;; esac case \$1 in --version) echo $it_version ;; --flags) echo_flags=yes ;; --libs) echo_libs=yes ;; --opt) flags=\$itpp_flags_opt libs=\$itpp_libs_opt ;; --debug) flags=\$itpp_flags_debug libs=\$itpp_libs_debug ;; --prof) flags=\$itpp_flags_prof libs=\$itpp_libs_prof ;; --shared) flags=\$itpp_flags_shared libs=\$itpp_libs_shared ;; *) usage 1 1>&2 ;; esac shift done if test "\$echo_flags" = "yes"; then echo \$flags fi if test "\$echo_libs" = "yes"; then echo \$libs fi EOF chmod ugo+x ./bin/it-config # ----------------------------------------------------------------------------