]> granicus.if.org Git - php/commitdiff
added module support (for dl()) for PDFlib
authorRainer Schaaf <rjs@php.net>
Mon, 12 Feb 2001 17:50:39 +0000 (17:50 +0000)
committerRainer Schaaf <rjs@php.net>
Mon, 12 Feb 2001 17:50:39 +0000 (17:50 +0000)
the PDF files now tell that they are generated by the PHP binding.

ext/pdf/Makefile.in
ext/pdf/config.m4
ext/pdf/pdf.c

index 8577f1f2ff0e5a22bca5a4816a1686757cc207cd..6e05e279b230e979f73734d30911005d96257dee 100644 (file)
@@ -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
index 1528b4944e806cccb5393b315d0321de187c9fa4..a7d92971ff3469372955eebe2bb14852690f912c 100644 (file)
@@ -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)
-])
index daf395fe30e270d1238a3a27339dfadbdc55bda5..b42227355dc6d7ee1ed54cb74d77c76f1d6b0b86 100644 (file)
@@ -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);
 }