From 81f5771b593a7b03cbcacc3b70111dffa36ebdf7 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Mon, 9 Aug 2004 05:10:18 +0000 Subject: [PATCH] improvements to the configuration process --- Cantera/fortran/src/Makefile.in | 26 +--- Cantera/python/setup.py.in | 1 + Cantera/src/DenseMatrix.cpp | 2 + Cantera/src/DenseMatrix.h | 3 +- Cantera/src/ctlapack.h | 19 ++- Cantera/src/ctvector.cpp | 85 +++++++++++ Cantera/src/ctvector.h | 45 ++++++ Cantera/src/misc.cpp | 4 +- Makefile.in | 15 +- config/configure | 258 ++++++++++++++++---------------- config/configure.in | 193 ++++++++++++++---------- configure | 174 +++++++++++---------- ext/math/fdump.f | 78 +++++----- 13 files changed, 548 insertions(+), 355 deletions(-) diff --git a/Cantera/fortran/src/Makefile.in b/Cantera/fortran/src/Makefile.in index 17ef996fd..5c4853da5 100644 --- a/Cantera/fortran/src/Makefile.in +++ b/Cantera/fortran/src/Makefile.in @@ -14,21 +14,6 @@ CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) FORT_FLAGS = @F90FLAGS@ -CXX_OBJS = fct.o fctxml.o - -#INTERFACE_MODULE_OBJS = fct_interface.o fctxml_interface.o -# -#USER_MODULE_OBJS = cantera_xml.o cantera_thermo.o cantera_kinetics.o \ -# cantera_funcs.o canteramod.o -# -#MODULES = $(INTERFACE_MODULE_OBJS) $(USER_MODULE_OBJS) -#OBJS = $(CXX_OBJS) $(USER_MODULE_OBJS) -# -#DEPENDS = $(CXX_OBJS:.o=.d) -#UMODS = $(USER_MODULE_OBJS:cantera_=) -#MODFILES = $(INTERFACE_MODULE_OBJS:_interface.o=.mod) $(UMODS:.o=.mod) - - CXX_OBJS = fct.o fctxml.o @@ -90,21 +75,22 @@ LIB_NAME=libfct.a FTLIB = @buildlib@/$(LIB_NAME) -lib: $(MODFILES) $(USER_MODULE_OBJS) $(CXX_OBJS) $(LIB_DEPS) +$(FTLIB): $(MODFILES) $(USER_MODULE_OBJS) $(CXX_OBJS) $(LIB_DEPS) $(RM) $(FTLIB) @ARCHIVE@ $(FTLIB) $(OBJS) cp -f $(MODFILES) $(MODULE_DIR) clean: - $(RM) $(OBJS) $(FTLIB) + $(RM) $(OBJS) $(FTLIB) $(MODFILES) install: - @INSTALL@ $(FTLIB) @prefix@/lib/cantera + @INSTALL@ $(FTLIB) @ct_libdir@ + @INSTALL@ $(MODFILES) @ct_incdir@ win-install: - @INSTALL@ ../../../lib/clib.lib @prefix@/lib/cantera + @INSTALL@ ../../../lib/fct.lib @ct_libdir@ -%.d: +%.d: %.cpp g++ -MM $(CXX_INCLUDES) $*.cpp > $*.d depends: $(DEPENDS) diff --git a/Cantera/python/setup.py.in b/Cantera/python/setup.py.in index fc055bbfa..199a692d2 100644 --- a/Cantera/python/setup.py.in +++ b/Cantera/python/setup.py.in @@ -8,6 +8,7 @@ libs = [] platform = sys.platform flibs = '@FLIBS@' +#linkargs = '@LCXX_FLAGS@' bllibstr = "@BLAS_LAPACK_LIBS@" bllibs = bllibstr.replace('-l',' ') diff --git a/Cantera/src/DenseMatrix.cpp b/Cantera/src/DenseMatrix.cpp index a62693d1e..a8bc155c2 100755 --- a/Cantera/src/DenseMatrix.cpp +++ b/Cantera/src/DenseMatrix.cpp @@ -93,6 +93,7 @@ namespace Cantera { } +#ifdef INCL_LEAST_SQUARES /** @todo fix lwork */ int leastSquares(DenseMatrix& A, double* b) { int info = 0; @@ -113,6 +114,7 @@ namespace Cantera { "DGELSS returned INFO = "+int2str(info)); return 0; } +#endif /** * Multiply \c A*b and return the result in \c prod. Uses BLAS diff --git a/Cantera/src/DenseMatrix.h b/Cantera/src/DenseMatrix.h index 0d8adfbe7..bb335ab9e 100755 --- a/Cantera/src/DenseMatrix.h +++ b/Cantera/src/DenseMatrix.h @@ -86,9 +86,10 @@ namespace Cantera { /** Solve Ax = b for multiple right-hand-side vectors. */ int solve(DenseMatrix& A, DenseMatrix& b); +#ifdef INCL_LEAST_SQUARES /** @todo fix lwork */ int leastSquares(DenseMatrix& A, double* b); - +#endif /** * Multiply \c A*b and return the result in \c prod. Uses BLAS * routine DGEMV. diff --git a/Cantera/src/ctlapack.h b/Cantera/src/ctlapack.h index 61dc7a9f9..792cdfc6e 100755 --- a/Cantera/src/ctlapack.h +++ b/Cantera/src/ctlapack.h @@ -12,8 +12,12 @@ #ifndef CT_CTLAPACK_H #define CT_CTLAPACK_H +#undef USE_CBLAS + #include "ct_defs.h" +//#include + // map BLAS names to names with or without a trailing underscore. #ifndef LAPACK_FTN_TRAILING_UNDERSCORE @@ -47,18 +51,15 @@ namespace ctlapack { } const char no_yes[2] = {'N', 'T'}; -// #ifdef HAVE_INTEL_MKL -// #include "../../ext/math/mkl_cblas.h" -// const CBLAS_ORDER cblasOrder[2] = { CblasRowMajor, CblasColMajor }; -// const CBLAS_TRANSPOSE cblasTrans[2] = { CblasNoTrans, CblasTrans }; -// #endif +//const CBLAS_ORDER cblasOrder[2] = { CblasRowMajor, CblasColMajor }; +//const CBLAS_TRANSPOSE cblasTrans[2] = { CblasNoTrans, CblasTrans }; + // C interfaces for Fortran Lapack routines extern "C" { #ifdef LAPACK_FTN_STRING_LEN_AT_END - int _DGEMV_(const char* transpose, const integer* m, const integer* n, const doublereal* alpha, const doublereal* a, const integer* lda, const doublereal* x, @@ -133,6 +134,10 @@ namespace Cantera { //cblas_dgemv(cblasOrder[storage], cblasTrans[trans], m, n, alpha, // a, lda, x, incX, beta, y, incY); //#else +#ifdef USE_CBLAS + cblas_dgemv(cblasOrder[storage], cblasTrans[trans], m, n, alpha, + a, lda, x, incX, beta, y, incY); +#else integer f_m = m, f_n = n, f_lda = lda, f_incX = incX, f_incY = incY; doublereal f_alpha = alpha, f_beta = beta; ftnlen trsize = 1; @@ -143,7 +148,7 @@ namespace Cantera { _DGEMV_(&no_yes[trans], trsize, &f_m, &f_n, &f_alpha, a, &f_lda, x, &f_incX, &f_beta, y, &f_incY); #endif - //#endif +#endif } diff --git a/Cantera/src/ctvector.cpp b/Cantera/src/ctvector.cpp index 17321b4d1..327ef0ca4 100755 --- a/Cantera/src/ctvector.cpp +++ b/Cantera/src/ctvector.cpp @@ -119,6 +119,91 @@ namespace ct { void ctvector_fp::clear() { fill(_data, _data + _size, 0.0); resize(0); } + //-------------------------------------// + // ctvector_float // + //-------------------------------------// + + + ctvector_float::ctvector_float(size_t n) : _size(0), _alloc(0), _data(0) { + resize(n); + } + + ctvector_float::ctvector_float(size_t n, value_type v0) + : _size(0), _alloc(0), _data(0) { + resize(n, v0); + } + + ctvector_float::ctvector_float(const ctvector_float& x) { + if (x._alloc > 0) { + _data = new value_type[x._alloc]; + copy(x._data, x._data + x._alloc, _data); + } + else { + _data = 0; + } + _size = x._size; + _alloc = x._alloc; + } + + ctvector_float ctvector_float::operator=(const ctvector_float& x) { + if (this == &x) return *this; + if (_data) delete[] _data; + if (x._alloc > 0) { + _data = new value_type[x._alloc]; + copy(x._data, x._data + x._alloc, _data); + } + else { + _data = 0; + } + _size = x._size; + _alloc = x._alloc; + return *this; + } + + ctvector_float::~ctvector_float() { + if (_data) delete[] _data; + _data = 0; + } + + void ctvector_float::resize(size_t n) { + size_t new_alloc = n+1; + value_type* newdata = new value_type[new_alloc]; + size_t datalen = (n > _size ? _size : n); + if (_data) { + copy(_data, _data + datalen, newdata); + } + if (_data) delete[] _data; + _data = newdata; + _alloc = new_alloc; + _size = n; + } + + void ctvector_float::resize(size_t n, value_type v0) { + size_t new_alloc = n+1; + value_type* newdata = new value_type[new_alloc]; + fill(newdata, newdata + new_alloc, v0); + size_t datalen = (n > _size ? _size : n); + if (_data) { + copy(_data, _data + datalen, newdata); + } + if (_data) delete[] _data; + _data = newdata; + _alloc = new_alloc; + _size = n; + } + + void ctvector_float::push_back(value_type x) { + size_t loc = _size; + if (_size == _alloc) { + resize(2*_alloc); + } + _data[loc] = x; + _size = loc + 1; + } + + void ctvector_float::clear() { fill(_data, _data + _size, 0.0); resize(0); } + + //-------------------------------------// // ctvector_int // diff --git a/Cantera/src/ctvector.h b/Cantera/src/ctvector.h index 0e408f287..e94cfb705 100755 --- a/Cantera/src/ctvector.h +++ b/Cantera/src/ctvector.h @@ -66,6 +66,49 @@ namespace ct { }; + /** + * A class for single-precision floating-point arrays + */ + class ctvector_float { + public: + + typedef unsigned int size_t; + typedef float doublereal; + typedef doublereal* iterator; + typedef const doublereal* const_iterator; + typedef doublereal* pointer; + typedef size_t difference_type; + typedef doublereal value_type; + + ctvector_float(size_t n=0); + ctvector_float(size_t n, value_type v0); + ctvector_float(const ctvector_float& x); + ctvector_float operator=(const ctvector_float& x); + virtual ~ctvector_float(); + + value_type operator[](size_t n) const { return _data[n]; } + value_type& operator[](size_t n) { return _data[n]; } + + void resize(size_t n); + void resize(size_t n, value_type v0); + + value_type back() const { return _data[_size-1]; } + const_iterator begin() const { return _data; } + iterator begin() { return _data; } + const_iterator end() const { return _data + _size; } + iterator end() { return _data + _size; } + void push_back(value_type x); + size_t size() const { return _size; } + void clear(); + bool empty() const { return (_size == 0); } + + protected: + size_t _size, _alloc; + iterator _data; + private: + }; + + // integer arrays class ctvector_int { public: @@ -113,6 +156,8 @@ namespace ct { std::ostream& operator<<(std::ostream& s, const ct::ctvector_fp& v); std::ostream& operator<<(std::ostream& s, ct::ctvector_fp& v); +std::ostream& operator<<(std::ostream& s, const ct::ctvector_float& v); +std::ostream& operator<<(std::ostream& s, ct::ctvector_float& v); std::ostream& operator<<(std::ostream& s, const ct::ctvector_int& v); diff --git a/Cantera/src/misc.cpp b/Cantera/src/misc.cpp index 8f9b0a981..a19976067 100755 --- a/Cantera/src/misc.cpp +++ b/Cantera/src/misc.cpp @@ -328,7 +328,7 @@ namespace Cantera { // add a default data location for Mac OS X // if (DARWIN == 1) - dirs.push_back("/Applications/Cantera/Data"); + dirs.push_back("/Applications/Cantera/data"); #endif // @@ -340,7 +340,7 @@ namespace Cantera { dirs.push_back(datadir); } - // CANTERA_ROOT is defined in file config.h. This file is written + // CANTERA_DATA is defined in file config.h. This file is written // during the build process (unix), and points to the directory // specified by the 'prefix' option to 'configure', or else to // /usr/local/cantera. diff --git a/Makefile.in b/Makefile.in index 839bb330d..45c9780ca 100755 --- a/Makefile.in +++ b/Makefile.in @@ -32,7 +32,8 @@ win: hdr-collect python matlab @echo Now type \'make win-install\' to install Cantera in @ct_dir@. @echo -install: hdr-install kernel-install data-install f90-modules-install python-install \ +install: hdr-install kernel-install clib-install data-install f90-modules-install \ + python-install \ matlab-install particles-install tools-install finish-install win-install: hdr-install win-kernel-install data-install python-install \ @@ -52,6 +53,9 @@ kernel: rm -f @buildbin@/* cd ext; @MAKE@ cd Cantera/src; @MAKE@ +ifeq ($(do_ranlib),1) + @RANLIB@ @buildlib@/*.a +endif # build the user library user: @@ -60,9 +64,8 @@ ifeq ($(incl_user_code),1) endif clib: +ifeq ($(build_clib),1) cd Cantera/clib/src; @MAKE@ -ifeq ($(do_ranlib),1) - @RANLIB@ @buildlib@/*.a endif fortran: @@ -82,11 +85,15 @@ kernel-install: @INSTALL@ -d @ct_libdir@ rm -f @ct_libdir@/* @INSTALL@ -m 644 @buildlib@/*.a @ct_libdir@ - cd Cantera/clib/src; @MAKE@ install ifeq ($(do_ranlib),1) @RANLIB@ @ct_libdir@/*.a endif +clib-install: +ifeq ($(build_clib),1) + cd Cantera/clib/src; @MAKE@ install +endif + win-kernel-install: @INSTALL@ -d @ct_libdir@ rm -f @ct_libdir@/* diff --git a/config/configure b/config/configure index c9958d2fb..4f2c808d4 100755 --- a/config/configure +++ b/config/configure @@ -271,7 +271,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Cantera.README" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR local_inst local_python_inst python_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir COMPACT_INSTALL CANTERA_LIBDIR CANTERA_INCDIR CT_TOOLS_BIN CANTERA_BINDIR CANTERA_EXAMPLES_DIR CANTERA_DATADIR build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE DO_RANLIB RANLIB SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c LOCAL_LIB_DIRS LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB foundF90 BUILD_F90 F90 F90FLAGS F77FLAGS PYTHON_CMD WIN_PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR local_inst local_python_inst python_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir COMPACT_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE DO_RANLIB RANLIB SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c LOCAL_LIB_DIRS LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB F77FLAGS PYTHON_CMD WIN_PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS BUILD_F90 F90 F90FLAGS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1327,10 +1327,11 @@ local_python_inst=${local_inst} if test "x${SET_PYTHON_SITE_PACKAGE_TOPDIR}" = "xy"; then python_prefix=${PYTHON_SITE_PACKAGE_TOPDIR} local_python_inst=1 + echo "Cantera's Python packages will be installed in ${python_prefix}" else python_prefix=$prefix fi -echo "Cantera's Python packages will be installed in ${python_prefix}" + @@ -1340,7 +1341,8 @@ ctversion=${CANTERA_VERSION} homedir=${HOME} -if test -z $local_inst; then +# default is a distributed unix-like installation; these values may be +# modified below. ct_libdir=${prefix}/lib/cantera/${ctversion} ct_incdir=${prefix}/include/cantera ct_incroot=${prefix}/include @@ -1352,44 +1354,32 @@ ct_tutdir=${prefix}/cantera/${ctversion}/tutorials ct_docdir=${prefix}/cantera/${ctversion}/doc ct_dir=${prefix}/cantera/${ctversion} ct_mandir=${prefix}/share/man -else -ct_libdir=${prefix}/lib/cantera/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin -ct_datadir=${prefix}/cantera/${ctversion}/data -ct_demodir=${prefix}/cantera/${ctversion}/demos -ct_templdir=${prefix}/cantera/${ctversion}/templates -ct_tutdir=${prefix}/cantera/${ctversion}/tutorials -ct_docdir=${prefix}/cantera/${ctversion}/doc -ct_dir=${prefix}/cantera/${ctversion} -ct_mandir=${prefix}/share/man -fi -# default is unix-like distributed installation (not everything within one directory) -COMPACT_INSTALL=0 +# A compact installation is one in which the $prefix directory +# contains only Cantera files. It is different than a local +# installation, in that the Python package is installed with other +# Python packages and modules in site-packages, rather than with the +# rest of the Cantera files, as in a local installation. Therefore, +# with a compact installation, there is no need to set PYTHONPATH. A +# compact installation is done on Windows systems and on Mac OS X +# systems, and a non-compact ("distributed") installation is done by +# default on other unix/linux systems, unless a local installation is +# being done. + +# default is unix-like distributed installation, +# unless a local installation is being done. +COMPACT_INSTALL=$local_inst if test "x${OS_IS_WIN}" = "x1"; then COMPACT_INSTALL=1 -ct_libdir=${prefix}/lib/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin -ct_datadir=${prefix}/data -ct_demodir=${prefix}/demos -ct_templdir=${prefix}/templates -ct_tutdir=${prefix}/tutorials -ct_docdir=${prefix}/doc -ct_dir=${prefix} -ct_mandir=${prefix} fi if test "x${OS_IS_DARWIN}" = "x1"; then COMPACT_INSTALL=1 +fi + +if test -n $COMPACT_INSTALL; then ct_libdir=${prefix}/lib/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin ct_datadir=${prefix}/data ct_demodir=${prefix}/demos ct_templdir=${prefix}/templates @@ -1412,20 +1402,20 @@ fi -CANTERA_DATADIR=$datadir/cantera/data + # # Cantera directory structure # -if test -z "$CANTERA_ROOT"; then CANTERA_ROOT=$prefix/cantera; fi - - -if test -z "$CT_TOOLS_BIN"; then CT_TOOLS_BIN=$CANTERA_ROOT/tools/bin; fi - - -if test -z "$CANTERA_EXAMPLES_DIR"; then CANTERA_EXAMPLES_DIR=$CANTERA_ROOT/examples; fi - - +#if test -z "$CANTERA_ROOT"; then CANTERA_ROOT=$prefix/cantera; fi +#AC_SUBST(CANTERA_LIBDIR) +#AC_SUBST(CANTERA_INCDIR) +#if test -z "$CT_TOOLS_BIN"; then CT_TOOLS_BIN=$CANTERA_ROOT/tools/bin; fi +#AC_SUBST(CT_TOOLS_BIN) +#AC_SUBST(CANTERA_BINDIR) +#if test -z "$CANTERA_EXAMPLES_DIR"; then CANTERA_EXAMPLES_DIR=$CANTERA_ROOT/examples; fi +#AC_SUBST(CANTERA_EXAMPLES_DIR) +#AC_SUBST(CANTERA_DATADIR) # Make sure we can run config.sub. @@ -1511,6 +1501,7 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- +# the root of the source tree ctroot=`(cd ..;pwd)` builddir=$target if test "x${OS_IS_WIN}" = "x1"; then @@ -1523,15 +1514,17 @@ if test -z "$username"; then username=$USER; fi +# the include directory in the 'build' subdirectory. This is required to build the test problems +# before Cantera has been installed. buildinc=$ctroot/build/include - buildlib=$ctroot/build/lib/$builddir buildbin=$ctroot/build/bin/$builddir +# add definitions to config.h cat >>confdefs.h <<_ACEOF #define DARWIN $OS_IS_DARWIN _ACEOF @@ -1548,15 +1541,13 @@ cat >>confdefs.h <<_ACEOF #define RXNPATH_FONT "$RPFONT" _ACEOF -cat >>confdefs.h <<_ACEOF -#define CANTERA_ROOT "$prefix/cantera" -_ACEOF - +#AC_DEFINE_UNQUOTED(CANTERA_ROOT,"$prefix/cantera") cat >>confdefs.h <<_ACEOF #define CANTERA_DATA "$ct_datadir" _ACEOF + if test -z "$MAKE"; then MAKE='make'; fi @@ -1693,13 +1684,9 @@ build_blas=1 build_lapack=1 fi -# if test -z "$LAPACK_LIBRARY"; then LAPACK_LIBRARY=-lctlapack; build_lapack=1; fi -# AC_SUBST(LAPACK_LIBRARY) -# build_blas=0 -# if test -z "$BLAS_LIBRARY"; then BLAS_LIBRARY=-lctblas; build_blas=1; fi -# AC_SUBST(BLAS_LIBRARY) + @@ -1830,51 +1817,13 @@ fi BUILD_F90=0 if test "x$BUILD_F90_INTERFACE" = "xy"; then BUILD_F90=1 - # Extract the first word of "$F90", so it can be a program name with args. -set dummy $F90; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_foundF90+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$foundF90"; then - ac_cv_prog_foundF90="$foundF90" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_foundF90="yes" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_foundF90" && ac_cv_prog_foundF90="no" +# AC_CHECK_PROG(foundF90, $F90, yes, no) +# if test x$foundF90 = "xno" ; then +# echo 'Did not find the Fortran 90 compiler, '$F90 +# echo " -> Turning off F90 interface even though it was requested" +# BUILD_F90=0 +# fi fi -fi -foundF90=$ac_cv_prog_foundF90 -if test -n "$foundF90"; then - echo "$as_me:$LINENO: result: $foundF90" >&5 -echo "${ECHO_T}$foundF90" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test x$foundF90 = "xno" ; then - echo 'Did not find the Fortran 90 compiler, '$F90 - echo " -> Turning off F90 interface even though it was requested" - BUILD_F90=0 - fi -fi - - - if test "x$F77FLAGS" = "x"; then F77FLAGS=$FFLAGS @@ -1894,10 +1843,7 @@ fi WIN_PYTHON_CMD=python if test $BUILD_PYTHON -gt 0; then -if test "$PYTHON_CMD" = "default" ; then - PYTHON_CMD= -fi -if test -z "$PYTHON_CMD"; then + if test "$PYTHON_CMD" = "default"; then for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -1992,18 +1938,19 @@ test -n "$WIN_PYTHON_CMD" || WIN_PYTHON_CMD=""none"" WIN_PYTHON_CMD=`cygpath -a -w "$WIN_PYTHON_CMD" | sed 's/\\\/\\//g'` echo "Windows Python command: $WIN_PYTHON_CMD" fi -else + else echo "Python command preset to $PYTHON_CMD" -fi -if test "$PYTHON_CMD" = "none"; then - 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 + fi + + if test "$PYTHON_CMD" = "none"; then + 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 else PYTHON_CMD=none WIN_PYTHON_CMD=none @@ -3374,6 +3321,7 @@ _ACEOF fi echo "$as_me:$LINENO: result: ${precompile_headers}" >&5 echo "${ECHO_T}${precompile_headers}" >&6 +fi has_sstream=no echo "$as_me:$LINENO: checking for sstream" >&5 @@ -3492,7 +3440,7 @@ fi # Provide some information about the compiler. -echo "$as_me:3495:" \ +echo "$as_me:3443:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -3669,7 +3617,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:3672: \"$ac_link\") >&5 +(eval echo $as_me:3620: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -3749,7 +3697,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:3752: \"$ac_link\") >&5 +(eval echo $as_me:3700: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -3917,16 +3865,75 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +override_f77_libs=0; case $ac_sys_system in - Darwin*) FLIBS='-lstdc++ -lg2c'; SHARED_CTLIB=0;; + Darwin*) FLIBS='-lstdc++ -lg2c'; override_f77_libs=1; SHARED_CTLIB=0;; esac - - - - +if test -n $override_f77_libs; then + echo The Fortran 77 libraries on this platform are not correctly determined by + echo the configuration process. They are being manually set to + echo FLIBS = $FLIBS fi +has_f90=no +f90type=none +f90_module_dir='-I' +f90_opts='' + +if test -n ${BUILD_F90}; then + echo "$as_me:$LINENO: checking Fortran 90 compiler ($F90) type" >&5 +echo $ECHO_N "checking Fortran 90 compiler ($F90) type... $ECHO_C" >&6 + cat >> testf90.f90 << EOF +module mt +double precision, parameter :: x = 2.3 +end module mt +program testf90 +use mt +integer :: i +end program testf90 +EOF + msg=`${F90} -c testf90.f90 &> /dev/null` + if test -f testf90.o; then + has_f90=yes + rm testf90.o + f90type=unknown + fi +# + msg=`${F90} -V &> f90out` + isnag=`grep -c NAGWare f90out` + if test "x${isnag}" != "x0"; then + f90type="NAG" + f90opts="-I. -I${ct_incroot}" + fi +# + msg=`${F90} -V -c testf90.f90 &> f90out` + isabsoft=`grep -c Absoft f90out` + if test "x${isabsoft}" != "x0"; then + f90type="Absoft" + f90opts="-p. -p${ct_incroot} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + fi + rm -f testf90.f90 f90out + echo "$as_me:$LINENO: result: ${f90type}" >&5 +echo "${ECHO_T}${f90type}" >&6 + if test -n $BUILD_F90; then + if test "x${has_f90}" = "xno"; then + echo " -> cannot build the Fortran 90 interface" + BUILD_F90=0 + fi + fi +fi +F90FLAGS=${f90opts}' '${F90FLAGS} + + + + + + + + + + @@ -4645,12 +4652,6 @@ s,@ct_tutdir@,$ct_tutdir,;t t s,@ct_docdir@,$ct_docdir,;t t s,@ct_dir@,$ct_dir,;t t s,@COMPACT_INSTALL@,$COMPACT_INSTALL,;t t -s,@CANTERA_LIBDIR@,$CANTERA_LIBDIR,;t t -s,@CANTERA_INCDIR@,$CANTERA_INCDIR,;t t -s,@CT_TOOLS_BIN@,$CT_TOOLS_BIN,;t t -s,@CANTERA_BINDIR@,$CANTERA_BINDIR,;t t -s,@CANTERA_EXAMPLES_DIR@,$CANTERA_EXAMPLES_DIR,;t t -s,@CANTERA_DATADIR@,$CANTERA_DATADIR,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t @@ -4692,10 +4693,6 @@ s,@LOCAL_LIBS@,$LOCAL_LIBS,;t t s,@CANTERA_PARTICLES_DIR@,$CANTERA_PARTICLES_DIR,;t t s,@BUILD_PARTICLES@,$BUILD_PARTICLES,;t t s,@CT_SHARED_LIB@,$CT_SHARED_LIB,;t t -s,@foundF90@,$foundF90,;t t -s,@BUILD_F90@,$BUILD_F90,;t t -s,@F90@,$F90,;t t -s,@F90FLAGS@,$F90FLAGS,;t t s,@F77FLAGS@,$F77FLAGS,;t t s,@PYTHON_CMD@,$PYTHON_CMD,;t t s,@WIN_PYTHON_CMD@,$WIN_PYTHON_CMD,;t t @@ -4721,6 +4718,9 @@ s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@FLIBS@,$FLIBS,;t t +s,@BUILD_F90@,$BUILD_F90,;t t +s,@F90@,$F90,;t t +s,@F90FLAGS@,$F90FLAGS,;t t s,@precompile_headers@,$precompile_headers,;t t s,@CXX_DEPENDS@,$CXX_DEPENDS,;t t s,@OS_IS_DARWIN@,$OS_IS_DARWIN,;t t diff --git a/config/configure.in b/config/configure.in index 1a4ddfcdf..5685615b3 100755 --- a/config/configure.in +++ b/config/configure.in @@ -83,10 +83,11 @@ local_python_inst=${local_inst} if test "x${SET_PYTHON_SITE_PACKAGE_TOPDIR}" = "xy"; then python_prefix=${PYTHON_SITE_PACKAGE_TOPDIR} local_python_inst=1 + echo "Cantera's Python packages will be installed in ${python_prefix}" else python_prefix=$prefix fi -echo "Cantera's Python packages will be installed in ${python_prefix}" + AC_SUBST(local_python_inst) AC_SUBST(python_prefix) @@ -96,8 +97,9 @@ AC_SUBST(ctversion) homedir=${HOME} AC_SUBST(homedir) -if test -z $local_inst; then -ct_libdir=${prefix}/lib/cantera/${ctversion} +# default is a distributed unix-like installation; these values may be +# modified below. +ct_libdir=${prefix}/lib/cantera/${ctversion} ct_incdir=${prefix}/include/cantera ct_incroot=${prefix}/include ct_bindir=${prefix}/bin @@ -108,44 +110,32 @@ ct_tutdir=${prefix}/cantera/${ctversion}/tutorials ct_docdir=${prefix}/cantera/${ctversion}/doc ct_dir=${prefix}/cantera/${ctversion} ct_mandir=${prefix}/share/man -else -ct_libdir=${prefix}/lib/cantera/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin -ct_datadir=${prefix}/cantera/${ctversion}/data -ct_demodir=${prefix}/cantera/${ctversion}/demos -ct_templdir=${prefix}/cantera/${ctversion}/templates -ct_tutdir=${prefix}/cantera/${ctversion}/tutorials -ct_docdir=${prefix}/cantera/${ctversion}/doc -ct_dir=${prefix}/cantera/${ctversion} -ct_mandir=${prefix}/share/man -fi -# default is unix-like distributed installation (not everything within one directory) -COMPACT_INSTALL=0 +# A compact installation is one in which the $prefix directory +# contains only Cantera files. It is different than a local +# installation, in that the Python package is installed with other +# Python packages and modules in site-packages, rather than with the +# rest of the Cantera files, as in a local installation. Therefore, +# with a compact installation, there is no need to set PYTHONPATH. A +# compact installation is done on Windows systems and on Mac OS X +# systems, and a non-compact ("distributed") installation is done by +# default on other unix/linux systems, unless a local installation is +# being done. + +# default is unix-like distributed installation, +# unless a local installation is being done. +COMPACT_INSTALL=$local_inst if test "x${OS_IS_WIN}" = "x1"; then COMPACT_INSTALL=1 -ct_libdir=${prefix}/lib/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin -ct_datadir=${prefix}/data -ct_demodir=${prefix}/demos -ct_templdir=${prefix}/templates -ct_tutdir=${prefix}/tutorials -ct_docdir=${prefix}/doc -ct_dir=${prefix} -ct_mandir=${prefix} fi if test "x${OS_IS_DARWIN}" = "x1"; then COMPACT_INSTALL=1 +fi + +if test -n $COMPACT_INSTALL; then ct_libdir=${prefix}/lib/${ctversion} -ct_incdir=${prefix}/include/cantera -ct_incroot=${prefix}/include -ct_bindir=${prefix}/bin ct_datadir=${prefix}/data ct_demodir=${prefix}/demos ct_templdir=${prefix}/templates @@ -155,6 +145,7 @@ ct_dir=${prefix} ct_mandir=${prefix} fi + AC_SUBST(ct_libdir) AC_SUBST(ct_incdir) AC_SUBST(ct_incroot) @@ -168,24 +159,24 @@ AC_SUBST(ct_docdir) AC_SUBST(ct_dir) AC_SUBST(COMPACT_INSTALL) -CANTERA_DATADIR=$datadir/cantera/data # # Cantera directory structure # -if test -z "$CANTERA_ROOT"; then CANTERA_ROOT=$prefix/cantera; fi -AC_SUBST(CANTERA_LIBDIR) -AC_SUBST(CANTERA_INCDIR) -if test -z "$CT_TOOLS_BIN"; then CT_TOOLS_BIN=$CANTERA_ROOT/tools/bin; fi -AC_SUBST(CT_TOOLS_BIN) -AC_SUBST(CANTERA_BINDIR) -if test -z "$CANTERA_EXAMPLES_DIR"; then CANTERA_EXAMPLES_DIR=$CANTERA_ROOT/examples; fi -AC_SUBST(CANTERA_EXAMPLES_DIR) -AC_SUBST(CANTERA_DATADIR) +#if test -z "$CANTERA_ROOT"; then CANTERA_ROOT=$prefix/cantera; fi +#AC_SUBST(CANTERA_LIBDIR) +#AC_SUBST(CANTERA_INCDIR) +#if test -z "$CT_TOOLS_BIN"; then CT_TOOLS_BIN=$CANTERA_ROOT/tools/bin; fi +#AC_SUBST(CT_TOOLS_BIN) +#AC_SUBST(CANTERA_BINDIR) +#if test -z "$CANTERA_EXAMPLES_DIR"; then CANTERA_EXAMPLES_DIR=$CANTERA_ROOT/examples; fi +#AC_SUBST(CANTERA_EXAMPLES_DIR) +#AC_SUBST(CANTERA_DATADIR) AC_CANONICAL_SYSTEM() +# the root of the source tree ctroot=`(cd ..;pwd)` builddir=$target if test "x${OS_IS_WIN}" = "x1"; then @@ -198,22 +189,25 @@ AC_SUBST(username) AC_SUBST(ctroot) +# the include directory in the 'build' subdirectory. This is required to build the test problems +# before Cantera has been installed. buildinc=$ctroot/build/include AC_SUBST(buildinc) - buildlib=$ctroot/build/lib/$builddir AC_SUBST(buildlib) buildbin=$ctroot/build/bin/$builddir AC_SUBST(buildbin) +# add definitions to config.h AC_DEFINE_UNQUOTED(DARWIN,$OS_IS_DARWIN) AC_DEFINE_UNQUOTED(CYGWIN,$OS_IS_CYGWIN) AC_DEFINE_UNQUOTED(WINMSVC,$OS_IS_WIN) AC_DEFINE_UNQUOTED(RXNPATH_FONT,"$RPFONT") -AC_DEFINE_UNQUOTED(CANTERA_ROOT,"$prefix/cantera") +#AC_DEFINE_UNQUOTED(CANTERA_ROOT,"$prefix/cantera") AC_DEFINE_UNQUOTED(CANTERA_DATA,"$ct_datadir") + if test -z "$MAKE"; then MAKE='make'; fi AC_SUBST(MAKE) @@ -347,17 +341,13 @@ build_blas=1 build_lapack=1 fi -# 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) AC_SUBST(BLAS_LAPACK_LIBS) AC_SUBST(BLAS_LAPACK_DIR) + # # Stubout section for f2c versions of lapack: # Define these variables, but turn them off in main version of code @@ -484,16 +474,13 @@ AC_SUBST(CT_SHARED_LIB) BUILD_F90=0 if test "x$BUILD_F90_INTERFACE" = "xy"; then BUILD_F90=1 - AC_CHECK_PROG(foundF90, $F90, yes, no) - if test x$foundF90 = "xno" ; then - echo 'Did not find the Fortran 90 compiler, '$F90 - echo " -> Turning off F90 interface even though it was requested" - BUILD_F90=0 - fi +# AC_CHECK_PROG(foundF90, $F90, yes, no) +# if test x$foundF90 = "xno" ; then +# echo 'Did not find the Fortran 90 compiler, '$F90 +# echo " -> Turning off F90 interface even though it was requested" +# BUILD_F90=0 +# fi fi -AC_SUBST(BUILD_F90) -AC_SUBST(F90) -AC_SUBST(F90FLAGS) if test "x$F77FLAGS" = "x"; then F77FLAGS=$FFLAGS @@ -513,28 +500,26 @@ fi WIN_PYTHON_CMD=python if test $BUILD_PYTHON -gt 0; then -if test "$PYTHON_CMD" = "default" ; then - PYTHON_CMD= -fi -if test -z "$PYTHON_CMD"; then + if test "$PYTHON_CMD" = "default"; then AC_PATH_PROGS(PYTHON_CMD, python2 python, "none") if test "x$OS_IS_WIN" = "x1"; then AC_PATH_PROGS(WIN_PYTHON_CMD, python, "none") WIN_PYTHON_CMD=`cygpath -a -w "$WIN_PYTHON_CMD" | sed 's/\\\/\\//g'` echo "Windows Python command: $WIN_PYTHON_CMD" fi -else + else echo "Python command preset to $PYTHON_CMD" -fi -if test "$PYTHON_CMD" = "none"; then - 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 + fi + + if test "$PYTHON_CMD" = "none"; then + 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 else PYTHON_CMD=none WIN_PYTHON_CMD=none @@ -594,6 +579,7 @@ if test -n "$GCC"; then fi fi AC_MSG_RESULT(${precompile_headers}) +fi has_sstream=no AC_MSG_CHECKING(for sstream) @@ -625,15 +611,72 @@ fi dnl Checks for libraries. AC_F77_LIBRARY_LDFLAGS() +override_f77_libs=0; case $ac_sys_system in - Darwin*) FLIBS='-lstdc++ -lg2c'; SHARED_CTLIB=0;; + Darwin*) FLIBS='-lstdc++ -lg2c'; override_f77_libs=1; SHARED_CTLIB=0;; esac +if test -n $override_f77_libs; then + echo The Fortran 77 libraries on this platform are not correctly determined by + echo the configuration process. They are being manually set to + echo FLIBS = $FLIBS +fi + +has_f90=no +f90type=none +f90_module_dir='-I' +f90_opts='' + +if test -n ${BUILD_F90}; then + AC_MSG_CHECKING(Fortran 90 compiler ($F90) type) + cat >> testf90.f90 << EOF +module mt +double precision, parameter :: x = 2.3 +end module mt +program testf90 +use mt +integer :: i +end program testf90 +EOF + msg=`${F90} -c testf90.f90 &> /dev/null` + if test -f testf90.o; then + has_f90=yes + rm testf90.o + f90type=unknown + fi +# + msg=`${F90} -V &> f90out` + isnag=`grep -c NAGWare f90out` + if test "x${isnag}" != "x0"; then + f90type="NAG" + f90opts="-I. -I${ct_incroot}" + fi +# + msg=`${F90} -V -c testf90.f90 &> f90out` + isabsoft=`grep -c Absoft f90out` + if test "x${isabsoft}" != "x0"; then + f90type="Absoft" + f90opts="-p. -p${ct_incroot} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + fi + rm -f testf90.f90 f90out + AC_MSG_RESULT(${f90type}) + if test -n $BUILD_F90; then + if test "x${has_f90}" = "xno"; then + echo " -> cannot build the Fortran 90 interface" + BUILD_F90=0 + fi + fi +fi +F90FLAGS=${f90opts}' '${F90FLAGS} +AC_SUBST(BUILD_F90) +AC_SUBST(F90) +AC_SUBST(F90FLAGS) + + AC_OBJEXT AC_EXEEXT -fi AC_SUBST(precompile_headers) AC_SUBST(CXX_DEPENDS) diff --git a/configure b/configure index bc8778bc1..915962506 100755 --- a/configure +++ b/configure @@ -14,8 +14,15 @@ # Edit this file to control how Cantera is built. Parameters can be set # here, or alternatively environment variables may be set before calling # this script. +# +# The default configuration uses GNU compilers (gcc/g++/g77) and +# builds as much of Cantera and its language interfaces as it can +# (e.g. if MATLAB is installed on your system, the MATLAB toolbox +# will be built automatically, otherwise it will be skipped. On linux +# or Mac OS X, this default configuration should work, and most +# likely you don't need to edit this file at all - just run it. # -# NOTE: if you make changes to this file, save it with another name +# NOTE: if you DO make changes to this file, save it with another name # so that it will not be overwritten if you update the source # distribution. @@ -43,7 +50,7 @@ CANTERA_INSTALL_DIR=${CANTERA_INSTALL_DIR:="c:/cantera"} # On a PC running MS-Windows, Cantera can be built either using # Microsoft Visual Studio, with the Visual C++ and Visual Fortran # compilers, or using the linux-like cygwin environment with the -# g++ and g77 compilers. +# g++ and g77 compilers. Set this to "y" to use Visual Studio. USE_VISUAL_STUDIO=${USE_VISUAL_STUDIO:="y"} # If you are using Visual Studio, set this to the location of the @@ -52,46 +59,54 @@ USE_VISUAL_STUDIO=${USE_VISUAL_STUDIO:="y"} FORTRAN_LIB_DIR="D:\Program Files\Microsoft Visual Studio\DF98\LIB" - #---------------------------------------------------------------------- # Language Interfaces #---------------------------------------------------------------------- # - -# Cantera provides interfaces for several languages. Set to 'y' to -# build the specified interface. - - -#------------ Python ------------------------------------------------- - -# Cantera uses Python to process .cti input files, so if you plan to -# use these, you need to have Python on your system. (If you will only -# use CTML input files, then you don't need Python at all.) - -# You only need to build the full Cantera Python interface if you plan -# to use Cantera from Python. If so, Python 2.0 or greater is -# required, and the Numeric extensions for Python are needed too. See -# file INSTALLING for more details. +# Cantera has several programming language interfaces. Select the ones +# you want to build. The default is to try to build all language +# interfaces. The Python interface will be built, the MATLAB +# interface will too if MATLAB is found, the Fortran 90/95 interface +# will be built if a Fortran 90/95 compiler is found on your +# system. You can customize these defaults by setting parameters in +# this section. # -# The configure process will attempt to find the Python interpreter on -# your system. However, if there is more than one and you want a -# specific interpreter to be used, then define PYTHON_CMD to be the -# full path to the desired Python interpreter. This allows you, for -# example, to build your own private Python interpreter and use it -# instead of the system Python interpreter. -#PYTHON_CMD=${PYTHON_CMD:="python"} +#----------------- Python -------------------------------------------- +# +# In addition to being one of the supported language interfaces, +# Python is used internally by Cantera, both in the build process and +# at run time (to process .cti input files). Therefore, you need to +# have Python on your system; if you don't, first install it from +# http://www.python.org before proceeding with the installation of +# Cantera. +# +# If you plan to write Python scripts yourself to solve problems, or +# you want to use the graphical MixMaster application, then you need +# the Cantera Python Package. If, on the other hand, you will only use +# Cantera from some other language (e.g. MATLAB or Fortran 90/95) and +# only need Python to process .cti files, then you only need a minimal +# subset of the package (actually, only one file). + +# Set PYTHON_PACKAGE to one of these two strings: +# full install everything needed to use Cantera from Python +# minimal install only enough to process .cti files -# Set to one of the following: -# full everything needed to use Cantera from Python -# minimal only enough to process .cti files -# none don't use Python at all; only CTML input files can be used. PYTHON_PACKAGE=${PYTHON_PACKAGE:="full"} -# Use when site packages must be put in system directories but Cantera -# tutorials must be put in user space. Note: an alternative to doing -# this is to put everything in user space, and define environment -# variable PYTHONPATH to tell Python where to find the Cantera package +# Cantera needs to know where to find the Python interpreter. By +# default, the configuration process will look for it somewhere on +# your PATH, either as 'python2' or as 'python'. If it is not on the +# PATH, or has a different name, set this to the full path to the +# Python interpreter. +PYTHON_CMD=${PYTHON_CMD:="default"} + + +# Set this to 'y' when site packages must be put in system directories +# but Cantera tutorials must be put in user space. An alternative to +# doing this is to put everything in user space by running this script +# with the 'prefix' option, and defining environment variable PYTHONPATH +# to tell Python where to find the Cantera package. # SET_PYTHON_SITE_PACKAGE_TOPDIR=${SET_PYTHON_SITE_PACKAGE_TOPDIR:="n"} @@ -99,43 +114,41 @@ PYTHON_SITE_PACKAGE_TOPDIR=${PYTHON_SITE_PACKAGE_TOPDIR:="/usr/local"} -#----------- Matlab -------------------------------------------------- +#----------- MATLAB -------------------------------------------------- -# Set this to "y" if you want to build the Matlab toolbox. Matlab must +# Set this to "y" if you want to build the MATLAB toolbox. MATLAB must # be installed on your system first, since the build process runs a -# Matlab script. If this is set to "y" but Matlab is not found, the -# Matlab toolbox will not be built. +# Matlab script. If this is set to "y" but MATLAB is not found, the +# MATLAB toolbox will not be built. Note that you may need to run 'mex +# -setup' within MATLAB to configure it for your C++ compiler before +# building the Cantera MATLAB Toolbox. BUILD_MATLAB_TOOLBOX=${BUILD_MATLAB_TOOLBOX:="y"} - -#----------- Fortran 77 ----------------------------------------------------- - -# Set this to "y" if you want to build Cantera using the f2c source instead -# of with .f sources in the ext directory. -# The default is not to do this on all platforms except vc++. -# Set this to "n" to never do this on any platform. -# Note, if set to "y", Cantera does not need a fortran compiler, and -# all fortran compiler parameters are irrelevant. - -BUILD_WITH_F2C=${BUILD_WITH_F2C:="y"} - + + #----------- Fortran 90/95 -------------------------------------------------- # Set this to "y" if you want to build the Fortran 90/95 interface. -# A Fortran 90/95 compiler is required. +# A Fortran 90/95 compiler is required. If none is found, the Fortran 90/95 +# interface will not be built. BUILD_F90_INTERFACE=${BUILD_F90_INTERFACE:="y"} # The Fortran 90/95 compiler F90=${F90:=f95} -# Compiler option flags for the Fortran 90/95 compiler +# Compiler option flags for the Fortran 90/95 compiler. If you are +# using the Absoft or the NAG compiler, additional options specific to +# these compilers will be added automatically, and you do not need to +# specify them here. Otherwise, add any required compiler-specific +# flas here. F90FLAGS=${F90FLAGS:='-O2'} #---------------------------------------------------------------------- # Customizations / Extensions +#---------------------------------------------------------------------- # # You can build your own libraries as part of the Cantera build process. # This allows you to derive your own classes from those provided by @@ -161,12 +174,15 @@ USER_SRC_DIR="Cantera/user" # don't change this # and transport properties, it is sufficient to enable only KINETICS # and TRANSPORT. +# Note: if you are building the full Python interface or the MATLAB +# interface, it is necessary to build the full kernel. # thermodynamic properties ENABLE_THERMO='y' # if set to 'y', the ck2cti program that converts Chemkin input files -# to Cantera format will be built +# to Cantera format will be built. If you don't use Chemkin format +# files, or if you run ck2cti on some other machine, you can set this to 'n'. ENABLE_CK='y' # homogeneous and heterogeneous kinetics @@ -191,7 +207,7 @@ ENABLE_SOLVERS='y' ENABLE_RXNPATH='y' # non-ideal pure substance models for a few fluids imported from the -# 'TPX' package (http://adam.caltech.edu/software/tpx) +# 'TPX' package. (http://adam.caltech.edu/software/tpx) ENABLE_TPX='y' @@ -207,10 +223,9 @@ ENABLE_TPX='y' # string that should be passed to the linker to link to these # libraries, and set BLAS_LAPACK_DIR to the directory where these # libraries are located. Otherwise, leave these lines commented out. - +# #BLAS_LAPACK_LIBS='-llapack -lf77blas -lcblas -latlas' -#BLAS_LAPACK_DIR='/usr/lib/atlas' - +#BLAS_LAPACK_DIR='/usr/lib' # # The options below do not need to be set if you are using the default # libraries. @@ -226,7 +241,6 @@ LAPACK_FTN_TRAILING_UNDERSCORE='y' LAPACK_FTN_STRING_LEN_AT_END='y' - #------------------------------------------------------------------ # C++ compiler options #------------------------------------------------------------------ @@ -242,8 +256,9 @@ CC=${CC:=gcc} # C++ compiler flags CXXFLAGS=${CXXFLAGS:="-O2 -Wall"} -# the C++ flags required for linking -#LCXX_FLAGS="-L/usr/lib/atlas" +# the C++ flags required for linking. Uncomment if additional flags +# need to be passed to the linker. +#LCXX_FLAGS="-framework vecLib" # Ending libraries to tack onto the linking of all C++ programs LCXX_END_LIBS=${LCXX_END_LIBS:="-lm"} @@ -256,37 +271,38 @@ PIC=${PIC:=-fPIC} SHARED=${SHARED:="-shared"} - #------------------------------------------------------------------- -# Fortran compiler options +# External procedures #------------------------------------------------------------------- -# Note: the Fortran 90 interface is currently not available. Hopefully -# it will be back at a future date... +# Cantera uses several external software packages, which are all in +# the 'ext' directory.. These options control how these packages are built. -# Cantera uses some external procedures written in Fortran 77. -# In addition, Cantera implements an interface for Fortran 90 -# application programs. The parameters in this section apply -# to both. +# For external procedures written in Fortran 77, both the original F77 +# source code and C souce code generated by the 'f2c' program are +# included. Set this to "y" if you want to build Cantera using the +# f2c-generated C sources instead of using the F77 sources in the ext +# directory. -# the Fortran 77 and Fortran 90 compilers. You only need a Fortran 90 -# compiler if you are building the Fortran 90 interface. +# The default is not to do this on all platforms except vc++. +# Set this to "n" to never do this on any platform. +# Note, if set to "y", Cantera does not need a fortran compiler, and +# all fortran compiler parameters below are irrelevant. + +BUILD_WITH_F2C=${BUILD_WITH_F2C:="default"} + +# if you are building the external Fortran 77 procedures from the Fortran +# source code, enter the compiler here. F77=${F77:=g77} -# Fortran 77 compiler flags. Note that these may be specified separately -# from the options for the Fortran 90/95 compiler (if any). +# Fortran 77 compiler flags. Note that the Fortran compiler flags must be set +# to produce object code compatible with the C/C++ compiler you are using. FFLAGS=${FFLAGS:='-O2'} -# the additional Fortran flags required for linking, if any +# the additional Fortran flags required for linking, if any. Leave commented +# out if no additional flags are required. #LFORT_FLAGS="-lF77 -lFI77" -# Fortran 90 module directory -## FORT_MODULE_DIRECTORY=${FORT_MODULE_DIRECTORY:=$CANTERA_ROOT/include/fortran} - -# Fortran 90 module search path command -## FORT_MODULE_PATH_CMD=${FORT_MODULE_PATH_CMD:="-I$FORT_MODULE_DIRECTORY"} - - #------------------------------------------------------ # other programs diff --git a/ext/math/fdump.f b/ext/math/fdump.f index 562de1015..c649f252b 100644 --- a/ext/math/fdump.f +++ b/ext/math/fdump.f @@ -29,42 +29,44 @@ C***END PROLOGUE FDUMP C***FIRST EXECUTABLE STATEMENT FDUMP RETURN END - integer function isamax(n,sx,incx) -c -c finds the index of element having max. absolute value. -c jack dongarra, linpack, 3/11/78. -c modified 3/93 to return if incx .le. 0. -c - real sx(1),smax - integer i,incx,ix,n -c - isamax = 0 - if( n.lt.1 .or. incx.le.0 ) return - isamax = 1 - if(n.eq.1)return - if(incx.eq.1)go to 20 -c -c code for increment not equal to 1 -c - ix = 1 - smax = abs(sx(1)) - ix = ix + incx - do 10 i = 2,n - if(abs(sx(ix)).le.smax) go to 5 - isamax = i - smax = abs(sx(ix)) - 5 ix = ix + incx - 10 continue - return -c -c code for increment equal to 1 -c - 20 smax = abs(sx(1)) - do 30 i = 2,n - if(abs(sx(i)).le.smax) go to 30 - isamax = i - smax = abs(sx(i)) - 30 continue - return - end +c$$$ +c$$$ integer function isamax(n,sx,incx) +c$$$c +c$$$c finds the index of element having max. absolute value. +c$$$c jack dongarra, linpack, 3/11/78. +c$$$c modified 3/93 to return if incx .le. 0. +c$$$c +c$$$ real sx(1),smax +c$$$ integer i,incx,ix,n +c$$$c +c$$$ isamax = 0 +c$$$ if( n.lt.1 .or. incx.le.0 ) return +c$$$ isamax = 1 +c$$$ if(n.eq.1)return +c$$$ if(incx.eq.1)go to 20 +c$$$c +c$$$c code for increment not equal to 1 +c$$$c +c$$$ ix = 1 +c$$$ smax = abs(sx(1)) +c$$$ ix = ix + incx +c$$$ do 10 i = 2,n +c$$$ if(abs(sx(ix)).le.smax) go to 5 +c$$$ isamax = i +c$$$ smax = abs(sx(ix)) +c$$$ 5 ix = ix + incx +c$$$ 10 continue +c$$$ return +c$$$c +c$$$c code for increment equal to 1 +c$$$c +c$$$ 20 smax = abs(sx(1)) +c$$$ do 30 i = 2,n +c$$$ if(abs(sx(i)).le.smax) go to 30 +c$$$ isamax = i +c$$$ smax = abs(sx(i)) +c$$$ 30 continue +c$$$ return +c$$$ end +c$$$