configure 2.36 KB
Newer Older
spigafi's avatar
spigafi committed
1
#!/bin/bash
2
#
3 4 5 6 7 8 9 10 11
# Copyright (C) 2001-2016 Quantum ESPRESSO group
# 
# 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. See the file `License' in the root directory
# of the present distribution.
#
#
12 13 14 15 16
# This script is a simple wrapper calling the autoconf configuration
# script (configure) in install/
# Dependencies may be also directly generated
# 
# Courtesy of A. Ferretti and G. Bussi
17
# Modified by F. Spiga and P. Giannozzi
18 19 20 21
#
#================================================================
#
MANUAL=" Usage
22
   configure [-h, --help] [--save] [<conf_flags>]
23 24

 -h, --help           print this manual    
25
     --save           do not make clean
26 27 28
 <conf_flags>         these flags will be passed to 
                      the autoconf configure

29
 After configuration, the make.inc file will be created in the
30
 QE home (current) directory
31
 NOTE: CUDA Fortran code available only as a separate package
32
 
33 34 35
 ---------------------------------------------------------------
 Manual from autoconf configure : 
 ---------------------------------------------------------------
36 37 38 39 40 41 42 43 44 45 46 47 48
"
#
#================================================================
#

# run from directory where this script is
auxdir=`echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
if [ "$auxdir" != "configure" ] ; then cd $auxdir ; fi

#
# detect the simplest cases 
#
case $1 in 
49
  ("-h" | "--help" )      echo "$MANUAL"     ; ./install/configure --help ; exit 0 ;;
50 51
esac

spigafi's avatar
spigafi committed
52

53 54 55
# run the autoconf configure with the
# given cong_flags 
#
56
test -e ./install/make.inc       && rm ./install/make.inc
57
test -e ./install/configure.msg  && rm ./install/configure.msg
spigafi's avatar
spigafi committed
58 59 60
#test -e ./install/Makefile  && rm ./install/Makefile

# SAFEGUARD: if you run configure without clean everything first there 
61
#            are chances that something goes wrong. Forcing veryclean then.
62 63 64 65

if [[  ($1 =~ "--save") ]] ; then
  shift;
elif [[ (-e make.inc) && (-e Makefile) ]] ; then
66
  make -f Makefile veryclean
spigafi's avatar
spigafi committed
67
fi
68

69
./install/configure "$@"
70

71
# copy make.inc in the home dir
72 73
# and final clean up
#
74
test -e ./install/make.inc && mv ./install/make.inc .
75 76 77
test -e config.log        && mv config.log    ./install/
test -e config.status     && mv config.status ./install/
test -e configure.msg     && mv configure.msg ./install/
78 79

exit 0