ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/ac-tools/configure.in
Revision: 956
Committed: Tue May 16 02:06:37 2006 UTC (19 years, 2 months ago) by gezelter
Original Path: trunk/ac-tools/configure.in
File size: 14433 byte(s)
Log Message:
*** empty log message ***

File Contents

# Content
1 dnl **** Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.59)
4 AC_INIT(OOPSE, 3.0, gezelter@nd.edu, oopse)
5 AC_CONFIG_AUX_DIR(ac-tools)
6 AC_CONFIG_SRCDIR([src/applications/oopse/oopse.cpp])
7 AC_CONFIG_HEADER([src/config.h])
8
9 builtin(include, ac-tools/aclocal.m4)
10 builtin(include, ac-tools/AC_CXX_HAVE_STL.m4)
11 builtin(include, ac-tools/AC_CXX_NAMESPACES.m4)
12 builtin(include, ac-tools/AC_CXX_STD.m4)
13
14 # who am i
15 AC_CANONICAL_HOST
16
17 AC_PREFIX_DEFAULT("/usr/local")
18
19 # set program name
20 PROGNAME="oopse"
21 AC_SUBST(PROGNAME)
22
23 AC_EXEEXT
24 AC_OBJEXT
25 OBJEXT=".$OBJEXT"
26
27 OOPSE=oopse
28
29 dnl **** define home dir of oopse
30 if test "x${prefix}" = "xNONE"
31 then
32 OOPSE_HOME=${ac_default_prefix}/oopse
33 else
34 OOPSE_HOME=${prefix}/oopse
35 fi
36 AC_ARG_ENABLE(oopse-home,
37 [ --enable-oopse-home=DIR define oopse home dir [PREFIX/oopse]],
38 [OOPSE_HOME="${enableval}"])
39
40 # there are two ways to do debugging. One with the --enable-debug flag
41 # and one using the DEBUG environment variable
42
43 debug=0
44 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Compile OOPSE in debug mode]), [debug=1])
45 if test "${DEBUG}"; then
46 AC_DEFINE(debug, 1, [Code compiled in debug mode])
47 msg="$msg, debug mode"
48 fi
49 AC_SUBST(debug)
50
51 # Checks for programs.
52 AC_PROG_CXX([icpc icc pgCC pathCC c++ xlc++ xlC g++ CC])
53 AC_PROG_CC([icc pgcc pathcc cc xlc gcc])
54 AC_PROG_FC([ifort ifc pgf95 pathf95 xlf95 lf95 epcf90 pathf90 xlf90 f95 f90 gfortran g95 fort], 95)
55 AC_PROG_CPP
56 AC_PROG_EGREP
57 AC_PROG_LN_S
58 AC_PROG_MAKE_SET
59 AC_PROG_RANLIB
60 AX_SYS_PERLSHARPBANG
61 AC_PROG_INSTALL
62 case "x$INSTALL" in
63 x/*) ;;
64 *) INSTALL=`pwd`/ac-tools/"shtool install -c" ;
65 esac
66 MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f"
67 AC_CHECK_PROG(AR, ar, ar, NONE)
68 if test "$AR" = "NONE"; then
69 AC_MSG_ERROR(--> Can't find \`ar'!)
70 AC_CACHE_SAVE
71 exit 1
72 fi
73 AC_PATH_PROG(PS, ps)
74 AC_CACHE_CHECK([for POSIX or BSD ps syntax], ac_cv_prog_ps_syntax, [
75 if $PS ax -o rss > /dev/null 2>&1; then
76 ac_cv_prog_ps_ax=yes
77 else
78 ac_cv_prog_ps_ax=no
79 fi
80 if $PS -ef -o rss > /dev/null 2>&1; then
81 ac_cv_prog_ps_ef=yes
82 else
83 ac_cv_prog_ps_ef=no
84 fi
85 if test "$ac_cv_prog_ps_ax" = yes; then
86 ac_cv_prog_ps_syntax=BSD
87 else
88 if test "$ac_cv_prog_ps_ef" = yes; then
89 ac_cv_prog_ps_syntax=POSIX
90 else
91 AC_MSG_ERROR(Could not determine ps syntax)
92 fi
93 fi
94 ])
95 AC_DEFINE_UNQUOTED(PSCOMMAND, $PS, [Path to ps program])
96 if test "$ac_cv_prog_ps_syntax" = BSD; then
97 AC_DEFINE(PSTYPE_IS_BSD, 1, [ps uses BSD-style arguments])
98 else
99 if test "$ac_cv_prog_ps_syntax" = POSIX; then
100 AC_DEFINE(PSTYPE_IS_POSIX, 1, [ps uses POSIX-style arguments])
101 else
102 AC_MSG_ERROR(Unknown ps syntax type!)
103 fi
104 fi
105
106 AC_LANG_PUSH(Fortran)
107 AC_FC_SRCEXT(F90)
108 dnl Check the flag for Fortran90 preprocessing
109 ACX_PROG_F90_PREPFLAG
110 dnl Check to see if a flag is required for preprocessing defines
111 ACX_PROG_F90_PREPDEFFLAG
112 AC_FC_WRAPPERS
113 AC_SUBST(FC_FUNC)
114 AC_SUBST(FC_FUNC_)
115 AC_FC_LIBRARY_LDFLAGS
116 dnl Fortran 90 module suffix
117 AC_CHECK_MODSUFFIX
118 dnl Fortran 90 module path specifier
119 AC_CHECK_MODDIRFLAG
120 AC_F90_MODULE_NAMES
121 pat=`echo $ac_cv_f90_module_names | sed 's/.*\(%.*%\).*/\1/'`
122 F90_MODULE_NAMES=empty
123 case $pat in
124 %MODULE%)
125 F90_MODULE_NAMES=UPPER ;;
126 %Module%)
127 F90_MODULE_NAMES=Mixed ;;
128 %module%)
129 F90_MODULE_NAMES=lower ;;
130 *)
131 F90_MODULE_NAMES=unknown ;;
132 esac
133 AC_SUBST(F90_MODULE_NAMES)
134 AC_LANG_POP
135
136 AC_LANG_C
137
138 dnl Checks for libraries.
139 AC_CHECK_LIB(m, asin, , exit)
140 ACX_CHECK_ZLIB
141 AC_ARG_WITH(fftw,
142 [ --without-fftw if you turn this off you cannot compute undulation spectra],, with_fftw=yes)
143 if test "$with_fftw" = "no"; then
144 AC_DEFINE(WITHOUT_FFTW,,[Disable all FFTW (and thus undulation spectrum) support])
145 fi
146 if test "$with_fftw" = "yes"; then
147 sizeof_real=8
148
149 ACX_CHECK_FFTW(fftw3,$sizeof_real)
150
151 if test "$with_mpi" = "yes"; then
152 ACX_CHECK_FFTW(fftw3_mpi,$sizeof_real)
153 fi
154
155 case ${ac_fftw_savedprefix} in
156 d) AC_DEFINE(FFTW_NAME_DFFTW,,[Use the d prefix on fftw includes]) ;;
157 *) AC_DEFINE(FFTW_NAME_FFTW,,[Dont use any prefix on fftw includes]) ;;
158 esac
159 else
160 echo "*******************************************************************"
161 echo "* FFTW libraries and include files are required for computing *"
162 echo "* undulation spectra with the staticProps program. If you don't *"
163 echo "* fftw turned on, OOPSE will still work, but you won't be able to *"
164 echo "* analyze your trajectories for this property. *"
165 echo "*******************************************************************"
166 fi # end of fftw check
167
168 # Checks for header files.
169 AC_HEADER_STDC
170 AC_CHECK_HEADERS([conio.h dlfcn.h fstream.h iostream.h libintl.h limits.h machine/hal_sysinfo.h math.h stddef.h stdio.h stdlib.h string.h strings.h strstream.h sys/param.h sys/pstat.h sys/sysmp.h sys/sysctl.h sys/sysinfo.h sys/systemcfg.h sys/table.h sys/time.h time.h unistd.h zlib.h])
171
172 # Checks for typedefs, structures, and compiler characteristics.
173 AC_HEADER_STDBOOL
174 AC_C_CONST
175 AC_C_INLINE
176 AC_C_RESTRICT
177 AC_TYPE_SIZE_T
178 AC_HEADER_TIME
179 AC_CHECK_TYPES(clock_t)
180 AC_C_CONST
181 AC_C_INLINE
182
183 # Checks for library functions.
184 AC_FUNC_MALLOC
185 AC_FUNC_MEMCMP
186 AC_FUNC_REALLOC
187 AC_FUNC_SELECT_ARGTYPES
188 AC_FUNC_STRFTIME
189 AC_FUNC_STRTOD
190 AC_CHECK_FUNCS([floor getpagesize gettimeofday memchr memmove memset pow pstat_getdynamic pstat_getstatic rint select snprintf sranddev sqrt strcasecmp strchr strdup stricmp strncasecmp strnicmp strrchr strstr strtol sysmp getsysinfo sysctl table])
191
192 # special check for _system_configuration because AIX <4.3.2 do not
193 # contain the `physmem' member.
194 AC_MSG_CHECKING([for external symbol _system_configuration])
195 AC_TRY_COMPILE([#include <sys/systemcfg.h>],
196 [double x = _system_configuration.physmem;],
197 [AC_MSG_RESULT([yes])
198 AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
199 [Define if you have the _system_configuration variable.])],
200 [AC_MSG_RESULT([no])])
201
202 dnl check for system getopt
203 adl_FUNC_GETOPT_LONG
204
205 AC_LANG_CPLUSPLUS
206 AC_CXX_NAMESPACES
207 AC_CXX_STD
208 AC_CHECK_HEADERS([ctype.h iostream fstream sstream strstream])
209 # AC_CPP_FUNC
210 # ------------------ #
211 # Checks to see if ANSI C99 CPP variable __func__ works.
212 # If not, perhaps __FUNCTION__ works instead.
213 # If not, we'll just define __func__ to "".
214 AC_DEFUN([AC_CPP_FUNC],
215 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
216 AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
217 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
218 [[const char *foo = __func__;]])],
219 [ac_cv_cpp_func=yes],
220 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
221 [[const char *foo = __FUNCTION__;]])],
222 [ac_cv_cpp_func=__FUNCTION__],
223 [ac_cv_cpp_func=no])])])
224 if test $ac_cv_cpp_func = __FUNCTION__; then
225 AC_DEFINE(__func__,__FUNCTION__,
226 [Define to __FUNCTION__ or "" if `__func__' does not conform to
227 ANSI C.])
228 elif test $ac_cv_cpp_func = no; then
229 AC_DEFINE(__func__,"",
230 [Define to __FUNCTION__ or "" if `__func__' does not conform to
231 ANSI C.])
232 fi
233 ])# AC_CPP_FUNC
234
235 AC_CPP_FUNC
236 AC_SUBST(__func__)
237
238
239 dnl check for strong optimization options
240
241 case $debug in
242 1)
243 ;;
244 *)
245 ACX_PROG_FC_MAXOPT
246 ACX_PROG_CC_MAXOPT
247 ACX_PROG_CXX_MAXOPT
248 ;;
249 esac
250
251 dnl OpenBabel needs this:
252 AC_DEFINE([OBAPI], [], [Used to export symbols for DLL / shared library builds])
253
254
255 AC_ARG_WITH(mpi,
256 [AC_HELP_STRING([--with-mpi=<prefix>],
257 [compile with MPI installed in <prefix> [default=no]])],
258 with_mpi=$withval,
259 with_mpi="no")
260
261 case "x$with_mpi" in
262 xyes | "x") USE_MPI=yes;;
263 xno) USE_MPI=no ;;
264 *) MPI="$with_mpi"; USE_MPI=yes ;;
265 esac
266 if test "$USE_MPI" = "yes" -a -z "$with_mpi"; then
267 MPI="/usr/local"
268 fi
269 if test "$USE_MPI" = "yes"; then
270 ACX_MPI
271 fi
272 AC_SUBST(USE_MPI)
273
274
275 dnl ########################################
276 dnl # Check for CGAL headers and libraries #
277 dnl ########################################
278
279 USE_CGAL=no
280 cgal_makefile=auto
281 AC_ARG_WITH(cgal-makefile,[ --with-cgal-makefile=FILE CGAL makefile that should be used], cgal_makefile="$withval")
282
283 if test "x$cgal_makefile" != xno; then
284
285 if test "x$cgal_makefile" = xauto -a "x$CGAL_MAKEFILE" != x; then
286 cgal_makefile="$CGAL_MAKEFILE"
287 fi
288
289 AC_MSG_CHECKING(for cgal_makefile: $cgal_makefile)
290
291 if test -f "$cgal_makefile"; then
292
293 cat >config.tmp.Makefile <<EOF
294 include $cgal_makefile
295 default:
296 @echo CGAL_OS_COMPILER=\"\${CGAL_OS_COMPILER}\" >config.tmp.cgalvariables
297 @echo CGAL_INCLDIR=\"\${CGAL_INCL_DIR}\" >>config.tmp.cgalvariables
298 @echo CGAL_INCLCONFDIR=\"\${CGAL_INCL_CONF_DIR}\" >>config.tmp.cgalvariables
299 @echo CGAL_LIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
300 @echo CGAL_RLIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
301 @echo CGAL_CXXFLAGS=\"\${CGAL_CXXFLAGS}\" >>config.tmp.cgalvariables
302 @echo GMP_INCLDIR=\"\${GMP_INCL_DIR}\" >>config.tmp.cgalvariables
303 @echo GMP_LIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
304 @echo GMP_RLIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
305 @echo LEDA_INCLDIR=\"\${LEDA_INCL_DIR}\" >>config.tmp.cgalvariables
306 @echo LEDA_LIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
307 @echo LEDA_RLIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
308 EOF
309
310 make -s -f config.tmp.Makefile
311 . config.tmp.cgalvariables
312
313 rm -f config.tmp.Makefile config.tmp.cgalvariables
314
315 if test "x$CGAL_INCLDIR" = "x"; then
316 CGAL_INCLDIR=""
317 fi
318
319 if test "x$CGAL_LIBDIR" = "x"; then
320 CGAL_LIBDIR=""
321 fi
322
323 if test "x$CGAL_RLIBDIR" = "x"; then
324 CGAL_RLIBDIR=""
325 fi
326
327 if test "x$LEDA_INCLDIR" = "x"; then
328 LEDA_INCLDIR=""
329 fi
330
331 if test "x$LEDA_LIBDIR" = "x"; then
332 LEDA_LIBDIR=""
333 fi
334
335 if test "x$LEDA_RLIBDIR" = "x"; then
336 LEDA_RLIBDIR=""
337 fi
338
339 if test "x$GMP_INCLDIR" = "x"; then
340 GMP_INCLDIR=""
341 fi
342
343 if test "x$GMP_LIBDIR" = "x"; then
344 GMP_LIBDIR=""
345 fi
346
347 if test "x$GMP_RLIBDIR" = "x"; then
348 GMP_RLIBDIR=""
349 fi
350
351 AC_MSG_RESULT(CGAL_OS_COMPILER= $CGAL_OS_COMPILER)
352 AC_MSG_RESULT(CGAL_INCLDIR= $CGAL_INCLDIR)
353 AC_MSG_RESULT(CGAL_INCLCONFDIR= $CGAL_INCLCONFDIR)
354 AC_MSG_RESULT(CGAL_LIBDIR= $CGAL_LIBDIR)
355 AC_MSG_RESULT(CGAL_CXXFLAGS= $CGAL_CXXFLAGS)
356 AC_MSG_RESULT(LEDA_INCLDIR= $LEDA_INCLDIR)
357 AC_MSG_RESULT(LEDA_LIBDIR= $LEDA_LIBDIR)
358 AC_MSG_RESULT(GMP_INCLDIR= $GMP_INCLDIR)
359 AC_MSG_RESULT(GMP_LIBDIR= $GMP_LIBDIR)
360
361 AC_LANG_PUSH(C++)
362 save_CXXFLAGS="$CXXFLAGS"
363 CXXFLAGS="$CXXFLAGS -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR"
364 AC_CHECK_HEADER(CGAL/Cartesian.h, cgal=yes, cgal=no)
365 CXXFLAGS="$save_CXXFLAGS"
366
367 if test "x$cgal" = xyes; then
368 AC_MSG_CHECKING([for CGAL version])
369 LOCATION=${CGAL_INCLDIR}
370 LOCATION=${LOCATION:-/usr/include}
371 if test -f $LOCATION/CGAL/version.h; then
372 CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/version.h | sed 's/[^0-9\.]*//g'`
373 else
374 CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/config.h | sed 's/[^0-9\.]*//g'`
375 fi
376 changequote({, })dnl
377 if echo $CGAL_VERSION | grep -q "^[3456789]"; then
378 changequote([, ])dnl
379 AC_MSG_RESULT([($CGAL_VERSION) yes])
380 else
381 AC_MSG_RESULT([($CGAL_VERSION) no])
382 cgal=no
383 fi
384 fi
385
386 if test "x$cgal" = xyes; then
387 CGAL_LIBS="-lCGAL"
388 AC_MSG_CHECKING([whether CGAL uses LEDA])
389 if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_LEDA; then
390 CGAL_USES_LEDA=yes
391 AC_MSG_RESULT([yes])
392 CGAL_DEFINES="-DCGAL_USE_LEDA -DLEDA_PREFIX"
393 else
394 AC_MSG_RESULT([no])
395 CGAL_USES_LEDA=no
396 fi
397
398 AC_MSG_CHECKING([whether CGAL uses GMP])
399 if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_GMP; then
400 CGAL_USES_GMP=yes
401 AC_MSG_RESULT([yes])
402 CGAL_DEFINES="-DCGAL_USE_GMP $CGAL_DEFINES"
403 else
404 AC_MSG_RESULT([no])
405 CGAL_USES_GMP=no
406 fi
407
408 CGAL_LIBS="$CGAL_LIBS -lm"
409
410 CGAL_CXXFLAGS="-ftemplate-depth-50"
411
412 AC_MSG_RESULT(CGAL_USES_LEDA= $CGAL_USES_LEDA)
413 AC_MSG_RESULT(CGAL_USES_GMP = $CGAL_USES_GMP)
414 AC_MSG_RESULT(CGAL_INCLDIR = $CGAL_INCLDIR)
415 AC_MSG_RESULT(CGAL_LIBDIR = $CGAL_LIBDIR)
416 AC_MSG_RESULT(CGAL_DEFINES = $CGAL_DEFINES)
417 AC_MSG_RESULT(CGAL_CXXFLAGS = $CGAL_CXXFLAGS)
418 AC_MSG_RESULT(CGAL_LIBS = $CGAL_LIBS)
419 fi
420
421 if test "x$cgal" = xyes; then
422 save_LIBS="$LIBS"
423 LIBS="$LIBS -L$CGAL_LIBDIR"
424 if test "x$CGAL_USES_LEDA" = xyes; then
425 LIBS="-lL $LIBS -L$LEDA_LIBDIR"
426 fi
427 # if test "x$CGAL_USES_GMP" = xyes; then
428 # LIBS="-lgmp $LIBS $GMP_LIBDIR"
429 # fi
430 AC_CHECK_CXX_LIB(CGAL, ::CGAL::Cartesian<int>::Point_2, [#include <CGAL/Cartesian.h>], [::CGAL::Cartesian<int>::Point_2 P], [cgal=yes], [cgal=no], -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR)
431 LIBS="$save_LIBS"
432 fi
433
434 fi
435 AC_LANG_POP()
436
437 fi
438
439 if test "x$cgal" = xyes; then
440 USE_CGAL=yes
441 AC_DEFINE(HAVE_CGAL, 1, [Is defined if the CGAL library is available.])
442 AC_DEFINE_UNQUOTED(CGAL_VERSION, $CGAL_VERSION, [The CGAL version number.])
443 changequote({, })dnl
444 if ! echo $CGAL_VERSION | grep -q "^3.0"; then
445 changequote([, ])dnl
446 AC_MSG_WARN(*****************************************************)
447 AC_MSG_WARN(*** Warning: Your CGAL version is newer than the ***)
448 AC_MSG_WARN(*** supported versions. It may still work though. ***)
449 AC_MSG_WARN(*****************************************************)
450 fi
451 else
452 if test "x$cgal_makefile" != xno; then
453 AC_MSG_RESULT(No CGAL support. These are not the droids you want.)
454 fi
455 CGAL_INCLDIR=
456 CGAL_LIBDIR=
457 CGAL_RLIBDIR=
458 CGAL_DEFINES=
459 CGAL_CXXFLAGS=
460 CGAL_LIBS=
461 fi
462
463 AC_SUBST(USE_CGAL)
464 CGAL_INC_DIR="${CGAL_INCLDIR} ${CGAL_INCLCONFDIR}"
465 AC_SUBST(CGAL_INC_DIR)
466 CGAL_LIB_DIR=${CGAL_LIBDIR}
467 AC_SUBST(CGAL_LIB_DIR)
468 CGAL_RLIB_DIR=${CGAL_RLIBDIR}
469 AC_SUBST(CGAL_RLIB_DIR)
470 AC_SUBST(CGAL_DEFINES)
471 AC_SUBST(CGAL_CXXFLAGS)
472 AC_SUBST(CGAL_LIBS)
473
474
475 BB_ENABLE_DOXYGEN
476
477 AC_SUBST(EXEEXT)
478 AC_SUBST(OBJEXT)
479 AC_SUBST(BATEXT)
480 AC_SUBST(MKINSTALLDIRS)
481 AC_SUBST(OOPSE)
482 AC_SUBST(OOPSE_HOME)
483 AC_SUBST(SUBDIRS)
484 AC_SUBST(CFLAGS)
485 AC_SUBST(CXXFLAGS)
486 AC_SUBST(CPPFLAGS)
487 AC_SUBST(FCFLAGS)
488 AC_SUBST(LDFLAGS)
489 AC_SUBST(PREPDEFFLAG)
490 AC_SUBST(F90_MODULE_NAMES)
491 AC_CONFIG_FILES([make/Makefile src/utils/Makefile src/applications/nanoRodBuilder/Makefile scripts/filepp], [chmod 0755 scripts/*])
492
493 AC_OUTPUT