📄 configure.in
字号:
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)
AC_INIT(blitz/blitz.h)
# Blitz++ configure utility, generated by autoconf.
#
# If you want to modify this file, make sure you are editing
# configure.in, and not configure.
AC_SET_MAKE
AC_CANONICAL_SYSTEM
SHELL=${CONFIG_SHELL-/bin/sh}
AC_SUBST(SHELL)dnl
echo ""
echo "Configuring Blitz++ for $target"
# Declare variables which we want substituted in the Makefile.in's
AC_SUBST(CXX_OPTIMIZE_FLAGS)
AC_SUBST(CXX_DEBUG_FLAGS)
AC_SUBST(CXXFFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(F77)
AC_SUBST(F90)
AC_SUBST(F77_OPTIMIZE_FLAGS)
AC_SUBST(F90_OPTIMIZE_FLAGS)
AC_SUBST(FORTLIBS)
AC_SUBST(BLASLIB)
# Process command-line arguments for configure
know_compiler=0
AC_ARG_WITH(cxx,
[ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC, cray, egcs, DECcxx, aCC)],
[case "$withval" in
KCCdev) # KAI C++ (development flags)
echo "Configuring for KAI C++ development environment"
bz_compiler=kccdev
CXX=KCC
CXXFLAGS="-DTV_KCC --restrict \
--no_implicit_include --abstract_pointer --abstract_float \
--no_implicit_typename --no_old_specializations \
--strict_warnings"
CXX_OPTIMIZE_FLAGS="+K3 -O3"
CXX_DEBUG_FLAGS="-g +K0 -DBZ_DEBUG"
;;
KCC*) # KAI C++ http://www.kai.com/
echo "Configuring for KAI C++"
bz_compiler=kcc
AC_BZ_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
CXX_OPTIMIZE_FLAGS="+K3 -O3"
CXX_DEBUG_FLAGS="-g +K0 -DBZ_DEBUG"
;;
SGI64*) # SGI C++ http://www.sgi.com
echo "Configuring for SGI C++ (64 bit abi)"
bz_compiler=sgiCC
AC_BZ_SET_COMPILER($withval,"CC","-64 -DBZ_DISABLE_XOPEN_SOURCE -LANG:std -LANG:restrict -lCio")
CXX_OPTIMIZE_FLAGS="-Ofast"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
LDFLAGS="-64"
;;
SGI32*) # SGI C++ http://www.sgi.com
echo "Configuring for SGI C++ (32 bit abi)"
bz_compiler=sgiCC
AC_BZ_SET_COMPILER($withval,"CC","-n32 -DBZ_DISABLE_XOPEN_SOURCE -LANG:std -LANG:restrict -lCio")
CXX_OPTIMIZE_FLAGS="-Ofast"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
LDFLAGS="-n32"
;;
FCC*)
echo "Configuring for Fujitsu C++"
bz_compiler=FCC
AC_BZ_SET_COMPILER($withval,"FCC","")
CXX_OPTIMIZE_FLAGS="-K fast"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
;;
DECcxx*) # DEC C++ http://www.digital.com/
echo "Configuring for DEC cxx"
bz_compiler=cxx
AC_BZ_SET_COMPILER($withval,"cxx","")
CXX_OPTIMIZE_FLAGS="-O4 -tune host"
CXX_DEBUG_FLAGS="-g -msg_display_tag -DBZ_DEBUG"
CXXFLAGS="-DBZ_DISABLE_XOPEN_SOURCE"
;;
cray*) # Cray C++
echo "Configuring for Cray C++."
bz_compiler=cray
AC_BZ_SET_COMPILER($withval,"CC","-h instantiate=used")
CXX_OPTIMIZE_FLAGS="-O3 -hpipeline3 -hunroll -haggress -hscalar2"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
;;
egcs*) # EGCS http://egcs.cygnus.com/
echo "Configuring for EGCS (wahoo!)"
bz_compiler=egcs
AC_BZ_SET_COMPILER($withval,"g++","-ftemplate-depth-30")
CXX_OPTIMIZE_FLAGS="-O2 -funroll-loops -fstrict-aliasing -fno-gcse"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
F77=g77
F77_OPTIMIZE_FLAGS="-O2 -funroll-loops"
FORTLIBS=-lg2c
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_DOUBLE_TRAILING_UNDERSCORES"
;;
# gcc by Mumit Khan <khan@xraylith.wisc.edu>
gcc*) # GCC http://gcc.gnu.org/
echo "Configuring for GCC (wahoo!)"
bz_compiler=gcc
AC_BZ_SET_COMPILER($withval,"g++","-ftemplate-depth-30")
CXX_OPTIMIZE_FLAGS="-O2 -funroll-loops -fstrict-aliasing -fno-gcse"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
F77=g77
F77_OPTIMIZE_FLAGS="-O2 -funroll-loops"
FORTLIBS=-lg2c
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_DOUBLE_TRAILING_UNDERSCORES"
;;
aCC*)
echo "Configuring for aCC (HP-UX)"
bz_compiler=aCC
AC_BZ_SET_COMPILER($withval,"aCC","")
CXX_OPTIMIZE_FLAGS="-O"
CXX_DEBUG_FLAGS="-g -DBZ_DEBUG"
F77=f77
F77_OPTIMIZE_FLAGS="-O"
;;
pgCC*) # Portland group http://www.pgroup.com/
echo "Configuring for Portland Group C++"
echo "You do know this isn't supported yet, right?"
bz_compiler=pgCC
AC_BZ_SET_COMPILER($withval,"pgCC","")
CXX_OPTIMIZE_FLAGS="-O4 -Mnoframe -Mnodepchk -Minline=levels:25"
CXX_DEBUG_FLAGS="-g -O0 -DBZ_DEBUG"
;;
*)
AC_MSG_WARN([--with-cxx: invalid option $withval])
;;
esac
know_compiler=1 ])
echo CXX = $CXX
if test $know_compiler -eq 0; then
cat << 'EOH'
This script only recognizes a small set of compilers and platforms so far.
You will have to rerun this script with one of these options:
--with-cxx=KCC KAI C++ (http://www.kai.com/)
--with-cxx=egcs EGCS (http://egcs.cygnus.com/)
--with-cxx=cray Cray C++ 3.0 or better (http://www.cray.com/)
--with-cxx=DECcxx DEC cxx 6.10 or better (http://www.dec.com/)
--with-cxx=SGI64 SGI C++ 7.3 or better (http://www.sgi.com/)
--with-cxx=SGI32 ... with 32-bit ABI
The Intel C++ compiler is also able to compile blitz, but this
script doesn't handle it yet. Ask if you need it.
EOH
exit 1
fi
# Set platform-specific fortran compilers and optimization settings
case "$target" in
*aix*)
echo "AIX: assuming f77 and xlf90"
F77=f77
F77_OPTIMIZE_FLAGS="-O3 -qhot"
F90=xlf90
F90_OPTIMIZE_FLAGS="-O3 -qhot"
FORTLIBS=-lxlf90
;;
*irix*)
echo "IRIX: assuming f77 and f90"
F77=f77
F77_OPTIMIZE_FLAGS="-Ofast -64"
F90=f90
F90_OPTIMIZE_FLAGS="-Ofast -64"
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_TRAILING_UNDERSCORES"
case "$CXX" in
KCC)
# When using KAI C++ under IRIX, enable some backend optimizations
CXX_OPTIMIZE_FLAGS="+K3 -O3 --COMPO_fe --output_restrict --backend -LANG:restrict=on -64 -mips4"
CXX_DEBUG_FLAGS="-g +K0 -DBZ_DEBUG -64 -mips4"
;;
esac
;;
*solaris*)
echo "Solaris: assuming f77 and f90"
F77=f77
F77_OPTIMIZE_FLAGS="-O3"
F90=f90
F90_OPTIMIZE_FLAGS="-O3"
;;
*osf*)
echo "OSF: assuming f77 and f90"
F77=f77
F77_OPTIMIZE_FLAGS="-O4 -tune host"
F90=f90
F90_OPTIMIZE_FLAGS="-O4 -tune host"
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_TRAILING_UNDERSCORES"
;;
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="-DBZ_FORTRAN_SYMBOLS_CAPS"
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
;;
*)
echo << EOF
Blitz++ has not been tuned for this platform. You may have trouble
building fortran benchmarks, and performance may be unexciting.
EOF
;;
esac
# Check if the script was called with --enable-optimize or
# --enable-debug, and if so modify the compilation flags.
bz_optimize=false
AC_ARG_ENABLE(optimize,
[ --enable-optimize enable compiler optimization flags],
[if test "$enableval" = yes; then
echo "Optimization flags enabled"
CXXFLAGS="$CXXFLAGS $CXX_OPTIMIZE_FLAGS"
fi], [])
bz_debug=false
AC_ARG_ENABLE(debug,
[ --enable-debug enable compiler debug flags],
[if test "$enableval" = yes; then
echo "Debugging flags enabled"
CXXFLAGS="$CXXFLAGS $CXX_DEBUG_FLAGS"
fi], [])
echo ""
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib)
AC_PROG_CXX
dnl AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
AC_CHECK_LIB(m, sin)
# See if there is a libblas.a which can be used for benchmark
# comparisons.
# blas = Basic Linear Algebra Subroutines
AC_ARG_WITH(blas,
[ --with-blas=DIR set the path for the blas library],
BLASPATH=-L"$withval",
BLASPATH="")
echo "Checking to see if there is a usable BLAS library kicking around.."
LDFLAGSsave=$LDFLAGS
LDFLAGS="$BLASPATH $LDFLAGS"
AC_CHECK_LIB(blas, daxpy_,
[ CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -DUSE_LIBBLAS"
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_TRAILING_UNDERSCORES"
BLASLIB="$BLASPATH -lblas" ])
AC_CHECK_LIB(blas, daxpy,
[ CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -DUSE_LIBBLAS"
CXXFFLAGS=""
BLASLIB="$BLASPATH -lblas" ])
AC_CHECK_LIB(blas, DAXPY,
[ CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -DUSE_LIBBLAS"
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_CAPS"
BLASLIB="$BLASPATH -lblas" ])
AC_CHECK_LIB(blas, daxpy__,
[ CXX_OPTIMIZE_FLAGS="$CXX_OPTIMIZE_FLAGS -DUSE_LIBBLAS"
CXXFFLAGS="-DBZ_FORTRAN_SYMBOLS_WITH_DOUBLE_TRAILING_UNDERSCORES"
BLASLIB="$BLASPATH -lblas" ])
LDFLAGS=$LDFLAGSsave
dnl This is where an integrated bzconfig will go eventually.
dnl For now, I'm happy to do it with the makefile.
dnl AC_MSG_CHECKING([C++ compiler ($CXX $CXXFLAGS $LDFLAGS) characteristics])
dnl AC_MSG_RESULT([])
dnl AC_CONFIG_HEADER(config.h)
# Create the lib subdirectory by hand, since it has no Makefile.in
if test ! -d lib ; then
mkdir lib
else
true
fi
# Process the Makefile.in's
AC_OUTPUT(Makefile benchmarks/Makefile examples/Makefile
src/Makefile testsuite/Makefile demos/Makefile compiler/Makefile)
# At some point in the future it would be nice to collect
# information about machines, OSes and compilers which
# people are using. Obviously this has to be handled in
# a sensitive way. Current idea: send the output
# of uname -a, $(target) and $(bz_compiler) via an
# anonymous remailer. Prompt the user and give them
# a chance to override this behaviour.
if false; then
rm -f __target_id
echo "Subject: blitz machineinfo" >>__target_id
echo "" >>__target_id
echo "Target: " $target >>__target_id
echo "Compiler: " $bz_compiler >>__target_id
echo "Date: " `date` >>__target_id
echo " "
echo "****************"
echo "With your permission, this script will send a mail message"
echo "containing some information about your hardware, OS, and compiler."
echo "This message will be sent via an anonymous remailer, so all"
echo "identifying information about you and your organization will be"
echo "removed. These mail messages allow the Blitz++ developers to"
echo "gauge how large the user base is, and what platforms are being"
echo "used. The email message will look like this:"
echo " "
echo "TO: anonymous remailer"
cat __target_id
echo " "
echo "Is it okay if this message is sent? (yes/no)"
read cansendtarget
case "$cansendtarget" in
y*)
sendmail tveldhui@seurat.uwaterloo.ca <__target_id
echo "Thanks. The mail has been sent."
touch .bz_surveyed
;;
*)
echo "No mail was sent."
;;
esac
rm -f __target_id
fi
cat << 'EOH'
The configure script has generated makefiles for your platform.
You have several options now:
make lib Check the compiler and create libblitz.a
make check Do the above plus build and check the testsuite
make all Do all of the above plus build the examples and
benchmarks (takes a long time)
EOH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -