[Xapian-discuss] PHP bindings on a Mac
Olly Betts
olly@survex.com
Wed, 26 May 2004 15:26:56 +0100
Can I just make it totally clear that this isn't anything weird we
(Xapian) are doing here.
As I understand it, most of this is down to how PHP expects modules to
be built - i.e. by running phpize to construct a mini autotools project which
will actually build the bindings.
The SWIG PHP machinery actually runs phpize on the fly, whereas I
*think* the PHP people intend it to be run as a one-off operation to
produce a framework project, but it's hard to be sure as it seems to be
undocumented! At least there's no man page, only one brief mention
(and Debian specific at that) in /usr/share/doc/php*, and phpize --help
just tells me it understands --clean and --help, but not what --clean
does!
With regard to the comment in php4/Makefile.am:
: # FIXME: this isn't going to work with an uninstalled libxapian
: # The whole "--with-xapian" concept is deeply flawed really
cd xapian &&\
./configure --with-xapian="`echo $(XAPIAN_CXXFLAGS)|sed 's!^-I!!;s!/include$$!!'`" &&\
$(MAKE)
As noted, the way SWIG+PHP works means that you have to install xapian-core
first. Not a huge limitation, but it's a shame that everything else works
without needing that.
But as the above also notes, the idea that you can specify a library using
"--with-XXX=/usr/local" or similar is flawed anyway. There may also be special
compile or link time flags which are required to link against the library
successfully. Xapian (like most modern libraries) provides an XXX-config
script which outputs the required options in response to command line options,
although the options to pass aren't totally standard unfortunately.
Looking at this again, I see that we could avoid passing --with-xapian at
all if we pass configure the various variables it would set. And that
would hopefully allow us to link against uninstalled versions.
Cheers,
Olly