From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.3, same on any unix
PHP version:      4.2.1
PHP Bug Type:     Dynamic loading
Bug description:  COMPILE_DL_MODULENAME different in configure and config.h.in

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, becuase of the lines in php_config.h.

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.

Thanks,

Brian

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

-- 
Edit bug report at http://bugs.php.net/?id=17423&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=17423&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=17423&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=17423&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=17423&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17423&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=17423&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=17423&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=17423&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=17423&r=globals

Reply via email to