dnl $Id: configure.in,v 1.66 2006/02/26 19:25:58 geuzaine Exp $ dnl dnl Copyright (C) 1997-2004 P. Dular, C. Geuzaine dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 dnl USA. dnl dnl Please report all bugs and problems to . dnl Process this file with autoconf to produce the configure script. dnl Check that this is the getdp source tree AC_INIT(Parser/GetDP.y) dnl Parse '--with' command-line options AC_ARG_WITH(gsl-prefix, AC_HELP_STRING([--with-gsl-prefix=PFX], [prefix where GSL is installed]), [GSL_PREFIX=$withval]) AC_ARG_WITH(blas-lapack-prefix, AC_HELP_STRING([--with-blas-lapack-prefix=PFX], [prefix where BLAS and LAPACK are installed]), [BLAS_LAPACK_PREFIX=$withval]) AC_ARG_WITH(readline-prefix, AC_HELP_STRING([--with-readline-prefix=PFX], [prefix where GNU readline is installed]), [READLINE_PREFIX=$withval]) AC_ARG_WITH(petsc-prefix, AC_HELP_STRING([--with-petsc-prefix=PFX], [prefix where PETSc is installed]), [PETSC_DIR=$withval]) AC_ARG_WITH(petsc-arch, AC_HELP_STRING([--with-petsc-arch=ARCH], [PETSc architecture]), [PETSC_ARCH=$withval]) AC_ARG_WITH(metis-prefix, AC_HELP_STRING([--with-metis-prefix=PFX], [prefix where Metis is installed]), [METIS_PREFIX=$withval]) dnl Parse '--enable' command line options AC_ARG_ENABLE(multiharmonic, AC_HELP_STRING([--enable-multiharmonic], [enable multiharmonic (> 2) calculations (default=no)])) AC_ARG_ENABLE(petsc, AC_HELP_STRING([--enable-petsc], [use PETSc linear solvers (default=no)])) AC_ARG_ENABLE(arpack, AC_HELP_STRING([--enable-arpack], [enable built-in Arpack eigensolver (default=yes)])) AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [build debug stack frame (default=no)])) AC_ARG_ENABLE(cygwin, AC_HELP_STRING([--enable-cygwin], [use the Cygwin library on Windows (default=no)])) AC_ARG_ENABLE(gsl, AC_HELP_STRING([--enable-gsl], [use GSL as numerical toolkit (default=yes)])) AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [use GNU readline (default=no)])) AC_ARG_ENABLE(metis, AC_HELP_STRING([--enable-metis], [use Metis for graph partitioning (default=no)])) dnl Get the operating system name UNAME=`uname` dnl Check for default compilers AC_PROG_CC AC_PROG_F77 if test "x${CC}" = "x" -o "x${F77}" = "x" ; then AC_MSG_ERROR([Could not find required compilers, aborting.]) fi LINKER="${F77}" dnl Take care of no-cygwin option before doing any other tests case "$UNAME" in CYGWIN*) if test "x$enable_cygwin" != "xyes"; then UNAME="${UNAME}-no-cygwin" CC="${CC} -mno-cygwin" F77="${F77} -mno-cygwin" LINKER="${LINKER} -mno-cygwin" fi ;; esac dnl Set default flags C_FLAGS="${CFLAGS}" C_PARSER_FLAGS="${CFLAGS}" F77_FLAGS="${FFLAGS}" OPTIONS="" dnl Use C for tests AC_LANG(C) dnl Check for various programs AC_PROG_CPP AC_PROG_RANLIB dnl How to build static libraries? AC_PATH_PROG(AR, ar) if test "x${AR}" = "x:"; then AC_MSG_ERROR([Could not find the library archiver, aborting.]) fi AR="${AR} ruvs" dnl See if we need a .exe extension on executables AC_EXEEXT dnl Check for standard math library AC_CHECK_LIB(m,main) dnl Set default subdirectories GETDP_DIRS="Main Parser Post Function Integration GeoData DofData Numeric DataStr FMM" dnl Modify the above defaults and specify the linker if test "x$enable_petsc" = "xyes"; then if test "x${PETSC_DIR}" = "x"; then AC_MSG_ERROR([Could not determine PETSC_DIR. Run configure again with --with-petsc-prefix.]) fi if test "x${PETSC_ARCH}" = "x"; then AC_MSG_ERROR([Could not determine PETSC_ARCH. Run configure again with --with-petsc-arch.]) fi OPTIONS="${OPTIONS} -DHAVE_BLAS_LAPACK" if test "x$enable_arpack" != "xno"; then OPTIONS="${OPTIONS} -DHAVE_ARPACK" GETDP_DIRS="${GETDP_DIRS} Arpack" GETDP_LIBS='-Llib -lMain -lParser -lPost -lFunction -lIntegration -lGeoData -lDofData -lNumeric -lDataStr -lFMM -lArpack ${PETSC_KSP_LIB}' else GETDP_LIBS='-Llib -lMain -lParser -lPost -lFunction -lIntegration -lGeoData -lDofData -lNumeric -lDataStr -lFMM ${PETSC_KSP_LIB}' fi SOLVER='-DHAVE_PETSC ${PETSCFLAGS} ${PETSC_INCLUDE}' LINKER='${CLINKER}' PETSC_INCLUDE_MAKEFILE='include ${PETSC_DIR}/bmake/common/variables' else GETDP_DIRS="${GETDP_DIRS} Sparskit" GETDP_LIBS="-Llib -lMain -lParser -lPost -lFunction -lIntegration -lGeoData -lDofData -lNumeric -lSparskit -lDataStr -lFMM" SOLVER="-DHAVE_SPARSKIT -DHAVE_ILU_FLOAT" dnl Check for blas and lapack (used by Arpack and Lanczos/GSL) AC_LANG_PUSH(Fortran 77) if test "x${BLAS_LAPACK_PREFIX}" != "x"; then LDFLAGS="-L${BLAS_LAPACK_PREFIX} -L${BLAS_LAPACK_PREFIX}/lib ${LDFLAGS}" fi AC_CHECK_LIB(blas,dasum,BLAS="yes",BLAS="no") if test "x${BLAS}" = "xyes"; then AC_CHECK_LIB(lapack,dbdsqr,LAPACK="yes",LAPACK="no",-lblas) if test "x${LAPACK}" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_BLAS_LAPACK" if test "x${BLAS_LAPACK_PREFIX}" != "x"; then GETDP_LIBS="${GETDP_LIBS} -L${BLAS_LAPACK_PREFIX} -L${BLAS_LAPACK_PREFIX}/lib" fi fi fi AC_LANG_POP() dnl Check for Arpack, then link with blas and lapack if necessary if test "x$enable_arpack" != "xno" -a "x${LAPACK}" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_ARPACK" GETDP_DIRS="${GETDP_DIRS} Arpack" GETDP_LIBS="${GETDP_LIBS} -lArpack" fi if test "x${LAPACK}" = "xyes"; then GETDP_LIBS="${GETDP_LIBS} -llapack -lblas" fi dnl Force specific options for native compilers case "${UNAME}" in IRIX*) dnl options for native SGI compiler if test "x${CC}" = "xcc"; then dnl add "-mips3 -n32" to all flags for portable 32 bit exe dnl -DHAVE_ILU_FLOAT crashes Sparskit SOLVER="-DHAVE_SPARSKIT" fi ;; HP-UX*) dnl options for native HP compiler if test "x${CC}" = "xcc"; then C_FLAGS="+O2 +Onolimit -Ae +DAportable" C_PARSER_FLAGS="+O1 -Ae +DAportable" fi if test "x${F77}" = "xf77"; then F77_FLAGS="+O2 +DAportable" LINKER="f77 +DAportable" GETDP_LIBS="Main/Main.o ${GETDP_LIBS}" SOLVER="-DHAVE_UNDERSCORE ${SOLVER}" fi ;; OSF1*) dnl options for native DEC compiler if test "x${CC}" = "xcc"; then C_PARSER_FLAGS="-O1" fi if test "x${F77}" = "xf77"; then LINKER="f77 -nofor_main" fi ;; SunOS*) GETDP_LIBS="${GETDP_LIBS} -lsocket" ;; AIX*) dnl options for native AIX compiler if test "x${CC}" = "xcc"; then C_FLAGS="-O2 -D_BSD -qMAXMEM=10000" C_PARSER_FLAGS="-O1 -D_BSD -qMAXMEM=10000" fi if test "x${F77}" = "xf77"; then F77_FLAGS="-O2 -D_BSD -qMAXMEM=10000" SOLVER="-DHAVE_SPARSKIT -DHAVE_UNDERSCORE" fi ;; CYGWIN* | MINGW*) if test "x$enable_cygwin" != "xyes"; then GETDP_LIBS="${GETDP_LIBS} -lwsock32" fi ;; Linux*) dnl options for pgi and intel compilers case "${F77}" in *pgf77*) LINKER="${F77} -Mnomain" GETDP_LIBS="Main/Main.o ${GETDP_LIBS}" ;; *ifort*) LINKER="${F77} -nofor_main" ;; esac ;; Darwin*) dnl force C linker on Mac OS X LINKER="gcc" GETDP_LIBS="${GETDP_LIBS} -lg2c" ;; esac fi dnl Check for GSL if test "x$enable_gsl" != "xno"; then if test "x${GSL_PREFIX}" != "x"; then LDFLAGS="-L${GSL_PREFIX} -L${GSL_PREFIX}/lib ${LDFLAGS}" fi AC_CHECK_LIB(gslcblas,main) AC_CHECK_LIB(gsl,main,GSL="yes",GSL="no") if test "x${GSL}" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_GSL" if test "x${GSL_PREFIX}" = "x"; then GETDP_LIBS="${GETDP_LIBS} -lgsl -lgslcblas" else GETDP_LIBS="${GETDP_LIBS} -L${GSL_PREFIX} -L${GSL_PREFIX}/lib -lgsl -lgslcblas" OPTIONS="${OPTIONS} -I${GSL_PREFIX} -I${GSL_PREFIX}/include" fi fi fi if test "x${GSL}" != "xyes"; then dnl Check if non-free numerical recipes routines are in the tree AC_CHECK_FILE(./NR/dsvdcmp.c,NR="yes",NR="no") if test "x${NR}" = "xyes"; then echo "********************************************************************" echo "You are building a non-free version of GetDP, using code copyright" echo "(C) 1986-92 Numerical Recipes Software J!0." echo "To use the GSL instead, run configure again with the --enable-gsl" echo "option." echo "********************************************************************" GETDP_DIRS="${GETDP_DIRS} NR" GETDP_LIBS="${GETDP_LIBS} -lNR" else echo "********************************************************************" echo "This is the free version of GetDP and configure could not find" echo "the GNU Scientific Library (GSL) on your system:" echo "- if it is installed in a non-standard location, please run" echo " configure again with the --with-gsl-prefix option" echo "- if it is not installed on your system, you can download it from" echo " http://sources.redhat.com/gsl/" echo "" echo "IMPORTANT NOTE: You need to install GSL version 1.2 or above. All" echo "versions <= 1.1.1 have a bug in the singular value decomposition" echo "algorithm that may cause GetDP to hang during execution." echo "********************************************************************" AC_MSG_ERROR([Could not find GSL, aborting.]) fi fi dnl Do we trace the function calls in getdp? if test "x$enable_debug" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_DEBUG_STACK" fi dnl Do we enable large number of harmonics in calculations? if test "x$enable_multiharmonic" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_MULTIHARMONIC" fi dnl Check for Metis if test "x$enable_metis" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_METIS" if test "x${METIS_PREFIX}" != "x"; then OPTIONS="${OPTIONS} -I${METIS_PREFIX} -I${METIS_PREFIX}/include" GETDP_LIBS="${GETDP_LIBS} -L${METIS_PREFIX} -L${METIS_PREFIX}/lib -lmetis" fi fi dnl Check for GNU readline if test "x$enable_readline" = "xyes"; then if test "x${READLINE_PREFIX}" != "x"; then CPPFLAGS="-I${READLINE_PREFIX} -I${READLINE_PREFIX}/include" LDFLAGS="-L${READLINE_PREFIX} -L${READLINE_PREFIX}/lib ${LDFLAGS}" fi AC_CHECK_HEADER(readline/readline.h,READLINE="yes",READLINE="no") dnl readline neads the termcap functions (also available in libcurses) AC_CHECK_LIB(termcap,main,TERMCAP="yes",TERMCAP="no") if test "x${TERMCAP}" = "xyes"; then AC_CHECK_LIB(readline,main,READLINE="yes",READLINE="no",-lhistory -ltermcap) else AC_CHECK_LIB(curses,main,CURSES="yes",CURSES="no") if test "x${CURSES}" = "xyes"; then AC_CHECK_LIB(readline,main,READLINE="yes",READLINE="no",-lhistory -lcurses) else READLINE="no" fi fi if test "x${READLINE}" = "xyes"; then OPTIONS="${OPTIONS} -DHAVE_READLINE" if test "x${READLINE_PREFIX}" = "x"; then GETDP_LIBS="${GETDP_LIBS} -lreadline -lhistory" else GETDP_LIBS="${GETDP_LIBS} -L${READLINE_PREFIX} -L${READLINE_PREFIX}/lib -lreadline -lhistory" OPTIONS="${OPTIONS} -I${READLINE_PREFIX} -I${READLINE_PREFIX}/include" fi if test "x${TERMCAP}" = "xyes"; then GETDP_LIBS="${GETDP_LIBS} -ltermcap" else GETDP_LIBS="${GETDP_LIBS} -lcurses" fi fi fi dnl Finish link line GETDP_LIBS="${GETDP_LIBS} -lm" dnl Add options to C compiler flags C_FLAGS="${C_FLAGS} ${OPTIONS}" C_PARSER_FLAGS="${C_PARSER_FLAGS} ${OPTIONS}" dnl Write output AC_SUBST(UNAME) AC_SUBST(C_FLAGS) AC_SUBST(C_PARSER_FLAGS) AC_SUBST(F77_FLAGS) AC_SUBST(SOLVER) AC_SUBST(LINKER) AC_SUBST(GETDP_DIRS) AC_SUBST(GETDP_LIBS) AC_SUBST(AR) AC_SUBST(PETSC_INCLUDE_MAKEFILE) AC_SUBST(PETSC_DIR) AC_SUBST(PETSC_ARCH) AC_OUTPUT(variables) dnl Print some information echo "********************************************************************" echo "GetDP is configured for" echo "- OS : $UNAME" echo "- C compiler : $CC $C_FLAGS" echo "- Fortran compiler : $F77 $F77_FLAGS" echo "- Linker : $LINKER" echo "- Solver : $SOLVER" if test "x$enable_petsc" = "xyes"; then echo "- PETSC_DIR : $PETSC_DIR" echo "- PETSC_ARCH : $PETSC_ARCH" fi echo "********************************************************************" echo "To fine-tune the configuration, edit the 'variables' file" echo "********************************************************************"