# -*- Autoconf -*- # # Copyright (C) 2005-2024 ABINIT Group (Yann Pouillon) # # 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 # # Enhance help message m4_divert_text([HELP_END], [ In order to facilitate the configuration of Abinit, you can save the options you regularly use into a file. For full instructions, please consult the doc/build/config-template.ac9 file in this directory tree. A lot more documentation on how to build and run Abinit is available on the Abinit Wiki. Please consult it at https://wiki.abinit.org/ whenever needed. Examples of configuration files for clusters are available at https://github.com/abinit/abiconfig. ]) # Initialize Autoconf AC_PREREQ(2.59) AC_INIT([ABINIT], [m4_esyscmd([config/scripts/git-version-gen .tarball-version])], [https://bugs.launchpad.net/abinit/], [abinit]) AC_REVISION([Autotools support for ABINIT 9]) AC_CONFIG_AUX_DIR([config/gnu]) AC_CONFIG_MACRO_DIR([config/m4]) AC_CONFIG_SRCDIR([src/98_main/abinit.F90]) AC_CONFIG_HEADERS([config.h]) # ---------------------------------------------------------------------------- # # # Startup # ABI_MSG_SECTION([Basic initialization]) # Initial setup AC_CANONICAL_TARGET # Disable pax to initialise Automake because it causes 'make dist' to fail alias pax='/bin/false' AM_INIT_AUTOMAKE([1.10 tar-ustar]) unalias pax # Early Abinit setup - the order is important! ABI_INIT_DIRS ABI_INIT_VERSION ABI_INIT_CPU_INFO ABI_INIT_OS_INFO ABI_INIT_HEADER ABI_INIT_ARCH # Check for common programs AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_SED AC_PROG_AWK AC_PROG_GREP AC_PATH_PROG(BOURNE_SHELL, sh, /bin/sh) AC_PATH_PROG(MV, mv, /bin/false) AC_PATH_PROG(PERL, perl, /bin/false) AC_PATH_PROG(RM, rm, /bin/false) AC_CHECK_PROGS(PATCH, [patch gpatch]) AC_CHECK_PROGS(TAR, [tar gtar star]) # Workaround for the "grep -e" issue on Solaris systems AC_PROG_EGREP # Workaround for the wrong path to install-sh on Mac systems ABI_PROG_MKDIR_P # Look for a command that provide absolute paths AC_CHECK_PROGS(REALPATH, [realpath readlink], [/bin/true]) test "${REALPATH}" = "readlink" && REALPATH="${REALPATH} -f" # We might need a Python interpreter early on ABI_PROG_PYTHON # Define command-line arguments ABI_OPTIONS_DEFINE # Read config file and ensure that priorities are respected ABI_ENV_BACKUP ABI_OPTIONS_BACKUP ABI_LOAD_OPTIONS ABI_OPTIONS_CFG_TRANSFER ABI_OPTIONS_RECALL ABI_ENV_RECALL # Set still undefined options ABI_OPTIONS_SETUP # Initialize environment, taking options into account ABI_ENV_INIT AC_SUBST(CC_LDFLAGS) AC_SUBST(CC_LIBS) AC_SUBST(CXX_LDFLAGS) AC_SUBST(CXX_LIBS) AC_SUBST(FC_LDFLAGS) AC_SUBST(FC_LIBS) # Initialize install dirs (requires version and config options to be set) ABI_INIT_INSTALL_DIRS # Disable wrapping of Fortran compiler by default abi_fc_wrap="no" # Save user-defined CPP abi_cpp_user="${CPP}" # Set-up required information for core libraries ABI_CORELIBS_INIT # ---------------------------------------------------------------------------- # # # Build-system information # ABI_MSG_SECTION([Build-system information]) # Display ABINIT version AC_MSG_NOTICE([ABINIT version ${ABINIT_VERSION}]) AC_MSG_NOTICE([]) # Display Autotools version information ABI_INFO_AUTOTOOLS # Display UI changes ABI_INFO_OPTIONS_CHANGED # Display changes in feature triggers ABI_INFO_TRIGGERS_CHANGED # ---------------------------------------------------------------------------- # # # Check option consistency # # NOTE: please hack this section with EXTREME CARE ABI_MSG_SECTION([Option consistency checking]) # --------- # # Libraries # # --------- # abi_optchk_ok="yes" AC_MSG_NOTICE([checking consistency of command-line options]) # C-CLOCK requires the building of 02_clib if test "${abi_cclock_enable}" = "yes"; then if test "${abi_clib_enable}" = "" -o "${abi_clib_enable}" = "no"; then AC_MSG_NOTICE([|---> enabling CLib (required by CClock, experimental!)]) abi_clib_enable="yes" abi_optchk_ok="no" fi fi # Only one of MPI I/O and NetCDF I/O can be the default if test "${abi_netcdf_default_enable}" = "yes" -a \ "${abi_mpi_io_default_enable}" = "yes"; then AC_MSG_ERROR([MPI I/O and NetCDF are mutually exclusive default I/O modes These maintainer options should only be used for testing purposes. Please do not use them unless you really know what you are doing.]) fi # Closing remarks if test "${abi_optchk_ok}" = "yes"; then AC_MSG_NOTICE([|---> all OK]) fi AC_MSG_NOTICE([]) # ------------------- # # Final step: parsing # # ------------------- # ABI_OPTIONS_PARSE AC_MSG_NOTICE([|---> all OK]) # ---------------------------------------------------------------------------- # # # Feature triggers startup # ABI_MSG_SECTION([Feature triggers and architecture startup]) # Init Steredeg core features SD_CORE_INIT # Do we want to use fallbacks? (must be first) ABI_FALLBACKS_INIT # ------------------------------------ # # Prepare MPI support ABI_MPI_INIT # Prepare GPU support (requires MPI) # Note: must be done after MPI ABI_GPU_INIT if test "${abi_gpu_enable}" = "yes" -a "${abi_mpi_enable}" != "yes"; then AC_MSG_ERROR([GPU support requires MPI]) fi # ------------------------------------ # # Init triggers parameters (must be call after we know about fallbacks) # Note: MPI and GPU must be initialized after feature triggers ABI_TRIGGERS_INIT # ---------------------------------------------------------------------------- # # # C support # ABI_MSG_SECTION([C support]) # Set basic Abinit C parameters # Note: advanced fetaures are set later on ABI_PROG_CC # ---------------------------------------------------------------------------- # # # C++ support # ABI_MSG_SECTION([C++ support]) # Set basic Abinit C++ parameters # Note: advanced fetaures are set later on ABI_PROG_CXX # ---------------------------------------------------------------------------- # # # Fortran support # ABI_MSG_SECTION([Fortran support]) # Set basic Abinit Fortran parameters # Note: advanced fetaures are set later on ABI_PROG_FC # Set default file extensions ABI_FC_EXTENSIONS # Get module file case ABI_FC_MOD_CASE # The IBM Fortran compiler crashes if the mpi module is included # more than once if test "${abi_fc_vendor}" = "ibm" -a "${abi_mpi_enable}" = "yes"; then AC_MSG_NOTICE([activating MPI workaround for the IBM Fortran compiler]) AC_DEFINE([HAVE_MPI_INCLUDED_ONCE], 1, [Define to 1 if you are using XLF.]) fi # Wrap Fortran compiler calls if needed or requested # Note: must be the last step of basic Fortran configuration if test "${abi_fc_wrapper_enable}" = "yes"; then abi_fc_wrap="yes" fi # FIXME: obsolete mechanism AC_SUBST(fc_mod_fcflags) # ---------------------------------------------------------------------------- # # # Hints # ABI_MSG_SECTION([Hints for the build flags]) # Look for a true C preprocessor if test "${TRUE_CPP}" = ""; then AC_CHECK_PROGS([TRUE_CPP],[cpp]) fi if test "${TRUE_CPP}" = ""; then AC_PATH_PROG([TRUE_CPP],[cpp]) fi if test "${TRUE_CPP}" = ""; then if test -x "/lib/cpp"; then TRUE_CPP="/lib/cpp" fi fi AC_MSG_CHECKING([for a true C preprocessor]) if test "${TRUE_CPP}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${TRUE_CPP}]) fi # Set Fortran preprocessor when needed if test "${abi_fc_wrap}" = "yes"; then AC_MSG_CHECKING([for a Fortran-compatible C preprocessor]) if test "${FPP}" = ""; then if test "${abi_cpp_user}" != ""; then FPP="${abi_cpp_user}" else if test "${TRUE_CPP}" != ""; then FPP="${TRUE_CPP}" else FPP="${CPP}" fi fi fi AC_MSG_RESULT([${FPP}]) fi # FIXME: set CPP vendor case "${target_os}" in aix*) abi_cpp_vendor="ibm" abi_xpp_vendor="ibm" abi_fpp_vendor="ibm" ;; *) abi_cpp_vendor="default" abi_xpp_vendor="default" abi_fpp_vendor="default" ;; esac case "${abi_fc_vendor}" in ibm) abi_fpp_vendor="ibm" ;; esac AC_MSG_NOTICE([setting C preprocessor vendor to '${abi_cpp_vendor}']) AC_MSG_NOTICE([setting C++ preprocessor vendor to '${abi_xpp_vendor}']) AC_MSG_NOTICE([setting Fortran preprocessor vendor to '${abi_fpp_vendor}']) # Preset flags to have the source building properly if test "${abi_hints_enable}" = "yes"; then # C support ABI_CPP_HINTS ABI_CC_HINTS # C++ support ABI_XPP_HINTS ABI_CXX_HINTS # Fortran support ABI_FPP_HINTS ABI_FC_HINTS # Library archiver support #ABI_AR_HINTS fi # Set Fortran flags according to openMP options _ABI_OMP_SET_FCFLAGS # Set Fortran preprocessing flags if test "${abi_fc_wrap}" = "yes"; then test "${FPPFLAGS}" = "" && FPPFLAGS="${FPPFLAGS_HINTS_EXT}" fi # Display Fortran preprocessing parameters AC_MSG_CHECKING([which Fortran preprocessor to use]) if test "${FPP}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${FPP}]) fi AC_MSG_CHECKING([which Fortran preprocessor flags to apply]) if test "${FPPFLAGS}" = ""; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${FPPFLAGS}]) fi # Display Fortran compiler wrapper status AC_MSG_CHECKING([whether to wrap Fortran compiler calls]) AC_MSG_RESULT([${abi_fc_wrap}]) # Export true CPPFLAGS (required by LibXC) AC_SUBST(CPPFLAGS_HINTS_EXT) # ---------------------------------------------------------------------------- # # # Debugging # # NOTE: # # * Please do not try to set-up the *FLAGS_DEBUG variables manually, # as they will systematically be overwritten. These flags should be # modified by the --with-*-dbgflags options only, and --enable-debug # set to "yes" in this case. # ABI_MSG_SECTION([Debugging]) # Init debug flags ABI_DEBUG_INIT([${abi_debug_flavor}]) # Activate "design-by-contract" debugging tests when paranoid AC_MSG_CHECKING([whether to activate design-by-contract debugging]) if test "${abi_debug_flavor}" = "paranoid"; then AC_DEFINE([DEBUG_CONTRACT], 1, [Define to 1 if you want to activate design-by-contract debugging tests.]) AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi AM_CONDITIONAL(DO_BUILD_32_CONTRACT, [test "${abi_debug_flavor}" = "paranoid"]) # ---------------------------------------------------------------------------- # # # Optimizations # # NOTE: The optimizations will be taken from *FLAGS_OPTIM environment # variables if with_optim_flavor is set to yes, or set to predefined values # for other optimization profiles. # ABI_MSG_SECTION([Optimizations]) # Disable optimizations if debug mode is activated in source files if test "${abi_debug_source}" = "yes"; then if test "${abi_optim_flavor}" != "none"; then AC_MSG_WARN([disabling optimizations]) fi abi_optim_flavor="none" fi # Init optimization flags # Note: must be done only once debugging is configured ABI_OPTIM_INIT([${abi_optim_flavor}]) # FIXME: 20_datashare does not support optimizations AC_MSG_NOTICE([disabling optimizations for src/20_datashare/]) fcflags_opt_20_datashare="-O0" AC_MSG_NOTICE([disabling optimizations for src/43_ptgroups/]) fcflags_opt_43_ptgroups="-O0" # FIXME: AMD LLVM fork for OpenMP GPU (aka AOMP) has a sensitive OpenMP GPU implementation, so we enable it where needed. # Checked with version 16.0.0 shipped with ROCm 5.6.0 (July 2023). if test "${abi_fc_vendor}" == "llvm" -a "${abi_gpu_flavor}" == "hip-double"; then if test "${abi_openmp_offload_enable}" = "yes"; then fcflags_opt_28_numeric_noabirule="${amd_openmp_flags}" fcflags_opt_45_xgTools="${amd_openmp_flags}" fcflags_opt_46_ghc_omp="${amd_openmp_flags}" fcflags_opt_66_nonlocal="${amd_openmp_flags}" fcflags_opt_66_wfs="${amd_openmp_flags}" fcflags_opt_67_common="${amd_openmp_flags}" fcflags_opt_79_seqpar_mpi="${amd_openmp_flags}" fcflags_opt_98_main="${amd_openmp_flags}" fi fi # Set per-directory Fortran optimizations # Note: must be done only once FCFLAGS_OPTIM is set ABI_OPTFLAGS_DIRS([${FCFLAGS_OPTIM}]) # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Save configuration # ABI_MSG_SECTION([Build flags]) # 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) # Preserve environment ABI_ENV_BACKUP # Look for archiver if test "${AR}" = ""; then AC_CHECK_PROGS(AR,[ar xiar]) fi # Set archiver command flag test "${ARFLAGS_CMD}" = "" && ARFLAGS_CMD="rc" AC_SUBST(ARFLAGS_CMD) # Look for ranlib AC_PROG_RANLIB # Restore back compile flags CFLAGS="${abi_env_CFLAGS}" CXXFLAGS="${abi_env_CXXFLAGS}" FCFLAGS="${abi_env_FCFLAGS}" # We want to be able access the archiver from anywhere AC_SUBST(AR) AC_SUBST(ARFLAGS) # Report the use of libtool-related options AC_SUBST(enable_shared) AC_SUBST(enable_static) AC_SUBST(with_gnu_ld) # Final adjustments for library archiver test "${ARFLAGS}" = "" && \ ARFLAGS="${ARFLAGS_DEBUG} ${ARFLAGS_OPTIM} ${ARFLAGS_HINTS} ${ARFLAGS_EXTRA} ${ARFLAGS_CMD}" # Final adjustments for C test "${CFLAGS}" = "" && \ CFLAGS="${CFLAGS_DEBUG} ${CFLAGS_OPTIM} ${CFLAGS_HINTS} ${CFLAGS_EXTRA}" test "${CC_LDFLAGS}" = "" && \ CC_LDFLAGS="${CC_LDFLAGS_DEBUG} ${CC_LDFLAGS_OPTIM} ${CC_LDFLAGS_HINTS} ${CC_LDFLAGS_EXTRA}" test "${CC_LIBS}" = "" && \ CC_LIBS="${CC_LIBS_DEBUG} ${CC_LIBS_OPTIM} ${CC_LIBS_HINTS} ${CC_LIBS_EXTRA}" # Final adjustments for C++ test "${CXXFLAGS}" = "" && \ CXXFLAGS="${CXXFLAGS_DEBUG} ${CXXFLAGS_OPTIM} ${CXXFLAGS_HINTS} ${CXXFLAGS_EXTRA}" test "${CXX_LDFLAGS}" = "" && \ CXX_LDFLAGS="${CXX_LDFLAGS_DEBUG} ${CXX_LDFLAGS_OPTIM} ${CXX_LDFLAGS_HINTS} ${CXX_LDFLAGS_EXTRA}" test "${CXX_LIBS}" = "" && \ CXX_LIBS="${CXX_LIBS_DEBUG} ${CXX_LIBS_OPTIM} ${CXX_LIBS_HINTS} ${CXX_LIBS_EXTRA}" # Final adjustments for Fortran # Note: FCFLAGS_OPTIM must not be included (per-directory optimizations) test "${FCFLAGS}" = "" && \ FCFLAGS="${FCFLAGS_DEBUG} ${FCFLAGS_HINTS} ${FCFLAGS_OPENMP} ${FCFLAGS_OPENMP_OFFLOAD} ${FCFLAGS_EXTRA}" test "${FC_LDFLAGS}" = "" && \ FC_LDFLAGS="${FC_LDFLAGS_DEBUG} ${FC_LDFLAGS_OPTIM} ${FC_LDFLAGS_HINTS} ${FC_LDFLAGS_EXTRA}" test "${FC_LIBS}" = "" && \ FC_LIBS="${FC_LIBS_DEBUG} ${FC_LIBS_OPTIM} ${FC_LIBS_HINTS} ${FC_LIBS_EXTRA}" # Final adjustments for preprocessors test "${CPPFLAGS}" = "" && \ CPPFLAGS="${CPPFLAGS_DEBUG} ${CPPFLAGS_OPTIM} ${CPPFLAGS_HINTS} ${CPPFLAGS_EXTRA}" test "${XPPFLAGS}" = "" && \ XPPFLAGS="${XPPFLAGS_DEBUG} ${XPPFLAGS_OPTIM} ${XPPFLAGS_HINTS} ${XPPFLAGS_EXTRA}" test "${FPPFLAGS}" = "" -a "${abi_fc_wrap}" = "no" && \ FPPFLAGS="${FPPFLAGS_DEBUG} ${FPPFLAGS_OPTIM} ${FPPFLAGS_HINTS} ${FPPFLAGS_EXTRA}" # Determine Fortran link flags (FCLIBS) # This is needed after FCFLAGS has been set as some compilers have extra # libraries linked due to optimizations levels or OpenMP # This step would be performed inside AC_FC_WRAPPERS but it fails due to a mischievous # double-quote in FCLIBS when using Cray compiler, so we trim it out in that specific case. AC_FC_LIBRARY_LDFLAGS if test "${abi_fc_vendor}" = "cray"; then FCLIBS=`echo ${FCLIBS} | tr '"' ' '` fi # Determine Fortran-C name mangling scheme AC_FC_WRAPPERS # FIXME: temporary workaround for Macs if test "${abi_cpu_platform}" = "apple"; then AC_MSG_WARN([${abi_cpu_platform} is not able to handle full link information]) AC_MSG_WARN([static builds will fail]) else AC_MSG_NOTICE([static builds may be performed]) FC_LIBS="${FC_LIBS} ${FCLIBS}" fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Advanced language features # # Note: these tests have to be performed after the flags have been # saved. ABI_MSG_SECTION([Advanced language features]) # Look for desired C features ABI_CC_FEATURES # Look for desired Fortran features ABI_FC_FEATURES # Look for desired Python features ABI_PY_FEATURES # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Platform-specific libraries # # Note: these tests have to be performed after the flags have been # saved. ABI_MSG_SECTION([Platform-specific libraries]) AC_MSG_CHECKING([which operating system we have]) AC_MSG_RESULT([${target_os}]) # Basic mathematical functions AC_LANG_PUSH([C]) AC_SEARCH_LIBS([expl], [m ml], [abi_math_expl_ok="yes"], [abi_math_expl_ok="no"]) AC_SEARCH_LIBS([logl], [m ml], [abi_math_logl_ok="yes"], [abi_math_logl_ok="no"]) AC_LANG_POP([C]) # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Multicore architecture support # Note: the following settings will be used by the connectors. ABI_MSG_SECTION([Multicore architecture support]) # MPI support ABI_MPI_DETECT if test "${abi_mpi_enable}" = "yes"; then ABI_MPI_DUMP fi # OpenMP support # Note: OPENMP_INIT has to be done after openMP Fortran flags have been set ABI_OPENMP_INIT ABI_OPENMP_DETECT # GPU support ABI_GPU_DETECT # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Optional features - Initialization # ABI_MSG_SECTION([Initialization of optional features]) # Init HDF5 #SD_HDF5_INIT([optional fail no-fortran]) #SD_HDF5_INIT([optional warn no-fortran]) SD_HDF5_INIT([required no-fortran warn]) # Init FFTW3 SD_FFTW3_INIT([optional skip]) # Init Levmar SD_LEVMAR_INIT([optional fail]) # Init LibPSML #SD_LIBPSML_INIT([optional fail]) SD_LIBPSML_INIT([optional warn]) # Init LibXC #SD_LIBXC_INIT([no-fortran optional fail]) SD_LIBXC_INIT([required no-fortran warn]) # Init NetCDF #SD_NETCDF_INIT([optional fail]) SD_NETCDF_INIT([required warn]) # Init NetCDF-Fortran #SD_NETCDF_FORTRAN_INIT([optional fail]) SD_NETCDF_FORTRAN_INIT([required warn]) # Init PAPI SD_PAPI_INIT([optional fail]) # Init PFFT SD_PFFT_INIT([optional skip]) # Init TRIQS SD_TRIQS_INIT([optional fail]) # Init Wannier90 #SD_WANNIER90_INIT([optional fail], [-lwannier90]) SD_WANNIER90_INIT([optional warn], [-lwannier90]) # Init XMLF90 #SD_XMLF90_INIT([optional fail]) SD_XMLF90_INIT([optional warn]) # Init KOKKOS SD_KOKKOS_INIT([optional fail]) #SD_KOKKOS_INIT([optional warn]) # Init YAKL SD_YAKL_INIT([optional fail]) #SD_YAKL_INIT([optional warn]) # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Linear algebra support # ABI_MSG_SECTION([Linear algebra support]) #SD_LINALG_INIT([required warn]) # This is called by ABI_LINALG_INIT now #SD_LINALG_INIT_FLAVOR # This is called by ABI_LINALG_INIT now ABI_LINALG_INIT ABI_LINALG_DETECT # the minimum needed to declare linalg working... sd_linalg_ok="no" test "${sd_linalg_has_blas}" = "yes" -a "${sd_linalg_has_lapack}" = "yes" && sd_linalg_ok="yes" # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Optimized FFT support (must be done after linear algebra is fully configured) # ABI_MSG_SECTION([Optimized FFT support]) if test "${sd_linalg_enable}" = "yes"; then SD_FFT_INIT SD_FFT_DETECT else echo "Skip FFT setting : linalg not enabled..." fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Profiling and performance analysis # #ABI_MSG_SECTION([Profiling and performance analysis]) # ---------------------------------------------------------------------------- # # # Feature triggers (optional features) # ABI_MSG_SECTION([Feature triggers]) # VERY IMPORTANT: THE ORDER IS CRITICAL - DO NOT CHANGE IT! # Note: some of the following packages are mandatory to run Abinit with # full capabilities, although internal implementations may provide # limited functionality in some cases # ------------------------------ # # PAPI library support SD_PAPI_DETECT AC_MSG_CHECKING([whether to enable the internal Abinit timer]) AC_MSG_RESULT([${abi_timer_enable}]) if test "${sd_papi_ok}" != "yes"; then if test "${abi_timer_enable}" = "yes"; then AC_DEFINE([HAVE_TIMER_ABINIT], 1, [Define to 1 if you want to use the Abinit timer.]) fi fi # ------------------------------ # # HDF5 library support SD_HDF5_DETECT AC_MSG_NOTICE([]) AC_MSG_NOTICE([dumping HDF5 parameters for diagnostics]) AC_MSG_NOTICE([---------------------------------------]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([ * sd_hdf5_enable = ${sd_hdf5_enable}]) AC_MSG_NOTICE([ * sd_hdf5_status = ${sd_hdf5_status}]) AC_MSG_NOTICE([ * sd_hdf5_h5cc = ${sd_hdf5_h5cc}]) AC_MSG_NOTICE([ * sd_hdf5_has_mpi = ${sd_hdf5_has_mpi}]) AC_MSG_NOTICE([]) ## Parallel NetCDF requires a few conditions to work # TODO abi_netcdf_mpi_enable not defined #if test "${abi_netcdf_mpi_enable}" = "yes"; then # if test "${sd_mpi_ok}" != "yes"; then # AC_MSG_ERROR([parallel NetCDF requested but MPI is not available]) # fi # if test "${abi_mpi_io_enable}" != "yes"; then # AC_MSG_ERROR([parallel NetCDF requested but MPI I/O is disabled]) # fi # if test "${sd_hdf5_mpi_ok}" != "yes"; then # AC_MSG_ERROR([parallel NetCDF requested but parallel HDF5 is not available]) # fi #fi # NetCDF library support (must be done after HDF5) SD_NETCDF_DETECT AC_MSG_NOTICE([]) AC_MSG_NOTICE([dumping NetCDF parameters for diagnostics]) AC_MSG_NOTICE([-----------------------------------------]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([ * sd_netcdf_ok = ${sd_netcdf_ok}]) AC_MSG_NOTICE([ * sd_netcdf_mpi_ok = ${sd_netcdf_mpi_ok}]) AC_MSG_NOTICE([ * sd_netcdf_enable = ${sd_netcdf_enable}]) AC_MSG_NOTICE([ * sd_netcdf_prefix = ${sd_netcdf_prefix}]) AC_MSG_NOTICE([]) # NetCDF library support (must be done after HDF5) SD_NETCDF_FORTRAN_DETECT AC_MSG_NOTICE([]) AC_MSG_NOTICE([dumping NetCDFF parameters for diagnostics]) AC_MSG_NOTICE([------------------------------------------]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([ * sd_netcdf_fortran_ok = ${sd_netcdf_fortran_ok}]) AC_MSG_NOTICE([ * sd_netcdf_fortran_mpi_ok = ${sd_netcdf_fortran_mpi_ok}]) AC_MSG_NOTICE([ * sd_netcdf_fortran_enable = ${sd_netcdf_fortran_enable}]) AC_MSG_NOTICE([ * sd_netcdf_fortran_prefix = ${sd_netcdf_fortran_prefix}]) AC_MSG_NOTICE([]) # XMLF90 library support SD_XMLF90_DETECT # LibPSML library support if test "${sd_xmlf90_ok}" = "yes"; then SD_LIBPSML_DETECT else if test "${sd_libpsml_enable}" = "auto"; then sd_libpsml_enable="no" else if test "${sd_libpsml_enable}" != "no"; then #AC_MSG_ERROR([LibPSML support has been requested but XMLF90 does not work AC_MSG_WARN([LibPSML support has been requested but XMLF90 does not work Please point the configuration to a working XMLF90 installation or disable LibPSML support]) fi fi fi AM_CONDITIONAL([DO_BUILD_PSML], [test "${sd_libpsml_enable}" = "yes " -a "${sd_libpsml_ok}" = "yes"]) # ------------------------------ # # Levmar library support SD_LEVMAR_DETECT # ------------------------------ # # LibXC library support #ABI_LIBXC_DETECT(2, 2) SD_LIBXC_DETECT AM_CONDITIONAL([DO_BUILD_01_LIBXC_EXT], [test "${sd_libxc_ok}" = "yes"]) # TRIQS support SD_TRIQS_DETECT AM_CONDITIONAL([DO_BUILD_67_TRIQS_EXT], [test "${sd_triqs_enable}" = "yes" -a "${sd_triqs_ok}" = "yes"]) # Wannier90 library support SD_WANNIER90_DETECT # AtomPAW integration support ABI_CHECK_ATOMPAW_BINS # KOKKOS library support SD_KOKKOS_DETECT # YAKL library support SD_YAKL_DETECT # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Build workflow # ABI_MSG_SECTION([Build workflow]) # Initialize the low-level routines of ABINIT as an external component SD_ABINIT_COMMON_INIT([optional skip]) SD_ABINIT_COMMON_DETECT # Initialize the LibPAW routines as an external component SD_LIBPAW_INIT([optional skip]) SD_LIBPAW_DETECT # ------------------------------ # # Init BigDFT (requires knowledge about ABINIT Common and LibPAW) if test "${sd_libxc_enable}" = "yes" -a "${sd_linalg_enable}" = "yes"; then #SD_BIGDFT_INIT([optional fail]) SD_BIGDFT_INIT([optional warn]) # BigDFT library support (requires linear algebra and LibXC) SD_BIGDFT_DETECT else echo "Skip BIGDFT setting : libxc not enabled..." fi # ------------------------------ # AC_MSG_CHECKING([how to build the components of ABINIT]) abi_build_steps="" if test "${sd_abinit_common_ok}" = "yes"; then test "${abi_build_steps}" = "" || abi_build_steps="${abi_build_steps}+" abi_build_steps="${abi_build_steps}common" fi if test "${sd_libpaw_ok}" = "yes"; then test "${abi_build_steps}" = "" || abi_build_steps="${abi_build_steps}+" abi_build_steps="${abi_build_steps}libpaw" fi if test "${sd_bigdft_ok}" = "yes"; then test "${abi_build_steps}" = "" || abi_build_steps="${abi_build_steps}+" abi_build_steps="${abi_build_steps}bigdft" fi if test "${abi_build_steps}" = ""; then abi_build_steps="monolith" else abi_build_steps="${abi_build_steps}+core" fi AC_MSG_RESULT([${abi_build_steps}]) # Allow the separate build of ABINIT Common AM_CONDITIONAL([DO_BUILD_SHARED_COMMON], [test "{sd_abinit_common_ok}" != "yes"]) # Allow the separate build of LibPAW AM_CONDITIONAL([DO_BUILD_SHARED_LIBPAW], [test "{sd_libpaw_ok}" != "yes"]) # FIXME: Let LibPAW know it is embedded in ABINIT AC_DEFINE([HAVE_LIBPAW_ABINIT], 1, [Must be defined to 1 to have LibPAW properly working.]) # Warn the user if support for wavelets is ill-configured if test "${abi_build_steps}" = "monolith" -a "${abi_bigdft_enable}" = "yes"; then AC_MSG_WARN([BigDFT will soon require the separate installation of ABINIT Common and LibPAW]) fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Final check of feature triggers # ABI_MSG_SECTION([Feature triggers summary]) # Display summary table ABI_TRIGGERS_SUMMARY #------------------------ START JMB --------------------------------------# # Check status of mandatory fallbacks status="" mandatory="" # Check linalg if test "${sd_linalg_flavor_req}" != "auto"; then if test "${sd_linalg_flavor}" != "${sd_linalg_flavor_req}"; then ABI_MSG_NOTICE_L([linalg-flavor],[__INFO__ : the linalg flavor is not the one requested!]) fi fi if test "${sd_linalg_enable}" != "yes"; then ABI_MSG_NOTICE_L([linalg-mandatory],[__CAUTION__ : linalg is __MANDATORY__ !]) mandatory="#" fi # Check HDF5 serial if test "${sd_hdf5_enable}" = "no"; then ABI_MSG_NOTICE_L([hdf5-mandatory],[__CAUTION__ : HDF5 is __MANDATORY__ !]) mandatory="#" else if test "${sd_hdf5_ok}" != "yes";then ABI_MSG_NOTICE_L([hdf5-nw],[__WARNING__ : HDF5 is not __WORKING__ !]) status="#" fi fi if test "${sd_hdf5_ok}" = "yes";then # Check NetCDF if test "${sd_netcdf_enable}" = "no"; then ABI_MSG_NOTICE_L([netcdf-mandatory],[__CAUTION__ : NetCDF is __MANDATORY__ !]) mandatory="#" else if test "${sd_netcdf_ok}" != "yes";then ABI_MSG_NOTICE_L([netcdf-nw],[__WARNING__ : NetCDF is not __WORKING__ !]) status="#" fi fi # Check NetCDF_fortran if test "${sd_netcdf_fortran_enable}" = "no"; then ABI_MSG_NOTICE_L([netcdf_fortran-mandatory],[__CAUTION__ : NetCDF Fortran is __MANDATORY__ !]) mandatory="#" else if test "${sd_netcdf_fortran_ok}" != "yes";then ABI_MSG_NOTICE_L([netcdf_fortran-nw],[__WARNING__ : NetCDF Fortran is not __WORKING__ !]) status="#" fi fi fi # Check LibXC if test "${sd_libxc_enable}" = "no"; then ABI_MSG_NOTICE_L([libxc-mandatory],[__CAUTION__ : LibXC is __MANDATORY__ !]) mandatory="#" else if test "${sd_libxc_ok}" != "yes";then ABI_MSG_NOTICE_L([libxc-nw],[__WARNING__ : LibXC is not __WORKING__ !]) status="#" fi fi # Check Wannier90 if test "${sd_wannier90_enable}" = "yes"; then if test "${sd_wannier90_ok}" != "yes"; then ABI_MSG_NOTICE_S([__CAUTION__ : Wannier90 is not __WORKING__ !], [ Action : check your Wannier90 installation]) status="#" fi fi # Check libPSML if test "${sd_libpsml_enable}" = "yes"; then if test "${sd_libpsml_ok}" != "yes"; then ABI_MSG_NOTICE_S([__CAUTION__ : libPSML is not __WORKING__ !], [ Action : check your libPSML installation]) status="#" fi fi # Check xmlf90 if test "${sd_xmlf90_enable}" = "yes"; then if test "${sd_xmlf90_ok}" != "yes"; then ABI_MSG_NOTICE_S([__CAUTION__ : xmlf90 is not __WORKING__ !], [ Action : check your xmlf90 installation]) status="#" fi fi # Help to produce libraires if test ! -z "${mandatory}"; then ABI_MSG_NOTICE_L([help-fb],[We can __help__ you !]) fi if test ! -z "${status}" -o ! -z "${mandatory}"; then ABI_MSG_NOTICE_S([ __Problems must be solved before continuing__ ]) fi # Always generate a build script for required fallbacks #AC_CONFIG_FILES([fallbacks/INSTALL fallbacks/README]) # AC_CONFIG_FILES([fallbacks/build-abinit-fallbacks.sh]) #AC_CONFIG_COMMANDS([chmod +x fallbacks/build-abinit-fallbacks.sh]) #AC_OUTPUT # Old formulation: AC_OUTPUT([fallbacks/INSTALL fallbacks/README fallbacks/build-abinit-fallbacks.sh],[chmod +x fallbacks/build-abinit-fallbacks.sh]) AC_OUTPUT([fallbacks/INSTALL fallbacks/README fallbacks/build-abinit-fallbacks.sh],[chmod +x fallbacks/build-abinit-fallbacks.sh]) # Check that we have all required fallbacks ABI_FALLBACKS_VALIDATE([${abi_fbk_required}]) # Report situation #if test "${abi_fbk_required}" = ""; then # AC_MSG_NOTICE([no fallback required - you may run production calculations]) #else # AC_MSG_NOTICE([fallbacks required - you should not run production calculations]) #fi # Check exit if test ! -z "${status}" -o ! -z "${mandatory}"; then exit 2 fi #-------------------- END JMB --------------------------------------------# # FIXME: copying linear algebra tarball for now, # ensuring ~/.abinit/tarballs/ exists if test "${abi_fbk_linalg}" = "yes"; then tmp_abinit_tardir="${HOME}/.abinit/tarballs" tmp_linalg_tarball="lapack-abinit_6.10.tar.gz" if test ! -s "${tmp_abinit_tardir}/${tmp_linalg_tarball}"; then AC_MSG_NOTICE([using tarball repository ${tmp_abinit_tardir}]) if test ! -e "${tmp_abinit_tardir}"; then AC_MSG_NOTICE([creating '${tmp_abinit_tardir}']) ${INSTALL} -d -m 755 "${tmp_abinit_tardir}" elif test ! -d "${tmp_abinit_tardir}"; then AC_MSG_ERROR(['${tmp_abinit_tardir}' is not a directory please move away the current file and reconfigure Abinit]) fi AC_MSG_NOTICE([installing linear algebra fallback tarball to '${tmp_abinit_tardir}']) ${INSTALL} -m 644 "${abinit_srcdir}/fallbacks/${tmp_linalg_tarball}" \ "${tmp_abinit_tardir}" fi fi # Check that all triggers or their fallbacks are working # FIXME: triggers must not fall back if with_* options are provided for pkg in ${abi_trig_packages}; do tmp_trig_errors="" eval tmp_pkg_ok=\"\$\{abi_${pkg}_ok\}\" eval tmp_fbk_ok=\"\$\{abi_fbk_${pkg}_ok\}\" if test "${tmp_pkg_ok}" = "no" -a "${tmp_fbk_ok}" != "yes"; then tmp_trig_errors="${tmp_trig_errors} ${pkg}" fi done if test "${tmp_trig_errors}" != ""; then for pkg in ${tmp_trig_errors}; do tmp_fbk_error=`echo "${abi_fbk_packages}" | grep "${pkg}"` AC_MSG_WARN([${pkg} support is unavailable or broken]) if test "${tmp_fbk_error}" != ""; then AC_MSG_WARN([${pkg} fallback is unavailable]) fi done AC_MSG_ERROR([some optional features were not found on this system (see messages above) Please correct the options of configure to match your actual situation]) fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Optional source code # ABI_MSG_SECTION([Optional source code]) # Defines and conditionals for CPP options # (see config/specs/options.conf for details) ABI_OPTIONS_CPP_DEFINES AM_CONDITIONAL([DO_BUILD_67_PYTHON_INVOCATION_EXT], [test "${enable_python_invocation}" = "yes"]) # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Buggy Fortran compilers # # NOTE: must be done at the end because the wrapper is built by configure # Wrap buggy Fortran compilers FC_NOWRAP="${FC}" if test "${abi_fc_wrap}" = "yes"; then FC="${abinit_builddir}/config/wrappers/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 oldish fixed-form Fortran libraries AC_SUBST(F77) AC_SUBST(FFLAGS) # Void CPPFLAGS to allow for C/Fortran mixing ABI_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="" # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # FIXME: Temporary options to remove case "${ABINIT_LEGACY_OPTION}" in mpi1) AC_DEFINE([HAVE_MPI1], 1, [Define to 1 if you have a MPI-1 implementation (obsolete, broken).]) ;; wannier90_v1) AC_DEFINE([HAVE_WANNIER90_V1], 1, [Define to 1 if you want to use Wanner90 1.x (awfully obsolete).]) ;; esac # FIXME: temporary translation of XML status if test "${abi_libxml2_enable}" = "yes"; then AC_DEFINE([HAVE_XML], 1, [Define to 1 if you want to use LibXML2-based XML I/O.]) fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # Output configuration # ABI_MSG_SECTION([Output]) # Output files # Note: later, add tests/atconfig and tests/atlocal for test suite ABI_OUTPUT # FIXME: Generate fake makefile for the fallbacks until the test farm is # updated test -e "fallbacks" || ${INSTALL} -d -m 755 "fallbacks" ${INSTALL} -m 644 "${abinit_srcdir}/config/makefiles/fallbacks.mf" \ "fallbacks/Makefile" # Call CMake to generate Makefile for Kokkos sources directories if test "${sd_kokkos_enable}" = "yes"; then rm ${abinit_builddir}/src/16_kokkos_toolbox/Makefile cd ${abinit_builddir}/src/16_kokkos_toolbox && \ cmake ${abinit_srcdir}/shared/common/src/16_kokkos_toolbox/. -Wno-dev \ -DUSE_AUTOTOOLS_BUILD_COMPAT=ON -DABINIT_SRC_DIR=${abinit_srcdir} \ -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_Fortran_FLAGS="${FCFLAGS}" \ -DCMAKE_CXX_FLAGS="-O2" -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_Fortran_COMPILER=${FC} && \ cd - rm ${abinit_builddir}/src/44_manage_kokkos/Makefile cd ${abinit_builddir}/src/44_manage_kokkos && \ cmake ${abinit_srcdir}/src/44_manage_kokkos/. -Wno-dev \ -DUSE_AUTOTOOLS_BUILD_COMPAT=ON -DABINIT_SRC_DIR=${abinit_srcdir} \ -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_Fortran_FLAGS="${FCFLAGS}" \ -DCMAKE_CXX_FLAGS="-O2" -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} \ -DCMAKE_Fortran_COMPILER=${FC} && \ cd - fi # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # ABI_MSG_SECTION([Final remarks]) # The end if test "${sd_linalg_flavor}" = "netlib-fallback"; then ABI_MSG_NOTICE([linalg-abinit], [Suboptimal linear algebra configuration]) fi if test "${sd_libxc_kxc_ok}" = "no"; then ABI_MSG_NOTICE([libxc-kxc], [Suboptimal libxc configuration]) fi # GPU 2024 implementation : deactivate this warning #if test "${abi_gpu_enable}" = "yes" -a "${sd_linalg_chk_gpu}" != "magma"; then # ABI_MSG_NOTICE([gpu-without-magma], # [Suboptimal GPU configuration]) #fi ABI_MSG_FC_BUGGY(${abi_fc_vendor}) ABI_MSG_END