Re: cvs: php4 /ext/cpdf config.m4

From: Date: Wed, 11 Dec 2002 10:57:07 +0000
Subject: Re: cvs: php4 /ext/cpdf config.m4
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-17110@lists.php.net to get a copy of this message
Once again i ask before commiting this to the branch. This and the last patch for cpdf add the necessary checks for the required libraries to avoid missleading error messages from configure in other modules. For me i search some time for configure problems in dba until noticing it was actually a problem with libraries needed by cpdf. marcus At 22:53 10.12.2002, Marcus Boerger wrote:
helly           Tue Dec 10 16:53:03 2002 EDT
Modified files:
    /php4/ext/cpdf      config.m4
Log: stick to "check <what> <result>" scheme, do not repeat messages and align messages correctly. Index: php4/ext/cpdf/config.m4 diff -u php4/ext/cpdf/config.m4:1.11 php4/ext/cpdf/config.m4:1.12
--- php4/ext/cpdf/config.m4:1.11        Tue Dec 10 09:31:00 2002
+++ php4/ext/cpdf/config.m4     Tue Dec 10 16:53:02 2002
@@ -1,54 +1,58 @@ -dnl $Id: config.m4,v 1.11 2002/12/10 14:31:00 helly Exp $ +dnl $Id: config.m4,v 1.12 2002/12/10 21:53:02 helly Exp $ AC_DEFUN(CPDF_TEMP_SUBST,[ old_LIBS=$LIBS - old_withval=$withval $1 LIBS=$old_LIBS - withval=$old_withval ]) -AC_DEFUN(CPDF_LIB_TEST,[ +AC_DEFUN(CPDF_JPEG_TEST,[ CPDF_TEMP_SUBST([
-    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],[
+    [  --with-jpeg-dir[=DIR]     CPDF: Set the path to libjpeg install prefix.],[
       for i in $withval /usr/local /usr; do
         if test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a; then
-         CPDF_JPEG_DIR=$i
+          CPDF_JPEG_DIR=$i
+          break;
         fi
       done
       if test -z "$CPDF_JPEG_DIR"; then
+        AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
         AC_MSG_ERROR([libjpeg.(a|so) not found.])
       fi
       LIBS="$LIBS -L$CPDF_JPEG_DIR/lib"
-      AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
-      PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib)
-    ],[
-      AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
+    ],)
+    AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_ERROR(Problem with libjpeg.(a|so). Please check config.log for more information.)],)
+    if test -z $CPDF_JPEG_DIR; then
       PHP_ADD_LIBRARY(jpeg)
-    ])
+    else
+      PHP_ADD_LIBRARY_WITH_PATH(jpeg, $CPDF_JPEG_DIR/lib)
+    fi
]) +]) +AC_DEFUN(CPDF_TIFF_TEST,[ CPDF_TEMP_SUBST([
-    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],[
+    [  --with-tiff-dir[=DIR]     CPDF: Set the path to libtiff install prefix.],[
       for i in $withval /usr/local /usr; do
         if test -f $i/lib/libtiff.$SHLIB_SUFFIX_NAME -o -f $i/lib/libtiff.a; then
-         CPDF_TIFF_DIR=$i
+          CPDF_TIFF_DIR=$i
+          break;
         fi
       done
       if test -z "$CPDF_TIFF_DIR"; then
+        AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
         AC_MSG_ERROR([libtiff.(a|so) not found.])
       fi
       LIBS="$LIBS -L$CPDF_TIFF_DIR/lib"
-      AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
-      PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib)
-    ],[
-      AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
+    ],)
+    AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_ERROR(Problem with libtiff.(a|so). Please check config.log for more information.)],)
+    if test -z $CPDF_TIFF_DIR; then
       PHP_ADD_LIBRARY(tiff)
-    ])
+    else
+      PHP_ADD_LIBRARY_WITH_PATH(tiff, $CPDF_TIFF_DIR/lib)
+    fi
]) ]) @@ -56,34 +60,37 @@ AC_ARG_WITH(cpdflib,
 [  --with-cpdflib[=DIR]    Include cpdflib support (requires cpdflib >= 2).],
[ - case $withval in
-    no)
-      AC_MSG_RESULT(no) ;;
-    yes)
-      AC_MSG_RESULT(yes)
-      PHP_NEW_EXTENSION(cpdf, cpdf.c)
-      CPDF_LIB_TEST
-      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)
-      ;;
-    *)
-      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)
-        CPDF_LIB_TEST
-        old_LIBS=$LIBS
-        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)
-      else
-        AC_MSG_ERROR([required haeder not found])
-      fi ;;
- esac + if test "$withval" = "no"; then
+    AC_MSG_RESULT(no)
+ else
+    AC_MSG_RESULT(yes)
+    PHP_NEW_EXTENSION(cpdf, cpdf.c)
+    CPDF_JPEG_TEST
+    CPDF_TIFF_TEST
+    for i in $withval /usr /usr/local; do
+      if test -f $i/include/cpdflib.h; then
+        CPDFLIB_INCLUDE=$i/include
+        AC_MSG_CHECKING(for cpdflib.h)
+        AC_MSG_RESULT([in $i/include])
+        CPDF_TEMP_SUBST([
+          LIBS="$LIBS -L$i/lib"
+          AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
+            [AC_MSG_ERROR([Cpdflib module requires cpdflib >= 2.])])
+        ])
+        if test "$i" != "/usr" -a "$i" != "/usr/local"; then
+          PHP_ADD_LIBRARY_WITH_PATH(cpdf, $i/lib)
+          PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
+        else
+          PHP_ADD_LIBRARY(cpdf)
+        fi
+        break
+      fi
+    done
+    if test -z "$CPDFLIB_INCLUDE"; then
+      AC_MSG_CHECKING(for cpdflib.h)
+      AC_MSG_ERROR([not found])
+    fi
+ fi ],[ AC_MSG_RESULT(no) ]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#17110) next »