diff options
| author | Rainer Schaaf <rjs@php.net> | 2001-02-12 17:50:39 +0000 | 
|---|---|---|
| committer | Rainer Schaaf <rjs@php.net> | 2001-02-12 17:50:39 +0000 | 
| commit | 4c21de658f33847ff26728acf6a32bca7ae98cc4 (patch) | |
| tree | 480d87136f210b546b567e8a451e12adaed626a0 | |
| parent | 4afacc0a7c9431ad3bcfcfda66bc2a3e5f81137e (diff) | |
| download | php-git-4c21de658f33847ff26728acf6a32bca7ae98cc4.tar.gz | |
added module support (for dl()) for PDFlib
the PDF files now tell that they are generated by the PHP binding.
| -rw-r--r-- | ext/pdf/Makefile.in | 3 | ||||
| -rw-r--r-- | ext/pdf/config.m4 | 28 | ||||
| -rw-r--r-- | ext/pdf/pdf.c | 21 | 
3 files changed, 23 insertions, 29 deletions
diff --git a/ext/pdf/Makefile.in b/ext/pdf/Makefile.in index 8577f1f2ff..6e05e279b2 100644 --- a/ext/pdf/Makefile.in +++ b/ext/pdf/Makefile.in @@ -1,5 +1,8 @@  LTLIBRARY_NAME    = libpdf.la  LTLIBRARY_SOURCES = pdf.c +LTLIBRARY_SHARED_NAME    = libpdf_php.la +PDFLIB_SHARED_LIBBADD    = -lpdf +LTLIBRARY_SHARED_LIBADD  = $(PDFLIB_SHARED_LIBBADD)  include $(top_srcdir)/build/dynlib.mk diff --git a/ext/pdf/config.m4 b/ext/pdf/config.m4 index 1528b4944e..a7d92971ff 100644 --- a/ext/pdf/config.m4 +++ b/ext/pdf/config.m4 @@ -1,18 +1,19 @@  dnl $Id$  AC_MSG_CHECKING(whether to include Pdflib 3.x support) -AC_ARG_WITH(pdflib, -[  --with-pdflib[=DIR]     Include pdflib 3.x support. -                          DIR is the pdflib install directory, -                          defaults to /usr/local.], -[ -echo $withval -  case "$withval" in + +PHP_ARG_WITH(pdflib,whether to include pdflib support, +[  --with-pdflib[=DIR]     Include pdflib 3.x support. DIR is the pdflib +			  base install directory, defaults to /usr/local +			  Set DIR to "shared" to build as dl, or "shared,DIR" +                          to build as dl and still specify DIR.]) + +  case "$PHP_PDFLIB" in      no)        AC_MSG_RESULT(no) ;;      yes)        AC_MSG_RESULT(yes) -      PHP_EXTENSION(pdf) +      PHP_EXTENSION(pdf, $ext_shared)        old_LDFLAGS=$LDFLAGS  		  old_LIBS=$LIBS  		  LIBS="$LIBS -ltiff -ljpeg -lpng -lz" @@ -20,7 +21,8 @@ echo $withval          [AC_MSG_ERROR(pdflib extension requires at least pdflib 3.x. You may also need libtiff and libjpeg. If so, use the options --with-tiff-dir=<DIR> and --with-jpeg-dir=<DIR>)])        LIBS=$old_LIBS        LDFLAGS=$old_LDFLAGS -      AC_ADD_LIBRARY(pdf) +      PHP_SUBST(PDFLIB_SHARED_LIBADD) +      AC_ADD_LIBRARY(pdf, PDFLIB_SHARED_LIBADD)        AC_ADD_LIBRARY(tiff)        AC_ADD_LIBRARY(png)        AC_ADD_LIBRARY(jpeg) @@ -30,7 +32,7 @@ echo $withval        test -f $withval/include/pdflib.h && PDFLIB_INCLUDE="$withval/include"        if test -n "$PDFLIB_INCLUDE" ; then          AC_MSG_RESULT(yes) -        PHP_EXTENSION(pdf) +        PHP_EXTENSION(pdf, $ext_shared)          old_withval=$withval          if test $HAVE_ZLIB; then @@ -113,12 +115,10 @@ echo $withval          AC_CHECK_LIB(pdf, PDF_show_boxed, [AC_DEFINE(HAVE_PDFLIB,1,[ ]) PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -lpdf"],            [AC_MSG_ERROR(pdflib extension requires pdflib 3.x.)])          LIBS=$old_LIBS -        AC_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib) +	PHP_SUBST(PDFLIB_SHARED_LIBADD) +        AC_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib, PDFLIB_SHARED_LIBADD)          AC_ADD_INCLUDE($PDFLIB_INCLUDE)        else          AC_MSG_RESULT(no)        fi ;;    esac -],[ -  AC_MSG_RESULT(no) -]) diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index daf395fe30..b42227355d 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -29,9 +29,9 @@  #include "ext/standard/head.h"  #include "ext/standard/info.h"  #include "ext/standard/file.h" -#include "ext/gd/php_gd.h"  #if HAVE_LIBGD13 +#include "ext/gd/php_gd.h"  #include "gd.h"  #endif @@ -193,25 +193,14 @@ zend_module_entry pdf_module_entry = {  ZEND_GET_MODULE(pdf)  #endif -static void _free_pdf_image(zend_rsrc_list_entry *rsrc) -{ -	int *pdf_image = (int *)rsrc->ptr; -	if(pdf_image) efree(pdf_image); -} -  static void _free_pdf_doc(zend_rsrc_list_entry *rsrc)  { -	PDF *pdf = (PDF *)rsrc->ptr;  	/* RJS: TODO: +	PDF *pdf = (PDF *)rsrc->ptr;  	   check whether pdf-Pointer is still valid, before pdf_delete()  	   + remove php-resource */ -	PDF_delete(pdf); -} - -static void _free_outline(zend_rsrc_list_entry *rsrc) -{ -	int *outline = (int *)rsrc->ptr; -	if(outline) efree(outline); +	/* PDF_delete(pdf); +*/  }  static void custom_errorhandler(PDF *p, int type, const char *shortmsg) @@ -401,6 +390,7 @@ PHP_FUNCTION(pdf_open)  	}  	PDF_set_parameter(pdf, "imagewarning", "true"); +	PDF_set_parameter(pdf, "binding", "PHP");  	ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);  } @@ -2099,6 +2089,7 @@ PHP_FUNCTION(pdf_new) {  	pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);  	PDF_set_parameter(pdf, "imagewarning", "true"); +	PDF_set_parameter(pdf, "binding", "PHP");  	ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);  }  | 
