dannote / mod-ndb

Automatically exported from code.google.com/p/mod-ndb
0 stars 0 forks source link

Remove dependency on apxs 1.3 #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would certainly be an improvement if multiple versions of apache were not 
required. 

Original issue reported on code.google.com by john.david.duncan on 11 Aug 2007 at 10:21

GoogleCodeExporter commented 9 years ago
Here's the information I get from apxs 1.3 on a Nevada machine. 

-bash-3.00$ diff Makefile~~ Makefile

16,18c16,18
< APXS_CFLAGS=
< APXS_CFLAGS_SHLIB=
< APXS_LDFLAGS_SHLIB=
---
> APXS_CFLAGS=-DSOLARIS2=2110 -DUSE_HSREGEX
> APXS_CFLAGS_SHLIB=-fPIC -DSHARED_MODULE
> APXS_LDFLAGS_SHLIB=-G

Original comment by john.david.duncan on 30 Aug 2007 at 5:49

GoogleCodeExporter commented 9 years ago
Here's the known apxs bug:  
http://issues.apache.org/bugzilla/show_bug.cgi?id=29771

Original comment by john.david.duncan on 30 Aug 2007 at 8:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
apxs in apache2 uses apache_home/build/libtool.

You find apache's libtool by running "apr-config --apr-libtool"

apxs gets its configuration by reading apache_home/build/config_vars.mk

Original comment by john.david.duncan on 31 Aug 2007 at 6:27

GoogleCodeExporter commented 9 years ago

Original comment by john.david.duncan on 1 Sep 2007 at 12:56

GoogleCodeExporter commented 9 years ago
There's the "what would apxs do?"  strategy:

run apxs on a sample file.
record the output. 
use the output as a template, but fix the compiler (use c++ instead of c), and 
maybe fix the debug/optimize 
options, and fill in the source file name with real files.

% apxs -c mod_build_this.c -llll -LLLL -IIII  > outfile 2>&1 
%    
% cat outfile 
gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe 
-DHARD_SERVER_LIMIT=2048 
-DEAPI -DSHARED_MODULE -I/usr/include/httpd  -c mod_build_this.c
cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o 
mod_build_this.so mod_build_this.o 
-llll -LLLL -IIII 

% /usr/local/apache22/bin/apxs -c mod_build_this.c -llll -LLLL -IIII  > outfile 
2>&1  
% 
% cat outfile 
/usr/local/apache22/build/libtool --silent --mode=compile gcc -prefer-pic   
-DDARWIN -
DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -DAP_DEBUG -g -O2 -Wall 
-Wmissing-prototypes -
Wstrict-prototypes -Wmissing-declarations -I/usr/local/apache22/include  
-I/usr/local/apache22/include   
-I/usr/local/apache22/include   -c -o mod_build_this.lo mod_build_this.c && 
touch mod_build_this.slo

/usr/local/apache22/build/libtool --silent --mode=link gcc -o mod_build_this.la 
 -rpath 
/usr/local/apache22/modules -module -avoid-version    mod_build_this.lo -llll 
-LLLL -IIII

Original comment by john.david.duncan on 1 Sep 2007 at 6:45

GoogleCodeExporter commented 9 years ago
Then there's the "how would apxs 1.3 do it?" strategy.
This is actually in src/Configure.  
Apache just has a long list of platforms it knows about.  In the end, if it 
doesn't know, it asks Perl:

        #   cool, Perl is installed on this platform...
        if [ "x`$PERL -V:dlsrc 2>/dev/null | grep dlopen`" != "x" ]; then
            #   ...and actually uses the dlopen-style interface,
            #   so we can guess the flags from its knowledge
            CFLAGS_SHLIB="`$PERL -V:cccdlflags | cut -d\' -f2`"
            LDFLAGS_SHLIB="`$PERL -V:lddlflags | cut -d\' -f2`"
            LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB
            LDFLAGS_SHLIB_EXPORT="`$PERL -V:ccdlflags | cut -d\' -f2`"
            #   but additionally we have to inform the
            #   user that we are just guessing the flags

cccldfilgs usually gives you something like "-fPIC".
lddlflags gives you the linker flags to build a shared library.  (On my mac, it 
does *not* supply -
flat_namespace).

This leads to a plan:
There is a simple OS test and a simple compiler test.
The compiler test looks for "gcc, suncc, or unknown".  unknown => ask Perl. 
The OS test looks for "Mac, Linux, Solaris, or unknown".  unknown => ask Perl. 

Original comment by john.david.duncan on 4 Nov 2007 at 12:43

GoogleCodeExporter commented 9 years ago
This is done is svn now.

Really, it is not a hard problem.  You default to the GNU compiler and the GNU 
linker.  But you also support two 
other linkers (Apple and Sun) and one other compiler (Sun).  And this strategy 
covers lots of platforms.  

Original comment by john.david.duncan on 6 Nov 2007 at 7:19

GoogleCodeExporter commented 9 years ago

Original comment by john.david.duncan on 25 Jun 2009 at 3:55