From 14e883c3a0ab9641be5b86836a23eba1f0527208 Mon Sep 17 00:00:00 2001 From: foobar Date: Thu, 10 May 2001 00:55:48 +0000 Subject: [PATCH] Cleaned up this a bit.. --- ext/fdf/config.m4 | 5 +- ext/gd/config.m4 | 466 ++++++++++++++++--------------------------- ext/mcrypt/config.m4 | 44 ++-- ext/pdf/config.m4 | 180 ++++++++--------- 4 files changed, 281 insertions(+), 414 deletions(-) diff --git a/ext/fdf/config.m4 b/ext/fdf/config.m4 index 3dca416acb..2f2cf1e076 100644 --- a/ext/fdf/config.m4 +++ b/ext/fdf/config.m4 @@ -23,13 +23,10 @@ if test "$PHP_FDFTK" != "no"; then PHP_ADD_INCLUDE($FDFTK_DIR/include) - old_LIBS=$LIBS - LIBS="$LIBS -L$FDFTK_DIR/lib -lm" FDFLIBRARY="" for i in fdftk FdfTk; do - AC_CHECK_LIB($i, FDFOpen, [FDFLIBRARY=$i]) + AC_CHECK_LIB($i, FDFOpen, [FDFLIBRARY=$i], [], [-L$FDFTK_DIR/lib -lm]) done - LIBS=$old_LIBS if test $FDFLIBRARY = ""; then AC_MSG_ERROR(fdftk module requires fdftk 2.0) diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index ef2fc964af..31659b53e4 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -1,326 +1,210 @@ +dnl +dnl $Id$ +dnl + AC_DEFUN(PHP_GD_JPEG,[ - AC_MSG_CHECKING([for libjpeg (needed by gd-1.8+)]) - AC_ARG_WITH(jpeg-dir, - [ --with-jpeg-dir[=DIR] GD: jpeg dir for gd-1.8+],[ - AC_MSG_RESULT(yes) - if test "$withval" = "yes"; then - withval="/usr/local" - fi - jold_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(jpeg,jpeg_read_header, [LIBS="$LIBS -ljpeg"],[AC_MSG_RESULT(no)],) - LIBS=$jold_LIBS - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -ljpeg" - GD_LFLAGS="$GD_LFLAGS -L$withval/lib" - else - PHP_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib) - fi - LIBS="$LIBS -L$withval/lib -ljpeg" - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-jpeg-dir=) - ]) + PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, + [ --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix.]) + + if test "$PHP_JPEG_DIR" != "no" -a "$PHP_JPEG_DIR"; then + AC_CHECK_LIB(jpeg,jpeg_read_header,[ + PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, GD_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libjpeg not found!) + ],[ + -L$PHP_JPEG_DIR/lib + ]) + else + AC_MSG_RESULT(not set. If configure fails try --with-jpeg-dir=) + fi ]) AC_DEFUN(PHP_GD_PNG,[ - AC_MSG_CHECKING([for libpng (needed by gd-2.0)]) - AC_ARG_WITH(png-dir, - [ --with-png-dir[=DIR] GD: png dir for gd-2.0+],[ - AC_MSG_RESULT(yes) - if test "$withval" = "yes"; then - withval="/usr/local" - fi - jold_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(png,png_info_init, [LIBS="$LIBS -lpng"],[AC_MSG_RESULT(no)],) - LIBS=$jold_LIBS - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lpng" - GD_LFLAGS="$GD_LFLAGS -L$withval/lib" - else - PHP_ADD_LIBRARY_WITH_PATH(png, $withval/lib) - fi - LIBS="$LIBS -L$withval/lib -lpng" - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-png-dir=) - ]) + PHP_ARG_WITH(png-dir, for the location of libpng, + [ --with-png-dir=DIR GD: Set the path to libpng install prefix.]) + + if test "$PHP_PNG_DIR" != "no" -a "$PHP_PNG_DIR"; then + AC_CHECK_LIB(png,png_info_init,[ + PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD) + PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, GD_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libpng not found!) + ],[ + -L$PHP_ZLIB_DIR/lib -lz -L$PHP_PNG_DIR/lib + ]) + else + AC_MSG_RESULT(If configure fails try --with-png-dir=) + fi ]) - AC_DEFUN(PHP_GD_XPM,[ - AC_MSG_CHECKING([for libXpm (needed by gd-1.8+)]) - AC_ARG_WITH(xpm-dir, - [ --with-xpm-dir[=DIR] GD: xpm dir for gd-1.8+],[ - AC_MSG_RESULT(yes) - if test "$withval" = "yes"; then - withval="/usr/X11R6" - fi - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib -lX11" - AC_CHECK_LIB(Xpm,XpmFreeXpmImage, [LIBS="$LIBS -L$withval/lib -lXpm"],[AC_MSG_RESULT(no)],) - LIBS=$old_LIBS - PHP_ADD_LIBRARY_WITH_PATH(Xpm, $withval/lib) - PHP_ADD_LIBRARY_WITH_PATH(X11, $withval/lib) - LIBS="$LIBS -L$withval/lib -lXpm -L$withval/lib -lX11" - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-xpm-dir=) - ]) + PHP_ARG_WITH(xpm-dir, for the location of libXpm, + [ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.]) + + if test "$PHP_XPM_DIR" != "no" -a "$PHP_XPM_DIR"; then + AC_CHECK_LIB(Xpm,XpmFreeXpmImage, [ + PHP_ADD_LIBRARY_WITH_PATH(Xpm, $PHP_XPM_DIR/lib, GD_SHARED_LIBADD) + PHP_ADD_LIBRARY_WITH_PATH(X11, $PHP_XPM_DIR/lib, GD_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libXpm.(a|so) or libX11.(a|so) not found!) + ],[ + -L$PHP_XPM_DIR/lib -lX11 + ]) + else + AC_MSG_RESULT(If configure fails try --with-xpm-dir=) + fi ]) -AC_DEFUN(PHP_GD_FREETYPE,[ - AC_MSG_CHECKING([for freetype(2) (needed by gd 2.0+)]) - AC_ARG_WITH(freetype-dir, - [ --with-freetype-dir[=DIR] GD: freetype 2 dir for gd 2.0+],[ - for i in /usr /usr/local "$CHECK_FREETYPE" ; do - if test -f "$i/include/freetype2/freetype/freetype.h"; then - FREETYPE2_DIR="$i" - FREETYPE2_INC_DIR="$i/include/freetype2/freetype" - fi - done - if test -n "$FREETYPE2_DIR" ; then - AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) - PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib) - PHP_ADD_INCLUDE($FREETYPE2_INC_DIR) - AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no (freetype2 not found)) - fi - ],[ - AC_MSG_RESULT(no) - AC_MSG_RESULT(If configure fails, try --with-freetype-dir=) - ]) +AC_DEFUN(PHP_GD_FREETYPE1,[ + PHP_ARG_WITH(ttf,whether to include include FreeType 1.x support, + [ --with-ttf[=DIR] GD: Include FreeType 1.x support]) + + if test "$PHP_TTF" != "no"; then + if test "$PHP_FREETYPE_DIR" = "no" -o "$PHP_FREETYPE_DIR" = ""; then + if test -n "$PHP_TTF" ; then + for i in /usr /usr/local "$PHP_TTF" ; do + if test -f "$i/include/freetype.h" ; then + TTF_DIR="$i" + unset TTF_INC_DIR + fi + if test -f "$i/include/freetype/freetype.h"; then + TTF_DIR="$i" + TTF_INC_DIR="$i/include/freetype" + fi + done + fi + if test -n "$TTF_DIR" ; then + AC_DEFINE(HAVE_LIBTTF,1,[ ]) + PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib, GD_SHARED_LIBADD) + fi + if test -z "$TTF_INC_DIR"; then + TTF_INC_DIR="$TTF_DIR/include" + fi + PHP_ADD_INCLUDE($TTF_INC_DIR) + else + AC_MSG_RESULT(no - FreeType 2.x is to be used instead) + fi + fi ]) - -AC_DEFUN(PHP_GD_CHECK_VERSION,[ - AC_CHECK_LIB(z, compress, LIBS="-lz $LIBS",,) - AC_CHECK_LIB(png,png_info_init, LIBS="-lpng $LIBS",,) - AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13,1,[ ]) ]) - AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15,1,[ ]) ]) - AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB,1,[ ]) ]) - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1,[ ])]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])]) - AC_CHECK_LIB(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])]) + +AC_DEFUN(PHP_GD_FREETYPE2,[ + PHP_ARG_WITH(freetype-dir, for freetype(2), + [ --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix.]) + + if test "$PHP_FREETYPE_DIR" != "no"; then + for i in /usr /usr/local "$PHP_FREETYPE_DIR" ; do + if test -f "$i/include/freetype2/freetype/freetype.h"; then + FREETYPE2_DIR="$i" + FREETYPE2_INC_DIR="$i/include/freetype2/freetype" + fi + done + + if test -n "$FREETYPE2_DIR" ; then + PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib, GD_SHARED_LIBADD) + PHP_ADD_INCLUDE($FREETYPE2_INC_DIR) + AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ]) + AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) + else + AC_MSG_ERROR(freetype2 not found!) + fi + else + AC_MSG_RESULT(If configure fails try --with-freetype-dir=) + fi ]) +AC_DEFUN(PHP_GD_T1LIB,[ + PHP_ARG_WITH(t1lib, whether to include T1lib support, + [ --with-t1lib[=DIR] GD: Include T1lib support.]) -AC_MSG_CHECKING(whether to enable truetype string function in gd) -AC_ARG_ENABLE(gd-native-ttf, -[ --enable-gd-native-ttf Enable TrueType string function in gd],[ - if test "$enableval" = "yes" ; then + if test "$PHP_T1LIB" != "no"; then + for i in /usr/local /usr $PHP_T1LIB; do + if test -f "$i/include/t1lib.h"; then + T1_DIR="$i" + fi + done + + if test "$T1_DIR" != "no"; then + AC_CHECK_LIB(t1, T1_GetExtend, [ + AC_DEFINE(HAVE_LIBT1,1,[ ]) + PHP_ADD_INCLUDE("$T1_DIR/include") + PHP_ADD_LIBRARY_WITH_PATH(t1, "$T1_DIR/lib", GD_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(Problem with libt1.(a|so). Please check config.log for more information.) + ]) + fi + fi +]) + +AC_DEFUN(PHP_GD_TTSTR,[ + PHP_ARG_ENABLE(gd-native-tt, whether to enable truetype string function in gd, + [ --enable-gd-native-ttf GD: Enable TrueType string function in gd]) + + if test "$PHP_GD_NATIVE_TT" = "yes"; then AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) fi -],[ - AC_MSG_RESULT(no) ]) +AC_DEFUN(PHP_GD_CHECK_VERSION,[ + AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])]) + AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])]) + AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])]) +]) -shared=no -AC_ARG_WITH(gd, + +PHP_ARG_WITH(gd, whether to include GD support, [ --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.], -[ - PHP_WITH_SHARED - old_withval=$withval + "shared,DIR" to build as a dl and still specify DIR.]) + +if test "$PHP_GD" != "no"; then + + PHP_EXTENSION(gd, $ext_shared) + PHP_SUBST(GD_SHARED_LIBADD) + +dnl Various checks for GD features + PHP_GD_TTSTR PHP_GD_JPEG PHP_GD_PNG PHP_GD_XPM - PHP_GD_FREETYPE - withval=$old_withval - - AC_MSG_CHECKING(whether to include GD support) + PHP_GD_FREETYPE2 + PHP_GD_FREETYPE1 + PHP_GD_T1LIB - case "$withval" in - no) - AC_MSG_RESULT(no) - ;; + case "$PHP_GD" in yes) - AC_DEFINE(HAVE_LIBGD,1,[ ]) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd $GD_LIBS" - else - AC_MSG_RESULT(yes (static)) - PHP_ADD_LIBRARY(gd) - fi - - old_LDFLAGS=$LDFLAGS - old_LIBS=$LIBS - -dnl Check the capabilities of GD lib... + PHP_ADD_LIBRARY(gd,, GD_SHARED_LIBADD) PHP_GD_CHECK_VERSION - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - PHP_ADD_LIBRARY(png) - PHP_ADD_LIBRARY(z) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lpng -lz" - fi - fi - - ac_cv_lib_gd_gdImageLine=yes - ;; - + AC_DEFINE(HAVE_LIBGD,1,[ ]) + ;; *) -dnl A whole whack of possible places where this might be - test -f $withval/include/gd1.3/gd.h && GD_INCLUDE="$withval/include/gd1.3" - test -f $withval/include/gd/gd.h && GD_INCLUDE="$withval/include/gd" - test -f $withval/include/gd.h && GD_INCLUDE="$withval/include" - test -f $withval/gd1.3/gd.h && GD_INCLUDE="$withval/gd1.3" - test -f $withval/gd/gd.h && GD_INCLUDE="$withval/gd" - test -f $withval/gd.h && GD_INCLUDE="$withval" - - test -f $withval/lib/libgd.so && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.so && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.so && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.so && GD_LIB="$withval" - test -f $withval/gd/libgd.so && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.so && GD_LIB="$withval/gd1.3" +dnl A whole whack of possible places where these might be + for i in include/gd1.3 include/gd include gd1.3 gd ""; do + test -f $PHP_GD/$i/gd.h && GD_INCLUDE="$PHP_GD/$i" + done - test -f $withval/lib/libgd.a && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.a && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.a && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.a && GD_LIB="$withval" - test -f $withval/gd/libgd.a && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.a && GD_LIB="$withval/gd1.3" + for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do + test -f $PHP_GD/$i/libgd.so -o -f $PHP_GD/$i/libgd.a && GD_LIB="$PHP_GD/$i" + done if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then + PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD) AC_DEFINE(HAVE_LIBGD,1,[ ]) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd $GD_LIBS" - GD_LFLAGS="-L$GD_LIB $GD_LFLAGS" - else - AC_MSG_RESULT(yes (static)) - PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB) - fi - old_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -L$GD_LIB" - old_LIBS=$LIBS - -dnl Check the capabilities of GD lib... PHP_GD_CHECK_VERSION - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - PHP_ADD_LIBRARY(z) - PHP_ADD_LIBRARY(png) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lpng -lz" - fi - fi - - ac_cv_lib_gd_gdImageLine=yes else AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $withval]) fi ;; esac -],[]) - - -if test "$with_gd" != "no" && test "$ac_cv_lib_gd_gdImageLine" = "yes"; then - CHECK_TTF="yes" - - - AC_ARG_WITH(ttf, - [ --with-ttf[=DIR] GD: Include FreeType 1.x support],[ - if test $withval = "no" ; then - CHECK_TTF="" - else - CHECK_TTF="$withval" - fi - ]) - - AC_MSG_CHECKING(whether to include FreeType 1.x support) - if test "$with_freetype_dir" = "no" -o "$with_freetype_dir" = ""; then - if test -n "$CHECK_TTF" ; then - for i in /usr /usr/local "$CHECK_TTF" ; do - if test -f "$i/include/freetype.h" ; then - TTF_DIR="$i" - unset TTF_INC_DIR - fi - if test -f "$i/include/freetype/freetype.h"; then - TTF_DIR="$i" - TTF_INC_DIR="$i/include/freetype" - fi - done - if test -n "$TTF_DIR" ; then - AC_DEFINE(HAVE_LIBTTF,1,[ ]) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lttf" - GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" - else - PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) - fi - if test -z "$TTF_INC_DIR"; then - TTF_INC_DIR="$TTF_DIR/include" - fi - PHP_ADD_INCLUDE($TTF_INC_DIR) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - else - AC_MSG_RESULT(no) - fi - else - AC_MSG_RESULT(no - FreeType 2.x is to be used instead) - fi - - AC_MSG_CHECKING(for T1lib support) - AC_ARG_WITH(t1lib, - [ --with-t1lib[=DIR] GD: Include T1lib support.], - [ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - for i in /usr/local /usr; do - if test -f "$i/include/t1lib.h"; then - T1_DIR="$i" - fi - done - else - if test -f "$withval/include/t1lib.h"; then - T1_DIR="$withval" - fi - fi - - if test "$T1_DIR" != "no"; then - PHP_ADD_INCLUDE("$T1_DIR/include") - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lt1" - GD_LFLAGS="$GD_LFLAGS -L$T1_DIR/lib" - else - PHP_ADD_LIBRARY_WITH_PATH(t1, "$T1_DIR/lib") - fi - LIBS="$LIBS -L$T1_DIR/lib -lt1" - fi - - AC_MSG_RESULT(yes) - AC_CHECK_LIB(t1, T1_GetExtend, [AC_DEFINE(HAVE_LIBT1,1,[ ])]) - else - AC_MSG_RESULT(no) - fi - ],[ - AC_MSG_RESULT(no) - ]) dnl NetBSD package structure if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then @@ -334,13 +218,5 @@ dnl SuSE 6.x package structure PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) PHP_ADD_INCLUDE($GD_INCLUDE) - PHP_EXTENSION(gd, $shared) - if test "$shared" != "yes"; then - GD_STATIC="libphpext_gd.la" - else - GD_SHARED="gd.la" - fi -fi -PHP_SUBST(GD_LFLAGS) -PHP_SUBST(GD_LIBS) +fi diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4 index 58fb050ced..075ef06430 100644 --- a/ext/mcrypt/config.m4 +++ b/ext/mcrypt/config.m4 @@ -1,10 +1,9 @@ +dnl dnl $Id$ -dnl config.m4 for extension mcrypt -dnl don't forget to call PHP_EXTENSION(mcrypt) +dnl PHP_ARG_WITH(mcrypt, for mcrypt support, -[ --with-mcrypt[=DIR] Include mcrypt support. DIR is the mcrypt - install directory.]) +[ --with-mcrypt[=DIR] Include mcrypt support. DIR is the mcrypt install directory.]) if test "$PHP_MCRYPT" != "no"; then for i in /usr/local /usr $PHP_MCRYPT; do @@ -14,29 +13,30 @@ if test "$PHP_MCRYPT" != "no"; then done if test -z "$MCRYPT_DIR"; then - AC_MSG_ERROR(Please reinstall libmcrypt - I cannot find mcrypt.h) + AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.) fi - PHP_ADD_INCLUDE($MCRYPT_DIR/include) - PHP_SUBST(MCRYPT_SHARED_LIBADD) - old_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $ld_runpath_switch$MCRYPT_DIR/lib -L$MCRYPT_DIR/lib" - AC_CHECK_LIB(mcrypt, init_mcrypt) - old_LIBS=$LIBS - LIBS="$LIBS -lltdl" - AC_CHECK_LIB(mcrypt, mcrypt_module_open, [LIBS="$LIBS -lltdl"],[ ],) - LIBS=$old_LIBS - LDFLAGS="$old_LDFLAGS" - if test "$ac_cv_lib_mcrypt_mcrypt_module_open" = "yes"; then - PHP_ADD_LIBRARY(ltdl) + AC_CHECK_LIB(mcrypt, mcrypt_module_open, + [ + PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD) AC_DEFINE(HAVE_LIBMCRYPT24,1,[ ]) - elif test "$ac_cv_lib_mcrypt_init_mcrypt" = "yes"; then - AC_DEFINE(HAVE_LIBMCRYPT22,1,[ ]) - else - AC_MSG_ERROR(Sorry, I was not able to diagnose which libmcrypt version you have installed.) - fi + ],[ + AC_CHECK_LIB(mcrypt, init_mcrypt, + [ + AC_DEFINE(HAVE_LIBMCRYPT22,1,[ ]) + ],[ + AC_MSG_ERROR(Sorry, I was not able to diagnose which libmcrypt version you have installed.) + ],[ + -L$MCRYPT_DIR/lib + ]) + ],[ + -L$MCRYPT_DIR/lib -lltdl + ]) + PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/lib, MCRYPT_SHARED_LIBADD) + PHP_ADD_INCLUDE($MCRYPT_DIR/include) AC_DEFINE(HAVE_LIBMCRYPT,1,[ ]) + PHP_SUBST(MCRYPT_SHARED_LIBADD) PHP_EXTENSION(mcrypt, $ext_shared) fi diff --git a/ext/pdf/config.m4 b/ext/pdf/config.m4 index 465dc128f0..c1da40cc04 100644 --- a/ext/pdf/config.m4 +++ b/ext/pdf/config.m4 @@ -1,4 +1,6 @@ +dnl dnl $Id$ +dnl PHP_ARG_WITH(pdflib,whether to include PDFlib support, [ --with-pdflib[=DIR] Include pdflib 3.x support. DIR is the pdflib @@ -6,120 +8,112 @@ PHP_ARG_WITH(pdflib,whether to include PDFlib support, Set DIR to "shared" to build as dl, or "shared,DIR" to build as dl and still specify DIR.]) +if test "$PHP_PDFLIB" != "no"; then + + PHP_SUBST(PDFLIB_SHARED_LIBADD) + PHP_EXTENSION(pdf, $ext_shared) + case "$PHP_PDFLIB" in yes) - PHP_EXTENSION(pdf, $ext_shared) - old_LDFLAGS=$LDFLAGS - old_LIBS=$LIBS - LIBS="$LIBS -ltiff -ljpeg -lpng -lz" AC_CHECK_LIB(pdf, PDF_show_boxed, [ AC_DEFINE(HAVE_PDFLIB,1,[ ]) ],[ 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= and --with-jpeg-dir=) + ],[ + -ltiff -ljpeg -lpng -lz ]) - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - PHP_SUBST(PDFLIB_SHARED_LIBADD) - PHP_ADD_LIBRARY(pdf, PDFLIB_SHARED_LIBADD) - PHP_ADD_LIBRARY(tiff) - PHP_ADD_LIBRARY(png) - PHP_ADD_LIBRARY(jpeg) - PHP_ADD_LIBRARY(z) - ;; - no) - ;; + + PHP_ADD_LIBRARY(pdf,, PDFLIB_SHARED_LIBADD) + PHP_ADD_LIBRARY(tiff,, PDFLIB_SHARED_LIBADD) + PHP_ADD_LIBRARY(png,, PDFLIB_SHARED_LIBADD) + PHP_ADD_LIBRARY(jpeg,, PDFLIB_SHARED_LIBADD) + PHP_ADD_LIBRARY(z,, PDFLIB_SHARED_LIBADD) + ;; *) - test -f $withval/include/pdflib.h && PDFLIB_INCLUDE="$withval/include" + test -f $PHP_PDFLIB/include/pdflib.h && PDFLIB_INCLUDE="$PHP_PDFLIB/include" if test -n "$PDFLIB_INCLUDE" ; then - PHP_EXTENSION(pdf, $ext_shared) - old_withval=$withval - if test $HAVE_ZLIB; then - AC_MSG_CHECKING([for zlib (needed by pdflib 3.x)]) - AC_ARG_WITH(zlib-dir, - [ --with-zlib-dir[=DIR] zlib dir for pdflib 3.x or include zlib support],[ - if test -z $withval; then - withval="/usr/local" - fi - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(z,deflate, [PDFLIB_LIBS="-L$withval/lib -lz"],[AC_MSG_RESULT(no)],) - LIBS=$old_LIBS - PHP_ADD_LIBRARY_WITH_PATH(z, $withval/lib) + if test "$PHP_ZLIB" = "no"; then + AC_MSG_CHECKING([for zlib (needed by pdflib)]) + + AC_CHECK_LIB(z,deflate, + [ + PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, PDFLIB_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libz.(a|so) not found! Try with --with-zlib-dir=) ],[ - AC_CHECK_LIB(z,deflate, ,[AC_MSG_RESULT(no, try --with-zlib=)],) - PHP_ADD_LIBRARY(z) - LIBS="$LIBS -lz" + -L$PHP_ZLIB_DIR/lib ]) else - echo "checking for libz needed by pdflib 3.x... already zlib support" - PDFLIB_LIBS="$ZLIB_LIBS" - LIBS="$LIBS -lz" + echo "checking for libz needed by pdflib... already zlib support" fi - AC_ARG_WITH(jpeg-dir, - [ --with-jpeg-dir[=DIR] jpeg dir for pdflib 3.x],[ - if test -z $withval; then - withval="/usr/local" - fi - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(jpeg,jpeg_read_header, [PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -ljpeg"],[AC_MSG_RESULT(no)],) - LIBS=$old_LIBS - PHP_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib) - LIBS="$LIBS -L$withval/lib -ljpeg" - ],[ - AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_RESULT(no, try --with-jpeg-dir=)],) - PHP_ADD_LIBRARY(jpeg) - LIBS="$LIBS -ljpeg" - ]) + + PHP_ARG_WITH(jpeg-dir, for the location of libjpeg, + [ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory]) - AC_ARG_WITH(png-dir, - [ --with-png-dir[=DIR] png dir for pdflib 3.x],[ - 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 - PHP_ADD_LIBRARY_WITH_PATH(png, $withval/lib) - LIBS="$LIBS -L$withval/lib -lpng" - ],[ - AC_CHECK_LIB(png,png_create_info_struct, ,[AC_MSG_RESULT(no, try --with-png-dir=)],) - PHP_ADD_LIBRARY(png) - LIBS="$LIBS -lpng" - ]) + if test "$PHP_JPEG_DIR" != "no" -a "$PHP_JPEG_DIR"; then + AC_CHECK_LIB(jpeg,jpeg_read_header, + [ + PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, PDFLIB_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libjpeg not found!) + ],[ + -L$PHP_JPEG_DIR/lib + ]) + else + AC_CHECK_LIB(jpeg,jpeg_read_header,[ ],[AC_MSG_RESULT(no, try --with-jpeg-dir=)]) + PHP_ADD_LIBRARY(jpeg,, PDFLIB_SHARED_LIBADD) + fi - AC_ARG_WITH(tiff-dir, - [ --with-tiff-dir[=DIR] tiff dir for pdflib 3.x],[ - if test -z $withval; then - withval="/usr/local" - fi - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(tiff,TIFFOpen, [PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -ltiff"],[AC_MSG_RESULT(no)],) - LIBS=$old_LIBS - PHP_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib) - LIBS="$LIBS -L$withval/lib -ltiff" - ],[ + + PHP_ARG_WITH(png-dir, for the location of libpng, + [ --with-png-dir[=DIR] PDFLIB: define libpng install directory]) + + if test "$PHP_PNG_DIR" != "no" -a "$PHP_PNG_DIR"; then + AC_CHECK_LIB(png,png_create_info_struct, + [ + PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, PDFLIB_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libpng not found!) + ],[ + -L$PHP_PNG_DIR/lib + ]) + else + AC_CHECK_LIB(png,png_create_info_struct,[ ],[AC_MSG_RESULT(no, try --with-png-dir=)]) + PHP_ADD_LIBRARY(png,, PDFLIB_SHARED_LIBADD) + fi + + + PHP_ARG_WITH(tiff-dir, for the location of libtiff, + [ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory]) + + if test "$PHP_TIFF_DIR" != "no" -a "$PHP_TIFF_DIR"; then + AC_CHECK_LIB(tiff,TIFFOpen, + [ + PHP_ADD_LIBRARY_WITH_PATH(tiff, $PHP_TIFF_DIR/lib, PDFLIB_SHARED_LIBADD) + ],[ + AC_MSG_ERROR(libtiff not found!) + ],[ + -L$PHP_TIFF_DIR/lib + ]) + else AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_RESULT(no, Try --with-tiff-dir=)],) - PHP_ADD_LIBRARY(tiff) - LIBS="$LIBS -ltiff" - ]) - withval=$old_withval + PHP_ADD_LIBRARY(tiff,, PDFLIB_SHARED_LIBADD) + fi + - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(pdf, PDF_show_boxed, [ + AC_CHECK_LIB(pdf, PDF_show_boxed, + [ AC_DEFINE(HAVE_PDFLIB,1,[ ]) - PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -lpdf" + PHP_ADD_LIBRARY_WITH_PATH(pdf, $PHP_PDFLIB/lib, PDFLIB_SHARED_LIBADD) + PHP_ADD_INCLUDE($PDFLIB_INCLUDE) ],[ AC_MSG_ERROR(pdflib extension requires pdflib 3.x.) + ],[ + -L$PHP_PDFLIB/lib ]) - LIBS=$old_LIBS - PHP_SUBST(PDFLIB_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib, PDFLIB_SHARED_LIBADD) - PHP_ADD_INCLUDE($PDFLIB_INCLUDE) - fi ;; + fi + ;; esac +fi -- 2.40.0