[GRASS-dev] Re: [GRASS GIS] #38: configure.in: wxwidgets and python checks

Glynn Clements glynn at gclements.plus.com
Sat Feb 9 16:14:42 EST 2008


Martin Landa wrote:

> > >  Based on Glynn's notes I updated the patch (see configure_wx-1.diff)
> > >
> > >  Instead of --with-python=path/py-config is used --with-python=path/python.
> > >  Configure also checks for python-config.
> > >
> > >  {{{
> > >    --with-python[=path/python] enable Python support (python with path,
> > >  e.g. '--with-python=/usr/bin/python2.5', default: no)
> > >    --with-wxwidgets[=path/wx-config] enable wxWidgets support (wx-config
> > >  with path, e.g. '--with-wxwidgets=/usr/local/bin/wx-config', default: no)
> > >  }}}
> >
> > I think that you really should be using python-config rather than
> > trying to roll your own mechanism to achieve the same ends.
> 
> python-config is used if available, see
> 
>   AC_PATH_PROG(PY_CONFIG, python-config, no)
> 
>   # With Python includes directory
> 
>   if test "$PY_CONFIG" = "no" ; then
>     PYTHONINC="`$PYTHON -c ['import sys
> includepy = \"%s/include/python%s\" % (sys.prefix, sys.version[:3])
> if sys.version[0] > \"1\" or sys.version[2] > \"4\":
>     libpl = \"%s/include/python%s\" % (sys.exec_prefix, sys.version[:3])
> else:
>     libpl = \"%s/'$PYLIB'/python%s/config\" % (sys.exec_prefix, sys.version[:3])
> print \"-I%s -I%s\" % (includepy, libpl)'`]"
>   else
>     PYTHONINC=`"$PY_CONFIG" --cflags`
>   fi
>   LOC_CHECK_INCLUDES(Python.h,Python,$PYTHONINC)
> 
> I am not sure if to require python-config.

I wouldn't assume that you can compile Python extensions without it.

For simple libraries, it's enough to know what the header and library
files are called and to let the user specify where they can be found.

For complex "subsystems", this is often inadequate. You may need any
number of additional libraries as well as specific compiler and linker
switches, many of which will be at least platform-dependent and
possibly worse (consider Gentoo, where everything gets built from
source with any number of user-selectable options).

E.g. on my system:

	$ python-config --cflags
	-I/usr/include/python2.4 -I/usr/include/python2.4 -fno-strict-aliasing -DNDEBUG

Okay, so --with-python-includes=-I/usr/include/python2.4 might
suffice, depending upon whether or not the code actually uses anything
which violates C aliasing rules and/or the extent to which the
compiler takes advantage of them (I presume the -fno-strict-aliasing
flag is there for a reason).

But that's on my system. There's no telling what additional flags it
might need on some other system.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list