--- php-4.3.0/ext/cpdf/config.m4.orig Wed Mar 13 10:18:53 2002
+++ php-4.3.0/ext/cpdf/config.m4 Thu Jan 2 13:12:16 2003
@@ -1,70 +1,97 @@
dnl $Id$
-AC_MSG_CHECKING(for cpdflib support)
-AC_ARG_WITH(cpdflib,
-[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).],
-[
- case $withval in
- no)
- AC_MSG_RESULT(no) ;;
+PHP_ARG_WITH(cpdflib, for cpdflib support,
+[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).])
+
+if test "$PHP_CPDFLIB" != "no"; then
+
+ PHP_NEW_EXTENSION(cpdf, cpdf.c, $ext_shared)
+ PHP_SUBST(CPDF_SHARED_LIBADD)
+
+ dnl # libjpeg
+
+ PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
+ [ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory. (OPTIONAL for PDFlib v4)])
+
+ if test "$PHP_JPEG_DIR" != "no"; then
+ PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, CPDF_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([libjpeg not found!])
+ ],[
+ -L$PHP_JPEG_DIR/lib
+ ])
+ else
+ AC_MSG_WARN([If configure fails, try --with-jpeg-dir=
])
+ fi
+
+ dnl # libpng
+
+ PHP_ARG_WITH(png-dir, for the location of libpng,
+ [ --with-png-dir[=DIR] PDFLIB: define libpng install directory. (OPTIONAL for PDFlib v4)])
+
+ if test "$PHP_PNG_DIR" != "no"; then
+ PHP_CHECK_LIBRARY(png,png_create_info_struct,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, CPDF_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([libpng not found!])
+ ],[
+ -L$PHP_PNG_DIR/lib
+ ])
+ else
+ AC_MSG_WARN([If configure fails, try --with-png-dir=])
+ fi
+
+ dnl # libtiff
+
+ PHP_ARG_WITH(tiff-dir, for the location of libtiff,
+ [ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory. (OPTIONAL for PDFlib v4)])
+
+ if test "$PHP_TIFF_DIR" != "no"; then
+ PHP_CHECK_LIBRARY(tiff,TIFFOpen,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH(tiff, $PHP_TIFF_DIR/lib, CPDF_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([libtiff not found!])
+ ],[
+ -L$PHP_TIFF_DIR/lib
+ ])
+ else
+ AC_MSG_WARN([If configure fails, try --with-tiff-dir=])
+ fi
+
+ dnl # zlib
+
+ AC_MSG_CHECKING([for the location of zlib])
+ if test "$PHP_ZLIB_DIR" = "no"; then
+ AC_MSG_RESULT([no. If configure fails, try --with-zlib-dir=])
+ else
+ AC_MSG_RESULT([$PHP_ZLIB_DIR])
+ PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, CPDF_SHARED_LIBADD)
+ fi
+
+ case $PHP_CPDFLIB in
yes)
- AC_MSG_RESULT(yes)
- PHP_NEW_EXTENSION(cpdf, cpdf.c)
AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
[AC_MSG_ERROR([Cpdf module requires cpdflib >= 2.])])
+ PHP_ADD_LIBRARY(cpdf,, CPDF_SHARED_LIBADD)
- PHP_ADD_LIBRARY(cpdf)
- PHP_ADD_LIBRARY(tiff)
- PHP_ADD_LIBRARY(jpeg)
;;
*)
- test -f $withval/include/cpdflib.h && CPDFLIB_INCLUDE=$withval/include
- if test -n "$CPDFLIB_INCLUDE" ; then
- AC_MSG_RESULT(yes)
- PHP_NEW_EXTENSION(cpdf, cpdf.c)
- old_LIBS=$LIBS
- old_withval=$withval
-
- AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
- AC_ARG_WITH(jpeg-dir,
- [ --with-jpeg-dir[=DIR] jpeg dir for cpdflib 2.x],[
- AC_MSG_RESULT(yes)
- if test -z $withval; then
- withval=/usr/local
- fi
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_RESULT(no)],)
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
- ],[
- AC_MSG_RESULT(no)
- AC_MSG_WARN(If configure fails try --with-jpeg-dir=)
- ])
-
- AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
- AC_ARG_WITH(tiff-dir,
- [ --with-tiff-dir[=DIR] tiff dir for cpdflib 2.x],[
- AC_MSG_RESULT(yes)
- if test -z $withval; then
- withval=/usr/local
- fi
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_RESULT(no)],)
- PHP_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib)
- ],[
- AC_MSG_RESULT(no)
- AC_MSG_WARN(If configure fails try --with-tiff-dir=)
- ])
- withval=$old_withval
-
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
- [AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
- LIBS=$old_LIBS
- PHP_ADD_LIBRARY_WITH_PATH(cpdf, $withval/lib)
- PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
+ if test -f "$PHP_CPDFLIB/include/cpdflib.h"; then
+ PHP_CHECK_LIBRARY(cpdf, cpdf_open,[
+ AC_DEFINE(HAVE_PDFLIB,1,[ ])
+ PHP_ADD_LIBRARY_WITH_PATH(cpdf, $PHP_CPDFLIB/lib, CPDF_SHARED_LIBADD)
+ PHP_ADD_INCLUDE($PHP_CPDFLIB/include)
+ ],[
+ AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])
+ ],[
+ -L$PHP_PDFLIB/lib
+ ])
else
- AC_MSG_RESULT(no)
- fi ;;
+ AC_MSG_ERROR([cpdflib.h not found! Check the path passed to --with-cpdflib=. PATH should be the install prefix directory.])
+ fi
+ ;;
esac
-],[
- AC_MSG_RESULT(no)
-])
+fi