Changeset 12072


Ignore:
Timestamp:
04/20/12 08:39:58 (13 years ago)
Author:
Eric.Larour
Message:

Better handling of python versions

File:
1 edited

Legend:

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

    r12064 r12072  
    302302        AC_MSG_RESULT($HAVE_BOOST)
    303303        dnl }}}
     304        dnl python-version{{{
     305        AC_ARG_WITH([python-version],
     306          AS_HELP_STRING([--with-python-version = PYTHONVERSION],[python version.]),
     307          [PYTHONVERSION=$withval],[PYTHONVERSION=""])
     308        AC_MSG_CHECKING(for python version)
     309
     310        HAVE_PYTHON3="no"
     311
     312        dnl recover major:
     313        PYTHON_MAJOR=${PYTHONVERSION%.*}
     314
     315        if test x$PYTHON_MAJOR = x3; then
     316                dnl are we running python 3?
     317                HAVE_PYTHON3="yes"
     318        fi
     319        AC_DEFINE_UNQUOTED([_PYTHON_MAJOR_],$PYTHON_MAJOR,[python version major])
     320
     321        AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
     322        AC_MSG_RESULT($PYTHON_MAJOR)
     323        dnl }}}
    304324        dnl python{{{
    305325        AC_ARG_WITH([python-dir],
     
    312332                HAVE_PYTHON=yes
    313333                PYTHONINCL=-I$PYTHON_ROOT/include
    314                 PYTHONLIB="-L$PYTHON_ROOT/lib -lpython3.2"
     334                PYTHONLIB="-L$PYTHON_ROOT/lib -lpython$PYTHONVERSION"
    315335                PYTHONEXT=.so
    316336                PYTHONLINK="-dynamiclib"
     
    327347        AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
    328348        AC_MSG_RESULT($HAVE_PYTHON)
    329         dnl }}}
    330         dnl python-version{{{
    331         AC_ARG_WITH([python-version],
    332           AS_HELP_STRING([--with-python-version = PYTHONVERSION],[python version.]),
    333           [PYTHONVERSION=$withval],[PYTHONVERSION=""])
    334         AC_MSG_CHECKING(for python version)
    335 
    336         HAVE_PYTHON3="no"
    337 
    338         dnl recover major:
    339         PYTHON_MAJOR=${PYTHONVERSION%.*}
    340 
    341         if test x$PYTHON_MAJOR = x3; then
    342                 dnl are we running python 3?
    343                 HAVE_PYTHON3="yes"
    344         fi
    345 
    346         AM_CONDITIONAL([PYTHON3], [test x$HAVE_PYTHON3 = xyes])
    347         AC_MSG_RESULT($PYTHON_MAJOR)
    348349        dnl }}}
    349350        dnl python-numpy{{{
     
    12221223        fi
    12231224
    1224         dnl check that we python version if python compile is specified
    1225         dnl if test "$HAVE_PYTHON" = "yes"  && test "$HAVE_PYTHONVERSION" = "no" ; then
    1226         dnl     AC_MSG_ERROR([need python-version if python compile is required!]);
    1227         dnl fi
    1228 
     1225        check that we python version if python compile is specified
     1226        if test "$HAVE_PYTHON" = "yes"  && test "$PYTHONVERSION" = "" ; then
     1227        AC_MSG_ERROR([need python-version if python compile is required!]);
     1228        fi
    12291229
    12301230        AC_MSG_RESULT(done)
Note: See TracChangeset for help on using the changeset viewer.