[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Re: mingw patch with working createfilemapping and re
From: |
Martin Dvh |
Subject: |
[Discuss-gnuradio] Re: mingw patch with working createfilemapping and resolved backslash problems |
Date: |
Wed, 20 Jul 2005 07:52:29 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030823 |
Martin Dvh wrote:
Hi all,
I added some additional code to gr_python.m4 to get rid of all remaining
backslash problems in python pathnames.
I put it in a section which is only executed on mingw (case host_os in
mingw*)
(No more python related patchnames required as ./configure parameters.)
I found that my changes of gr_python.m4 collided with recent changes in cvs.
I tried to make a new working version containing the new way of finding the
python include path (as in current cvs) but couldn't get that to work.
Configure crashes on this code on mingw (I get an unexpected end of file):
AC_CACHE_CHECK([for Python include path],
cv_python_path,
[
if test -z "$PYTHON" ; then
AC_MSG_ERROR([cannot find Python path])
fi
I think this has again todo with the backslashes (and possibly m4 underquoting)
in the cv_python_path that AM_PATH_PYTHON provides.
I attached my version of gr_python.m4
This uses the "old" way of determing Python include path and it works on mingw and should also work on other systems (it checks for host_os = mingw for the
mingw specific code).
This might however make cross-compiling more difficult so I still hope my new
code and the new code in cvs can be made to work together.
Greetings,
Martin
dnl
dnl Copyright 2003 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
dnl GNU Radio is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl GNU Radio is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GNU Radio; see the file COPYING. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
dnl
# PYTHON_DEVEL()
#
# Checks for Python and tries to get the include path to 'Python.h'.
# It provides the $(PYTHON_CPPFLAGS) output variable.
AC_DEFUN([PYTHON_DEVEL],[
AC_REQUIRE([AM_PATH_PYTHON])
AC_REQUIRE([AC_CANONICAL_HOST])
# Check for Python include path
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON" ; then
AC_MSG_ERROR([cannot find Python path])
fi
# ask distutils which include path we should use
python_cmd='
import distutils.sysconfig
import os
path = distutils.sysconfig.get_python_inc(plat_specific=False)
if os.sep == "\\":
path = path.replace("\\", "/")
print path
'
python_path=`$PYTHON -c "$python_cmd"`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python include path])
fi
AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path])
# Check for Python headers usability
python_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
AC_CHECK_HEADERS([Python.h], [],
[AC_MSG_ERROR([cannot find usable Python headers])])
CPPFLAGS="$python_save_CPPFLAGS"
# The block below is commented out because it breaks the x86-64 and
OS/X build.
# Only set this on mingw target, (only implemented for mingw host, for
crosscompiling you need to trick this)
PYTHON_LDFLAGS=""
case $host_os in
*mingw* )
AC_MSG_CHECKING([for Python LDFLAGS])
python_cmd='
import distutils.sysconfig
import os
path = distutils.sysconfig.PREFIX + "/libs"
if os.sep == "\\":
path = path.replace("\\", "/")
print path
'
python_stdlib_path=`$PYTHON -c "$python_cmd"`
python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"`
libpython_name="python$PYTHON_VERSION"
# Standard install of python for win32 has libpython24.a in stead of
libpython2.4.a so we check for the library without the dot in the
versionnumber.
python_stdlib_filename=`find $python_stdlib_path -type f -name
libpython$python_version_nodot.* -print | sed "1q"`
if test -n "$python_stdlib_filename" ; then
libpython_name="python$python_version_nodot"
fi
PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
AC_MSG_RESULT($PYTHON_LDFLAGS)
# Replace all backslashes in PYTHON Paths with forward slashes
AC_MSG_CHECKING([for pythondir])
pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
AC_MSG_RESULT($pythondir)
AC_SUBST([pythondir])
AC_MSG_CHECKING([for pkgpythondir])
pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
AC_MSG_RESULT($pkgpythondir)
AC_SUBST([pkgpythondir])
AC_MSG_CHECKING([for pyexecdir])
pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
AC_MSG_RESULT($pyexecdir)
AC_SUBST([pyexecdir])
AC_MSG_CHECKING([for pkgpyexecdir])
pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
AC_MSG_RESULT($pkgpyexecdir)
AC_SUBST([pkgpyexecdir])
esac
AC_SUBST([PYTHON_LDFLAGS])
dnl # Check for Python library path
dnl AC_MSG_CHECKING([for Python library path])
dnl python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
dnl for i in "$python_path/lib/python$PYTHON_VERSION/config/"
"$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/"
"$python_path/lib/python/" "$python_path/" "$python_path/libs" ; do
dnl python_path=`find $i -type f -name libpython$PYTHON_VERSION.*
-print | sed "1q"`
dnl if test -n "$python_path" ; then
dnl break
dnl fi
dnl done
dnl python_path=`echo $python_path | sed "s,/libpython.*$,,"`
dnl if test -z "$python_path" ; then
dnl AC_MSG_WARN(cannot find Python library path)
dnl fi
dnl AC_MSG_RESULT([$python_path])
dnl
dnl AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
dnl #
dnl python_site=`echo $python_path | sed "s/config/site-packages/"`
dnl AC_SUBST([PYTHON_SITE_PKG],[$python_site])
dnl #
dnl # libraries which must be linked in when embedding
dnl #
dnl AC_MSG_CHECKING(python extra libraries)
dnl PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
dnl conf = distutils.sysconfig.get_config_var; \
dnl print conf('LOCALMODLIBS')+' '+conf('LIBS')"
dnl AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
dnl AC_SUBST(PYTHON_EXTRA_LIBS)
dnl
dnl
dnl # Check for Python library usability
dnl python_save_LIBS=$LIBS
dnl python_save_CPPFLAGS=$CPPFLAGS
dnl LIBS="$LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS"
dnl CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
dnl
dnl AC_MSG_CHECKING(Python headers and library usability)
dnl AC_TRY_LINK([ #include <Python.h> ], [ PyArg_Parse(NULL, NULL); ],
dnl [AC_MSG_RESULT(yes)],
dnl [AC_MSG_WARN(no dev lib, crossing fingers)
dnl AC_SUBST([PYTHON_LDFLAGS],[""])])
dnl
dnl CPPFLAGS="$python_save_CPPFLAGS"
dnl LIBS="$python_save_LIBS"
])