SV: [PECL-DEV] Specifying static libraries in config.m4
| From: | Danne dot Lundqvist at corp dot vodafone dot se | Date: | Thu, 04 Nov 2004 08:03:53 +0000 |
| Subject: | SV: [PECL-DEV] Specifying static libraries in config.m4 | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-1583@lists.php.net to get a copy of this message | ||
I have been too busy to test it more. The problem I had/ve was
that when using the PHP_ADD_LIBRARY_WITH_PATH it ends up in
the Makefile as, for example, -L/usr/local/mylib -lmylib
Whereas I only want it to be included in the link process as
normal object files are.
Maybe PHP_ADD_LIBRARY_WITH_PATH is wrong for doing that?
If it matters I'm on Tru64 V5.1 2650 alpha using cc/cxx.
I'm using autoconf 2.59, automake 1.9.2 libtool 1.5.10 and
m4 1.4.2 - and I know about the cache issue but it doesn't
seem to be a "real" problem.
Regards
Danne
-----Ursprungligt meddelande-----
Från: Homme Zwaagstra [mailto:hrz@geodata.soton.ac.uk]
Skickat: den 3 november 2004 11:29
Till: Wez Furlong
Kopia: danne.lundqvist@corp.vodafone.se; pecl-dev@lists.php.net
Ämne: Re: [PECL-DEV] Specifying static libraries in config.m4
On Tue, Oct 26, 2004 at 11:36:37AM +0100, Wez Furlong wrote:
> It should work for static libs too.
I can indeed confirm that it works for static libraries. The related problem
that I've been having, however, is checking for static libraries in
config.m4. The build process works fine but I'm having to use the following
hack using LDFLAGS to prevent PHP_CHECK_LIBRARY failing with unresolved
references to symbols in libneo_utl.a.
old_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--whole-archive -lneo_utl -Wl,--no-whole-archive"
PHP_CHECK_LIBRARY(neo_cs, cs_init, [
PHP_ADD_LIBRARY_WITH_PATH(neo_cs, $CLEARSILVER_LIBDIR,
CLEARSILVER_SHARED_LIBADD) ],[
AC_MSG_ERROR(Could not find Neotonic libneo_cs library)
],[
-L$CLEARSILVER_LIBDIR
])
LDFLAGS=$old_LDFLAGS
My question is: is there a more portable way of doing this (using LIBTOOL,
for instance)?
The following Makefile shows how I successfully compile the extension
manually.
CS_DIR=/usr/local
all: clearsilver.so
clearsilver.so: clearsilver.o
ld -shared -L$(CS_DIR)/lib --whole-archive -lneo_utl -lneo_cs
--no-whole-archive -o clearsilver.so clearsilver.o
clearsilver.o: clearsilver.c php_clearsilver.h
gcc -fpic -DCOMPILE_DL_CLEARSILVER=1 -I. -I../.. -I../../Zend
-I../../TSRM -I../../main -I$(CS_DIR)/include/ClearSilver -c -o
clearsilver.o clearsilver.c
Sources and details of the extension can be found at
<http://www.geodata.soton.ac.uk/software/php_clearsilver>.
This is my first
extension so all feedback is welcome!
I'm using PHP 4.3.7 and my build environment is:
OS:
Linux - Linux 2.4.21-15.0.3.ELsmp #1 SMP Tue Jun 29 18:04:47 EDT 2004 i686
Automake:
automake (GNU automake) 1.6.3
Autoconf:
autoconf (GNU Autoconf) 2.57
Libtool:
ltmain.sh (GNU libtool) 1.4.3 (1.922.2.110 2002/10/23 01:39:54)
Compiler:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red
Hat Linux 3.2.3-34)
> On Tue, 26 Oct 2004 12:33:06 +0200, danne.lundqvist@corp.vodafone.se
> <danne.lundqvist@corp.vodafone.se> wrote:
> > Hi,
> >
> > I need to create a custom extension that needs a static library
> > (.a). As there is no shared library available for this api I have to
> > use the static. I understand how to use the PHP_ADD_LIBRARY_PATH
> > with shared libraries. I can't find any example where static
> > libraries are used though.
> >
> > Is there a "standard" way of specifying static libraries in the
> > config.m4?
> >
> > Regards
> > /Danne
--
Homme Zwaagstra
GeoData Institute
University of Southampton
______________________________________
OBS! Vi har ändrat våra e-postadresser, se avsändaradressen ovan. V.g.
uppdatera dina eventuella sändlistor.
N.B. Our e-mail addresses are changed (see above sender address). Please
change any sendlists accordingly. Thank you.
______________________________________
This message and any files or documents attached are confidential and may
also be legally privileged or protected by other legal rules. It is intended
only for the individual or entity named. If you are not the named addressee
or you have received this email in error, please inform the sender
immediately, delete it from your system and do not copy or disclose it or
its contents or use it for any purpose.
Thank you.
Please also note that transmission cannot be guaranteed to be secure or
error-free.