On Tue, May 15, 2001 at 10:53:23AM +0200, Petr Cech wrote:
> On Tue, May 15, 2001 at 11:44:38AM +0300 , Alexander Bokovoy wrote:
> > On Tue, May 15, 2001 at 10:35:37AM +0200, Petr Cech wrote:
> > > Hi,
> > > I've been strugling for some time with the possibility of building some
> > > extension not inside of ext/ dir, but using phpize to just add some module
> > > later. Strangely, it didn't work - mostly. configure was created, Makefiles,
> > > config.h ... Just great, but the resulting .so did not. But only in some
> > > modules. And I fond also why:
> > > 
> > > Modules don't #include config.h generated by the ./configure - including
> > > this right at the top fixes the problems.
> > > 
> > > So, putting in every module and having phpize generate -DHAVE_CONFIG_H would
> > > make it really painless for everyone to build his favorite extension
> > > 
> > > #ifdef HAVE_CONFIG_H
> > > #include "config.h"
> > > #endif
> > Another way (without changing extension) is to run configure as
> > CFLAGS="$CFLAGS -DHAVE_FOO=1 -DCOMPILE_DL_FOO=1" ./configure [options]
> 
> this can work with simple, no config, extensions. But of course it doesn't
> catch things like pgsql's configure searching for
> 
>   AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
>   AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[ ]))
>   AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ]))
>   AC_CHECK_LIB(pq, 
>pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[ ]))
> 
> which get into the config.h. Defining them by hand is IMHO really not the
> way, this should be done.
Yes. Actually, I'm using slightly different approach:

%build
# Fix includes so that local config header file will always supercede global options
for j in `ls *.c` ; do
    perl -pi -e "s/#include \"php.h\"/#include \"php.h\"\n#include \"config.h\"/" $j
done
phpize

%configure

BUILD_ENV_VARS="top_srcdir=$RPM_BUILD_DIR/%name-%version \
                bindir=$RPM_BUILD_ROOT/usr/bin \
                sbindir=$RPM_BUILD_ROOT/usr/sbin \
                includedir=$RPM_BUILD_ROOT/usr/include \
                exec_prefix=$RPM_BUILD_ROOT/usr \
                libdir=$RPM_BUILD_ROOT/usr/lib \
                prefix=$RPM_BUILD_ROOT/usr \
                localstatedir=$RPM_BUILD_ROOT/var/lib \
                PEAR_INSTALLDIR=$RPM_BUILD_ROOT/usr/lib/php \
                EXTENSION_DIR=$RPM_BUILD_ROOT/usr/lib/php/extensions"
make $BUILD_ENV_VARS
  
This is of course for RPM-based systems, but debian/rules will perform
with same success. 
-- 
Sincerely yours, Alexander Bokovoy 
  The Midgard Project    | ALT  Linux  Team | Minsk Linux Users Group
 www.midgard-project.org | www.altlinux.ru  |    www.minsk-lug.net 
-- You won't skid if you stay in a rut.
                -- Frank Hubbard

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to