ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/ac-tools/configure.in
Revision: 2562
Committed: Fri Jan 13 15:48:46 2006 UTC (18 years, 5 months ago) by gezelter
File size: 13334 byte(s)
Log Message:
changed compiler search order

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
142 # Checks for header files.
143 AC_HEADER_STDC
144 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])
145
146 # Checks for typedefs, structures, and compiler characteristics.
147 AC_HEADER_STDBOOL
148 AC_C_CONST
149 AC_C_INLINE
150 AC_C_RESTRICT
151 AC_TYPE_SIZE_T
152 AC_HEADER_TIME
153 AC_CHECK_TYPES(clock_t)
154 AC_C_CONST
155 AC_C_INLINE
156
157 # Checks for library functions.
158 AC_FUNC_MALLOC
159 AC_FUNC_MEMCMP
160 AC_FUNC_REALLOC
161 AC_FUNC_SELECT_ARGTYPES
162 AC_FUNC_STRFTIME
163 AC_FUNC_STRTOD
164 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])
165
166 # special check for _system_configuration because AIX <4.3.2 do not
167 # contain the `physmem' member.
168 AC_MSG_CHECKING([for external symbol _system_configuration])
169 AC_TRY_COMPILE([#include <sys/systemcfg.h>],
170 [double x = _system_configuration.physmem;],
171 [AC_MSG_RESULT([yes])
172 AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
173 [Define if you have the _system_configuration variable.])],
174 [AC_MSG_RESULT([no])])
175
176 dnl check for system getopt
177 adl_FUNC_GETOPT_LONG
178
179 AC_LANG_CPLUSPLUS
180 AC_CXX_NAMESPACES
181 AC_CXX_STD
182 AC_CHECK_HEADERS([ctype.h iostream fstream sstream strstream])
183 # AC_CPP_FUNC
184 # ------------------ #
185 # Checks to see if ANSI C99 CPP variable __func__ works.
186 # If not, perhaps __FUNCTION__ works instead.
187 # If not, we'll just define __func__ to "".
188 AC_DEFUN([AC_CPP_FUNC],
189 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
190 AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
191 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
192 [[const char *foo = __func__;]])],
193 [ac_cv_cpp_func=yes],
194 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
195 [[const char *foo = __FUNCTION__;]])],
196 [ac_cv_cpp_func=__FUNCTION__],
197 [ac_cv_cpp_func=no])])])
198 if test $ac_cv_cpp_func = __FUNCTION__; then
199 AC_DEFINE(__func__,__FUNCTION__,
200 [Define to __FUNCTION__ or "" if `__func__' does not conform to
201 ANSI C.])
202 elif test $ac_cv_cpp_func = no; then
203 AC_DEFINE(__func__,"",
204 [Define to __FUNCTION__ or "" if `__func__' does not conform to
205 ANSI C.])
206 fi
207 ])# AC_CPP_FUNC
208
209 AC_CPP_FUNC
210 AC_SUBST(__func__)
211
212
213 dnl check for strong optimization options
214
215 case $debug in
216 1)
217 ;;
218 *)
219 ACX_PROG_FC_MAXOPT
220 ACX_PROG_CC_MAXOPT
221 ACX_PROG_CXX_MAXOPT
222 ;;
223 esac
224
225 dnl OpenBabel needs this:
226 AC_DEFINE([OBAPI], [], [Used to export symbols for DLL / shared library builds])
227
228
229 AC_ARG_WITH(mpi,
230 [AC_HELP_STRING([--with-mpi=<prefix>],
231 [compile with MPI installed in <prefix> [default=no]])],
232 with_mpi=$withval,
233 with_mpi="no")
234
235 case "x$with_mpi" in
236 xyes | "x") USE_MPI=yes;;
237 xno) USE_MPI=no ;;
238 *) MPI="$with_mpi"; USE_MPI=yes ;;
239 esac
240 if test "$USE_MPI" = "yes" -a -z "$with_mpi"; then
241 MPI="/usr/local"
242 fi
243 if test "$USE_MPI" = "yes"; then
244 ACX_MPI
245 fi
246 AC_SUBST(USE_MPI)
247
248 dnl ########################################
249 dnl # Check for CGAL headers and libraries #
250 dnl ########################################
251
252 USE_CGAL=no
253 cgal_makefile=auto
254 AC_ARG_WITH(cgal-makefile,[ --with-cgal-makefile=FILE CGAL makefile that should be used], cgal_makefile="$withval")
255
256 if test "x$cgal_makefile" != xno; then
257
258 if test "x$cgal_makefile" = xauto -a "x$CGAL_MAKEFILE" != x; then
259 cgal_makefile="$CGAL_MAKEFILE"
260 fi
261
262 AC_MSG_CHECKING(for cgal_makefile: $cgal_makefile)
263
264 if test -f "$cgal_makefile"; then
265
266 cat >config.tmp.Makefile <<EOF
267 include $cgal_makefile
268 default:
269 @echo CGAL_OS_COMPILER=\"\${CGAL_OS_COMPILER}\" >config.tmp.cgalvariables
270 @echo CGAL_INCLDIR=\"\${CGAL_INCL_DIR}\" >>config.tmp.cgalvariables
271 @echo CGAL_INCLCONFDIR=\"\${CGAL_INCL_CONF_DIR}\" >>config.tmp.cgalvariables
272 @echo CGAL_LIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
273 @echo CGAL_RLIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
274 @echo CGAL_CXXFLAGS=\"\${CGAL_CXXFLAGS}\" >>config.tmp.cgalvariables
275 @echo GMP_INCLDIR=\"\${GMP_INCL_DIR}\" >>config.tmp.cgalvariables
276 @echo GMP_LIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
277 @echo GMP_RLIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
278 @echo LEDA_INCLDIR=\"\${LEDA_INCL_DIR}\" >>config.tmp.cgalvariables
279 @echo LEDA_LIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
280 @echo LEDA_RLIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
281 EOF
282
283 make -s -f config.tmp.Makefile
284 . config.tmp.cgalvariables
285
286 rm -f config.tmp.Makefile config.tmp.cgalvariables
287
288 if test "x$CGAL_INCLDIR" = "x"; then
289 CGAL_INCLDIR=""
290 fi
291
292 if test "x$CGAL_LIBDIR" = "x"; then
293 CGAL_LIBDIR=""
294 fi
295
296 if test "x$CGAL_RLIBDIR" = "x"; then
297 CGAL_RLIBDIR=""
298 fi
299
300 if test "x$LEDA_INCLDIR" = "x"; then
301 LEDA_INCLDIR=""
302 fi
303
304 if test "x$LEDA_LIBDIR" = "x"; then
305 LEDA_LIBDIR=""
306 fi
307
308 if test "x$LEDA_RLIBDIR" = "x"; then
309 LEDA_RLIBDIR=""
310 fi
311
312 if test "x$GMP_INCLDIR" = "x"; then
313 GMP_INCLDIR=""
314 fi
315
316 if test "x$GMP_LIBDIR" = "x"; then
317 GMP_LIBDIR=""
318 fi
319
320 if test "x$GMP_RLIBDIR" = "x"; then
321 GMP_RLIBDIR=""
322 fi
323
324 AC_MSG_RESULT(CGAL_OS_COMPILER= $CGAL_OS_COMPILER)
325 AC_MSG_RESULT(CGAL_INCLDIR= $CGAL_INCLDIR)
326 AC_MSG_RESULT(CGAL_INCLCONFDIR= $CGAL_INCLCONFDIR)
327 AC_MSG_RESULT(CGAL_LIBDIR= $CGAL_LIBDIR)
328 AC_MSG_RESULT(CGAL_CXXFLAGS= $CGAL_CXXFLAGS)
329 AC_MSG_RESULT(LEDA_INCLDIR= $LEDA_INCLDIR)
330 AC_MSG_RESULT(LEDA_LIBDIR= $LEDA_LIBDIR)
331 AC_MSG_RESULT(GMP_INCLDIR= $GMP_INCLDIR)
332 AC_MSG_RESULT(GMP_LIBDIR= $GMP_LIBDIR)
333
334 AC_LANG_PUSH(C++)
335 save_CXXFLAGS="$CXXFLAGS"
336 CXXFLAGS="$CXXFLAGS -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR"
337 AC_CHECK_HEADER(CGAL/Cartesian.h, cgal=yes, cgal=no)
338 CXXFLAGS="$save_CXXFLAGS"
339
340 if test "x$cgal" = xyes; then
341 AC_MSG_CHECKING([for CGAL version])
342 LOCATION=${CGAL_INCLDIR}
343 LOCATION=${LOCATION:-/usr/include}
344 if test -f $LOCATION/CGAL/version.h; then
345 CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/version.h | sed 's/[^0-9\.]*//g'`
346 else
347 CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/config.h | sed 's/[^0-9\.]*//g'`
348 fi
349 changequote({, })dnl
350 if echo $CGAL_VERSION | grep -q "^[3456789]"; then
351 changequote([, ])dnl
352 AC_MSG_RESULT([($CGAL_VERSION) yes])
353 else
354 AC_MSG_RESULT([($CGAL_VERSION) no])
355 cgal=no
356 fi
357 fi
358
359 if test "x$cgal" = xyes; then
360 CGAL_LIBS="-lCGAL"
361 AC_MSG_CHECKING([whether CGAL uses LEDA])
362 if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_LEDA; then
363 CGAL_USES_LEDA=yes
364 AC_MSG_RESULT([yes])
365 CGAL_DEFINES="-DCGAL_USE_LEDA -DLEDA_PREFIX"
366 else
367 AC_MSG_RESULT([no])
368 CGAL_USES_LEDA=no
369 fi
370
371 AC_MSG_CHECKING([whether CGAL uses GMP])
372 if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_GMP; then
373 CGAL_USES_GMP=yes
374 AC_MSG_RESULT([yes])
375 CGAL_DEFINES="-DCGAL_USE_GMP $CGAL_DEFINES"
376 else
377 AC_MSG_RESULT([no])
378 CGAL_USES_GMP=no
379 fi
380
381 CGAL_LIBS="$CGAL_LIBS -lm"
382
383 CGAL_CXXFLAGS="-ftemplate-depth-50"
384
385 AC_MSG_RESULT(CGAL_USES_LEDA= $CGAL_USES_LEDA)
386 AC_MSG_RESULT(CGAL_USES_GMP = $CGAL_USES_GMP)
387 AC_MSG_RESULT(CGAL_INCLDIR = $CGAL_INCLDIR)
388 AC_MSG_RESULT(CGAL_LIBDIR = $CGAL_LIBDIR)
389 AC_MSG_RESULT(CGAL_DEFINES = $CGAL_DEFINES)
390 AC_MSG_RESULT(CGAL_CXXFLAGS = $CGAL_CXXFLAGS)
391 AC_MSG_RESULT(CGAL_LIBS = $CGAL_LIBS)
392 fi
393
394 if test "x$cgal" = xyes; then
395 save_LIBS="$LIBS"
396 LIBS="$LIBS -L$CGAL_LIBDIR"
397 if test "x$CGAL_USES_LEDA" = xyes; then
398 LIBS="-lL $LIBS -L$LEDA_LIBDIR"
399 fi
400 # if test "x$CGAL_USES_GMP" = xyes; then
401 # LIBS="-lgmp $LIBS $GMP_LIBDIR"
402 # fi
403 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)
404 LIBS="$save_LIBS"
405 fi
406
407 fi
408 AC_LANG_POP()
409
410 fi
411
412 if test "x$cgal" = xyes; then
413 USE_CGAL=yes
414 AC_DEFINE(HAVE_CGAL, 1, [Is defined if the CGAL library is available.])
415 AC_DEFINE_UNQUOTED(CGAL_VERSION, $CGAL_VERSION, [The CGAL version number.])
416 changequote({, })dnl
417 if ! echo $CGAL_VERSION | grep -q "^3.0"; then
418 changequote([, ])dnl
419 AC_MSG_WARN(*****************************************************)
420 AC_MSG_WARN(*** Warning: Your CGAL version is newer than the ***)
421 AC_MSG_WARN(*** supported versions. It may still work though. ***)
422 AC_MSG_WARN(*****************************************************)
423 fi
424 else
425 if test "x$cgal_makefile" != xno; then
426 AC_MSG_RESULT(No CGAL support. These are not the droids you want.)
427 fi
428 CGAL_INCLDIR=
429 CGAL_LIBDIR=
430 CGAL_RLIBDIR=
431 CGAL_DEFINES=
432 CGAL_CXXFLAGS=
433 CGAL_LIBS=
434 fi
435
436 AC_SUBST(USE_CGAL)
437 CGAL_INC_DIR="${CGAL_INCLDIR} ${CGAL_INCLCONFDIR}"
438 AC_SUBST(CGAL_INC_DIR)
439 CGAL_LIB_DIR=${CGAL_LIBDIR}
440 AC_SUBST(CGAL_LIB_DIR)
441 CGAL_RLIB_DIR=${CGAL_RLIBDIR}
442 AC_SUBST(CGAL_RLIB_DIR)
443 AC_SUBST(CGAL_DEFINES)
444 AC_SUBST(CGAL_CXXFLAGS)
445 AC_SUBST(CGAL_LIBS)
446
447
448 BB_ENABLE_DOXYGEN
449
450 AC_SUBST(EXEEXT)
451 AC_SUBST(OBJEXT)
452 AC_SUBST(BATEXT)
453 AC_SUBST(MKINSTALLDIRS)
454 AC_SUBST(OOPSE)
455 AC_SUBST(OOPSE_HOME)
456 AC_SUBST(SUBDIRS)
457 AC_SUBST(CFLAGS)
458 AC_SUBST(CXXFLAGS)
459 AC_SUBST(CPPFLAGS)
460 AC_SUBST(FCFLAGS)
461 AC_SUBST(LDFLAGS)
462 AC_SUBST(PREPDEFFLAG)
463 AC_SUBST(F90_MODULE_NAMES)
464 AC_CONFIG_FILES([make/Makefile src/utils/Makefile src/applications/nanoRodBuilder/Makefile scripts/filepp], [chmod 0755 scripts/*])
465
466 AC_OUTPUT