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