summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2002-03-21 20:22:05 +0000
committerfoobar <sniper@php.net>2002-03-21 20:22:05 +0000
commitd5333717601e3c45907e6fd1f8d22982db8aafc1 (patch)
tree0d21547d89a6710047f1d3c1aeb5e41ede78b3bb
parenteb8c6b4696629ceecfaa2e83abd1faabd586fd1d (diff)
downloadphp-git-d5333717601e3c45907e6fd1f8d22982db8aafc1.tar.gz
- Fixed bug #16165 again. We check libc for iconv functions only if
no path is given for --with-iconv. # I hope this is the last time.
-rw-r--r--acinclude.m431
-rw-r--r--ext/iconv/iconv.c5
2 files changed, 26 insertions, 10 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 631b0dce43..23fa1b1986 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1374,14 +1374,25 @@ AC_DEFUN(PHP_SETUP_ICONV, [
found_iconv=no
unset ICONV_DIR
- AC_CHECK_FUNC(iconv, [
- PHP_DEFINE(HAVE_ICONV)
- found_iconv=yes
- ],[
- AC_CHECK_FUNC(libiconv,[
- PHP_DEFINE(HAVE_LIBICONV)
+ dnl
+ dnl Check libc first if no path is provided in --with-iconv
+ dnl
+ if test "$PHP_ICONV" = "yes"; then
+ AC_CHECK_FUNC(iconv, [
+ PHP_DEFINE(HAVE_ICONV)
found_iconv=yes
- ],[
+ ],[
+ AC_CHECK_FUNC(libiconv,[
+ PHP_DEFINE(HAVE_LIBICONV)
+ found_iconv=yes
+ ])
+ ])
+ fi
+
+ dnl
+ dnl Check external libs for iconv funcs
+ dnl
+ if test "$found_iconv" = "no"; then
for i in $PHP_ICONV /usr/local /usr; do
if test -r $i/include/giconv.h; then
@@ -1396,7 +1407,7 @@ AC_DEFUN(PHP_SETUP_ICONV, [
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 install prefix of iconv with --with-iconv=<DIR>])
fi
if test -f $ICONV_DIR/lib/lib$iconv_lib_name.a ||
@@ -1416,11 +1427,11 @@ AC_DEFUN(PHP_SETUP_ICONV, [
-L$ICONV_DIR/lib
])
fi
- ])
- ])
+ fi
if test "$found_iconv" = "yes"; then
if test -n "$ICONV_DIR"; then
+ AC_DEFINE(HAVE_ICONV, 1, [ ])
PHP_ADD_LIBRARY_WITH_PATH($iconv_lib_name, $ICONV_DIR/lib, $1)
PHP_ADD_INCLUDE($ICONV_DIR/include)
fi
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 472d6ce85a..99d172a963 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -32,7 +32,12 @@
#if HAVE_ICONV
+#ifdef HAVE_GICONV_H
+#include <giconv.h>
+#else
#include <iconv.h>
+#endif
+
#include <errno.h>
#include "php_globals.h"