Enabled shared build of gd module

This commit is contained in:
Gergely Madarász 1999-09-06 16:50:11 +00:00
parent 2829eaeee8
commit 8ee14c990b
3 changed files with 84 additions and 14 deletions

View File

@ -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=

View File

@ -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)

View File

@ -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>