# -*- Autoconf -*- # # Copyright (C) 2005-2006 ABINIT Group (Yann Pouillon) # All rights reserved. # # This file is part of the ABINIT software package. For license information, # please see the COPYING file in the top-level directory of the ABINIT source # distribution. # # ---------------------------------------------------------------------------- # # # IMPORTANT NOTE # # Please DO NOT EDIT this file unless you REALLY know what you are doing. # Everything is important, in particular the order of the various commands # executed here. YOU HAVE BEEN WARNED ! # # ---------------------------------------------------------------------------- # # # Autoconf & Automake startup # # Initialize Autoconf AC_PREREQ(2.57) AC_INIT([ABINIT],[5.2.4],[pouillon@pcpm.ucl.ac.be],[abinit]) AC_REVISION([Autotools support for ABINIT 5]) AC_CONFIG_AUX_DIR(config/gnu) AC_CONFIG_SRCDIR(src/main/abinit.F90) AC_PREFIX_DEFAULT(/opt/etsf) # Test suite - DO NOT ACTIVATE ! #AC_CONFIG_TESTDIR(tests) # Embedded packages linalg_pkg_name="lapack-pre_abinit_3.2" #linalg_pkg_name="lapack-3.0" netcdf_pkg_name="netcdf-3.6.0-p1" nqxc_pkg_name="libxc-0.1.0" xmlf90_pkg_name="xmlf90-1.2g" linalg_pkg_string="An old, robust, version of Lapack library (hacked for ABINIT by Yann Pouillon)" #linalg_pkg_string="Lapack 3.0 (hacked for ABINIT by Yann Pouillon)" netcdf_pkg_string="NetCDF 3.6.0-p1 (upstream release)" nqxc_pkg_string="Nanoquanta XC library 20051128-CVS (hacked for ABINIT by Yann Pouillon)" xmlf90_pkg_string="XML Fortran 90 library 1.2g (hacked for ABINIT by Yann Pouillon)" AC_SUBST(linalg_pkg_name) AC_SUBST(netcdf_pkg_name) AC_SUBST(nqxc_pkg_name) AC_SUBST(xmlf90_pkg_name) AC_SUBST(linalg_pkg_string) AC_SUBST(netcdf_pkg_string) AC_SUBST(nqxc_pkg_string) AC_SUBST(xmlf90_pkg_string) # ---------------------------------------------------------------------------- # ABI_MSG_SECTION([Build environment]) # Initial setup AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9) AM_CONFIG_HEADER([config.h]) ABI_INIT_SOURCE_DIRS ABI_INIT_VERSION ABI_INIT_CPU_INFO(${target}) ABI_INIT_HEADER # Define command-line arguments ABI_OPTIONS_DEFINE # Initialize environment variables ABI_ENV_INIT # Read config file and ensure that priorities are respected ABI_ENV_BACKUP ABI_OPTIONS_BACKUP ABI_OPTIONS_INIT ABI_LOAD_OPTIONS ABI_OPTIONS_RESTORE ABI_ENV_RESTORE # Initialize install dirs (requires version and config options to be set) ABI_INIT_INSTALL_DIRS # ---------------------------------------------------------------------------- # # # Miscellaneous utilities # ABI_MSG_SECTION([Utilities]) # Check for common programs AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_LN_S # Check for other programs AC_PATH_PROG(BOURNE_SHELL,sh,/bin/sh) AC_PATH_PROG(PERL,perl,/usr/bin/perl) AC_PATH_PROG(PYTHON,python,/usr/bin/python) AC_PATH_PROG(RM,rm,/bin/rm) AC_PATH_PROG(MV,mv,/bin/mv) AC_PATH_PROG(TAR,tar,/bin/tar) AC_PATH_PROG(MARKDOWN,markdown,/usr/bin/markdown) AC_PATH_PROG(LATEX,latex,/usr/bin/latex) AC_PATH_PROG(DVI2PS,dvips,/usr/bin/dvips) AC_PATH_PROG(DVI2PDF,dvipdf,/usr/bin/dvipdf) AC_PATH_PROG(PS2PDF,ps2pdf,/usr/bin/ps2pdf) # Workaround for the "grep -e" issue on Solaris systems AC_PROG_EGREP if test ! -x "${MARKDOWN}"; then AC_MSG_NOTICE([using internal version of MarkDown]) MARKDOWN="${abinit_builddir}/bin/markdown" fi # ---------------------------------------------------------------------------- # # # Libraries and linking # ABI_MSG_SECTION([Libraries and linking]) # Disable shared objects (might change in the future) AC_DISABLE_SHARED # Look for archivers and linkers AC_PROG_RANLIB AC_PROG_LD AC_PATH_PROG(AR,ar,/usr/bin/ar) # Apply tricks if test "${enable_tricks}" = "yes"; then ABI_TRICKS_AR(${target_os}) if test "${enable_64bit_flags}" = "yes"; then AC_MSG_CHECKING([for 64-bit archiver flags]) if test "${ARFLAGS_64BITS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${ARFLAGS_64BITS}]) AR="${AR} ${ARFLAGS_64BITS}" fi else ARFLAGS_64BITS="" fi fi # Define Unix stream editor AC_MSG_CHECKING([for sed]) SED="${lt_cv_path_SED}" if test "${SED}" = ""; then AC_PATH_PROG(SED,sed,/usr/bin/sed) fi AC_MSG_RESULT([${SED}]) AC_SUBST(SED) AC_SUBST(with_gnu_ld) # ---------------------------------------------------------------------------- # # # Preprocessing # ABI_MSG_SECTION([Preprocessing]) # Propagate CPPFLAGS if test "${CPPFLAGS}" = "" -a "${with_cppflags}" != ""; then CPPFLAGS="${with_cppflags}" fi # Look for the default C preprocessor AC_PROG_CPP # Apply tricks if test "${enable_tricks}" = "yes"; then ABI_TRICKS_CPP(${target_os}) if test "${enable_64bit_flags}" = "yes"; then AC_MSG_CHECKING([for 64-bit preprocessor flags]) if test "${CPPFLAGS_64BITS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${CPPFLAGS_64BITS}]) CPP="${CPP} ${CPPFLAGS_64BITS}" fi else CPPFLAGS_64BITS="" fi else TRUE_CPP="${CPP}" TRUE_CPPFLAGS="" fi AC_SUBST(TRUE_CPP) AC_SUBST(TRUE_CPPFLAGS) # ---------------------------------------------------------------------------- # # # C support # ABI_MSG_SECTION([C support]) # Look for the C compiler AC_PROG_CC ABI_PROG_CC # Check C pointer size (required for NQXC library support) OCT_NQXC_POINTER_SIZE # Check for system peculiarities AC_C_BIGENDIAN # Apply tricks if test "${enable_tricks}" = "yes"; then ABI_TRICKS_CC(${cc_type},${cc_version}) if test "${enable_64bit_flags}" = "yes"; then AC_MSG_CHECKING([for 64-bit C flags]) if test "${CFLAGS_64BITS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${CFLAGS_64BITS}]) CC="${CC} ${CFLAGS_64BITS}" fi else CFLAGS_64BITS="" fi fi # ---------------------------------------------------------------------------- # # # C++ support # ABI_MSG_SECTION([C++ support]) # Look for the C++ compiler AC_PROG_CXX ABI_PROG_CXX # Apply tricks if test "${enable_tricks}" = "yes"; then ABI_TRICKS_CXX(${cxx_type},${cxx_version}) if test "${enable_64bit_flags}" = "yes"; then AC_MSG_CHECKING([for 64-bit C++ flags]) if test "${CXXFLAGS_64BITS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${CXXFLAGS_64BITS}]) CXX="${CXX} ${CXXFLAGS_64BITS}" fi else CXXFLAGS_64BITS="" fi fi # ---------------------------------------------------------------------------- # # # Fortran support # ABI_MSG_SECTION([Fortran support]) # Check for compiler AC_PROG_FC ABI_PROG_FC # Wrap Fortran compiler calls if needed or requested if test "${enable_fc_wrapper}" = "yes"; then fc_wrap="yes" fi if test "${fc_wrap}" = "yes"; then AC_MSG_NOTICE([Fortran compiler calls will be wrapped]) if test "${TRUE_CPP}" = ""; then AC_MSG_ERROR([the Fortran wrapper requires a working C preprocessor]) fi fi # The IBM Fortran compiler is too buggy to compile standard Fortran 90 files # The following measure should suffice in most cases (let's hope!) if test "${fc_type}" = "ibm"; then FC_SRCEXT="f" else FC_SRCEXT="F90" fi # Apply tricks as soon as possible if test "${enable_tricks}" = "yes"; then ABI_TRICKS_FC(${fc_type},${fc_version}) if test "${enable_64bit_flags}" = "yes"; then AC_MSG_CHECKING([for 64-bit Fortran flags]) if test "${FCFLAGS_64BITS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${FCFLAGS_64BITS}]) FC="${FC} ${FCFLAGS_64BITS}" fi else FCFLAGS_64BITS="" fi fi # Look for exit() support ABI_CHECK_FORTRAN_EXIT # Check whether top read file list from standard input if test "${enable_stdin}" = "no"; then AC_DEFINE([READ_FROM_FILE],1,[Read file list from a file instead of standard input]) fi # Mangle C/C++ names so that they match the name-mangling scheme used by # the Fortran compiler (may crash "configure" in some rare cases) if test "${enable_smart_config}" = "yes"; then AC_FC_WRAPPERS fi # Activate Fortran interfaces if requested AC_MSG_CHECKING([whether to activate Fortran interfaces]) if test "${enable_fortran_interfaces}" = "yes"; then AC_DEFINE([HAVE_FORTRAN_INTERFACES],1, [Define to 1 if you want to use Fortran interfaces]) fi AC_MSG_RESULT([${enable_fortran_interfaces}]) # Map NQXC "FLOAT" type to Fortran "double precision" OCT_NQXC_FLOAT # ---------------------------------------------------------------------------- # # # Optimizations # # NOTE: Please do not try to set-up the CFLAGS_OPT, CXXFLAGS_OPT, and # FCFLAGS_OPT variables manually, as they will systematically be # overwritten. These flags should be modified by the # --with-*-optflags options only. # ABI_MSG_SECTION([Optimizations]) # Load optimizations from the optflags database if test "${enable_debug}" = "no" -a "${enable_tricks}" = "yes"; then if test "${CFLAGS}" = ""; then if test "${with_cc_optflags}" = ""; then ABI_LOAD_OPTFLAGS(${cc_type}_cc,${cc_version},${abi_cpu_model}) else AC_MSG_NOTICE(reading C optimizations from command-line) CFLAGS_OPT="${with_cc_optflags}" fi else AC_MSG_NOTICE([no C optimizations - using provided CFLAGS instead]) CFLAGS_OPT="" fi if test "${CXXFLAGS}" = ""; then if test "${with_cxx_optflags}" = ""; then ABI_LOAD_OPTFLAGS(${cxx_type}_cxx,${cxx_version},${abi_cpu_model}) else AC_MSG_NOTICE(reading C++ optimizations from command-line) CXXFLAGS_OPT="${with_cxx_optflags}" fi else AC_MSG_NOTICE([no C++ optimizations - using provided CXXFLAGS instead]) CXXFLAGS_OPT="" fi if test "${FCFLAGS}" = ""; then if test "${with_fc_optflags}" = ""; then ABI_LOAD_OPTFLAGS(${fc_type}_fc,${fc_version},${abi_cpu_model}) else FCFLAGS_OPT="${with_fc_optflags}" AC_MSG_NOTICE(reading Fortran optimizations from command-line) fi else AC_MSG_NOTICE([no Fortran optimizations - using provided FCFLAGS instead]) FCFLAGS_OPT="" fi else AC_MSG_NOTICE([optimizations have been turned off]) fi # Activate debug mode if requested if test "${enable_debug}" = "yes"; then # Set optimization level to 0 and activate debug information output CFLAGS_OPT="-O0" if test "${ac_cv_prog_cc_g}" = "yes"; then CFLAGS_OPT="-g ${CFLAGS_OPT}" fi CXXFLAGS_OPT="-O0" if test "${ac_cv_prog_cxx_g}" = "yes"; then CXXFLAGS_OPT="-g ${CXXFLAGS_OPT}" fi FCFLAGS_OPT="-O0" if test "${ac_cv_prog_fc_g}" = "yes"; then FCFLAGS_OPT="-g ${FCFLAGS_OPT}" fi # Define preprocessing option AC_DEFINE([DEBUG_MODE],1,[Define to 1 to turn on debug mode]) # Report AC_MSG_NOTICE([debug mode activated]) fi # Enable per-directory Fortran optimizations if test "${FCFLAGS}" = ""; then ABI_OPTFLAGS_DIRS([${FCFLAGS_OPT}]) else AC_MSG_NOTICE([per-directory Fortran optimizations replaced by FCFLAGS]) fi # ---------------------------------------------------------------------------- # # # MPI support # ABI_MSG_SECTION([MPI support]) # Initialize MPI variables ABI_MPI_INIT # Look for MPI and setup corresponding variables ABI_MPI_CHECK # Enable MPI time tracing if requested if test "${enable_mpi}" = "yes" -a "${enable_mpi_trace}" = "yes"; then AC_DEFINE([MPI_TRACE],1,[Time tracing for MPI]) fi # Report MPI status ABI_MPI_REPORT # Define condition AM_CONDITIONAL(DO_BUILD_PARALLEL,test "${enable_mpi}" = "yes") # ---------------------------------------------------------------------------- # # # External libraries # ABI_MSG_SECTION([External libraries]) # Linear algebra support (BLAS and LAPACK) linalg_type="${with_linalg_type}" ABI_EXTLIB_LINALG # NetCDF file I/O support ABI_EXTLIB_NETCDF # Nanoquanta exchange-correlation library support if test "${enable_smart_config}" = "no"; then if test "${enable_nqxc}" = "yes"; then AC_MSG_WARN([NQXC support cannot be enabled (requires smart config)]) fi enable_nqxc="no" with_nqxc_include="" with_nqxc_ldflags="" fi ABI_EXTLIB_NQXC # XML file I/O support ABI_EXTLIB_XMLF90 # ---------------------------------------------------------------------------- # # # FFTW support # # Require link flags to be set if test "${with_fftw_ldflags}" = ""; then enable_fftw="no" fi AC_MSG_CHECKING([whether to use the FFTW library]) AC_MSG_RESULT(${enable_fftw}) # Define preprocessing options if test "${enable_fftw}" = "yes"; then AC_MSG_WARN([FFTW support is still under development]) AC_DEFINE(HAVE_FFTW,1,[Define to 1 if you want to use the FFTW library]) AC_MSG_CHECKING([whether to use the threaded version of FFTW]) AC_MSG_RESULT(${enable_fftw_threads}) if test "${enable_fftw_threads}" = "yes"; then AC_DEFINE(HAVE_FFTW_THREADS,1,[Define to 1 if you want to use the threaded FFTW library]) fi fi # Propagate results fftw_include="" fftw_ldflags="${with_fftw_ldflags}" AC_SUBST(fftw_include) AC_SUBST(fftw_ldflags) # ---------------------------------------------------------------------------- # # # Other libraries (not managed by scripts for now) # light_include="" AC_SUBST(light_include) macroav_include="" AC_SUBST(macroav_include) numeric_include="" AC_SUBST(numeric_include) numericf90_include="" AC_SUBST(numericf90_include) # ---------------------------------------------------------------------------- # # # Save configuration # # Set-up target and binary package names # Note: requires knowledge of Fortran compiler ABI_INIT_TARGET ABINIT_BINARY_PACKAGE="${PACKAGE}-${VERSION}_${ABINIT_TARGET}" AC_SUBST(ABINIT_BINARY_PACKAGE) # Final adjustments of C and C++ compiler flags if test "${CPPFLAGS}" = ""; then CPPFLAGS="${CPPFLAGS_OPT} ${EXTRA_CPPFLAGS}" fi if test "${CFLAGS}" = ""; then CFLAGS="${CFLAGS_OPT} ${EXTRA_CFLAGS}" fi if test "${CXXFLAGS}" = ""; then CXXFLAGS="${CXXFLAGS_OPT} ${EXTRA_CXXFLAGS}" fi # Fortran: FCFLAGS_OPT must not be included (per-directory optimizations) if test "${FCFLAGS}" = ""; then FCFLAGS="${EXTRA_FCFLAGS}" fi # Check if the user has defined a MPI preprocessing option mpi_defs=`echo "${MPI_CPPFLAGS}" | ${EGREP} -e '-DMPI'` if test "${mpi_defs}" = ""; then MPI_CPPFLAGS="-DMPI ${MPI_CPPFLAGS}" fi # Adjust MPI flags MPI_CPPFLAGS="${CPPFLAGS} ${MPI_CPPFLAGS}" MPI_CFLAGS="${CFLAGS} ${MPI_CFLAGS}" MPI_CXXFLAGS="${CXXFLAGS} ${MPI_CXXFLAGS}" MPI_FCFLAGS="${FCFLAGS} ${MPI_FCFLAGS}" if test "${enable_mpi}" = "yes" -a "${MPI_FC}" != ""; then FC="${MPI_FC}" if test "${enable_64bit_flags}" = "yes"; then FC="${FC} ${FCFLAGS_64BITS}" fi fi # Wrap buggy Fortran compilers (keep always after MPI) FC_NOWRAP="${FC}" if test "${fc_wrap}" = "yes"; then FC="${abinit_builddir}/util/build/wrap-fc" fi AC_SUBST(FC_NOWRAP) # Force F77 and F90 environment variables (keep always last) F77="${FC}" FFLAGS="${FCFLAGS}" F90="${FC}" F90FLAGS="${FCFLAGS}" # The following is required for old fixed-form Fortran libraries AC_SUBST(F77) AC_SUBST(FFLAGS) # ---------------------------------------------------------------------------- # # # Output configuration # ABI_MSG_SECTION([Output]) # Output files # Note: later, add tests/atconfig and tests/atlocal for test suite ABI_OUTPUT # The end ABI_MSG_FC_BUGGY(${fc_type}) ABI_MSG_END