-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfigure
executable file
·131 lines (110 loc) · 4.03 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
#rm Makefile
prefix=$(pwd)/bin
mpi=false
echo ''
echo '###################################################'
echo '# #'
echo '# LICHEM: Layered Interacting CHEmical Models #'
echo '# #'
echo '# Symbiotic Computational Chemistry #'
echo '# #'
echo '###################################################'
echo ''
for arg in "$@"; do
case "$arg" in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
;;
--parallel)
mpi=true;;
--help)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --help : available options.'
echo ' --parallel: install parallel lichem'
echo ' --prefix= : installation directory. '
echo ' i.e. --prefix=./bin/'
echo 'all invalid options are silently ignored'
exit 0
;;
esac
done
echo 'GENERATING MAKEFILE ...'
echo ''
# HEADER #
echo '###################################################' > Makefile
echo '# #' >> Makefile
echo '# LICHEM: Layered Interacting CHEmical Models #' >> Makefile
echo '# #' >> Makefile
echo '# Symbiotic Computational Chemistry #' >> Makefile
echo '# #' >> Makefile
echo '###################################################' >> Makefile
echo '' >> Makefile
echo '### Standard compiler settings ###' >> Makefile
echo '' >> Makefile
if $mpi; then
echo ' Configuring for parallel LICHEM'
echo ' Installation directory: ' $prefix
echo ' CXX= mpicxx'
echo ' CXXFLAGS=-O3 -fopenmp'
echo 'CXX= mpic++' >>Makefile
echo 'CXXFLAGS= -O3 -fopenmp' >>Makefile
#update header file
sed -i 's/LICHEM_QSM\.h/LICHEM_QSM_MPI\.h/g' include/LICHEM_headers.h
#add mpi header
if ! grep -q "#include <mpi\.h>" include/LICHEM_clibs.h ;
then
#sed -i 's/\ (.* \) #endif/ \ 1#include <mpi\.h>/g' include/LICHEM_clibs.h
sed -i '/#include <algorithm>/a #include <mpi\.h>' include/LICHEM_clibs.h
#echo '#endif' >> include/LICHEM_clibs.h
fi
else
echo ' Configuring for serial LICHEM'
echo ' Installation directory: ' $prefix
echo ' CXX= g++'
echo ' CXXFLAGS= -static -O3 -fopenmp'
echo 'CXX= g++' >>Makefile
echo 'CXXFLAGS= -static -O3 -fopenmp' >>Makefile
echo '' >>Makefile
echo 'UNAME := $(shell uname)' >>Makefile
echo 'ifeq ($(UNAME), Darwin)' >>Makefile
echo 'CXXFLAGS= -O3 -fopenmp' >>Makefile
echo 'endif' >>Makefile
#update header file
sed -i 's/LICHEM_QSM_MPI\.h/LICHEM_QSM\.h/g' include/LICHEM_headers.h
#if mpi.h exists remove it
if grep -q "#include <mpi\.h>" include/LICHEM_clibs.h ;
then
sed -i '/#include <mpi\.h>/d' include/LICHEM_clibs.h
fi
fi
#INSTALL DIRECTORY
echo '' >> Makefile
echo '### Install directory ### ' >> Makefile
echo 'INSTALLBIN='$prefix >> Makefile
cat ./src/makefile.in >>Makefile
if $mpi; then
echo ' $(CXX) ./src/mpi/LICHEM_MPI.cpp -o $(INSTALLBIN)/lichem.MPI $(FLAGSBINMPI)'>>Makefile
echo ' @strip $(INSTALLBIN)/lichem.MPI' >>Makefile
# echo ' @echo "" '>>Makefile
# echo ' @echo "Installation complete"'>>Makefile
# echo ' @echo "Please type " ' >>Makefile
# echo ' @echo " export PATH="$(INSTALLBIN)":\$$PATH" ' >>Makefile
# echo ' @echo "to add lichem.MPI executable to your PATH"'
else
echo ' $(CXX) ./src/LICHEM.cpp -o $(INSTALLBIN)/lichem $(FLAGSBIN)'>>Makefile
echo ' @strip $(INSTALLBIN)/lichem' >>Makefile
# echo ' @echo "" '>>Makefile
# echo ' @echo "Installation complete"'>>Makefile
# echo ' @echo "Please type " ' >>Makefile
# echo ' @echo " export PATH="$(INSTALLBIN)":\$$PATH" ' >>Makefile
# echo ' @echo "to add lichem.MPI executable to your PATH"'
fi
echo''
echo 'CONFIGURATION COMPLETE.'
echo 'TO BUILD, TYPE;'
echo ''
echo ' make install'
echo ''
echo ''