Changeset 6039c6 in git for m4/ax_python_embed.m4


Ignore:
Timestamp:
Apr 10, 2017, 3:44:33 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '98550b669234b32be762076c32b3be2c35188ac4')
Children:
7626a494d17999205045943cef22e9c6ab6c9f63
Parents:
8a20520a56cabf3ab18f0ccf689a7f4d0910d24a
Message:
update: ax_python_embed.m4 to version 15 (port: debian 9)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • m4/ax_python_embed.m4

    r8a2052 r6039c6  
    11# ===========================================================================
    2 #      http://www.gnu.org/software/autoconf-archive/ax_python_embed.html
     2#     https://www.gnu.org/software/autoconf-archive/ax_python_embed.html
    33# ===========================================================================
    44#
     
    121121#   warranty.
    122122
    123 #serial 8
     123#serial 15
    124124
    125125# AX_PYTHON_DEFAULT( )
     
    140140# Input:
    141141#   $1 is the optional search path for the python executable if needed
    142 # Ouput:
     142# Output:
    143143#   PYTHON_USE (AM_CONDITIONAL) is true if python executable found
    144144#   and --enable-python was requested; otherwise false.
     
    171171                    # "yes" was specified, but we don't have a path
    172172                    # for the executable.
    173                     # So, let's searth the PATH Environment Variable.
     173                    # So, let's search the PATH Environment Variable.
    174174                    AC_MSG_RESULT(yes)
    175175                    AC_PATH_PROG(
     
    224224    if test -n "$PYTHON"
    225225    then
    226         ax_python_prefix=`${PYTHON}-config --prefix`
     226        ax_python_prefix=`${PYTHON} -c "import sys; print(sys.prefix)"`
    227227        if test -z "$ax_python_prefix"
    228228        then
    229229            AC_MSG_ERROR([Python Prefix is not known])
    230230        fi
    231 #        ax_python_execprefix=`${PYTHON}-config --exec-prefix`
    232 #        ax_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`
    233 #        ax_python_includespec="-I${ax_python_prefix}/include/python${ax_python_version}"
    234 #        if test x"$python_prefix" != x"$python_execprefix"; then
    235 #            ax_python_execspec="-I${ax_python_execprefix}/include/python${ax_python_version}"
    236 #            ax_python_includespec="${ax_python_includespec} $ax_python_execspec"
    237 #        fi
    238         ax_python_cspec=`${PYTHON}-config --cflags | sed -e 's@ -mno-fused-madd @ @g'`
    239         #   or -Qunused-arguments / clang :(
    240 #        ax_python_cspec="${ax_python_ccshared} ${ax_python_includespec}"
     231        ax_python_execprefix=`${PYTHON} -c "import sys; print(sys.exec_prefix)"`
     232        ax_python_version=`$PYTHON -c "import sys; print(sys.version[[:3]])"`
     233        ax_python_includespec="-I${ax_python_prefix}/include/python${ax_python_version}"
     234        if test x"$python_prefix" != x"$python_execprefix"; then
     235            ax_python_execspec="-I${ax_python_execprefix}/include/python${ax_python_version}"
     236            ax_python_includespec="${ax_python_includespec} $ax_python_execspec"
     237        fi
     238        ax_python_ccshared=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('CFLAGSFORSHARED'))"`
     239        ax_python_cspec="${ax_python_ccshared} ${ax_python_includespec}"
    241240        AC_SUBST([PYTHON_CSPEC], [${ax_python_cspec}])
    242241        AC_MSG_NOTICE([PYTHON_CSPEC=${ax_python_cspec}])
     
    270269AC_DEFUN([AX_PYTHON_LSPEC],
    271270[
    272 
    273271    AC_ARG_VAR( [PYTHON], [Python Executable Path] )
    274272    if test -n "$PYTHON"
    275273    then
    276 
    277274        AX_PYTHON_RUN([
    278275import sys
     
    304301    # other included Frameworks.  However, it is necessary
    305302    # where someone has installed more than one frameworked
    306     # Python.  Frameworks are really only used in Mac OS X.
     303    # Python.  Frameworks are really only used in MacOSX.
    307304    strLibFW = dictConfig.get("PYTHONFRAMEWORKPREFIX")
    308305    if strLibFW and (strLibFW != ""):
    309306        strLinkSpec += " -F%s" % (strLibFW)
    310307strLinkSpec += " %s" % (dictConfig.get('LINKFORSHARED'))
    311 print strLinkSpec
     308print(strLinkSpec)
    312309        ])
    313 
    314 #        AC_SUBST([PYTHON_LSPEC], [${ax_python_output}])
    315 #        AC_MSG_NOTICE([PYTHON_LSPEC=${ax_python_output}])
    316 
    317         ax_python_lspec=`${PYTHON}-config --ldflags`
    318         AC_SUBST([PYTHON_LSPEC], [${ax_python_lspec}])
    319         AC_MSG_NOTICE([PYTHON_LSPEC=${ax_python_lspec}])
    320 
     310        AC_SUBST([PYTHON_LSPEC], [${ax_python_output}])
     311        AC_MSG_NOTICE([PYTHON_LSPEC=${ax_python_output}])
    321312    fi
    322313])
     
    355346        AC_MSG_ERROR([Python Executable Path is not known])
    356347    fi
    357     ax_python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
    358     ax_python_execprefix=`${PYTHON} -c "import sys; print sys.exec_prefix"`
     348    ax_python_prefix=`${PYTHON} -c "import sys; print(sys.prefix)"`
     349    ax_python_execprefix=`${PYTHON} -c "import sys; print(sys.exec_prefix)"`
    359350    AC_SUBST([PYTHON_PREFIX], ["${ax_python_prefix}"])
    360351    AC_SUBST([PYTHON_EXECPREFIX], ["${ax_python_execprefix}"])
     
    395386# Run ACTION-IF-TRUE if the Python interpreter has version >= VERSION.
    396387# Run ACTION-IF-FALSE otherwise.
    397 # This test uses sys.hexversion instead of the string equivalant (first
     388# This test uses sys.hexversion instead of the string equivalent (first
    398389# word of sys.version), in order to cope with versions such as 2.2c1.
    399390# hexversion has been introduced in Python 1.5.2; it's probably not
     
    407398        AC_MSG_CHECKING([whether $PYTHON version >= $1])
    408399        AX_PYTHON_RUN([
    409 import sys, string
     400import sys
    410401# split strings by '.' and convert to numeric.  Append some zeros
    411402# because we need at least 4 digits for the hex conversion.
    412 minver = map(int, string.split('$1', '.')) + [[0, 0, 0]]
     403# It accepts a string like "X[.Y[.Z]]" with X,Y,Z=digits
     404# and [] means optional.
     405minver = list(map(int, '$1'.split('.'))) + [[0, 0, 0]]
     406minver[3] = 255
    413407minverhex = 0
    414 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
     408for i in range(0, 4): minverhex = (minverhex << 8) + minver[[i]]
    415409if sys.hexversion >= minverhex:
    416410    sys.exit( 0 )
     
    453447# Input:
    454448#   $1 is the optional search path for the python executable if needed
    455 # Ouput:
     449# Output:
    456450#   PYTHON_USE (AM_CONDITIONAL) is true if python executable found
    457451#   and --with-python was requested; otherwise false.
     
    484478                    # "yes" was specified, but we don't have a path
    485479                    # for the executable.
    486                     # So, let's searth the PATH Environment Variable.
     480                    # So, let's search the PATH Environment Variable.
    487481                    AC_MSG_RESULT(yes)
    488482                    AC_PATH_PROG(
Note: See TracChangeset for help on using the changeset viewer.