Skip to content

Commit 1962e1e

Browse files
author
Sascha Schumann
committed
Avoid duplicate tests and make third parameter truly optional.
1 parent 4597486 commit 1962e1e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

acinclude.m4

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,23 +1362,24 @@ AC_DEFUN(PHP_SETUP_ICONV, [
13621362
found_iconv=yes
13631363
], [
13641364
1365-
iconv_lib_name=iconv
13661365
for i in $PHP_ICONV /usr/local /usr; do
1367-
if test -r $i/include/giconv.h || test -r $i/include/iconv.h; then
1366+
if test -r $i/include/giconv.h; then
13681367
ICONV_DIR=$i
1369-
if test -r $i/include/giconv.h; then
1370-
iconv_lib_name=giconv
1371-
fi
1368+
iconv_lib_name=giconv
13721369
break
1373-
fi
1370+
elif test -r $i/include/iconv.h; then
1371+
ICONV_DIR=$i
1372+
iconv_lib_name=iconv
1373+
break
1374+
fi
13741375
done
13751376
13761377
if test -z "$ICONV_DIR"; then
1377-
AC_MSG_ERROR(Please specify the location of iconv with --with-iconv)
1378+
AC_MSG_ERROR([Please specify the location of iconv with --with-iconv])
13781379
fi
13791380
1380-
if test -f $ICONV_DIR/lib/lib${iconv_lib_name}.a ||
1381-
test -f $ICONV_DIR/lib/lib${iconv_lib_name}.$SHLIB_SUFFIX_NAME
1381+
if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a ||
1382+
test -f $ICONV_DIR/lib/lib$iconv_lib_name.$SHLIB_SUFFIX_NAME
13821383
then
13831384
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
13841385
found_iconv=yes
@@ -1394,13 +1395,12 @@ AC_DEFUN(PHP_SETUP_ICONV, [
13941395
fi
13951396
])
13961397
1397-
if test "$found_iconv" = "no"; then
1398-
$3
1399-
else
1398+
if test "$found_iconv" = "yes"; then
14001399
if test -n "$ICONV_DIR"; then
14011400
PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1)
14021401
PHP_ADD_INCLUDE($ICONV_DIR/include)
14031402
fi
14041403
$2
1404+
ifelse([$3],[],,[else $3])
14051405
fi
14061406
])

0 commit comments

Comments
 (0)