ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/ac-tools/configure.in
Revision: 2546
Committed: Wed Jan 11 23:04:09 2006 UTC (18 years, 8 months ago) by gezelter
File size: 13305 byte(s)
Log Message:
autoconf modernization and cruft-removal

File Contents

# User Rev Content
1 gezelter 1490 dnl **** Process this file with autoconf to produce a configure script.
2    
3 gezelter 2546 AC_PREREQ(2.59)
4 gezelter 1499 AC_INIT(OOPSE, 2.0, gezelter@nd.edu, oopse)
5 gezelter 1490 AC_CONFIG_AUX_DIR(ac-tools)
6 gezelter 2546 AC_CONFIG_SRCDIR([src/applications/oopse/oopse.cpp])
7     AC_CONFIG_HEADER([src/config.h])
8 gezelter 1490
9     builtin(include, ac-tools/aclocal.m4)
10 gezelter 2510 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 gezelter 1490
14 gezelter 2546 # who am i
15     AC_CANONICAL_HOST
16 gezelter 1490
17     AC_PREFIX_DEFAULT("/usr/local")
18    
19     # set program name
20     PROGNAME="oopse"
21     AC_SUBST(PROGNAME)
22    
23 gezelter 2546 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 gezelter 1490 # 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 gezelter 2546 # Checks for programs.
52     AC_PROG_CXX([pathCC icpc icc xlc++ xlC CC g++ c++])
53 gezelter 2502 AC_PROG_CC([pathcc icc xlc gcc cc])
54 gezelter 2546 AC_PROG_FC([pathf95 ifort ifc xlf95 pgf95 lf95 epcf90 xlf90 pgf90 fort f95 f90 g95 f77], 95)
55 gezelter 2473 AC_PROG_CPP
56     AC_PROG_EGREP
57 gezelter 2546 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 gezelter 1490 fi
73 gezelter 2546 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 gezelter 1490
106 gezelter 2546 AC_LANG_PUSH(Fortran)
107     AC_FC_SRCEXT(F90)
108 gezelter 1490 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 gezelter 2546 AC_FC_WRAPPERS
113     AC_SUBST(FC_FUNC)
114     AC_SUBST(FC_FUNC_)
115     AC_FC_LIBRARY_LDFLAGS
116 gezelter 1490 dnl Fortran 90 module suffix
117     AC_CHECK_MODSUFFIX
118     dnl Fortran 90 module path specifier
119     AC_CHECK_MODDIRFLAG
120 gezelter 1535 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 gezelter 1490 AC_LANG_POP
135    
136 gezelter 2546 AC_LANG_C
137 gezelter 2510
138 gezelter 2452 dnl Checks for libraries.
139     AC_CHECK_LIB(m, asin, , exit)
140 gezelter 2546 ACX_CHECK_ZLIB
141 gezelter 2452
142 gezelter 2546 # Checks for header files.
143     AC_HEADER_STDC
144     AC_CHECK_HEADERS([libintl.h limits.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h])
145     AC_CHECK_HEADERS([stdio.h conio.h strstream.h iostream.h fstream.h math.h time.h sys/pstat.h sys/sysmp.h sys/sysinfo.h sys/table.h sys/sysctl.h sys/sytemcfg.h machine/hal_sysinfo.h])
146    
147     # Checks for typedefs, structures, and compiler characteristics.
148     AC_HEADER_STDBOOL
149     AC_C_CONST
150     AC_C_INLINE
151     AC_C_RESTRICT
152     AC_TYPE_SIZE_T
153     AC_HEADER_TIME
154     AC_CHECK_TYPES(clock_t)
155     AC_C_CONST
156     AC_C_INLINE
157    
158     # Checks for library functions.
159     AC_FUNC_MALLOC
160     AC_FUNC_MEMCMP
161     AC_FUNC_REALLOC
162     AC_FUNC_SELECT_ARGTYPES
163     AC_FUNC_STRFTIME
164     AC_FUNC_STRTOD
165     AC_CHECK_FUNCS([floor getpagesize gettimeofday memchr memmove memset pow pstat_getdynamic rint select snprintf sranddev sqrt strcasecmp strchr strdup stricmp strncasecmp strnicmp strrchr strstr strtol sysmp getsysinfo sysctl table])
166    
167 tim 1997 # special check for _system_configuration because AIX <4.3.2 do not
168     # contain the `physmem' member.
169     AC_MSG_CHECKING([for external symbol _system_configuration])
170     AC_TRY_COMPILE([#include <sys/systemcfg.h>],
171     [double x = _system_configuration.physmem;],
172     [AC_MSG_RESULT([yes])
173     AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
174     [Define if you have the _system_configuration variable.])],
175     [AC_MSG_RESULT([no])])
176    
177 gezelter 1490 dnl check for system getopt
178     adl_FUNC_GETOPT_LONG
179    
180 tim 2518 AC_LANG_CPLUSPLUS
181 gezelter 2546 AC_CXX_NAMESPACES
182     AC_CXX_STD
183     AC_CHECK_HEADERS([ctype.h iostream fstream sstream strstream])
184 tim 2518 # AC_CPP_FUNC
185     # ------------------ #
186     # Checks to see if ANSI C99 CPP variable __func__ works.
187     # If not, perhaps __FUNCTION__ works instead.
188     # If not, we'll just define __func__ to "".
189     AC_DEFUN([AC_CPP_FUNC],
190     [AC_REQUIRE([AC_PROG_CC_STDC])dnl
191     AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
192     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
193     [[const char *foo = __func__;]])],
194     [ac_cv_cpp_func=yes],
195     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
196     [[const char *foo = __FUNCTION__;]])],
197     [ac_cv_cpp_func=__FUNCTION__],
198     [ac_cv_cpp_func=no])])])
199     if test $ac_cv_cpp_func = __FUNCTION__; then
200     AC_DEFINE(__func__,__FUNCTION__,
201     [Define to __FUNCTION__ or "" if `__func__' does not conform to
202     ANSI C.])
203     elif test $ac_cv_cpp_func = no; then
204     AC_DEFINE(__func__,"",
205     [Define to __FUNCTION__ or "" if `__func__' does not conform to
206     ANSI C.])
207     fi
208     ])# AC_CPP_FUNC
209    
210     AC_CPP_FUNC
211     AC_SUBST(__func__)
212    
213 gezelter 1490
214 gezelter 2546 dnl check for strong optimization options
215 gezelter 2029
216 gezelter 2546 case $debug in
217     1)
218     ;;
219     *)
220     ACX_PROG_FC_MAXOPT
221     ACX_PROG_CC_MAXOPT
222     ACX_PROG_CXX_MAXOPT
223     ;;
224     esac
225    
226     dnl OpenBabel needs this:
227 gezelter 2452 AC_DEFINE([OBAPI], [], [Used to export symbols for DLL / shared library builds])
228 gezelter 1490
229 gezelter 2452
230 gezelter 1490 AC_ARG_WITH(mpi,
231     [AC_HELP_STRING([--with-mpi=<prefix>],
232     [compile with MPI installed in <prefix> [default=no]])],
233     with_mpi=$withval,
234     with_mpi="no")
235    
236     case "x$with_mpi" in
237     xyes | "x") USE_MPI=yes;;
238     xno) USE_MPI=no ;;
239     *) MPI="$with_mpi"; USE_MPI=yes ;;
240     esac
241     if test "$USE_MPI" = "yes" -a -z "$with_mpi"; then
242     MPI="/usr/local"
243     fi
244     if test "$USE_MPI" = "yes"; then
245     ACX_MPI
246     fi
247     AC_SUBST(USE_MPI)
248    
249 gezelter 2190 dnl ########################################
250     dnl # Check for CGAL headers and libraries #
251     dnl ########################################
252    
253     USE_CGAL=no
254     cgal_makefile=auto
255     AC_ARG_WITH(cgal-makefile,[ --with-cgal-makefile=FILE CGAL makefile that should be used], cgal_makefile="$withval")
256    
257     if test "x$cgal_makefile" != xno; then
258    
259     if test "x$cgal_makefile" = xauto -a "x$CGAL_MAKEFILE" != x; then
260     cgal_makefile="$CGAL_MAKEFILE"
261     fi
262    
263 gezelter 2203 AC_MSG_CHECKING(for cgal_makefile: $cgal_makefile)
264 gezelter 2190
265     if test -f "$cgal_makefile"; then
266    
267     cat >config.tmp.Makefile <<EOF
268     include $cgal_makefile
269     default:
270     @echo CGAL_OS_COMPILER=\"\${CGAL_OS_COMPILER}\" >config.tmp.cgalvariables
271     @echo CGAL_INCLDIR=\"\${CGAL_INCL_DIR}\" >>config.tmp.cgalvariables
272     @echo CGAL_INCLCONFDIR=\"\${CGAL_INCL_CONF_DIR}\" >>config.tmp.cgalvariables
273     @echo CGAL_LIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
274     @echo CGAL_RLIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables
275     @echo CGAL_CXXFLAGS=\"\${CGAL_CXXFLAGS}\" >>config.tmp.cgalvariables
276     @echo GMP_INCLDIR=\"\${GMP_INCL_DIR}\" >>config.tmp.cgalvariables
277     @echo GMP_LIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
278     @echo GMP_RLIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables
279     @echo LEDA_INCLDIR=\"\${LEDA_INCL_DIR}\" >>config.tmp.cgalvariables
280     @echo LEDA_LIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
281     @echo LEDA_RLIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables
282     EOF
283    
284     make -s -f config.tmp.Makefile
285     . config.tmp.cgalvariables
286    
287     rm -f config.tmp.Makefile config.tmp.cgalvariables
288    
289     if test "x$CGAL_INCLDIR" = "x"; then
290     CGAL_INCLDIR=""
291     fi
292    
293     if test "x$CGAL_LIBDIR" = "x"; then
294     CGAL_LIBDIR=""
295     fi
296    
297     if test "x$CGAL_RLIBDIR" = "x"; then
298     CGAL_RLIBDIR=""
299     fi
300    
301     if test "x$LEDA_INCLDIR" = "x"; then
302     LEDA_INCLDIR=""
303     fi
304    
305     if test "x$LEDA_LIBDIR" = "x"; then
306     LEDA_LIBDIR=""
307     fi
308    
309     if test "x$LEDA_RLIBDIR" = "x"; then
310     LEDA_RLIBDIR=""
311     fi
312    
313     if test "x$GMP_INCLDIR" = "x"; then
314     GMP_INCLDIR=""
315     fi
316    
317     if test "x$GMP_LIBDIR" = "x"; then
318     GMP_LIBDIR=""
319     fi
320    
321     if test "x$GMP_RLIBDIR" = "x"; then
322     GMP_RLIBDIR=""
323     fi
324    
325 gezelter 2203 AC_MSG_RESULT(CGAL_OS_COMPILER= $CGAL_OS_COMPILER)
326     AC_MSG_RESULT(CGAL_INCLDIR= $CGAL_INCLDIR)
327     AC_MSG_RESULT(CGAL_INCLCONFDIR= $CGAL_INCLCONFDIR)
328     AC_MSG_RESULT(CGAL_LIBDIR= $CGAL_LIBDIR)
329     AC_MSG_RESULT(CGAL_CXXFLAGS= $CGAL_CXXFLAGS)
330     AC_MSG_RESULT(LEDA_INCLDIR= $LEDA_INCLDIR)
331     AC_MSG_RESULT(LEDA_LIBDIR= $LEDA_LIBDIR)
332     AC_MSG_RESULT(GMP_INCLDIR= $GMP_INCLDIR)
333     AC_MSG_RESULT(GMP_LIBDIR= $GMP_LIBDIR)
334 gezelter 2190
335     AC_LANG_PUSH(C++)
336     save_CXXFLAGS="$CXXFLAGS"
337     CXXFLAGS="$CXXFLAGS -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR"
338     AC_CHECK_HEADER(CGAL/Cartesian.h, cgal=yes, cgal=no)
339     CXXFLAGS="$save_CXXFLAGS"
340    
341     if test "x$cgal" = xyes; then
342     AC_MSG_CHECKING([for CGAL version])
343     LOCATION=${CGAL_INCLDIR}
344     LOCATION=${LOCATION:-/usr/include}
345     if test -f $LOCATION/CGAL/version.h; then
346     CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/version.h | sed 's/[^0-9\.]*//g'`
347     else
348     CGAL_VERSION=`grep '#define.*\<CGAL_VERSION\>.*' $LOCATION/CGAL/config.h | sed 's/[^0-9\.]*//g'`
349     fi
350     changequote({, })dnl
351     if echo $CGAL_VERSION | grep -q "^[3456789]"; then
352     changequote([, ])dnl
353     AC_MSG_RESULT([($CGAL_VERSION) yes])
354     else
355     AC_MSG_RESULT([($CGAL_VERSION) no])
356     cgal=no
357     fi
358     fi
359    
360     if test "x$cgal" = xyes; then
361     CGAL_LIBS="-lCGAL"
362     AC_MSG_CHECKING([whether CGAL uses LEDA])
363     if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_LEDA; then
364     CGAL_USES_LEDA=yes
365     AC_MSG_RESULT([yes])
366     CGAL_DEFINES="-DCGAL_USE_LEDA -DLEDA_PREFIX"
367     else
368     AC_MSG_RESULT([no])
369     CGAL_USES_LEDA=no
370     fi
371    
372     AC_MSG_CHECKING([whether CGAL uses GMP])
373     if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_GMP; then
374     CGAL_USES_GMP=yes
375     AC_MSG_RESULT([yes])
376     CGAL_DEFINES="-DCGAL_USE_GMP $CGAL_DEFINES"
377     else
378     AC_MSG_RESULT([no])
379     CGAL_USES_GMP=no
380     fi
381    
382     CGAL_LIBS="$CGAL_LIBS -lm"
383    
384     CGAL_CXXFLAGS="-ftemplate-depth-50"
385    
386 gezelter 2203 AC_MSG_RESULT(CGAL_USES_LEDA= $CGAL_USES_LEDA)
387     AC_MSG_RESULT(CGAL_USES_GMP = $CGAL_USES_GMP)
388     AC_MSG_RESULT(CGAL_INCLDIR = $CGAL_INCLDIR)
389     AC_MSG_RESULT(CGAL_LIBDIR = $CGAL_LIBDIR)
390     AC_MSG_RESULT(CGAL_DEFINES = $CGAL_DEFINES)
391     AC_MSG_RESULT(CGAL_CXXFLAGS = $CGAL_CXXFLAGS)
392     AC_MSG_RESULT(CGAL_LIBS = $CGAL_LIBS)
393 gezelter 2190 fi
394    
395     if test "x$cgal" = xyes; then
396     save_LIBS="$LIBS"
397     LIBS="$LIBS -L$CGAL_LIBDIR"
398     if test "x$CGAL_USES_LEDA" = xyes; then
399     LIBS="-lL $LIBS -L$LEDA_LIBDIR"
400     fi
401     # if test "x$CGAL_USES_GMP" = xyes; then
402     # LIBS="-lgmp $LIBS $GMP_LIBDIR"
403     # fi
404     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)
405     LIBS="$save_LIBS"
406     fi
407    
408     fi
409     AC_LANG_POP()
410    
411     fi
412    
413     if test "x$cgal" = xyes; then
414     USE_CGAL=yes
415     AC_DEFINE(HAVE_CGAL, 1, [Is defined if the CGAL library is available.])
416     AC_DEFINE_UNQUOTED(CGAL_VERSION, $CGAL_VERSION, [The CGAL version number.])
417     changequote({, })dnl
418     if ! echo $CGAL_VERSION | grep -q "^3.0"; then
419     changequote([, ])dnl
420     AC_MSG_WARN(*****************************************************)
421     AC_MSG_WARN(*** Warning: Your CGAL version is newer than the ***)
422     AC_MSG_WARN(*** supported versions. It may still work though. ***)
423     AC_MSG_WARN(*****************************************************)
424     fi
425     else
426     if test "x$cgal_makefile" != xno; then
427 gezelter 2203 AC_MSG_RESULT(No CGAL support. These are not the droids you want.)
428 gezelter 2190 fi
429     CGAL_INCLDIR=
430     CGAL_LIBDIR=
431     CGAL_RLIBDIR=
432     CGAL_DEFINES=
433     CGAL_CXXFLAGS=
434     CGAL_LIBS=
435     fi
436    
437     AC_SUBST(USE_CGAL)
438     CGAL_INC_DIR="${CGAL_INCLDIR} ${CGAL_INCLCONFDIR}"
439     AC_SUBST(CGAL_INC_DIR)
440     CGAL_LIB_DIR=${CGAL_LIBDIR}
441     AC_SUBST(CGAL_LIB_DIR)
442     CGAL_RLIB_DIR=${CGAL_RLIBDIR}
443     AC_SUBST(CGAL_RLIB_DIR)
444     AC_SUBST(CGAL_DEFINES)
445     AC_SUBST(CGAL_CXXFLAGS)
446     AC_SUBST(CGAL_LIBS)
447    
448 gezelter 1490
449 gezelter 1540 BB_ENABLE_DOXYGEN
450 gezelter 1490
451     AC_SUBST(EXEEXT)
452     AC_SUBST(OBJEXT)
453     AC_SUBST(BATEXT)
454     AC_SUBST(MKINSTALLDIRS)
455     AC_SUBST(OOPSE)
456     AC_SUBST(OOPSE_HOME)
457     AC_SUBST(SUBDIRS)
458     AC_SUBST(CFLAGS)
459     AC_SUBST(CXXFLAGS)
460     AC_SUBST(CPPFLAGS)
461 gezelter 2546 AC_SUBST(FCFLAGS)
462 gezelter 1490 AC_SUBST(LDFLAGS)
463     AC_SUBST(PREPDEFFLAG)
464 gezelter 1535 AC_SUBST(F90_MODULE_NAMES)
465 gezelter 2199 AC_CONFIG_FILES([make/Makefile src/utils/Makefile src/applications/nanoRodBuilder/Makefile scripts/filepp], [chmod 0755 scripts/*])
466 gezelter 1490
467     AC_OUTPUT