Re: [PHP4BETA] extension linking
| From: | Chad Cunningham | Date: | Fri, 14 Jan 2000 15:45:34 +0000 |
| Subject: | Re: [PHP4BETA] extension linking | ||
| References: | 1 2 3 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-9122@lists.php.net to get a copy of this message | ||
Oops, hit send by accident...
Anyway, my extension links and compiled fine as a standalone binary, but
when I try to compile as an apache module with apxs, I get undefined
symbols when starting up the webserver. My config.m4 and Makefile.am are
below, does the same thing as informix, it properly builds a library in
the extension directory and links with it.
config.m4
=========
AC_MSG_CHECKING(for FrontBase support)
AC_ARG_WITH(frontbase,
[ --with-frontbase[=DIR] Include FrontBase support. DIR is the FrontBase
installation directory, the default location
is /usr/local/FrontBase. Set DIR to "shared",
or "shared,DIR" to build as a dl.],
[
PHP_WITH_SHARED
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
if test -f
/usr/local/FrontBase/include/FBCAccess/FBCAccess.h; then
FBSQL_INCDIR=/usr/local/FrontBase/include
FBSQL_LIBDIR=/usr/local/FrontBase/lib
elif test -f /Local/Library/FrontBase/include/FBCAccess/FBCAccess.h;
then
FBSQL_INCDIR=/Local/Library/FrontBase/include
FBSQL_LIBDIR=/Local/Library/FrontBase/lib
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(Invalid FrontBase directory - unable to find
FBCAccess.h)
fi
else
if test -f $withval/include/FBCAccess/FBCAccess.h; then
FBSQL_INCDIR=$withval/include
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(Invalid FrontBase directory - unable to find
FBCAccess.h under $withval)
fi
fi
FBSQL_INCLUDE=-I$FBSQL_INCDIR
AC_DEFINE(HAVE_FBSQL)
if test "$shared" = "yes"; then
AC_MSG_RESULT(yes (shared))
FBSQL_SHARED="fbsql.la"
else
AC_MSG_RESULT(yes (static))
AC_ADD_INCLUDE($FBSQL_INCDIR)
dnl AC_ADD_LIBRARY_WITH_PATH(FBCAccess, $FBSQL_LIBDIR)
FBSQL_STATIC="libphpext_fbsql.la"
fi
PHP_EXTENSION(fbsql, $shared)
FBSQL_OBJS="$FBSQL_OBJS $FBSQL_LIBDIR/FBCAccess.o"
FBSQL_LIBADD="$FBSQL_LIBADD -Lext/fbsql -lFBCAccess"
FBSQL_LIBS="$FBSQL_LIBADD"
else
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_FBSQL, 0)
fi
],[
AC_MSG_RESULT(no)
])
AC_SUBST(FBSQL_LIBS)
AC_SUBST(FBSQL_OBJS)
Makefile.am
===========
noinst_LTLIBRARIES=libphpext_fbsql.la
noinst_LIBRARIES=libFBCAccess.a
libFBCAccess_a_SOURCES=stub.c
libFBCAccess_a_LIBADD=@FBSQL_OBJS@
libphpext_fbsql_la_SOURCES=fbsql.c
libphpext_fbsql_la_LIBADD=@FBSQL_LIBS@
Chad Cunningham wrote:
>
> Sascha Schumann wrote:
>
> > Have a look at ext/informix/config.m4 and search for
> > libphp_ifx.a. You basically need to build a temporary static
> > library which can be linked into the target later.
>
> Finally got around to playing with this :) This strategy works fine for
> a standalone binary, compiles and works great.
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--
Chad Cunningham
ccunning@math.ohio-state.edu
"I'll tell you what kind of guy I was. If you ordered a boxcar full of
sons-of-bitches and opened the door and only found me inside, you could
consider the order filled."
-Robert Mitchum