Changeset 15674


Ignore:
Timestamp:
08/01/13 14:15:55 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added more checks on python and chaco

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/m4/issm_options.m4

    r15673 r15674  
    9898
    9999        dnl 1. See if matlab has been provided
    100         AC_ARG_WITH([matlab-dir],                                                                     dnl feature
    101         AS_HELP_STRING([--with-matlab-dir=DIR],[matlab root directory. necessary for serial build.]), dnl help string
    102         [MATLAB_ROOT=$withval],                                                                       dnl action if given
    103         [MATLAB_ROOT="no"])                                                                           dnl action if not given
     100        AC_ARG_WITH([matlab-dir],                                         dnl feature
     101        AS_HELP_STRING([--with-matlab-dir=DIR],[matlab root directory.]), dnl help string
     102        [MATLAB_ROOT=$withval],                                           dnl action if given
     103        [MATLAB_ROOT="no"])                                               dnl action if not given
    104104
    105105        AC_MSG_CHECKING([whether matlab is enabled])
     
    111111                  AC_MSG_ERROR([matlab directory provided ($MATLAB_ROOT) does not exist]);
    112112                fi
    113                 AC_DEFINE([_HAVE_MATLAB_],[1],[with matlab in ISSM src])
    114113        fi
    115114        AC_MSG_RESULT($HAVE_MATLAB)
     
    119118        if test "x$HAVE_MATLAB" = "xyes"; then
    120119
     120                AC_DEFINE([_HAVE_MATLAB_],[1],[with matlab in ISSM src])
    121121                AC_MSG_CHECKING(for matlab headers and libraries in $MATLAB_ROOT)
    122122                MATLABINCL="-I$MATLAB_ROOT/extern/include/"
     
    152152        dnl triangle {{{
    153153        AC_ARG_WITH([triangle-dir],
    154                           AS_HELP_STRING([--with-triangle-dir=DIR], [triangle root directory. necessary for serial build]),
     154                          AS_HELP_STRING([--with-triangle-dir=DIR], [triangle root directory.]),
    155155                         [TRIANGLE_ROOT=$withval],[TRIANGLE_ROOT="no"])
    156156
     
    164164                        AC_MSG_ERROR([triangle directory provided ($TRIANGLE_ROOT) does not exist]);
    165165                fi
    166                 AC_DEFINE([_HAVE_TRIANGLE_],[1],[with triangle in ISSM src])
    167166        fi
    168167        AC_MSG_RESULT($HAVE_TRIANGLE)
     
    202201                        AC_MSG_ERROR([boost directory provided ($BOOST_ROOT) does not exist]);
    203202                fi
    204                 AC_DEFINE([_HAVE_BOOST_],[1],[with boost in ISSM src])
    205203        fi
    206204        AC_MSG_RESULT($HAVE_BOOST)
     
    218216        dnl dakota{{{
    219217        AC_ARG_WITH([dakota-dir],
    220           AS_HELP_STRING([--with-dakota-dir=DIR], [dakota root directory. necessary for serial build]),
     218          AS_HELP_STRING([--with-dakota-dir=DIR], [dakota root directory.]),
    221219          [DAKOTA_ROOT=$withval],[DAKOTA_ROOT="no"])
    222220       
     
    230228                        AC_MSG_ERROR([dakota directory provided ($DAKOTA_ROOT) does not exist]);
    231229                fi
    232                 AC_DEFINE([_HAVE_DAKOTA_],[1],[with dakota in ISSM src])
    233230        fi
    234231        AC_MSG_RESULT($HAVE_DAKOTA)
     
    290287                        ;;
    291288                esac
    292                 AC_DEFINE([_HAVE_DAKOTA_],[1],[with Dakota in ISSM src])
    293289
    294290                case $DAKOTA_VERSION in
     
    322318                AC_DEFINE_UNQUOTED([_DAKOTA_BUILD_],$DAKOTA_BUILD,[Dakota build version number])
    323319
     320                AC_DEFINE([_HAVE_DAKOTA_],[1],[with Dakota in ISSM src])
    324321                AC_SUBST([DAKOTAINCL])
    325322                AC_SUBST([DAKOTAFLAGS])
     
    330327        AC_ARG_WITH([python-dir],
    331328          AS_HELP_STRING([--with-python-dir=DIR], [python root directory.]),
    332           [PYTHON_ROOT=$withval],[PYTHON_ROOT=""])
    333 
    334         AC_MSG_CHECKING(for python)
    335         if test -d "$PYTHON_ROOT"; then
    336                 HAVE_PYTHON="yes"
    337                 AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
    338         else
     329          [PYTHON_ROOT=$withval],[PYTHON_ROOT="no"])
     330
     331        dnl Check whether python is enabled
     332        AC_MSG_CHECKING([for python])
     333        if test "x$PYTHON_ROOT" = "xno" ; then
    339334                HAVE_PYTHON=no
     335        else
     336                HAVE_PYTHON=yes
     337                if ! test -d "$PYTHON_ROOT"; then
     338                        AC_MSG_ERROR([python directory provided ($PYTHON_ROOT) does not exist]);
     339                fi
    340340        fi
    341341        AC_MSG_RESULT($HAVE_PYTHON)
    342 
    343         dnl get python version
    344         if test x$HAVE_PYTHON = xyes; then
     342        AM_CONDITIONAL([PYTHON],[test x$HAVE_PYTHON = xyes])
     343
     344        dnl python specifics
     345        if test "x$HAVE_PYTHON" = "xyes"; then
    345346                AC_MSG_CHECKING(for python version)
    346                 dnl Query Python for its version number.  Getting [:3] seems to be
    347                 dnl the best way to do this; it's what "site.py" does in the standard
    348                 dnl library.
     347                dnl Query Python for its version number.  Getting [:3] seems to be the
     348                dnl best way to do this; it's what "site.py" does in the standard library.
    349349                PYTHON_VERSION=$($PYTHON_ROOT/bin/python -c "import sys; print sys.version[[:3]]")
    350350                AC_MSG_RESULT($PYTHON_VERSION)
    351351
    352                 dnl recover major:
     352                dnl recover major
    353353                PYTHON_MAJOR=${PYTHON_VERSION%.*}
    354                 if test x$PYTHON_MAJOR = x3; then
    355                         dnl are we running python 3?
     354                AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
     355                if test "x$PYTHON_MAJOR" = "x3"; then
    356356                        HAVE_PYTHON3="yes"
    357357                else
    358358                        HAVE_PYTHON3="no"
    359359                fi
    360                 AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
     360                AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
    361361
    362362                PYTHONINCL=-I$PYTHON_ROOT/include
    363363                PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHON_VERSION"
    364364                PYTHONEXT=.so
    365 
    366365                case "${host_os}" in
    367366                        *cygwin*)
     
    375374                        ;;
    376375                esac
    377 
     376                AC_DEFINE([_HAVE_PYTHON_],[1],[with python in ISSM src])
    378377                AC_SUBST([PYTHONINCL])
    379378                AC_SUBST([PYTHONLIB])
     
    382381                AC_SUBST([PYTHONLINK])
    383382        fi
    384         AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
    385         AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
    386383        dnl }}}
    387384        dnl python-numpy{{{
    388385        AC_ARG_WITH([python-numpy-dir],
    389386          AS_HELP_STRING([--with-python-numpy-dir=DIR], [python-numpy root directory.]),
    390           [PYTHON_NUMPY_ROOT=$withval],[PYTHON_NUMPY_ROOT=""])
     387          [PYTHON_NUMPY_ROOT=$withval],[PYTHON_NUMPY_ROOT="no"])
     388       
     389        dnl Check whether numpy is enabled
    391390        AC_MSG_CHECKING(for python-numpy)
    392        
    393         if test -d "$PYTHON_NUMPY_ROOT"; then
    394                 dnl defaults
     391        if test "x$PYTHON_NUMPY_ROOT" = "xno" ; then
     392                HAVE_PYTHON_NUMPY=no
     393        else
    395394                HAVE_PYTHON_NUMPY=yes
     395                if ! test -d "$PYTHON_NUMPY_ROOT"; then
     396                        AC_MSG_ERROR([numpy directory provided ($PYTHON_NUMPY_ROOT) does not exist]);
     397                fi
     398        fi
     399        AC_MSG_RESULT($HAVE_PYTHON_NUMPY)
     400
     401        dnl numpy lib
     402        if test "x$HAVE_PYTHON_NUMPY" = "xyes"; then
    396403                PYTHON_NUMPYINCL="-I$PYTHON_NUMPY_ROOT -I$PYTHON_NUMPY_ROOT/core/include/numpy"
    397 
    398404                AC_DEFINE([_HAVE_PYTHON_NUMPY_],[1],[with Python-Numpy in ISSM src])
    399405                AC_SUBST([PYTHON_NUMPYINCL])
    400         else
    401                 HAVE_PYTHON_NUMPY=no
    402         fi
    403         AC_MSG_RESULT($HAVE_PYTHON_NUMPY)
     406        fi
    404407        dnl }}}
    405408        dnl chaco{{{
    406409        AC_ARG_WITH([chaco-dir],
    407410          AS_HELP_STRING([--with-chaco-dir=DIR], [chaco root directory.]),
    408           [CHACO_ROOT=$withval],[CHACO_ROOT=""])
    409         AC_MSG_CHECKING(for chaco)
     411          [CHACO_ROOT=$withval],[CHACO_ROOT="no"])
    410412       
    411         if test -d "$CHACO_ROOT"; then
    412 
    413                 dnl defaults
     413        dnl Check whether chaco is enabled
     414        AC_MSG_CHECKING([for chaco])
     415        if test "x$CHACO_ROOT" = "xno" ; then
     416                HAVE_CHACO=no
     417        else
    414418                HAVE_CHACO=yes
     419                if ! test -d "$CHACO_ROOT"; then
     420                        AC_MSG_ERROR([chaco directory provided ($CHACO_ROOT) does not exist]);
     421                fi
     422        fi
     423        AC_MSG_RESULT($HAVE_CHACO)
     424        AM_CONDITIONAL([CHACO],[test x$HAVE_CHACO = xyes])
     425
     426        dnl library and header files
     427        if test "x$HAVE_CHACO" = "xyes"; then
    415428                CHACOINCL=-I$CHACO_ROOT/include
    416429                CHACOLIB="-L$CHACO_ROOT/lib -lchacominusblas"
    417 
    418430                AC_DEFINE([_HAVE_CHACO_],[1],[with Chaco in ISSM src])
    419431                AC_SUBST([CHACOINCL])
    420432                AC_SUBST([CHACOLIB])
    421 
    422         else
    423                 HAVE_CHACO=no
    424         fi
    425         AC_MSG_RESULT($HAVE_CHACO)
     433        fi
    426434        dnl }}}
    427435        dnl scotch{{{
Note: See TracChangeset for help on using the changeset viewer.