Changeset 13756


Ignore:
Timestamp:
10/19/12 16:01:23 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: detetct if we are using petsc3.3, in which case metis library is automatically included
python version is dynamically checked for

File:
1 edited

Legend:

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

    r13748 r13756  
    230230          AS_HELP_STRING([--with-python-dir=DIR], [python root directory.]),
    231231          [PYTHON_ROOT=$withval],[PYTHON_ROOT=""])
     232
    232233        AC_MSG_CHECKING(for python)
    233        
    234234        if test -d "$PYTHON_ROOT"; then
    235          AC_MSG_RESULT($HAVE_PYTHON)
    236                 dnl defaults
    237                 HAVE_PYTHON3="no"
    238235                HAVE_PYTHON="yes"
    239                 AC_MSG_RESULT($HAVE_PYTHON)
    240                
    241                 AC_ARG_WITH([python-version],
    242                   AS_HELP_STRING([--with-python-version = PYTHONVERSION],[python version.]),
    243                   [PYTHONVERSION=$withval],[PYTHONVERSION=""])
     236                AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
     237        else
     238         HAVE_PYTHON=no
     239        fi
     240        AC_MSG_RESULT($HAVE_PYTHON)
     241
     242        dnl get python version
     243        if test "$HAVE_PYTHON" = "yes"; then
    244244                AC_MSG_CHECKING(for python version)
     245                dnl Query Python for its version number.  Getting [:3] seems to be
     246                dnl the best way to do this; it's what "site.py" does in the standard
     247                dnl library.
     248                PYTHON_VERSION=$($PYTHON_ROOT/bin/python -c "import sys; print sys.version[[:3]]")
     249                AC_MSG_RESULT($PYTHON_VERSION)
    245250
    246251                dnl recover major:
    247                 PYTHON_MAJOR=${PYTHONVERSION%.*}
    248 
     252                PYTHON_MAJOR=${PYTHON_VERSION%.*}
    249253                if test x$PYTHON_MAJOR = x3; then
    250254                        dnl are we running python 3?
     
    252256                fi
    253257                AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
    254                 AC_MSG_RESULT($PYTHON_MAJOR)
    255258
    256259                PYTHONINCL=-I$PYTHON_ROOT/include
     
    270273                esac
    271274
    272                 AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
    273275                AC_SUBST([PYTHONINCL])
    274276                AC_SUBST([PYTHONLIB])
     
    276278                AC_SUBST([PYTHONWRAPPEREXT])
    277279                AC_SUBST([PYTHONLINK])
    278         else
    279                 HAVE_PYTHON=no
    280                 AC_MSG_RESULT($HAVE_PYTHON)
    281280        fi
    282281        AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
     
    455454        AM_CONDITIONAL([ROSE], [test x$HAVE_ROSE = xyes])
    456455        AC_MSG_RESULT($HAVE_ROSE)
    457         dnl }}}
    458         dnl metis{{{
    459         AC_ARG_WITH([metis-dir],
    460           AS_HELP_STRING([--with-metis-dir=DIR],[metis root directory. necessary for serial build]),
    461           [METIS_ROOT=$withval],[METIS_ROOT=""])
    462 
    463    AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT)
    464 
    465         if test -d "$METIS_ROOT"; then
    466 
    467                 dnl first figure out version of metis: does the VERSION file exist?
    468                 if test -e "$METIS_ROOT/VERSION"; then
    469                         METIS_VERSION=4
    470                 else
    471                         METIS_VERSION=5
    472                 fi
    473 
    474                 dnl defaults
    475                 HAVE_METIS=yes
    476 
    477                 if test "$METIS_VERSION" = "4" ; then
    478                        
    479                         METISINCL=-I"$METIS_ROOT/Lib"
    480                         case "${host_os}" in
    481                                 *cygwin*)
    482                                 METISLIB="-LIBPATH:\"$METIS_ROOT\" libmetis.lib"
    483                                 ;;
    484                                 *linux*)
    485                                 METISLIB=-L"$METIS_ROOT/ -lmetis"
    486                                 ;;
    487                                 *darwin*)
    488                                 METISLIB=-L"$METIS_ROOT/ -lmetis"
    489                                 ;;
    490                         esac
    491 
    492                         AC_DEFINE([_METIS_VERSION_],[4],[ Metis version number])
    493                 fi
    494                 if test "$METIS_VERSION" = "5" ; then
    495        
    496                         case "${host_os}" in
    497                                 *cygwin*)
    498                                 METISLIB="-LIBPATH:\"$METIS_ROOT\" libmetis.lib"
    499                                 ;;
    500                                 *linux*)
    501                                 METISLIB=-L"$METIS_ROOT/lib -lmetis"
    502                                 ;;
    503                                 *darwin*)
    504                                 METISLIB=-L"$METIS_ROOT/lib -lmetis"
    505                                 ;;
    506                         esac
    507 
    508                         METISINCL=-I"$METIS_ROOT/include"
    509                         AC_DEFINE([_METIS_VERSION_],[5],[ Metis version number])
    510                 fi
    511 
    512                 AC_DEFINE([_HAVE_METIS_],[1],[with Metis in ISSM src])
    513                 AC_SUBST([METISINCL])
    514                 AC_SUBST([METISLIB])
    515         else
    516                 HAVE_METIS=no
    517         fi
    518         AM_CONDITIONAL([METIS], [test x$HAVE_METIS = xyes])
    519         AC_MSG_RESULT($HAVE_METIS)
    520456        dnl }}}
    521457        dnl mpi{{{
     
    595531                        else
    596532                                PETSCLIB="-link -LIBPATH:\"$PETSC_ROOT/lib\" libpetsc.lib"
     533                                if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+=" libmetis.lib"; fi
    597534                        fi
    598535                        ;;
     
    602539                        else
    603540                                PETSCLIB="-L$PETSC_ROOT/lib -lpetsc -ldl"
     541                                if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+=" -lmetis"; fi
    604542                        fi
    605543                        ;;
     
    609547                        else
    610548                                PETSCLIB="-L$PETSC_ROOT/lib -lpetsc"
     549                                if test $PETSC_MAJOR -gt 3 || test $PETSC_MINOR -ge 3; then PETSCLIB+=" -lmetis"; fi
    611550                        fi
    612551                        ;;
     
    622561        AM_CONDITIONAL([PETSC], [test x$HAVE_PETSC = xyes])
    623562        AC_MSG_RESULT($HAVE_PETSC)
     563        dnl }}}
     564        dnl metis{{{
     565        if test "$HAVE_PETSC" = "yes" && test "x$PETSC_MAJOR" = "x3" && test $PETSC_MINOR -ge 3; then
     566
     567                dnl in petsc >=3.3, metis is provided
     568                HAVE_METIS="yes"
     569                AC_DEFINE([_METIS_VERSION_],[5],[ Metis version number])
     570                AC_DEFINE([_HAVE_METIS_],[1],[with Metis in ISSM src])
     571        else
     572                AC_ARG_WITH([metis-dir],
     573                  AS_HELP_STRING([--with-metis-dir=DIR],[metis root directory. necessary for serial build]),
     574                  [METIS_ROOT=$withval],[METIS_ROOT=""])
     575
     576                AC_MSG_CHECKING(for metis headers and libraries in $METIS_ROOT)
     577
     578                if test -d "$METIS_ROOT"; then
     579
     580                        dnl first figure out version of metis: does the VERSION file exist?
     581                        if test -e "$METIS_ROOT/VERSION"; then
     582                                METIS_VERSION=4
     583                        else
     584                                METIS_VERSION=5
     585                        fi
     586
     587                        dnl defaults
     588                        HAVE_METIS=yes
     589
     590                        if test "$METIS_VERSION" = "4" ; then
     591                                       
     592                                METISINCL=-I"$METIS_ROOT/Lib"
     593                                case "${host_os}" in
     594                                        *cygwin*)
     595                                        METISLIB="-LIBPATH:\"$METIS_ROOT\" libmetis.lib"
     596                                        ;;
     597                                        *linux*)
     598                                        METISLIB=-L"$METIS_ROOT/ -lmetis"
     599                                        ;;
     600                                        *darwin*)
     601                                        METISLIB=-L"$METIS_ROOT/ -lmetis"
     602                                        ;;
     603                                esac
     604
     605                                        AC_DEFINE([_METIS_VERSION_],[4],[ Metis version number])
     606                        fi
     607                        if test "$METIS_VERSION" = "5" ; then
     608               
     609                                case "${host_os}" in
     610                                        *cygwin*)
     611                                        METISLIB="-LIBPATH:\"$METIS_ROOT\" libmetis.lib"
     612                                        ;;
     613                                        *linux*)
     614                                        METISLIB=-L"$METIS_ROOT/lib -lmetis"
     615                                        ;;
     616                                        *darwin*)
     617                                        METISLIB=-L"$METIS_ROOT/lib -lmetis"
     618                                        ;;
     619                                esac
     620
     621                                METISINCL=-I"$METIS_ROOT/include"
     622                                AC_DEFINE([_METIS_VERSION_],[5],[ Metis version number])
     623                        fi
     624
     625                        AC_DEFINE([_HAVE_METIS_],[1],[with Metis in ISSM src])
     626                        AC_SUBST([METISINCL])
     627                        AC_SUBST([METISLIB])
     628                else
     629                        HAVE_METIS=no
     630                fi
     631                AC_MSG_RESULT($HAVE_METIS)
     632        fi
     633        AM_CONDITIONAL([METIS], [test x$HAVE_METIS = xyes])
    624634        dnl }}}
    625635        dnl tao{{{
     
    13551365        fi
    13561366
    1357         dnl check that we have python version if python compile is specified
    1358         if test "$HAVE_PYTHON" = "yes"  && test "$PYTHONVERSION" = "" ; then
    1359         AC_MSG_ERROR([need python-version if python compile is required!]);
    1360         fi
    1361 
    13621367        dnl check that if we have MPI, we have metis
    13631368        if test "$HAVE_METIS" = "yes"  && test "$HAVE_MPI" = "no" ; then
    13641369        AC_MSG_ERROR([need mpi if using the metis partitioner!]);
    13651370        fi
    1366 
    1367 
    1368 
    1369 
    13701371
    13711372        AC_MSG_RESULT(done)
     
    14251426        AC_MSG_RESULT($USE_64BIT_INDICES)
    14261427        dnl }}}
    1427         dnl circular-dependency{{{
    1428         AC_ARG_WITH([circular-dependency],
    1429           AS_HELP_STRING([--with-circular-dependency = bool],[do we look for circular dependencies, default "yes", ex: --with-circular-dependency="no"]),
    1430           [CIRCULAR_DEPENDENCIES=$withval],[CIRCULAR_DEPENDENCIES=yes])
    1431         AC_MSG_CHECKING(for circular dependencies)
    1432         AM_CONDITIONAL([CIRCULAR_DEPENDENCIES], [test x$CIRCULAR_DEPENDENCIES = xyes])
    1433         AC_MSG_RESULT($CIRCULAR_DEPENDENCIES)
    1434 
    1435         dnl }}}
    14361428])
Note: See TracChangeset for help on using the changeset viewer.