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

Re: ./configure --with-python



On Fri, 2004-05-07 at 00:23, W. Borgert wrote:
> Quoting Roland Stigge <stigge@antcom.de>:
> > checking local Python configuration... checking for  script directory...
> > NONE/lib/python2.3/site-packages
> > checking for  extension module directory...
> > NONE/lib/python2.3/site-packages
> > looks good
> 
> The script says "looks good", but I disagree.  Maybe some autoconf stuff
> replaced '/usr' with 'NONE'?

I think the problem is in acinclude.m4 - I've attached the unified diff
of 0.93 against 0.92.2

Note the following extract:

+  if test -e "${py_config_dir}/libpython${PYTHON_VERSION}.a"; then
+    PYTHON_LIBS="-L${py_config_dir} -lpython${PYTHON_VERSION}
$py_localmodlibs $py_basemodlibs $py_other_libs"


Now py_config_dir is set here:

-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+py_config_dir=`$PYTHON -c "import os; print
os.path.abspath('$pyexecdir/../config')"`

So it relies on the value of pyexecdir (note that 9.2.2 does not).

My autoconf and m4 skills are pretty much non-existent, but the
following appears to set pyexecdir:

+  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+    [am_cv_python_pyexecdir],
+    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import
sysconfig; print
sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null
||
+     echo
"${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])

Both OR clauses make use of PYTHON_EXEC_PREFIX, which is set here:

+  AC_SUBST([PYTHON_EXEC_PREFIX], [${exec_prefix}])

Of course, exec_prefix defaults to NONE, but can be passed as an option
to ./configure (--exec-prefix).

I have confirmed that passing --exec-prefix=/usr to ./configure results
in successful detection of python libraries (when --with-python is used
as well, of course).

However, ./configure --help indicates that exec-prefix is used to
specificy the location to "install architecture-dependent files". I
think that using exec-prefix to determine the location of python
libraries is therefore incorrect.

This is probably the point where I'd attach a patch to solve the
problem, but as mentioned previously I've never used autoconf or m4
before - I don't even know if my (possible) explanation is correct.

Hopefully someone with more experience can confirm/deny the contents of
this email :-)

Cheers

Andrew
--- dia-0.92.2/work/dia-0.92.2/acinclude.m4	2002-03-10 09:22:42.000000000 +1100
+++ dia-0.93/work/dia-0.93/acinclude.m4	2004-04-30 03:00:39.000000000 +1000
@@ -1,6 +1,6 @@
 dnl Check if the C compiler accepts a certain C flag, and if so adds it to
 dnl CFLAGS
-AC_DEFUN(DIA_CHECK_CFLAG, [
+AC_DEFUN([DIA_CHECK_CFLAG], [
   AC_MSG_CHECKING(if C compiler accepts $1)
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $1"
@@ -96,11 +96,8 @@
   dnl distinct variables so they can be overridden if need be.  However,
   dnl general consensus is that you shouldn't need this ability.
 
-  AC_SUBST(PYTHON_PREFIX)
-  PYTHON_PREFIX='${prefix}'
-
-  AC_SUBST(PYTHON_EXEC_PREFIX)
-  PYTHON_EXEC_PREFIX='${exec_prefix}'
+  AC_SUBST([PYTHON_PREFIX], [${prefix}])
+  AC_SUBST([PYTHON_EXEC_PREFIX], [${exec_prefix}])
 
   dnl At times (like when building shared libraries) you may want
   dnl to know which OS platform Python thinks this is.
@@ -119,8 +116,11 @@
   dnl Also, if the package prefix isn't the same as python's prefix,
   dnl then the old $(pythondir) was pretty useless.
 
-  AC_SUBST(pythondir)
-  pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
+    [am_cv_python_pythondir],
+    [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
+  AC_SUBST([pythondir], [$am_cv_python_pythondir])
 
   dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
   dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
@@ -133,8 +133,11 @@
   dnl pyexecdir -- directory for installing python extension modules
   dnl   (shared libraries)  Was PYTHON_SITE_EXEC in previous betas.
 
-  AC_SUBST(pyexecdir)
-  pyexecdir=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+    [am_cv_python_pyexecdir],
+    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
 
   dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
   dnl   Maybe this should be put in python.am?
@@ -147,7 +150,7 @@
 
 dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
 dnl Check if a module containing a given symbol is visible to python.
-AC_DEFUN(AM_CHECK_PYMOD,
+AC_DEFUN([AM_CHECK_PYMOD],
 [AC_REQUIRE([AM_PATH_PYTHON])
 py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
@@ -213,9 +216,9 @@
 
 AC_MSG_CHECKING(for libpython${PYTHON_VERSION}.a)
 
-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+py_config_dir=`$PYTHON -c "import os; print os.path.abspath('$pyexecdir/../config')"`
 
-py_makefile="${py_exec_prefix}/lib/python${PYTHON_VERSION}/config/Makefile"
+py_makefile="${py_config_dir}/Makefile"
 if test -f "$py_makefile"; then
 dnl extra required libs
   py_localmodlibs=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $py_makefile`
@@ -223,8 +226,8 @@
   py_other_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $py_makefile`
 
 dnl now the actual libpython
-  if test -e "${py_exec_prefix}/lib/python${PYTHON_VERSION}/config/libpython${PYTHON_VERSION}.a"; then
-    PYTHON_LIBS="-L${py_exec_prefix}/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION} $py_localmodlibs $py_basemodlibs $py_other_libs"
+  if test -e "${py_config_dir}/libpython${PYTHON_VERSION}.a"; then
+    PYTHON_LIBS="-L${py_config_dir} -lpython${PYTHON_VERSION} $py_localmodlibs $py_basemodlibs $py_other_libs"
     AC_MSG_RESULT(found)
   else
     AC_MSG_RESULT(not found)
@@ -241,7 +244,7 @@
 dnl AC_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
 dnl
-AC_DEFUN(AC_CHECK_FT2,
+AC_DEFUN([AC_CHECK_FT2],
 [dnl
 dnl Get the cflags and libraries from the freetype-config script
 dnl


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK