autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python macros?


From: Jürgen A. Erhard
Subject: Python macros?
Date: Thu, 24 May 2001 03:46:53 +0200
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.5 (i686-pc-linux-gnu) MULE/4.0 (HANANOEN)

Here's one I did for a project where I want to use 2.0.  Since
"python" is still 1.5.2 on Debian, it had to be smart enough to see
that "python"'s not 2.0...

It's not perfect... but it Works For Me(tm)  ;-)

AC_DEFUN(jae_PYTHON,
[
# Try to find Python in the path
AC_PATH_PROG(PATH_TO_PYTHON, python)

if test "$1" != "" ; then
   # There's a min version specified.  Run a python prog that checks the version
   if test -n "$PATH_TO_PYTHON" && $PATH_TO_PYTHON -c '
import sys, string
if map(int, string.split(string.split(sys.version)[[0]], ".")) < map(int, 
string.split(sys.argv[[1]], ".")):
   sys.exit(1)' $1; then

        PYTHON=$PATH_TO_PYTHON
   else

        if test -z "$PATH_TO_PYTHON"; then
           AC_MSG_WARN([No "python" executable found])
        else
           AC_MSG_WARN([$PATH_TO_PYTHON is a version older than $1, trying to 
find python$1])
        fi

        # Try to find PYTHON+version
        AC_PATH_PROG([PATH_TO_PYTHON]translit([$1], .), python$1)
        if test -z "$[PATH_TO_PYTHON]translit([$1], .)"; then
            AC_MSG_ERROR([no python $1 interpreter found])
        else
            PYTHON=$[PATH_TO_PYTHON]translit([$1], .)
        fi

   fi

else
        if test -z "$PATH_TO_PYTHON"; then
            AC_MSG_ERROR([no python interpreter found])
        else
            PYTHON=$PATH_TO_PYTHON
        fi
   PYTHON=$PATH_TO_PYTHON

fi


AC_SUBST(PYTHON)
]
)



-- 
Jürgen A. Erhard    address@hidden   phone: (GERMANY) 0721 27326
          My WebHome: http://members.tripod.com/Juergen_Erhard
          George Herrimann's Krazy Kat (http://www.krazy.com)
                     Shah, shah!  Ayatollah you so!

Attachment: pgpahofz1IKeW.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]