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

223 lines
5.8 KiB
Plaintext
Raw Normal View History

2009-12-04 10:42:19 +01:00
# 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],[http://eplf.sourceforge.net])
AC_SYS_LONG_FILE_NAMES
2010-06-22 15:59:15 +02:00
EPLF_PATH=`pwd`
AC_SUBST(EPLF_PATH)
EXE=$EPLF_PATH/bin/eplf
AC_SUBST(EXE)
2009-12-04 10:42:19 +01:00
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
2010-06-22 15:59:15 +02:00
# Check for wget
AC_CHECK_PROGS([WGET],[wget],[])
######################################################
# Define download function
AC_DEFUN([AC_DOWNLOAD],[{
# AC_DOWNLOAD ( VARIABLE, name, url )
WHERE=
if [[ ! -z $WGET ]] ; then
echo ""
echo "**************************"
echo $2 is not installed
echo "**************************"
echo "Do you want to download it?"
select x in yes no
do
if [[ ! -z $x ]] ; then
break
fi
done
if [[ $x == yes ]] ; then
if [[ ! -d "Downloads" ]] ; then
mkdir $EPLF_PATH/Downloads
fi
cd $EPLF_PATH/Downloads
mkdir $EPLF_PATH/Downloads/tmp
cd $EPLF_PATH/Downloads/tmp
wget -nc "$3" && WHERE=`ls -tr | tail -1`
mv * $EPLF_PATH/Downloads
cd $EPLF_PATH/Downloads
rm -rf tmp
cd $EPLF_PATH
fi
if [[ ! -z $WHERE ]] ; then
echo $2 was downloaded to Downloads/$WHERE.
$1=1
else
AC_MSG_ERROR([$2 should be installed. You can download it at
$3])
fi
else
AC_MSG_ERROR([Please download $2 at
$3])
fi
}])
######################################################
# Check for python
AC_CHECK_PROGS([PYTHON],[python],[])
if [[ -z $PYTHON ]] ; then
AC_MSG_ERROR([Python should be installed:
http://www.python.org])
fi
######################################################
# IRPF90 compiler
AC_CHECK_PROGS([IRPF90],[irpf90],[])
if [[ -z $IRPF90 ]] ; then
AC_DOWNLOAD([IRPF90],[IRPF90],[http://sourceforge.net/projects/irpf90/files/latest])
AC_MSG_ERROR([Install IRPF90 and run this configure script again.])
fi
######################################################
# EZFIO
2010-06-22 21:31:56 +02:00
EZFIO=`ls EZFIO*.tar.gz | tail -1`
2010-06-22 15:59:15 +02:00
if [[ -z $EZFIO ]] ; then
AC_DOWNLOAD([EZFIO],[EZFIO],[http://sourceforge.net/projects/ezfio/files/latest])
if [[ -z $EZFIO ]] ; then
AC_MSG_ERROR([Download EZFIO.tar.gz into $PWD and run this configure script again.])
fi
mv Downloads/EZFIO*.tar.gz .
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])
2009-12-04 10:42:19 +01:00
# 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="-O3"
2009-12-04 10:45:39 +01:00
IRPF90="$IRPF90 -DMPI"
2009-12-04 10:42:19 +01:00
;;
ifort*)
FCFLAGS="-O3 -axT -ip"
if test $STATIC == 1 ; then
FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static"
fi
;;
gfortran*)
2009-12-09 23:28:19 +01:00
FCFLAGS="-O3 -ffast-math"
2009-12-04 10:42:19 +01:00
if test $STATIC == 0 ; then
FCFLAGS="$FCFLAGS -static-libgcc -static"
fi
;;
esac
AC_SUBST(IRPF90)
# Write make.config
if [[ $STATIC = 1 ]] ; then
LIB="$STATIC_LIB -lz"
else
LIB="$SHARED_LIB -lz"
AC_MSG_WARN([
=====================================================
Using shared library. Add
2010-06-22 15:59:15 +02:00
$EPLF_PATH/EZFIO/lib/
2009-12-04 10:42:19 +01:00
to the LD_LIBRARY_PATH environment variable.
=====================================================
])
fi
AC_SUBST([LIB])
2010-06-22 15:59:15 +02:00
cd $EPLF_PATH
echo "export EPLF_PATH=$EPLF_PATH" > $HOME/.eplfrc
echo "export LD_LIBRARY_PATH=\$EPLF_PATH/EZFIO/lib/:\$LD_LIBRARY_PATH" >> $HOME/.qmcchemrc
echo "export PATH=\$PATH:\$EPLF_PATH/bin/" >> $HOME/.eplfrc
echo "export PATH=\$PATH:\$EPLF_PATH/scripts/" >> $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/.basrhc file:"
echo ". $HOME/.eplfrc"
echo "2) Execute"
echo ". $HOME/.eplfrc"
echo "make"
echo "************************************"
2009-12-04 10:42:19 +01:00
AC_OUTPUT