]> granicus.if.org Git - php/commitdiff
Avoid duplicate tests and make third parameter truly optional.
authorSascha Schumann <sas@php.net>
Wed, 20 Mar 2002 12:08:30 +0000 (12:08 +0000)
committerSascha Schumann <sas@php.net>
Wed, 20 Mar 2002 12:08:30 +0000 (12:08 +0000)
acinclude.m4

index 18c24182b350f73f007a9b394db01ba2c106f95a..949f1f9d8925b7338eb469574381a7fcbbfcb4da 100644 (file)
@@ -1362,23 +1362,24 @@ AC_DEFUN(PHP_SETUP_ICONV, [
     found_iconv=yes
   ], [
 
-    iconv_lib_name=iconv
     for i in $PHP_ICONV /usr/local /usr; do
-      if test -r $i/include/giconv.h || test -r $i/include/iconv.h; then
+      if test -r $i/include/giconv.h; then
         ICONV_DIR=$i
-        if test -r $i/include/giconv.h; then
-          iconv_lib_name=giconv
-        fi
+        iconv_lib_name=giconv
         break
-      fi
+      elif test -r $i/include/iconv.h; then
+        ICONV_DIR=$i
+        iconv_lib_name=iconv
+        break
+         fi
     done
 
     if test -z "$ICONV_DIR"; then
-      AC_MSG_ERROR(Please specify the location of iconv with --with-iconv)
+      AC_MSG_ERROR([Please specify the location of iconv with --with-iconv])
     fi
   
-    if test -f $ICONV_DIR/lib/lib${iconv_lib_name}.a ||
-       test -f $ICONV_DIR/lib/lib${iconv_lib_name}.$SHLIB_SUFFIX_NAME
+    if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a ||
+       test -f $ICONV_DIR/lib/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME
     then
       PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
         found_iconv=yes
@@ -1394,13 +1395,12 @@ AC_DEFUN(PHP_SETUP_ICONV, [
     fi
   ])
 
-  if test "$found_iconv" = "no"; then
-    $3
-  else
+  if test "$found_iconv" = "yes"; then
     if test -n "$ICONV_DIR"; then
       PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1)
       PHP_ADD_INCLUDE($ICONV_DIR/include)
     fi
     $2
+ifelse([$3],[],,[else $3])
   fi
 ])