Re: [PHP-DEV] [PATCH] Fix bundle compilation on Darwin for Apache 2.0

2002-05-13 Thread Justin Erenkrantz

On Mon, May 13, 2002 at 09:04:36AM +0300, Marko Karppinen wrote:
 I have been quite happy to have finally got rid of libtool on our links,
 however! I'd much prefer committing the rest of your patch and waiting for
 the first bug report about libtool-specific dependencies.
 
 The problem is that while linking with libtool might work with the
 Apple-supplied glibtool, it doesn't with a fresh GNU 1.4.x one. This means
 that running buildconf (with your other patch) would become mandatory on
 Darwin, even for end users. Me not like.
 
 Again, I throw the ball in your court -- it seems entirely possible to me to
 get the *real* dependencies figured out when building ap{ru}-config.

httpd-2.0 doesn't build with the stock libtool-1.4.2 either.  So,
if you're using Apache 2.0, you're going to need a patched libtool
anyway.  I'd imagine that binary distributions of httpd-2.0 will
include the patched libtool in its installbuilddir (whomever built
the binary needs a good libtool), so that may be a way to work
around the problem - leverage httpd's libtool on Darwin.

It's a point of contention that we've been trying to bring to Apple's
attention (Fred and I have been emailing the Core OS team).  We're
trying to get them to a) include it in Jaguar and b) submit it
upstream.  I'm crossing my fingers, but I'm not really optimistic on
this point that Apple is going to address this.  I believe JimJag is
tasked with trying to submit ASF-desired patches to GNU tools
upstream to FSF.

After talking with the Apple linker developer, I'm not entirely clear
what we can do.  Both of us agreed that it will get awfully messy
if we try to resolve the dependencies of httpd ourselves - the only
way to do this seems to be to leverage ap{ru}-config.  As I mentioned
earlier, we discussed ways the linker could handle it, but that's
not going to help until possibly 10.3-land (and only if we keep
pressure on them to help).

Thoughts?  -- justin

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




Re: [PHP-DEV] [PATCH] Fix bundle compilation on Darwin for Apache 2.0

2002-05-13 Thread Justin Erenkrantz

On Mon, May 13, 2002 at 10:41:16PM +0300, Marko Karppinen wrote:
 One More Thing, Justin :)
 
  +MH_BUNDLE_FLAGS=`$APXS_BINDIR/apr-config --ldflags --link-ld --libs`
 
 Could you give me a scenario where we might need something from --ldflags or
 --link-ld? Wouldn't just the libs do? I'd rather not include something that
 might override our choices on the link line.

Such as using an external expat, gdbm, or berkeley-db.  Bringing
apr-util in on Darwin requires bringing in any dependencies, so we
have to bring in whatever apr or apr-util depends upon.

(This is off my Linux box, but the output on my Darwin box is
remarkably similar.)

% srclib/apr-util/apu-config --libs
 -lgdbm -ldb /usr/lib/libexpat.la
% srclib/apr-util/apu-config --ldflags
 -L/pkg/db-4.0.14/lib
% srclib/apr-util/apu-config --link-ld
 -L/home/jerenkrantz/cvs-apache/build/worker/srclib/apr-util -laprutil

I've talked with some people, and we may have a solution for the
expat libraries indicating its libtool path.  That should remove the
need for libtool on Darwin.  However, I'm concerned that not using
libtool for compiling and linking may introduce problems down the
road.  -- justin

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




[PHP-DEV] [PATCH] Fix bundle compilation on Darwin for Apache 2.0

2002-05-12 Thread Justin Erenkrantz

This patch adds support for Darwin bundles for the apache2filter
module.  I brought up extending apxs to allow building self-contained
libraries on the dev@httpd lists to no answer.  Since Darwin is a
special case that requires self-contained libraries (unless using
a flat namespace), I don't think it's necessary to add code to apxs
to always build self-contained libraries - we just need to handle
Darwin specially.

This patch does two things that should only be Darwin specific:
- Call apr-config and apu-config to determine the link information
for the requisite libraries so that they can be self-contained.
- Modifies the libphp4.bundle target to allow linking with libtool.
Since ap{ru}-config *may* print out information requiring libtool
to link (i.e. libexpat.la as a dependency), this makes more sense
to me.

While I was at WWDC last week, I talked to the linker developer
and we tossed around some ideas for handling this bundling problem.
I don't forsee any solution coming in the Jaguar timeframe, but
perhaps something later on.  If you are interested in more details,
drop me a line as I don't think the entire PHP community cares
about Darwin.  =)

Please let me know if you have any questions or comments.  I have
tested this on my platform and it works.  -- justin

Index: Makefile.global
===
RCS file: /repository/php4/Makefile.global,v
retrieving revision 1.11
diff -u -r1.11 Makefile.global
--- Makefile.global 28 Apr 2002 03:27:43 -  1.11
+++ Makefile.global 12 May 2002 23:01:21 -
 -15,7 +15,7 
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath 
$(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) 
$(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $
 
 libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
-   $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) 
$(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(EXTRA_LIBS) 
$(ZEND_EXTRA_LIBS) -o $  cp $ libs/libphp4.so
+   $(LIBTOOL) --mode=link $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) 
+$(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) 
+$(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $  cp $ libs/libphp4.so
 
 php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) 
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) 
$(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $
Index: sapi/apache2filter/config.m4
===
RCS file: /repository/php4/sapi/apache2filter/config.m4,v
retrieving revision 1.15
diff -u -r1.15 config.m4
--- sapi/apache2filter/config.m45 May 2002 09:52:39 -   1.15
+++ sapi/apache2filter/config.m412 May 2002 23:01:33 -
 -57,7 +57,18 
 INSTALL_IT=$APXS -i -a -n php4 $SAPI_LIBTOOL 
 ;;
   *darwin*)
-MH_BUNDLE_FLAGS=-bundle -bundle_loader $APXS_HTTPD
+dnl When using bundles on Darwin, we must resolve all symbols.  However,
+dnl the linker does not recursively look at the bundle loader and
+dnl pull in its dependencies.  Therefore, we must pull in the APR
+dnl and APR-util libraries.
+APXS_BINDIR=`$APXS -q BINDIR`
+if test -f $APXS_BINDIR/apr-config; then
+MH_BUNDLE_FLAGS=`$APXS_BINDIR/apr-config --ldflags --link-ld --libs`
+fi
+if test -f $APXS_BINDIR/apu-config; then
+MH_BUNDLE_FLAGS=`$APXS_BINDIR/apu-config --ldflags --link-ld --libs` 
+$MH_BUNDLE_FLAGS
+fi
+MH_BUNDLE_FLAGS=-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS
 PHP_SUBST(MH_BUNDLE_FLAGS)
 PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c 
php_functions.c)
 SAPI_SHARED=libs/libphp4.so

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