cantera/config/configure.in
2003-09-08 15:56:51 +00:00

469 lines
9.8 KiB
Text
Executable file

dnl Process this file with autoconf to produce a configure script.
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
AC_INIT(Cantera.README)
AC_CONFIG_HEADER(../config.h)
AC_CONFIG_AUX_DIR(.)
echo
echo "--------------------------------------------------------------"
echo
echo " Cantera Configuration Script "
echo
echo "--------------------------------------------------------------"
echo
AC_DEFINE(NDEBUG)
ac_sys_system=`uname -s`
ac_sys_release=`uname -r`
AC_PREFIX_DEFAULT([/usr/local])
local_inst=1
if test "x${prefix}" = "xNONE"; then
prefix=${ac_default_prefix}
local_inst=0
if test ! -d ${prefix}; then
echo
echo "********************************************************************"
echo "Installation directory /usr/local does not exist. Either create it and"
echo "re-run configure, or specify another installation directory using the"
echo "prefix option:"
echo " ./configure --prefix=<installation_directory>"
echo "********************************************************************"
exit 1
fi
fi
echo "Cantera will be installed in ${prefix}"
AC_SUBST(prefix)
AC_SUBST(local_inst)
CANTERA_LIBDIR=$prefix/lib/cantera
CANTERA_INCDIR=$prefix/include/cantera
ctroot=`(cd ..;pwd)`
if test -z "$username"; then username=$USER; fi
AC_SUBST(username)
AC_SUBST(ctroot)
AC_CANONICAL_SYSTEM()
buildlib=$ctroot/build/lib/$target
AC_SUBST(buildlib)
if test -z "$MAKE"; then MAKE='make'; fi
AC_SUBST(MAKE)
#if test -z "$ARCHIVE"; then ARCHIVE='ar ruv'; fi
AC_SUBST(ARCHIVE)
#if test -z "$SOEXT"; then SOEXT='so'; fi
AC_SUBST(SOEXT)
if test -z "$SHARED"; then SHARED='-shared'; fi
AC_SUBST(SHARED)
if test -z "$PIC"; then PIC='-fPIC'; fi
AC_SUBST(PIC)
#if test -z "$LCXX_FLAGS"; then LCXX_FLAGS="$CXXFLAGS"; fi
AC_SUBST(LCXX_FLAGS)
#if test -z "$LCXX_END_LIBS"; then LCXX_END_LIBS='-lm'; fi
AC_SUBST(LCXX_END_LIBS)
#########################################################
# The Cantera Kernel
#########################################################
KERNEL='base'
BUILD_CK=
NEED_CKREADER=
NEED_BLAS=
NEED_LAPACK=
NEED_RECIPES=
NEED_MATH=
NEED_TPX=
NEED_CVODE=
NEED_TRANSPORT=
NEED_ZEROD=
NEED_ONED=
if test "$ENABLE_THERMO" = "y"; then KERNEL=$KERNEL' 'thermo; fi
if test "$ENABLE_KINETICS" = "y"; then KERNEL=$KERNEL' 'kinetics; fi
if test "$ENABLE_CK" = "y"
then KERNEL=$KERNEL' 'ck
BUILD_CK=1
NEED_CKREADER=1
fi
if test "$ENABLE_TRANSPORT" = "y"
then KERNEL=$KERNEL' 'trprops
NEED_BLAS=1
NEED_LAPACK=1
NEED_MATH=1
NEED_TRANSPORT=1
fi
if test "$ENABLE_EQUIL" = "y"
then KERNEL=$KERNEL' 'equil
NEED_BLAS=1
NEED_LAPACK=1
NEED_RECIPES=1
fi
if test "$ENABLE_REACTORS" = "y"
then KERNEL=$KERNEL' 'reactor
NEED_CVODE=1
NEED_ZEROD=1
fi
if test "$ENABLE_SOLVERS" = "y"
then KERNEL=$KERNEL' 'solvers
NEED_CVODE=1
NEED_MATH=1
fi
if test "$ENABLE_FLOW1D" = "y"
then KERNEL=$KERNEL' 'flow1D
NEED_BLAS=1
NEED_LAPACK=1
NEED_MATH=1
NEED_ONED=1
fi
if test "$ENABLE_RXNPATH" = "y"
then KERNEL=$KERNEL' 'rpath
fi
if test "$ENABLE_TPX" = "y"
then KERNEL=$KERNEL' 'tpx
NEED_TPX=1
fi
AC_SUBST(KERNEL)
AC_SUBST(BUILD_CK)
AC_SUBST(LIB_DIR)
########################################################
# BLAS and LAPACK
########################################################
#
# if lapack and blas libraries have been specified, then skip building the
# supplied libraries
build_lapack=0
if test -z "$LAPACK_LIBRARY"; then LAPACK_LIBRARY=-lctlapack; build_lapack=1; fi
AC_SUBST(LAPACK_LIBRARY)
AC_SUBST(build_lapack)
build_blas=0
if test -z "$BLAS_LIBRARY"; then BLAS_LIBRARY=-lctblas; build_blas=1; fi
AC_SUBST(BLAS_LIBRARY)
AC_SUBST(build_blas)
LOCAL_LIBS=
if test -n "$NEED_ONED"
then LOCAL_LIBS=$LOCAL_LIBS' '-loneD
fi
if test -n "$NEED_ZEROD"
then LOCAL_LIBS=$LOCAL_LIBS' '-lzeroD
fi
if test -n "$NEED_TRANSPORT"
then LOCAL_LIBS=$LOCAL_LIBS' '-ltransport
fi
if test -n "$NEED_CKREADER"
then LOCAL_LIBS=$LOCAL_LIBS' '-lconverters
fi
LOCAL_LIBS=$LOCAL_LIBS' '-lcantera
if test -n "$NEED_RECIPES"
then LOCAL_LIBS=$LOCAL_LIBS' '-lrecipes
fi
if test -n "$NEED_CVODE"
then LOCAL_LIBS=$LOCAL_LIBS' '-lcvode
fi
if test -n "$NEED_LAPACK"
then LOCAL_LIBS=$LOCAL_LIBS' '$LAPACK_LIBRARY
fi
if test -n "$NEED_MATH"
then LOCAL_LIBS=$LOCAL_LIBS' '-lctmath
fi
if test -n "$NEED_BLAS"
then LOCAL_LIBS=$LOCAL_LIBS' '$BLAS_LIBRARY
fi
if test -n "$NEED_TPX"
then LOCAL_LIBS=$LOCAL_LIBS' '-ltpx
fi
AC_SUBST(LOCAL_LIBS)
#
# Cantera directory structure
#
if test -z "$CANTERA_ROOT"; then CANTERA_ROOT=$prefix/cantera; fi
#AC_SUBST(CANTERA_ROOT)
#if test -z "$CANTERA_LIBDIR"; then CANTERA_LIBDIR=$CANTERA_ROOT/lib; fi
AC_SUBST(CANTERA_LIBDIR)
#if test -z "$CANTERA_INCDIR"; then CANTERA_INCDIR=$CANTERA_ROOT/include; fi
AC_SUBST(CANTERA_INCDIR)
if test -z "$CT_TOOLS_BIN"; then CT_TOOLS_BIN=$CANTERA_ROOT/tools/bin; fi
AC_SUBST(CT_TOOLS_BIN)
if test -z "$CANTERA_BINDIR"; then CANTERA_BINDIR=$CANTERA_ROOT/bin; fi
AC_SUBST(CANTERA_BINDIR)
if test -z "$CANTERA_EXAMPLES_DIR"; then CANTERA_EXAMPLES_DIR=$CANTERA_ROOT/examples; fi
AC_SUBST(CANTERA_EXAMPLES_DIR)
if test -z "$CANTERA_DATA_DIR"; then CANTERA_DATA_DIR=$CANTERA_ROOT/data; fi
AC_SUBST(CANTERA_DATA_DIR)
#-------------------------------------------------
# Language Interfaces
#-------------------------------------------------
AC_SUBST(CT_SHARED_LIB)
BUILD_F90=0
if test "$BUILD_F90_INTERFACE" != "n"; then
BUILD_F90=1
fi
AC_SUBST(BUILD_F90)
BUILD_CLIB=0
#
# Python Interface
#
BUILD_PYTHON=0
if test -z "$PYTHON_CMD"; then
AC_PATH_PROGS(PYTHON_CMD, python2 python, "none")
fi
if test "$PYTHON_CMD" != "none"; then
if test "$BUILD_PYTHON_INTERFACE" != "n"; then
BUILD_PYTHON=1; BUILD_CLIB=1
fi
else
echo
echo "********************************************************************"
echo "Configuration error. Python is required to build Cantera, but it"
echo "cannot be found. Set environment variable PYTHON_CMD to the full path to"
echo "the Python interpreter on your system, and run configure again."
echo "********************************************************************"
exit 1
fi
AC_SUBST(BUILD_PYTHON)
#
# Matlab Interface
#
BUILD_MATLAB=0
if test "$BUILD_MATLAB_TOOLBOX" != "n"; then
if test -z "$MATLAB_CMD"; then
AC_PATH_PROG(MATLAB_CMD, matlab, "none")
if test "$MATLAB_CMD" != "none"; then BUILD_MATLAB=1; BUILD_CLIB=1; fi
fi
fi
AC_SUBST(BUILD_MATLAB)
AC_SUBST(BUILD_CLIB)
#-------------------------------------------------
export_name=$target
AC_SUBST(export_name)
dnl Checks for programs.
AC_PROG_CXX()
AC_PROG_CC()
AC_PROG_INSTALL
AC_SUBST(CXX_DEPENDS)
#---------------------------------
# Fortran
#---------------------------------
AC_PROG_F77()
# if G77 is defined, then add a flag to turn off adding a second underscore
# to procedures that have an underscore in the name
if test -n "$G77"; then
FFLAGS=$FFLAGS' -fno-second-underscore'
fi
SHARED_CTLIB=0
OS_IS_DARWIN=0
OS_IS_WIN=0
mex_ext=mexglx
dnl Checks for libraries.
AC_F77_LIBRARY_LDFLAGS()
case $ac_sys_system in
Darwin*) FLIBS='-lg2c -lgcc'; SHARED_CTLIB=0; OS_IS_DARWIN=1; mex_ext=mexmac;;
CYGWIN*) OS_IS_WIN=1; mex_ext=dll;;
esac
AC_SUBST(FLIBS)
AC_SUBST(OS_IS_DARWIN)
AC_SUBST(OS_IS_WIN)
AC_SUBST(SHARED_CTLIB)
AC_SUBST(mex_ext)
# filename extensions for Fortran 77
if test -z "$F77_EXT"; then F77_EXT=f; fi
AC_SUBST(F77_EXT)
AC_LANG_CPLUSPLUS
AC_OBJEXT
AC_EXEEXT
if test -z "$CXX_EXT"; then CXX_EXT=cpp; fi
AC_SUBST(CXX_EXT)
if test -z "$OBJ_EXT"; then OBJ_EXT=$OBJEXT; fi
AC_SUBST(OBJ_EXT)
if test -z "$EXE_EXT"; then EXE_EXT=$EXEEXT; fi
AC_SUBST(EXE_EXT)
dnl AC_LANG_FORTRAN77
local_math_libs='-lrecipes -lcvode'
AC_SUBST(local_math_libs)
math_libs='-lrecipes -lcvode -lctmath'
AC_SUBST(math_libs)
if test "$LAPACK_FTN_TRAILING_UNDERSCORE" = "y"
then AC_DEFINE(LAPACK_FTN_TRAILING_UNDERSCORE)
fi
if test "$LAPACK_FTN_STRING_LEN_AT_END" = "y"
then AC_DEFINE(LAPACK_FTN_STRING_LEN_AT_END)
fi
if test "$LAPACK_NAMES" = "lower"
then AC_DEFINE(LAPACK_NAMES_LOWERCASE)
fi
# from the Python configure.in file...
# Set info about shared libraries.
AC_SUBST(SO)
AC_SUBST(LDSHARED)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX, .dll on Cygwin
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $ac_sys_system in
hp*|HP*) SO=.sl;;
CYGWIN*) SO=.dll;;
Darwin*) SO=.dylib;;
*) SO=.so;;
esac
fi
AC_MSG_RESULT($SO)
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
AC_LANG_CPLUSPLUS
dnl AC_MSG_CHECKING(for the Standard Template Library)
dnl Checks for library functions.
AC_OUTPUT(../Cantera/Makefile \
../Cantera/src/Makefile \
../Cantera/src/zeroD/Makefile \
../Cantera/src/oneD/Makefile \
../Cantera/src/converters/Makefile \
../Cantera/src/transport/Makefile \
../Cantera/clib/src/Makefile \
../Cantera/fortran/src/Makefile \
../Cantera/fortran/f77demos/f77demos.mak \
../Cantera/matlab/Makefile \
../Cantera/python/Makefile \
../Cantera/python/setup.py \
../Cantera/cxx/Makefile \
../Cantera/python/src/Makefile \
../ext/lapack/Makefile \
../ext/blas/Makefile \
../ext/cvode/Makefile \
../ext/math/Makefile \
../ext/tpx/Makefile \
../ext/Makefile \
../ext/recipes/Makefile \
../examples/Makefile \
../examples/cxx/Makefile \
../Makefile \
../tools/Makefile \
../tools/src/Makefile \
../tools/src/sample.mak \
../tools/templates/f77/demo.mak \
../tools/templates/cxx/demo.mak \
../tools/testtools/Makefile \
../data/inputs/Makefile \
../test_problems/Makefile \
../test_problems/cxx_ex/Makefile \
../test_problems/silane_equil/Makefile \
../test_problems/surfkin/Makefile \
../test_problems/diamondSurf/Makefile )
# )
echo
echo "Now type '${MAKE}' to build Cantera"
echo
# $Log: configure.in,v