1 |
mmeineke |
377 |
dnl **** Process this file with autoconf to produce a configure script. |
2 |
|
|
|
3 |
|
|
AC_INIT(src/oopse.cpp) |
4 |
|
|
AC_CONFIG_AUX_DIR(ac-tools) |
5 |
|
|
|
6 |
|
|
AC_CONFIG_HEADER(config.h:ac-tools/config.h.in) |
7 |
|
|
|
8 |
|
|
AC_PREFIX_DEFAULT("/usr/local") |
9 |
|
|
|
10 |
|
|
builtin(include, ac-tools/aclocal.m4) |
11 |
|
|
|
12 |
|
|
dnl Checks for C compiler |
13 |
|
|
AC_PROG_RANLIB |
14 |
|
|
AC_PROG_YACC |
15 |
|
|
AC_PROG_LEX |
16 |
|
|
|
17 |
|
|
AC_SUBST(EXEEXT) |
18 |
|
|
AC_SUBST(OBJEXT) |
19 |
|
|
AC_SUBST(BATEXT) |
20 |
|
|
|
21 |
|
|
AC_SUBST(MKINSTALLDIRS) |
22 |
|
|
|
23 |
|
|
AC_SUBST(OOPSE) |
24 |
|
|
AC_SUBST(OOPSE_HOME) |
25 |
|
|
AC_SUBST(sprng_libdir) |
26 |
|
|
AC_SUBST(mpich_libdir) |
27 |
|
|
AC_SUBST(sprng_include) |
28 |
|
|
AC_SUBST(mpich_include) |
29 |
|
|
AC_SUBST(mpi_f90_mods) |
30 |
|
|
AC_SUBST(SUBDIRS) |
31 |
|
|
|
32 |
|
|
OOPSE=oopse |
33 |
|
|
|
34 |
|
|
dnl **** define home dir of oopse |
35 |
|
|
if test "x${prefix}" = "xNONE" |
36 |
|
|
then |
37 |
|
|
OOPSE_HOME=${ac_default_prefix}/oopse |
38 |
|
|
else |
39 |
|
|
OOPSE_HOME=${prefix}/oopse |
40 |
|
|
fi |
41 |
|
|
AC_ARG_ENABLE(oopse-home, |
42 |
|
|
[ --enable-oopse-home=DIR define oopse home dir [PREFIX/oopse]], |
43 |
|
|
[OOPSE_HOME="${enableval}"]) |
44 |
|
|
|
45 |
|
|
dnl **** define C compiler |
46 |
|
|
CC=${CC-icc} |
47 |
|
|
AC_ARG_WITH(cc, |
48 |
|
|
[ --with-cc=PROG use PROG as C compiler [${CC-icc}]], |
49 |
|
|
[CC="${withval}"]) |
50 |
|
|
AC_PROG_CC([icc gcc cc]) |
51 |
|
|
|
52 |
|
|
dnl **** define C compiler |
53 |
|
|
CXX=${CXX-icc} |
54 |
|
|
AC_ARG_WITH(cxx, |
55 |
|
|
[ --with-cxx=PROG use PROG as C++ compiler [${CXX-icc}]], |
56 |
|
|
[CXX="${withval}"]) |
57 |
|
|
AC_PROG_CXX([icc g++ c++]) |
58 |
|
|
|
59 |
|
|
dnl **** define Fortran compiler |
60 |
|
|
F77=${F77-ifc} |
61 |
|
|
AC_ARG_WITH(f77, |
62 |
|
|
[ --with-f77=PROG use PROG as Fortran compiler [${F77-ifc}]], |
63 |
|
|
[F77="${withval}"]) |
64 |
|
|
AC_PROG_F77([ifc f90]) |
65 |
|
|
|
66 |
|
|
dnl **** check if user wants to compile with debugging support |
67 |
|
|
AC_ARG_ENABLE(debug, |
68 |
|
|
[ --enable-debug turn on debugging [no]], |
69 |
|
|
[case "${enableval}" in |
70 |
|
|
yes) debug=true ;; |
71 |
|
|
no) debug=false ;; |
72 |
|
|
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; |
73 |
|
|
esac],[debug=false]) |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
dnl **** Define CFLAGS etc empty to prevent configure from setting them |
77 |
|
|
CFLAGS=${CFLAGS-""} |
78 |
|
|
FFLAGS=${FFLAGS-""} |
79 |
|
|
LDFLAGS=${LDFLAGS-""} |
80 |
|
|
OPTIMIZE=${OPTIMIZE-""} |
81 |
|
|
DEBUG=${DEBUG-""} |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
dnl **** Check for host type |
85 |
|
|
AC_CANONICAL_HOST |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
if test "x${CFLAGS}" = "x" |
89 |
|
|
then |
90 |
|
|
if test "x${GCC}" = "xyes" |
91 |
|
|
then |
92 |
|
|
dnl **** default settings for gcc |
93 |
|
|
DEBUG="-g -O2" |
94 |
|
|
OPTIMIZE="-O2" |
95 |
|
|
CFLAGS="-fno-common -Wall -pedantic -Wpointer-arith -Wnested-externs" |
96 |
|
|
|
97 |
|
|
dnl **** check for strength-reduce bug |
98 |
|
|
ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce") |
99 |
|
|
|
100 |
|
|
dnl **** some arch-specific optimizations/settings for gcc |
101 |
|
|
case "${host}" in |
102 |
|
|
i486-*) CPU_FLAGS="-m486";; |
103 |
|
|
i586-*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium, |
104 |
|
|
[CPU_FLAGS=-mcpu=pentium], |
105 |
|
|
[ACX_CHECK_CC_FLAGS(-mpentium,pentium, |
106 |
|
|
[CPU_FLAGS=-mpentium], [CPU_FLAGS=-m486])]) |
107 |
|
|
;; |
108 |
|
|
i686-*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro, |
109 |
|
|
[CPU_FLAGS=-mcpu=pentiumpro], |
110 |
|
|
[ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro, |
111 |
|
|
[CPU_FLAGS=-mpentiumpro], [CPU_FLAGS=-m486])]) |
112 |
|
|
;; |
113 |
|
|
esac |
114 |
|
|
|
115 |
|
|
CFLAGS="$CPU_FLAGS $CFLAGS" |
116 |
|
|
else |
117 |
|
|
case "${host}" in |
118 |
|
|
alpha*-dec-osf4.*) |
119 |
|
|
CFLAGS="-std1 -w0" |
120 |
|
|
OPTIMIZE="-O2" |
121 |
|
|
DEBUG="-g3 -O2" |
122 |
|
|
;; |
123 |
|
|
hppa*-hp-hpux*) |
124 |
|
|
CFLAGS="-Aa -D_HPUX_SOURCE" |
125 |
|
|
OPTIMIZE="-O" |
126 |
|
|
DEBUG="-g -O" |
127 |
|
|
;; |
128 |
|
|
mips-sgi-irix6.[[4-9]]*) |
129 |
|
|
CFLAGS="-w" |
130 |
|
|
OPTIMIZE="-O2 -OPT:Olimit=0" |
131 |
|
|
DEBUG="-g3 -O2 -OPT:Olimit=0" |
132 |
|
|
;; |
133 |
|
|
mips-sgi-irix*) |
134 |
|
|
CFLAGS="-fullwarn -woff 835" |
135 |
|
|
OPTIMIZE="-O2 -Olimit 3500" |
136 |
|
|
;; |
137 |
|
|
rs6000-ibm-aix*) |
138 |
|
|
CFLAGS="-D_ALL_SOURCE" |
139 |
|
|
OPTIMIZE="-O2" |
140 |
|
|
DEBUG="-g -O2" |
141 |
|
|
;; |
142 |
|
|
*) |
143 |
|
|
CFLAGS="" |
144 |
|
|
OPTIMIZE="-O" |
145 |
|
|
DEBUG="-g" |
146 |
|
|
;; |
147 |
|
|
esac |
148 |
|
|
fi |
149 |
|
|
fi |
150 |
|
|
|
151 |
|
|
case $debug in |
152 |
|
|
true) CFLAGS="$DEBUG $CFLAGS";; |
153 |
|
|
*) CFLAGS="$OPTIMIZE $CFLAGS";; |
154 |
|
|
esac |
155 |
|
|
|
156 |
|
|
dnl **** .exe/.obj file extensions |
157 |
|
|
AC_EXEEXT |
158 |
|
|
AC_OBJEXT |
159 |
|
|
|
160 |
|
|
OBJEXT=".$OBJEXT" |
161 |
|
|
|
162 |
|
|
AC_PROG_MAKE_SET |
163 |
|
|
|
164 |
|
|
dnl **** Checks for programs. |
165 |
|
|
AC_CHECK_PROG(AR, ar, ar, NONE) |
166 |
|
|
if test "$AR" = "NONE"; then |
167 |
|
|
AC_MSG_ERROR(--> Can't find \`ar'!) |
168 |
|
|
AC_CACHE_SAVE |
169 |
|
|
exit 1 |
170 |
|
|
fi |
171 |
|
|
|
172 |
|
|
AC_F77_LIBRARY_LDFLAGS |
173 |
|
|
|
174 |
|
|
case $F77 in |
175 |
|
|
ifc) fortran_machine_defs='Linux_ifc_machdep.$(O)' flibs_extra='-lPEPCF90' ;; |
176 |
|
|
*) echo $F77; AC_MSG_ERROR([currently only ifc is supported as the fortran compiler. See README for details]) ;; |
177 |
|
|
esac |
178 |
|
|
AC_SUBST([fortran_machine_defs]) |
179 |
|
|
AC_SUBST([flibs_extra]) |
180 |
|
|
|
181 |
|
|
AC_ARG_WITH(mpi_f90_mods, |
182 |
|
|
[ --with-mpi_f90_mods=<dir> specify the location of the MPI F90 |
183 |
|
|
modules (default is |
184 |
|
|
/usr/local/include/f90choice], |
185 |
|
|
[mpi_f90_mods="${withval}"], |
186 |
|
|
[mpi_f90_mods="/usr/local/include/f90choice"] ) |
187 |
|
|
AC_SUBST(mpi_f90_mods) |
188 |
|
|
if test -r $mpi_f90_mods/MPI.mod; then |
189 |
|
|
AC_DEFINE(USE_MPI_F90_MODS, 1, [define whether we have the MPI f90 modules]) |
190 |
|
|
else |
191 |
|
|
AC_MSG_ERROR(--> Can't find MPI f90 modules!) |
192 |
|
|
AC_CACHE_SAVE |
193 |
|
|
exit 1 |
194 |
|
|
fi |
195 |
|
|
|
196 |
|
|
AC_ARG_WITH(sprng_include, |
197 |
|
|
[ --with-sprng_include=<include dir> specify the location of the sprng |
198 |
|
|
headers (default is |
199 |
|
|
/usr/local/include/sprng)], |
200 |
|
|
[sprng_include="$withval"], |
201 |
|
|
[sprng_include="/usr/local/include/sprng"] ) |
202 |
|
|
AC_SUBST(sprng_include) |
203 |
|
|
AC_CHECK_HEADERS([$sprng_include/sprng.h], |
204 |
|
|
AC_DEFINE(USE_SPRNG, 1, [define whether we have the sprng libraries]), |
205 |
|
|
AC_MSG_ERROR(sprng header files not found.)) |
206 |
|
|
|
207 |
|
|
AC_ARG_WITH(sprng_libdir, |
208 |
|
|
[ --with-sprng_libdir=<library dir> specify the location of the sprng |
209 |
|
|
libraries (default is |
210 |
|
|
/usr/local/lib)], |
211 |
|
|
[sprng_libdir="$withval"], |
212 |
|
|
[sprng_libdir="/usr/local/lib"] ) |
213 |
|
|
AC_SUBST(sprng_libdir) |
214 |
|
|
AC_CHECK_FILE([$sprng_libdir/libsprng.a],, |
215 |
|
|
AC_MSG_ERROR(libsprng.a not found.)) |
216 |
|
|
|
217 |
|
|
AC_ARG_WITH(mpich_include, |
218 |
|
|
[ --with-mpich_include=<include dir> specify the location of the mpich |
219 |
|
|
headers (default is |
220 |
|
|
/usr/local/include)], |
221 |
|
|
[mpich_include="$withval"], |
222 |
|
|
[mpich_include="/usr/local/include"] ) |
223 |
|
|
AC_SUBST(mpich_include) |
224 |
|
|
AC_CHECK_HEADERS([$mpich_include/mpi.h], |
225 |
|
|
AC_DEFINE(HAVE_MPICH, 1, [define whether we have the mpich libraries]), |
226 |
|
|
AC_MSG_ERROR(mpich header files not found.)) |
227 |
|
|
|
228 |
|
|
AC_ARG_WITH(mpich_libdir, |
229 |
|
|
[ --with-mpich_libdir=<library dir> specify the location of the mpich |
230 |
|
|
libraries (default is /usr/local/lib)], |
231 |
|
|
[mpich_libdir="$withval"], |
232 |
|
|
[mpich_libdir="/usr/local/lib"] ) |
233 |
|
|
AC_SUBST(mpich_libdir) |
234 |
|
|
AC_CHECK_FILE([$mpich_libdir/libmpich.a],, |
235 |
|
|
AC_MSG_ERROR(libmpi.a not found.)) |
236 |
|
|
|
237 |
|
|
|
238 |
|
|
AC_PROG_INSTALL |
239 |
|
|
case "x$INSTALL" in |
240 |
|
|
x/*) ;; |
241 |
|
|
*) INSTALL=`pwd`/ac-tools/"shtool install -c" ; |
242 |
|
|
esac |
243 |
|
|
|
244 |
|
|
MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f" |
245 |
|
|
|
246 |
|
|
dnl **** Final list of subdirs |
247 |
|
|
SUBDIRS="libBASS libmdtools src forceFields" |
248 |
|
|
|
249 |
|
|
dnl **** Create Make.conf |
250 |
|
|
AC_OUTPUT(Make.conf:ac-tools/Make.conf.in) |