autoconf
[Top][All Lists]
Advanced

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

Re: Python and Autoconf


From: Russ Allbery
Subject: Re: Python and Autoconf
Date: 22 May 2001 15:46:57 -0700
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Glen Starchman <address@hidden> writes:

> Anyone have any more Python-specific autoconf macros? 

Not wrapped into a nice macro yet, but INN currently uses the following in
order to get the paths needed to embed Python.  Python 2 has a nicer way
of handling this, but the following works with both 1.5.1 and 2.

dnl Libraries and flags for embedded Python.
dnl FIXME: I wish there was a less icky way to get this.
if test x"$DO_PYTHON" = xdefine ; then
    AC_MSG_CHECKING(for Python linkage)
    py_prefix=`$_PATH_PYTHON -c 'import sys; print sys.prefix'`
    py_ver=`$_PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
    py_libdir="${py_prefix}/lib/python${py_ver}"
    PYTHON_INC="-I${py_prefix}/include/python${py_ver}"
    py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
    py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
    py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
    py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's
/^.*=//'`
    py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^
.*=//'`
    PYTHON_LIB="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $
py_liblocalmod $py_libbasemod"
    PYTHON_LIB=`echo $PYTHON_LIB | sed -e 's/[ \\t]*/ /g'`
    AC_MSG_RESULT($py_libdir)
else
    PYTHON_LIB=""
    PYTHON_INC=""
fi
AC_SUBST(PYTHON_LIB)
AC_SUBST(PYTHON_INC)

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>



reply via email to

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