I am changing the way I build my PHP extension and am running into 
some problems. I was originally would build it by copying the 
directory foo_bar into the ext directory and added 
--enable-foo_bar=shared to the configure line of PHP and build PHP. 
Everything worked great!  Now I am looking to build it by:

phpize
./configure --enable-foo_bar=shared
make

If I build PHP with the module and install it, 
include/php/main/php_config.h would have two lines in it:

/*   */
#define HAVE_FOO_BAR 1

/* Whether to build foo_bar as dynamic module */
#define COMPILE_DL_FOO_BAR 1

And now any clean rebuilds of the extension using the phpize way will work.

Now if I do a clean build and install of PHP without the module, then 
try to build the module PHP via phpize, PHP can't load it.  Running 
nm on it reveals that the get_module function is not in the .so file. 
I have traced the missing get_module function down to:

#ifdef COMPILE_DL_FOO_BAR
ZEND_GET_MODULE(foo_bar)
#endif

and COMPILE_DL_FOO_BAR is not defined at compile time.  This is not 
defined because after running phpize config.h.in and configure are 
different:

--- config.h.in
#undef COMPILE_DL_FOO_BAR

---configure
#define COMPILE_DL_FOOBAR 1

It seems that the configure script is getting the underscore removed 
from the module name.  From what I can tell this is done in 
acinclude.m4 line 962:

AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to 
build $1 as dynamic module)

I think this needs to be changed to:

AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z_-), 1, Whether 
to build $1 as dynamic module)

This will handle extensions with both dashes and underscores, I think.

I also find the same line in the aclocal.m4, so it may need changed there to.

Am I off base here or is this a bug? I thought I would as before 
submitting a bug report.

Thanks,

Brian

BTW, no my extension is not named foo_bar, but it does have a underscore it.






-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to