10
0
mirror of https://gitlab.com/scemama/eplf synced 2024-10-31 19:23:55 +01:00
eplf/configure.ac
2020-06-03 00:33:30 +02:00

169 lines
4.4 KiB
Plaintext

# EPLF computes the Electron Pair Localization Function
# Copyright (C) 2009 Anthony SCEMAMA, CNRS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Anthony Scemama
# LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier
# 118, route de Narbonne
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
VERSION=[`. version ; echo $VERSION`]
AC_SUBST([VERSION])
AC_REVISION([$Revision: $VERSION $])
AC_PREREQ([2.50])
AC_INIT([EPLF], [], [scemama@irsamc.ups-tlse.fr],[eplf],[https://gitlab.com/scemama/eplf])
AC_SYS_LONG_FILE_NAMES
EPLF_PATH=`pwd`
AC_SUBST(EPLF_PATH)
EXE=$EPLF_PATH/bin/eplf
AC_SUBST(EXE)
AC_CONFIG_SRCDIR([src/main.irp.f])
AC_CONFIG_FILES([make.config])
AC_PREFIX_DEFAULT([./])
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_CC
# Check for curl
AC_CHECK_PROGS([CURL],[curl],[])
######################################################
# Check for python
AC_CHECK_PROGS([PYTHON],[python3],[])
if [[ -z $PYTHON ]] ; then
AC_MSG_ERROR([Python3 should be installed])
fi
######################################################
# IRPF90 compiler
AC_CHECK_PROGS([IRPF90],[irpf90],[])
if [[ -z $IRPF90 ]] ; then
AC_MSG_ERROR([IRPF90 should be installed: python3 -m pip install irpf90])
fi
######################################################
# Check for MPI
EPLF_HAS_MPI=0
if [[ -z "$STATIC" ]] ; then
AC_CHECK_PROGS([MPIRUN],[mpirun mpiexec],[])
if [[ ! -z $MPIRUN ]] ; then
MPIRUN=`which $MPIRUN`
fi
AC_CHECK_PROGS([MPIFC],[mpif90],[])
if [[ -z $MPIFC ]] ; then
echo "**************************"
echo "Warning: MPI not found. You can get OpenMPI at:"
echo "http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.1.tar.gz"
echo "**************************"
else
EPLF_HAS_MPI=1
fi
fi
AC_SUBST([EPLF_HAS_MPI])
# Test if Static zlib is present
# ------------------------------
AC_CHECK_LIB([z],[gzclose],[STATIC=1],[STATIC=0],[-static])
STATIC_LIB="../EZFIO/lib/libezfio_irp.a"
SHARED_LIB="-L../EZFIO/lib -lezfio"
# Test Fortran
# ------------
AC_LANG([Fortran])
AC_PROG_FC([mpif90 ifort gfortran],[Fortran 90])
AC_PROG_FC_C_O
AC_FC_SRCEXT([F90])
AC_FC_FREEFORM
case $FC in
mpif90*)
FCFLAGS="-fPIC -O2 -ffree-line-length-none -ffast-math "
IRPF90="$IRPF90 -DMPI"
;;
ifort*)
FCFLAGS="-O2 -xHost -ip"
if test $STATIC == 1 ; then
FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static"
fi
;;
gfortran*)
FCFLAGS="-fPIC -O2 -ffast-math -ffree-line-length-none"
if test $STATIC == 0 ; then
FCFLAGS="$FCFLAGS -static-libgcc -static"
fi
;;
esac
AC_SUBST([FC])
AC_SUBST([IRPF90])
AC_SUBST([FCFLAGS])
# Write make.config
if [[ $STATIC = 1 ]] ; then
LIB="$STATIC_LIB -lz"
else
LIB="$SHARED_LIB -lz"
AC_MSG_WARN([
=====================================================
Using shared library. Add
$EPLF_PATH/EZFIO/lib/
to the LD_LIBRARY_PATH environment variable.
=====================================================
])
fi
AC_SUBST([LIB])
cd $EPLF_PATH
echo "export EPLF_PATH=$EPLF_PATH" > $HOME/.eplfrc
echo "export LD_LIBRARY_PATH=\$EPLF_PATH/EZFIO/lib/:\$LD_LIBRARY_PATH" >> $HOME/.eplfrc
echo "export PATH=\$EPLF_PATH/bin/":\$PATH >> $HOME/.eplfrc
echo "export PATH=\$EPLF_PATH/scripts/:\$PATH" >> $HOME/.eplfrc
echo "export EPLF_HAS_MPI=$EPLF_HAS_MPI" >> $HOME/.eplfrc
echo "export EPLF_MPIRUN=$MPIRUN" >> $HOME/.eplfrc
echo "************************************"
echo "To finish the installation:"
echo "1) Add the following line to your $HOME/.bashrc file:"
echo ". $HOME/.eplfrc"
echo "2) Execute"
echo ". $HOME/.eplfrc"
echo "make"
echo "************************************"
AC_OUTPUT