I'm getting very close (I hope??) to successfully compiling 4.3 as a DSO on Mac OS X, but I'm not quite there yet. Any help would be much appreciated. I'd be happy to share details of how I got this far if anybody is interested.
I'm running OS X 10.1.5 with the latest security updates and gnu libtool (renamed glibtool so as not to conflict with Apple's libtool) 1.4.1, with patch (from http://savannah.gnu.org/patch/index.php?func=detailpatch&patch_id=111&group_id=25).
I am working with the latest stable CVS snapshot (200207081200).
After applying numerous patches (specifically to ltmain.sh and to a few files in Zend) that I found in various places, occasionally modifying them a bit, I configure using:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --with-apxs --with-mysql --enable-magic-quotes --with-zlib --disable-pear --with-xml
This works fine (i.e., no errors reported).
make then churns away for a while. When it is almost finished, I get some warnings about redefinitions:
Making all in apache
[...snip...]
In file included from /usr/include/httpd/httpd.h:72,
from sapi_apache.c:32:
/usr/include/httpd/ap_config.h:437: warning: HAVE_MMAP' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:325: warning: this is the location of the previous definition
/usr/include/httpd/ap_config.h:444: warning:HAVE_SNPRINTF' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:442: warning: this is the location of the previous definition
In file included from /usr/include/httpd/httpd.h:72,
from sapi_apache.c:32:
/usr/include/httpd/ap_config.h:1388: warning: XtOffsetOf' redefined
/usr/local/src/php-4.3/main/php.h:346: warning: this is the location of the previous definition
In file included from /usr/local/src/php-4.3/main/php_syslog.h:7,
from /usr/local/src/php-4.3/ext/standard/php_ext_syslog.h:26,
from /usr/local/src/php-4.3/ext/standard/php_standard.h:33,
from sapi_apache.c:56:
/usr/local/src/php-4.3/main/php_config.h:325: warning:HAVE_MMAP' redefined
/usr/include/httpd/ap_config.h:437: warning: this is the location of the previous definition
/usr/local/src/php-4.3/main/php_config.h:442: warning: `HAVE_SNPRINTF' redefined
/usr/include/httpd/ap_config.h:444: warning: this is the location of the previous definition
[...snip...]
In file included from /usr/include/httpd/httpd.h:72,
from mod_php4.c:32:
/usr/include/httpd/ap_config.h:437: warning: HAVE_MMAP' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:325: warning: this is the location of the previous definition
/usr/include/httpd/ap_config.h:444: warning:HAVE_SNPRINTF' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:442: warning: this is the location of the previous definition
In file included from /usr/include/httpd/httpd.h:72,
from mod_php4.c:32:
/usr/include/httpd/ap_config.h:1388: warning: XtOffsetOf' redefined
/usr/local/src/php-4.3/main/php.h:346: warning: this is the location of the previous definition
In file included from /usr/local/src/php-4.3/main/php_syslog.h:7,
from /usr/local/src/php-4.3/ext/standard/php_ext_syslog.h:26,
from /usr/local/src/php-4.3/ext/standard/php_standard.h:33,
from mod_php4.c:57:
/usr/local/src/php-4.3/main/php_config.h:325: warning:HAVE_MMAP' redefined
/usr/include/httpd/ap_config.h:437: warning: this is the location of the previous definition
/usr/local/src/php-4.3/main/php_config.h:442: warning: `HAVE_SNPRINTF' redefined
/usr/include/httpd/ap_config.h:444: warning: this is the location of the previous definition
[... snip...]
In file included from php_apache_http.h:6,
from php_apache.c:45:
/usr/include/httpd/ap_config.h:437: warning: HAVE_MMAP' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:325: warning: this is the location of the previous definition
/usr/include/httpd/ap_config.h:444: warning:HAVE_SNPRINTF' redefined
/usr/local/src/php-4.3/TSRM/../main/php_config.h:442: warning: this is the location of the previous definition
In file included from php_apache_http.h:6,
from php_apache.c:45:
/usr/include/httpd/ap_config.h:1388: warning: `XtOffsetOf' redefined
/usr/local/src/php-4.3/main/php.h:346: warning: this is the location of the previous definition
But it keeps going. Then it ends with:
Making all in .
/bin/sh /usr/local/src/php-4.3/libtool --silent --mode=compile cc -I. -I/usr/local/src/php-4.3/ -I/usr/local/src/php-4.3/main -I/usr/local/src/php-4.3 -I/usr/include/httpd -I/usr/local/src/php-4.3/Zend -I/usr/local/src/php-4.3/ext/mysql/libmysql -I/usr/local/src/php-4.3/ext/xml/expat -traditional-cpp -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -DHARD_SERVER_LIMIT=2048 -DEAPI -I/usr/local/src/php-4.3/TSRM -g -O2 -prefer-pic -c stub.c
/bin/sh /usr/local/src/php-4.3/libtool --silent --mode=link cc -I. -I/usr/local/src/php-4.3/ -I/usr/local/src/php-4.3/main -I/usr/local/src/php-4.3 -I/usr/include/httpd -I/usr/local/src/php-4.3/Zend -I/usr/local/src/php-4.3/ext/mysql/libmysql -I/usr/local/src/php-4.3/ext/xml/expat -traditional-cpp -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -DHARD_SERVER_LIMIT=2048 -DEAPI -I/usr/local/src/php-4.3/TSRM -g -O2 -prefer-pic -o libphp4.la -rpath /usr/local/src/php-4.3/libs -avoid-version stub.lo Zend/libZend.la sapi/apache/libsapi.la main/libmain.la regex/libregex.la /usr/local/src/php-4.3/ext/zlib/libzlib.la /usr/local/src/php-4.3/ext/ctype/libctype.la /usr/local/src/php-4.3/ext/mysql/libmysql.la /usr/local/src/php-4.3/ext/pcre/libpcre.la /usr/local/src/php-4.3/ext/posix/libposix.la /usr/local/src/php-4.3/ext/session/libsession.la /usr/local/src/php-4.3/ext/standard/libstandard.la /usr/local/src/php-4.3/ext/xml/libxml.la TSRM/libtsrm.la -lz -lm -ldl -ldl
/usr/local/src/php-4.3/libtool: parse error: condition expected: xyes = [3170]
/usr/local/src/php-4.3/.libs
OK, that looks bad, and I suppose it is, because while apxs does not complain when I attempt to install the module (which does exist in ./libs at this point), apache will not load it.
Alternatively, if instead of running apxs immediately after make, I go ahead with make install, I get:
apxs:Error: file libs/libphp4.dylib is not a DSO
(In fact, there is no such file.)
CHAPTER 2
Following advice found somewhere (sorry, I don't recall where now) I edited congif_vars.mk to add -DHAVE_LIBDL to the CPPFLAGS line. I also changed the configure options to include "--disable-shared" (no I do not really know what this does, if anything).
Under these conditions, make ends a little differently, but still has the "parse error" from libtool, as above. Here's how it ends now:
Making all in .
[...snip...]
mkdir .libs
rm -fr .libs/libphp4.la .libs/libphp4. .libs/libphp4.
(cd . && ln -s stub.lo stub.o)
/usr/local/src/php-4.3/libtool: parse error: condition expected: xyes = [3170]
cc -dynamiclib -flat_namespace -undefined suppress -o .libs/libphp4.so stub.lo -all_load Zend/.libs/libZend.al sapi/apache/.libs/libsapi.al main/.libs/libmain.al regex/.libs/libregex.al /usr/local/src/php-4.3/ext/zlib/.libs/libzlib.al /usr/local/src/php-4.3/ext/ctype/.libs/libctype.al /usr/local/src/php-4.3/ext/mysql/.libs/libmysql.al /usr/local/src/php-4.3/ext/pcre/.libs/libpcre.al /usr/local/src/php-4.3/ext/posix/.libs/libposix.al /usr/local/src/php-4.3/ext/session/.libs/libsession.al /usr/local/src/php-4.3/ext/standard/.libs/libstandard.al /usr/local/src/php-4.3/ext/xml/.libs/libxml.al TSRM/.libs/libtsrm.al -ldl -lz -lm -ldl -ldl -lc -install_name /usr/local/src/php-4.3/libs/libphp4.so
creating libphp4.la
(cd .libs && rm -f libphp4.la && ln -s ../libphp4.la libphp4.la)
/usr/local/src/php-4.3/.libs
Note the line:
/usr/local/src/php-4.3/libtool: parse error: condition expected: xyes = [3170]
make install still generates an error. Here's how it ends:
Making install in .
/usr/local/src/php-4.3/build/shtool mkdir -p "/usr/libexec/httpd" && apxs -S LIBEXECDIR="/usr/libexec/httpd" -i -a -n php4 libs/libphp4.dylib
apxs:Error: file libs/libphp4.dylib is not a DSO
make[1]: [install-sapi] Error 1
make: [install-recursive] Error 1