📄 configure.ac
字号:
# Process this file with autoconf to produce a configure script.AC_INIT(meep, 0.20.3, meep@ab-initio.mit.edu)AC_CONFIG_SRCDIR(src/step.cpp)# Shared-library version number; indicates api compatibility, and is# not the same as the "public" version number. (Don't worry about this# except for public releases.)SHARED_VERSION_INFO="2:3:0" # CURRENT:REVISION:AGEAM_INIT_AUTOMAKE(1.6)AM_CONFIG_HEADER(config.h)AM_MAINTAINER_MODEAC_SUBST(SHARED_VERSION_INFO)AM_ENABLE_SHARED(no) dnl shared libs cause too many headaches to be defaultMEEP_SUFFIX=""##############################################################################AC_ARG_WITH(doc, [AC_HELP_STRING([--with-doc], [include old documentation in dist])], with_doc=$withval,with_doc=no)AM_CONDITIONAL(WITH_DOC, test "x$with_doc" = xyes)AC_ARG_WITH(saturable-absorbers, [AC_HELP_STRING([--with-saturable-absorbers],[enable undocumented support for saturable absorbers])], with_sat_abs=$withval, with_sat_abs=no)if test "x$with_sat_abs" = "xyes"; then AC_DEFINE([WITH_SATURABLE_ABSORBERS],[1],[Define to enable old, undocumented support for saturable absorbers])fi############################################################################### Check for mpiCC immediately after getting C++ compiler...AC_PROG_CXX# Check for MPI libraryAC_ARG_WITH(mpi, [AC_HELP_STRING([--with-mpi],[enable MPI parallelization])], with_mpi=$withval, with_mpi=no)if test "x$with_mpi" = "xyes"; then AC_LANG_PUSH([C++]) ACX_MPI([],[AC_MSG_ERROR([could not find mpi library for --with-mpi])]) CXX=$MPICXX AC_LANG_POP([C++]) MEEP_SUFFIX="${MEEP_SUFFIX}_mpi"fi############################################################################### More checksAC_PROG_LIBTOOLAC_CHECK_PROG(LATEX2HTML, latex2html, latex2html)if test -z "$LATEX2HTML"; then AC_MSG_WARN([Cannot find latex2html in your path!]) # FIXME: use standard 'missing' script from automake LATEX2HTML='echo not running latex2html...'fiAC_SUBST(LATEX2HTML)AC_CHECK_LIB(m, sin)AC_CHECK_LIB(fftw3, fftw_plan_dft_1d, [], [AC_CHECK_LIB(dfftw, fftw_create_plan, [], [AC_CHECK_LIB(fftw, fftw_create_plan, [], [AC_MSG_WARN([Missing FFTW library...slow DFT will be used for monitor-point Fourier transform])])])])############################################################################ Harminv library# First, try pkg-config, if it is installed. Note that, annoyingly,# pkg-config doesn't look in /usr/local by default, so we have to# add this to the path for that common case. It also doesn't give# us a way to print its default path, grr, so we have to assume that this# is /usr/lib/pkgconfig.PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/local/lib/pkgconfigexport PKG_CONFIG_PATHPKG_CHECK_MODULES(HARMINV, harminv >= 1.1, [CFLAGS="$CFLAGS $HARMINV_CFLAGS"; LIBS="$HARMINV_LIBS $LIBS"; have_harminv=yes], [have_harminv=no])# As a fallback, check manually for BLAS/LAPACK and harminv libraries:if test $have_harminv = no; then AC_F77_WRAPPERS ACX_BLAS ACX_LAPACK([], [AC_MSG_WARN([BLAS/LAPACK needed for harminv])]) save_CC=$CC CC=$CXX # harminv test must use $CXX since harminv may be a C++ lib # just use lapack/blas in default libs since we always need them AC_CHECK_LIB(harminv, harminv_get_freq_error, [have_harminv=yes; LIBS="-lharminv $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"], [AC_MSG_WARN([harminv support is disabled])], [$LAPACK_LIBS $BLAS_LIBS $FLIBS]) CC=$save_CCfiif test $have_harminv = yes; then AC_DEFINE([HAVE_HARMINV],[1],[Define if you have libharminv])fi############################################################################### GNU Scientific LibraryAC_CHECK_FUNC(cblas_cgemm, [], [AC_CHECK_LIB(gslcblas, cblas_cgemm)])AC_CHECK_LIB(gsl, gsl_sf_bessel_Jn, [], [AC_MSG_WARN([Missing GNU GSL library...Bessel-function field initialization will not be supported.])])############################################################################### Check for HDF5 libraryAC_ARG_WITH(hdf5, [AC_HELP_STRING([--without-hdf5],[do not allow HDF5 output])], ok=$withval, ok=yes)if test "$ok" = "yes"; then AC_CHECK_LIB(z,deflate, [],[AC_MSG_WARN([zlib is required for HDF5!])]) save_CC=$CC if test "x$with_mpi" = "xyes"; then CC=$MPICXX fi save_LIBS_0="$LIBS" # save, to check later if we found any library AC_CHECK_LIB(hdf5, H5Pcreate, [ AC_CHECK_HEADERS(hdf5.h, [LIBS="-lhdf5 $LIBS" AC_DEFINE(HAVE_HDF5,1,[Define if we have & link HDF5])])]) if test x"$save_LIBS_0" = x"$LIBS"; then AC_MSG_WARN([Couldn't find the HDF5 library!! Switching to --without-hdf5.]) fi CC=$save_CC if test "x$with_mpi" = "xyes"; then AC_CHECK_FUNCS(H5Pset_mpi H5Pset_fapl_mpio) fifi############################################################################### Figure out the number of processors so we can quickly build the docs and# run the tests... (FIXME: use more standard autoconf macros)RUNCODE=""if test "x$with_mpi" = "xyes"; then cat > test_num_processors.c <<MYEOF#include <unistd.h>#include <stdio.h>#include <stdlib.h>int main() { long nprocs; nprocs = sysconf(_SC_NPROCESSORS_ONLN); if (nprocs < 1) nprocs = 1; printf ("%ld\n",nprocs); exit (EXIT_SUCCESS);}MYEOF $CC -o test_num_processors test_num_processors.c NUMPROCS=`./test_num_processors` rm -f test_num_processors test_num_processors.c echo Looks like we have got "$NUMPROCS" processors RUNCODE="mpirun -np $NUMPROCS"fiAC_SUBST(RUNCODE)############################################################################### Compiler flags# For some annoying reason, g++ requires you to compile# all code with -march if you compile any code with -march,# otherwise segfaults can occur (observed in g++ 3.3.5).# We also need to be careful about -malign-double.ARCHFLAG=""AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile for debugging])], enable_debug=$enableval, enable_debug=no)if test "$enable_debug" = "yes"; then CFLAGS="-g" CXXFLAGS="-g" FFLAGS="-g" AC_DEFINE(DEBUG,1,[define to enable debugging code])else # Pick "good" compiler flags(?) AX_CXX_MAXOPT for flg in $CXXFLAGS; do case $flg in -march=*|-mcpu=*|-malign*) ARCHFLAG="$ARCHFLAG $flg" ;; esac donefiAC_SUBST(ARCHFLAG)# Add lots of compiler warnings in maintainer mode if we are using gcc:# (The variable $GXX is set to "yes" by AC_PROG_CXX if we are using g++.)if test "$GXX" = "yes" && test "$USE_MAINTAINER_MODE" = yes; then CXXFLAGS="$CXXFLAGS -Wall -W"fi##############################################################################AC_CHECK_PROG(HC, ghc, ghc)if test "$USE_MAINTAINER_MODE" = yes; thenif test x"$HC" = x; then AC_MSG_ERROR([the ghc Haskell compiler is required in maintainer mode])else ghc_vers=`$HC -V | sed 's/.*version *\([[0-9]][[0-9.]]*\).*$/\1/'` (echo "import FiniteMap"; echo 'main = putStr "Hello world"') > conftest.hs GHC_PACKAGEFLAG=unknown AC_MSG_CHECKING([for ghc -package for FiniteMap]) for flag in data ghc-6.6 ghc-$ghc_vers; do if $HC -package $flag -c conftest.hs >&AS_MESSAGE_LOG_FD 2>&1; then GHC_PACKAGEFLAG=$flag break; fi done rm -f conftest* AC_MSG_RESULT([$GHC_PACKAGEFLAG]) if test x"$GHC_PACKAGEFLAG" = xunknown; then AC_MSG_ERROR([unable to find working -package for FiniteMap]) fififiAC_SUBST(GHC_PACKAGEFLAG)############################################################################### Libraries and flags (other than -lmeep) required to link Meep:MEEPLIBS="$LDFLAGS $LIBS"AC_SUBST(MEEPLIBS)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -