1999-04-22 02:48:28 +00:00
dnl $Id$
2000-03-09 14:41:15 +00:00
AC_MSG_CHECKING(whether to include Pdflib 3.x support)
1999-04-22 02:48:28 +00:00
AC_ARG_WITH(pdflib,
2000-03-09 14:41:15 +00:00
[ --with-pdflib[=DIR] Include pdflib 3.x support.
1999-04-22 02:48:28 +00:00
DIR is the pdflib install directory,
defaults to /usr/local.],
[
1999-08-05 16:25:10 +00:00
echo $withval
1999-04-22 02:48:28 +00:00
case "$withval" in
no)
AC_MSG_RESULT(no) ;;
yes)
AC_MSG_RESULT(yes)
PHP_EXTENSION(pdf)
1999-12-07 10:49:19 +00:00
old_LDFLAGS=$LDFLAGS
old_LIBS=$LIBS
2000-02-02 11:18:06 +00:00
LIBS="$LIBS -ltiff -ljpeg -lpng -lz"
2000-03-09 14:41:15 +00:00
AC_CHECK_LIB(pdf, PDF_show_boxed, [AC_DEFINE(HAVE_PDFLIB,1,[ ])],
2000-03-13 05:58:50 +00:00
[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>)])
1999-12-07 10:49:19 +00:00
LIBS=$old_LIBS
LDFLAGS=$old_LDFLAGS
AC_ADD_LIBRARY(pdf)
AC_ADD_LIBRARY(tiff)
2000-02-02 11:18:06 +00:00
AC_ADD_LIBRARY(png)
1999-12-07 10:49:19 +00:00
AC_ADD_LIBRARY(jpeg)
AC_ADD_LIBRARY(z)
1999-04-22 02:48:28 +00:00
;;
*)
1999-12-07 10:49:19 +00:00
test -f $withval/include/pdflib.h && PDFLIB_INCLUDE="$withval/include"
1999-04-22 02:48:28 +00:00
if test -n "$PDFLIB_INCLUDE" ; then
AC_MSG_RESULT(yes)
PHP_EXTENSION(pdf)
1999-08-12 06:23:28 +00:00
old_withval=$withval
1999-08-19 17:07:27 +00:00
1999-08-10 17:07:00 +00:00
if test $HAVE_ZLIB; then
2000-03-09 14:41:15 +00:00
AC_MSG_CHECKING([for zlib (needed by pdflib 3.x)])
1999-08-05 16:25:10 +00:00
AC_ARG_WITH(zlib-dir,
2000-03-09 14:41:15 +00:00
[ --with-zlib-dir[=DIR] zlib dir for pdflib 3.x or include zlib support],[
1999-08-05 16:25:10 +00:00
if test -z $withval; then
withval="/usr/local"
fi
1999-12-09 07:15:36 +00:00
old_LIBS=$LIBS
LIBS="$LIBS -L$withval/lib"
1999-08-05 16:25:10 +00:00
AC_CHECK_LIB(z,deflate, [PDFLIB_LIBS="-L$withval/lib -lz"],[AC_MSG_RESULT(no)],)
1999-12-09 07:15:36 +00:00
LIBS=$old_LIBS
AC_ADD_LIBRARY_WITH_PATH(z, $withval/lib)
1999-08-05 16:25:10 +00:00
],[
2000-03-09 14:41:15 +00:00
AC_CHECK_LIB(z,deflate, ,[AC_MSG_RESULT(no, try --with-zlib=<DIR>)],)
AC_ADD_LIBRARY(z)
LIBS="$LIBS -lz"
1999-08-05 16:25:10 +00:00
])
else
2000-03-09 14:41:15 +00:00
echo "checking for libz needed by pdflib 3.x... already zlib support"
1999-08-05 16:25:10 +00:00
PDFLIB_LIBS="$ZLIB_LIBS"
1999-08-10 17:07:00 +00:00
LIBS="$LIBS -lz"
1999-08-05 16:25:10 +00:00
fi
1999-08-12 06:23:28 +00:00
AC_ARG_WITH(jpeg-dir,
2000-03-09 14:41:15 +00:00
[ --with-jpeg-dir[=DIR] jpeg dir for pdflib 3.x],[
1999-08-12 06:23:28 +00:00
if test -z $withval; then
withval="/usr/local"
fi
1999-12-09 07:15:36 +00:00
old_LIBS=$LIBS
LIBS="$LIBS -L$withval/lib"
1999-08-12 06:23:28 +00:00
AC_CHECK_LIB(jpeg,jpeg_read_header, [PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -ljpeg"],[AC_MSG_RESULT(no)],)
1999-12-09 07:15:36 +00:00
LIBS=$old_LIBS
1999-12-07 10:49:19 +00:00
AC_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
1999-08-19 17:07:27 +00:00
LIBS="$LIBS -L$withval/lib -ljpeg"
1999-08-12 06:23:28 +00:00
],[
2000-03-09 14:41:15 +00:00
AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_RESULT(no, try --with-jpeg-dir=<DIR>)],)
AC_ADD_LIBRARY(jpeg)
LIBS="$LIBS -ljpeg"
1999-08-12 06:23:28 +00:00
])
2000-02-02 11:18:06 +00:00
AC_ARG_WITH(png-dir,
2000-03-09 14:41:15 +00:00
[ --with-png-dir[=DIR] png dir for pdflib 3.x],[
2000-02-02 11:18:06 +00:00
if test -z $withval; then
withval="/usr/local"
fi
old_LIBS=$LIBS
LIBS="$LIBS -L$withval/lib"
AC_CHECK_LIB(png,png_create_info_struct, [PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -lpng"],[AC_MSG_RESULT(no)],)
LIBS=$old_LIBS
AC_ADD_LIBRARY_WITH_PATH(png, $withval/lib)
LIBS="$LIBS -L$withval/lib -lpng"
],[
2000-03-09 14:41:15 +00:00
AC_CHECK_LIB(png,png_create_info_struct, ,[AC_MSG_RESULT(no, try --with-png-dir=<DIR>)],)
AC_ADD_LIBRARY(png)
LIBS="$LIBS -lpng"
2000-02-02 11:18:06 +00:00
])
1999-08-12 06:23:28 +00:00
AC_ARG_WITH(tiff-dir,
2000-03-09 14:41:15 +00:00
[ --with-tiff-dir[=DIR] tiff dir for pdflib 3.x],[
1999-08-12 06:23:28 +00:00
if test -z $withval; then
withval="/usr/local"
fi
1999-12-09 07:15:36 +00:00
old_LIBS=$LIBS
LIBS="$LIBS -L$withval/lib"
1999-08-12 06:23:28 +00:00
AC_CHECK_LIB(tiff,TIFFOpen, [PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -ltiff"],[AC_MSG_RESULT(no)],)
1999-12-09 07:15:36 +00:00
LIBS=$old_LIBS
1999-12-07 10:49:19 +00:00
AC_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib)
1999-12-09 07:15:36 +00:00
LIBS="$LIBS -L$withval/lib -ltiff"
1999-08-12 06:23:28 +00:00
],[
2000-03-09 14:41:15 +00:00
AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_RESULT(no, Try --with-tiff-dir=<DIR>)],)
AC_ADD_LIBRARY(tiff)
LIBS="$LIBS -ltiff"
1999-08-12 06:23:28 +00:00
])
withval=$old_withval
1999-12-09 07:15:36 +00:00
old_LIBS=$LIBS
1999-04-22 02:48:28 +00:00
LIBS="$LIBS -L$withval/lib"
2000-03-09 14:41:15 +00:00
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.)])
1999-12-09 07:15:36 +00:00
LIBS=$old_LIBS
1999-12-07 10:49:19 +00:00
AC_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib)
AC_ADD_INCLUDE($PDFLIB_INCLUDE)
1999-04-22 02:48:28 +00:00
else
AC_MSG_RESULT(no)
fi ;;
esac
],[
AC_MSG_RESULT(no)
])