# 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 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],[]) ###################################################### # Define download function AC_DEFUN([AC_DOWNLOAD],[{ # AC_DOWNLOAD ( VARIABLE, name, url ) WHERE= if [[ ! -z $CURL ]] ; then echo "" echo "**************************" echo $1 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 $CURL -L "$3" -o $2 && mv $2 .. && WHERE=$2 cd $EPLF_PATH rm -rf $EPLF_PATH/Downloads/tmp 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.gz],[http://sourceforge.net/projects/irpf90/files/irpf90-1.1.57-noarch.exe.gz/download]) gunzip Downloads/irpf90.gz mv Downloads/irpf90 bin/ chmod +x bin/irpf90 IRPF90=$EPLF_PATH/bin/irpf90 fi ###################################################### # EZFIO EZFIO=`ls EZFIO*.tar.gz | tail -1` if [[ -z $EZFIO ]] ; then AC_DOWNLOAD([EZFIO],[EZFIO.tar.gz],[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 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]) # 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" IRPF90="$IRPF90 -DMPI" ;; ifort*) FCFLAGS="-O3 -axT -ip" if test $STATIC == 1 ; then FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static" fi ;; gfortran*) FCFLAGS="-O3 -ffast-math" 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 $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