diff options
| author | Gergely Madarász <gorgo@php.net> | 1999-09-06 16:50:11 +0000 |
|---|---|---|
| committer | Gergely Madarász <gorgo@php.net> | 1999-09-06 16:50:11 +0000 |
| commit | 8ee14c990bbd303ae253d28c198ceacd3d7ddccb (patch) | |
| tree | 7204284b85f34ea5eb440a2794a8f801601f8636 | |
| parent | 2829eaeee85c0de8b46b5dffd7ee4e700eea5ea8 (diff) | |
| download | php-git-8ee14c990bbd303ae253d28c198ceacd3d7ddccb.tar.gz | |
Enabled shared build of gd module
| -rw-r--r-- | ext/gd/Makefile.am | 19 | ||||
| -rw-r--r-- | ext/gd/config.m4 | 75 | ||||
| -rw-r--r-- | ext/gd/gd.c | 4 |
3 files changed, 84 insertions, 14 deletions
diff --git a/ext/gd/Makefile.am b/ext/gd/Makefile.am index b2deac251d..40d5ef9462 100644 --- a/ext/gd/Makefile.am +++ b/ext/gd/Makefile.am @@ -1,4 +1,17 @@ ## Process this file with automake to produce Makefile.in -INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend -noinst_LIBRARIES=libphpext_gd.a -libphpext_gd_a_SOURCES=gd.c gdcache.c gdttf.c + +phplibdir=$(libdir)/php + +SRC=gd.c gdcache.c gdttf.c +INCLUDES=@INCLUDES@ -I@GD_INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend +noinst_LIBRARIES=@GD_STATIC@ +EXTRA_LIBRARIES=libphpext_gd.a +libphpext_gd_a_SOURCES=$(SRC) + +phplib_LTLIBRARIES=@GD_SHARED@ +EXTRA_LTLIBRARIES=gd.la +gd_la_SOURCES=$(SRC) +gd_la_LIBADD=@GD_LFLAGS@ @GD_LIBS@ +gd_la_LDFLAGS=-avoid-version -module -rpath $(phplibdir) +EXTRA_LIBS= + diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index b32614a59d..a3e6585b21 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -1,15 +1,36 @@ AC_MSG_CHECKING(whether to include GD support) AC_ARG_WITH(gd, [ --without-gd Disable GD support. - --with-gd[=DIR] Include GD support (DIR is GD's install dir).], + --with-gd[=DIR] Include GD support (DIR is GD's install dir). + Set DIR to "shared" to build as a dl, or + "shared,DIR" to build as a dl and still specify DIR.], [ + case $withval in + shared) + shared=yes + withval=yes + ;; + shared,*) + shared=yes + withval=`echo $withval | sed -e 's/^shared,//'` + ;; + *) + shared=no + ;; + esac + case "$withval" in no) AC_MSG_RESULT(no) ;; yes) - AC_ADD_LIBRARY(gd) AC_DEFINE(HAVE_LIBGD) - AC_MSG_RESULT(yes) + if test "$shared" = "yes"; then + AC_MSG_RESULT(yes (shared)) + GD_LIBS="-lgd" + else + AC_MSG_RESULT(yes (static)) + AC_ADD_LIBRARY(gd) + fi AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) ac_cv_lib_gd_gdImageLine=yes ;; @@ -37,9 +58,15 @@ dnl A whole whack of possible places where this might be test -f $withval/gd1.3/libgd.a && GD_LIB="$withval/gd1.3" if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then - AC_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB) AC_DEFINE(HAVE_LIBGD) - AC_MSG_RESULT(yes) + if test "$shared" != "yes"; then + AC_MSG_RESULT(yes (static)) + AC_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB) + else + AC_MSG_RESULT(yes (shared)) + GD_LIBS="-lgd" + GD_LFLAGS="-L$GD_LIB" + fi AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) ac_cv_lib_gd_gdImageLine=yes else @@ -73,14 +100,26 @@ if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then done if test -n "$FREETYPE_DIR" ; then AC_DEFINE(HAVE_LIBFREETYPE) - AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib) - AC_ADD_INCLUDE($FREETYPE_DIR/include) + if test "$shared" != "yes"; then + AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib) + AC_ADD_INCLUDE($FREETYPE_DIR/include) + else + GD_LIBS="$GD_LIBS -lfreetype" + GD_LFLAGS="$GD_LFLAGS -L$FREETYPE_DIR/lib" + GD_INCLUDES="$GD_INCLUDES -I$FREETYPE_DIR/include" + fi AC_MSG_RESULT(yes) else if test -n "$TTF_DIR" ; then AC_DEFINE(HAVE_LIBTTF) - AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) - AC_ADD_INCLUDE($TTF_DIR/include) + if test "$shared" != "yes"; then + AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) + AC_ADD_INCLUDE($TTF_DIR/include) + else + GD_LIBS="$GD_LIBS -lttf" + GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" + GD_INCLUDES="$GD_INCLUDES -I$TTF_DIR/include" + fi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) @@ -107,6 +146,20 @@ if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then AC_MSG_RESULT(no) ]) - PHP_EXTENSION(gd) - AC_ADD_INCLUDE($GD_INCLUDE) + PHP_EXTENSION(gd, $shared) + if test "$shared" != "yes"; then + AC_ADD_INCLUDE($GD_INCLUDE) + GD_STATIC="libphpext_gd.a" + else + if test -n "$GD_INCLUDE"; then + GD_INCLUDES="$GD_INCLUDES -I$GD_INCLUDE" + fi + GD_SHARED="gd.la" + fi fi + +AC_SUBST(GD_LFLAGS) +AC_SUBST(GD_LIBS) +AC_SUBST(GD_INCLUDES) +AC_SUBST(GD_STATIC) +AC_SUBST(GD_SHARED) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index f3d3eae22e..a0a7eb9fe9 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -25,6 +25,10 @@ /* Note that there is no code from the gd package in this file */ +#ifdef PIC +# define COMPILE_DL 1 +#endif + #include "php.h" #include "ext/standard/head.h" #include <math.h> |
