--- trunk/OOPSE-3.0/ac-tools/configure.in 2004/09/28 22:14:11 1499 +++ trunk/OOPSE-3.0/ac-tools/configure.in 2005/12/15 14:47:17 2510 @@ -5,8 +5,11 @@ builtin(include, ac-tools/aclocal.m4) builtin(include, ac-tools/fortran90.m4) builtin(include, ac-tools/aclocal.m4) +builtin(include, ac-tools/AC_CXX_HAVE_STL.m4) +builtin(include, ac-tools/AC_CXX_NAMESPACES.m4) +builtin(include, ac-tools/AC_CXX_STD.m4) -AC_CONFIG_SRCDIR([src/applications/oopse.cpp]) +AC_CONFIG_SRCDIR([src/applications/oopse/oopse.cpp]) AC_PREFIX_DEFAULT("/usr/local") @@ -28,12 +31,20 @@ dnl Checks for C compiler # who am i AC_CANONICAL_HOST + + dnl Checks for C compiler -AC_PROG_CC([icc xlc gcc cc]) +AC_PROG_CC([pathcc icc xlc gcc cc]) dnl Checks for C++ compiler -AC_PROG_CXX([icpc icc xlc++ xlC CC g++ c++]) +AC_PROG_CXX([pathCC icpc icc xlc++ xlC CC g++ c++]) +dnl Checks for C preprocessor +AC_PROG_CPP + +dnl Checks for grep and egrep +AC_PROG_EGREP + dnl If we are not running g++ then we might need some other flags dnl to get the templates compiled correctly OOPSE_TEMPLATE_FLAGS="" @@ -81,7 +92,7 @@ AC_PROG_F90([ifort ifc f90 xlf90 pgf90 epcf90 f95 xlf9 dnl Fortran 90 compilation checks are next -AC_PROG_F90([ifort ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) +AC_PROG_F90([pathf95 ifort ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) dnl Check the flag for Fortran90 preprocessing ACX_PROG_F90_PREPFLAG dnl Check to see if a flag is required for preprocessing defines @@ -97,10 +108,56 @@ AC_LANG_POP AC_CHECK_MODSUFFIX dnl Fortran 90 module path specifier AC_CHECK_MODDIRFLAG +AC_F90_MODULE_NAMES +pat=`echo $ac_cv_f90_module_names | sed 's/.*\(%.*%\).*/\1/'` +F90_MODULE_NAMES=empty +case $pat in + %MODULE%) + F90_MODULE_NAMES=UPPER ;; + %Module%) + F90_MODULE_NAMES=Mixed ;; + %module%) + F90_MODULE_NAMES=lower ;; + *) + F90_MODULE_NAMES=unknown ;; +esac +AC_SUBST(F90_MODULE_NAMES) AC_LANG_POP +AC_LANG_CPLUSPLUS +AC_HEADER_STDC +AC_CXX_NAMESPACES +AC_CXX_STD + +dnl Checks for libraries. +AC_CHECK_LIB(m, asin, , exit) + +AC_LANG_C +ACX_CHECK_ZLIB +dnl Checks for header files. +AC_CHECK_HEADERS([stdlib.h string.h sys/param.h unistd.h sys/time.h 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]) +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS([ctype.h iostream fstream sstream strstream]) +AC_LANG_C +AC_CHECK_FUNCS([rint snprintf sranddev strcasecmp strncasecmp stricmp strnicmp pstat_getstatic sysmp getsysinfo sysctl table]) +# special check for _system_configuration because AIX <4.3.2 do not +# contain the `physmem' member. +AC_MSG_CHECKING([for external symbol _system_configuration]) +AC_TRY_COMPILE([#include ], + [double x = _system_configuration.physmem;], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, + [Define if you have the _system_configuration variable.])], + [AC_MSG_RESULT([no])]) +AC_HEADER_TIME + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_TYPES(clock_t) +AC_C_CONST +AC_C_INLINE + + dnl check for system getopt -AC_LANG_PUSH(C) adl_FUNC_GETOPT_LONG dnl check for strong optimization options @@ -121,6 +178,7 @@ AC_CHECK_PROG(AR, ar, ar, NONE) AC_PROG_RANLIB AC_PROG_YACC AC_PROG_LEX +AX_SYS_PERLSHARPBANG AC_CHECK_PROG(AR, ar, ar, NONE) if test "$AR" = "NONE"; then AC_MSG_ERROR(--> Can't find \`ar'!) @@ -128,7 +186,43 @@ fi exit 1 fi +AC_PATH_PROG(PS, ps) +AC_CACHE_CHECK([for POSIX or BSD ps syntax], ac_cv_prog_ps_syntax, [ + if $PS ax -o rss > /dev/null 2>&1; then + ac_cv_prog_ps_ax=yes + else + ac_cv_prog_ps_ax=no + fi + if $PS -ef -o rss > /dev/null 2>&1; then + ac_cv_prog_ps_ef=yes + else + ac_cv_prog_ps_ef=no + fi + if test "$ac_cv_prog_ps_ax" = yes; then + ac_cv_prog_ps_syntax=BSD + else + if test "$ac_cv_prog_ps_ef" = yes; then + ac_cv_prog_ps_syntax=POSIX + else + AC_MSG_ERROR(Could not determine ps syntax) + fi + fi +]) +AC_DEFINE_UNQUOTED(PSCOMMAND, $PS, [Path to ps program]) +AC_DEFINE([OBAPI], [], [Used to export symbols for DLL / shared library builds]) + + +if test "$ac_cv_prog_ps_syntax" = BSD; then + AC_DEFINE(PSTYPE_IS_BSD, 1, [ps uses BSD-style arguments]) +else + if test "$ac_cv_prog_ps_syntax" = POSIX; then + AC_DEFINE(PSTYPE_IS_POSIX, 1, [ps uses POSIX-style arguments]) + else + AC_MSG_ERROR(Unknown ps syntax type!) + fi +fi + AC_ARG_WITH(mpi, [AC_HELP_STRING([--with-mpi=], [compile with MPI installed in [default=no]])], @@ -148,29 +242,228 @@ AC_ARG_WITH(sprng, fi AC_SUBST(USE_MPI) -AC_ARG_WITH(sprng, - [AC_HELP_STRING([--with-sprng=], - [compile with SPRNG installed in [default=/usr/local]])], - with_sprng=$withval, - with_sprng="/usr/local") +dnl AC_ARG_WITH(sprng, +dnl [AC_HELP_STRING([--with-sprng=], +dnl [compile with SPRNG installed in [default=/usr/local]])], +dnl with_sprng=$withval, +dnl with_sprng="/usr/local") +dnl +dnl case "x$with_sprng" in +dnl xyes | "x") USE_SPRNG=yes;; +dnl xno) USE_SPRNG=no ;; +dnl *) SPRNG="$with_sprng"; USE_SPRNG=yes ;; +dnl esac +dnl if test "$USE_SPRNG" = "yes" -a -z "$with_sprng"; then +dnl SPRNG="/usr/local" +dnl fi +dnl if test "$USE_SPRNG" = "yes"; then +dnl ACX_SPRNG +dnl fi +dnl AC_SUBST(USE_SPRNG) -case "x$with_sprng" in - xyes | "x") USE_SPRNG=yes;; - xno) USE_SPRNG=no ;; - *) SPRNG="$with_sprng"; USE_SPRNG=yes ;; -esac -if test "$USE_SPRNG" = "yes" -a -z "$with_sprng"; then - SPRNG="/usr/local" -fi -if test "$USE_SPRNG" = "yes"; then - ACX_SPRNG -fi -AC_SUBST(USE_SPRNG) +dnl ######################################## +dnl # Check for CGAL headers and libraries # +dnl ######################################## +USE_CGAL=no +cgal_makefile=auto +AC_ARG_WITH(cgal-makefile,[ --with-cgal-makefile=FILE CGAL makefile that should be used], cgal_makefile="$withval") -CHECK_MKL +if test "x$cgal_makefile" != xno; then + + if test "x$cgal_makefile" = xauto -a "x$CGAL_MAKEFILE" != x; then + cgal_makefile="$CGAL_MAKEFILE" + fi + + AC_MSG_CHECKING(for cgal_makefile: $cgal_makefile) + + if test -f "$cgal_makefile"; then + + cat >config.tmp.Makefile <config.tmp.cgalvariables + @echo CGAL_INCLDIR=\"\${CGAL_INCL_DIR}\" >>config.tmp.cgalvariables + @echo CGAL_INCLCONFDIR=\"\${CGAL_INCL_CONF_DIR}\" >>config.tmp.cgalvariables + @echo CGAL_LIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables + @echo CGAL_RLIBDIR=\"\${CGAL_LIB_DIR}/\${CGAL_OS_COMPILER}\" >>config.tmp.cgalvariables + @echo CGAL_CXXFLAGS=\"\${CGAL_CXXFLAGS}\" >>config.tmp.cgalvariables + @echo GMP_INCLDIR=\"\${GMP_INCL_DIR}\" >>config.tmp.cgalvariables + @echo GMP_LIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables + @echo GMP_RLIBDIR=\"\${GMP_LIB_DIR}\" >>config.tmp.cgalvariables + @echo LEDA_INCLDIR=\"\${LEDA_INCL_DIR}\" >>config.tmp.cgalvariables + @echo LEDA_LIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables + @echo LEDA_RLIBDIR=\"\${LEDA_LIB_DIR}\" >>config.tmp.cgalvariables +EOF + make -s -f config.tmp.Makefile + . config.tmp.cgalvariables + rm -f config.tmp.Makefile config.tmp.cgalvariables + + if test "x$CGAL_INCLDIR" = "x"; then + CGAL_INCLDIR="" + fi + + if test "x$CGAL_LIBDIR" = "x"; then + CGAL_LIBDIR="" + fi + + if test "x$CGAL_RLIBDIR" = "x"; then + CGAL_RLIBDIR="" + fi + + if test "x$LEDA_INCLDIR" = "x"; then + LEDA_INCLDIR="" + fi + + if test "x$LEDA_LIBDIR" = "x"; then + LEDA_LIBDIR="" + fi + + if test "x$LEDA_RLIBDIR" = "x"; then + LEDA_RLIBDIR="" + fi + + if test "x$GMP_INCLDIR" = "x"; then + GMP_INCLDIR="" + fi + + if test "x$GMP_LIBDIR" = "x"; then + GMP_LIBDIR="" + fi + + if test "x$GMP_RLIBDIR" = "x"; then + GMP_RLIBDIR="" + fi + + AC_MSG_RESULT(CGAL_OS_COMPILER= $CGAL_OS_COMPILER) + AC_MSG_RESULT(CGAL_INCLDIR= $CGAL_INCLDIR) + AC_MSG_RESULT(CGAL_INCLCONFDIR= $CGAL_INCLCONFDIR) + AC_MSG_RESULT(CGAL_LIBDIR= $CGAL_LIBDIR) + AC_MSG_RESULT(CGAL_CXXFLAGS= $CGAL_CXXFLAGS) + AC_MSG_RESULT(LEDA_INCLDIR= $LEDA_INCLDIR) + AC_MSG_RESULT(LEDA_LIBDIR= $LEDA_LIBDIR) + AC_MSG_RESULT(GMP_INCLDIR= $GMP_INCLDIR) + AC_MSG_RESULT(GMP_LIBDIR= $GMP_LIBDIR) + + AC_LANG_PUSH(C++) + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR" + AC_CHECK_HEADER(CGAL/Cartesian.h, cgal=yes, cgal=no) + CXXFLAGS="$save_CXXFLAGS" + + if test "x$cgal" = xyes; then + AC_MSG_CHECKING([for CGAL version]) + LOCATION=${CGAL_INCLDIR} + LOCATION=${LOCATION:-/usr/include} + if test -f $LOCATION/CGAL/version.h; then + CGAL_VERSION=`grep '#define.*\.*' $LOCATION/CGAL/version.h | sed 's/[^0-9\.]*//g'` + else + CGAL_VERSION=`grep '#define.*\.*' $LOCATION/CGAL/config.h | sed 's/[^0-9\.]*//g'` + fi +changequote({, })dnl + if echo $CGAL_VERSION | grep -q "^[3456789]"; then +changequote([, ])dnl + AC_MSG_RESULT([($CGAL_VERSION) yes]) + else + AC_MSG_RESULT([($CGAL_VERSION) no]) + cgal=no + fi + fi + + if test "x$cgal" = xyes; then + CGAL_LIBS="-lCGAL" + AC_MSG_CHECKING([whether CGAL uses LEDA]) + if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_LEDA; then + CGAL_USES_LEDA=yes + AC_MSG_RESULT([yes]) + CGAL_DEFINES="-DCGAL_USE_LEDA -DLEDA_PREFIX" + else + AC_MSG_RESULT([no]) + CGAL_USES_LEDA=no + fi + + AC_MSG_CHECKING([whether CGAL uses GMP]) + if echo $CGAL_CXXFLAGS | grep -q -- -DCGAL_USE_GMP; then + CGAL_USES_GMP=yes + AC_MSG_RESULT([yes]) + CGAL_DEFINES="-DCGAL_USE_GMP $CGAL_DEFINES" + else + AC_MSG_RESULT([no]) + CGAL_USES_GMP=no + fi + + CGAL_LIBS="$CGAL_LIBS -lm" + + CGAL_CXXFLAGS="-ftemplate-depth-50" + + AC_MSG_RESULT(CGAL_USES_LEDA= $CGAL_USES_LEDA) + AC_MSG_RESULT(CGAL_USES_GMP = $CGAL_USES_GMP) + AC_MSG_RESULT(CGAL_INCLDIR = $CGAL_INCLDIR) + AC_MSG_RESULT(CGAL_LIBDIR = $CGAL_LIBDIR) + AC_MSG_RESULT(CGAL_DEFINES = $CGAL_DEFINES) + AC_MSG_RESULT(CGAL_CXXFLAGS = $CGAL_CXXFLAGS) + AC_MSG_RESULT(CGAL_LIBS = $CGAL_LIBS) + fi + + if test "x$cgal" = xyes; then + save_LIBS="$LIBS" + LIBS="$LIBS -L$CGAL_LIBDIR" + if test "x$CGAL_USES_LEDA" = xyes; then + LIBS="-lL $LIBS -L$LEDA_LIBDIR" + fi + # if test "x$CGAL_USES_GMP" = xyes; then + # LIBS="-lgmp $LIBS $GMP_LIBDIR" + # fi + AC_CHECK_CXX_LIB(CGAL, ::CGAL::Cartesian::Point_2, [#include ], [::CGAL::Cartesian::Point_2 P], [cgal=yes], [cgal=no], -I$CGAL_INCLDIR -I$CGAL_INCLCONFDIR) + LIBS="$save_LIBS" + fi + + fi + AC_LANG_POP() + +fi + +if test "x$cgal" = xyes; then + USE_CGAL=yes + AC_DEFINE(HAVE_CGAL, 1, [Is defined if the CGAL library is available.]) + AC_DEFINE_UNQUOTED(CGAL_VERSION, $CGAL_VERSION, [The CGAL version number.]) +changequote({, })dnl + if ! echo $CGAL_VERSION | grep -q "^3.0"; then +changequote([, ])dnl + AC_MSG_WARN(*****************************************************) + AC_MSG_WARN(*** Warning: Your CGAL version is newer than the ***) + AC_MSG_WARN(*** supported versions. It may still work though. ***) + AC_MSG_WARN(*****************************************************) + fi +else + if test "x$cgal_makefile" != xno; then + AC_MSG_RESULT(No CGAL support. These are not the droids you want.) + fi + CGAL_INCLDIR= + CGAL_LIBDIR= + CGAL_RLIBDIR= + CGAL_DEFINES= + CGAL_CXXFLAGS= + CGAL_LIBS= +fi + +AC_SUBST(USE_CGAL) +CGAL_INC_DIR="${CGAL_INCLDIR} ${CGAL_INCLCONFDIR}" +AC_SUBST(CGAL_INC_DIR) +CGAL_LIB_DIR=${CGAL_LIBDIR} +AC_SUBST(CGAL_LIB_DIR) +CGAL_RLIB_DIR=${CGAL_RLIBDIR} +AC_SUBST(CGAL_RLIB_DIR) +AC_SUBST(CGAL_DEFINES) +AC_SUBST(CGAL_CXXFLAGS) +AC_SUBST(CGAL_LIBS) + +dnl CHECK_MKL + +BB_ENABLE_DOXYGEN + AC_EXEEXT AC_OBJEXT OBJEXT=".$OBJEXT" @@ -229,7 +522,8 @@ AC_CONFIG_HEADER([src/config.h]) AC_SUBST(LDFLAGS) AC_SUBST(PREPFLAG) AC_SUBST(PREPDEFFLAG) +AC_SUBST(F90_MODULE_NAMES) AC_CONFIG_HEADER([src/config.h]) -AC_CONFIG_FILES([make/Make.conf]) +AC_CONFIG_FILES([make/Makefile src/utils/Makefile src/applications/nanoRodBuilder/Makefile scripts/filepp], [chmod 0755 scripts/*]) AC_OUTPUT