helly           Tue Dec 10 09:31:01 2002 EDT

  Modified files:              
    /php4/ext/cpdf      config.m4 
  Log:
  -when required haeder was not found --with-cdpf was simply ignored. I
   changed this to be an error.
  -cpdf did not check for --with-jpeg-dir and --with-tiff-dir
  
  
Index: php4/ext/cpdf/config.m4
diff -u php4/ext/cpdf/config.m4:1.10 php4/ext/cpdf/config.m4:1.11
--- php4/ext/cpdf/config.m4:1.10        Wed Mar 13 04:18:53 2002
+++ php4/ext/cpdf/config.m4     Tue Dec 10 09:31:00 2002
@@ -1,4 +1,56 @@
-dnl $Id: config.m4,v 1.10 2002/03/13 09:18:53 sas Exp $
+dnl $Id: config.m4,v 1.11 2002/12/10 14:31:00 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,[
+  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],[
+      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
+        fi
+      done
+      if test -z "$CPDF_JPEG_DIR"; then
+        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.)],)
+      PHP_ADD_LIBRARY(jpeg)
+    ]) 
+  ])
+
+  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],[
+      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
+        fi
+      done
+      if test -z "$CPDF_TIFF_DIR"; then
+        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.)],)
+      PHP_ADD_LIBRARY(tiff)
+    ]) 
+  ])
+])
 
 AC_MSG_CHECKING(for cpdflib support)
 AC_ARG_WITH(cpdflib,
@@ -10,59 +62,26 @@
     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)
-      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)
+        CPDF_LIB_TEST
         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=<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=<DIR>)
-        ]) 
-        withval=$old_withval
-
-          LIBS="$LIBS -L$withval/lib"
+        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_RESULT(no)
+        AC_MSG_ERROR([required haeder not found])
       fi ;;
   esac
 ],[



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to