Annotation of embedaddon/php/ext/iconv/config.m4, revision 1.1
1.1 ! misho 1: dnl
! 2: dnl $Id: config.m4 247585 2007-12-04 11:27:25Z tony2001 $
! 3: dnl
! 4:
! 5: PHP_ARG_WITH(iconv, for iconv support,
! 6: [ --without-iconv[=DIR] Exclude iconv support], yes)
! 7:
! 8: if test "$PHP_ICONV" != "no"; then
! 9:
! 10: PHP_SETUP_ICONV(ICONV_SHARED_LIBADD, [
! 11: iconv_avail="yes";
! 12: ],[
! 13: iconv_avail="no";
! 14: ])
! 15:
! 16: if test "$iconv_avail" != "no"; then
! 17: if test -z "$ICONV_DIR"; then
! 18: for i in /usr/local /usr; do
! 19: if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then
! 20: PHP_ICONV_PREFIX="$i"
! 21: break
! 22: fi
! 23: done
! 24: if test -z "$PHP_ICONV_PREFIX"; then
! 25: PHP_ICONV_PREFIX="/usr"
! 26: fi
! 27: else
! 28: PHP_ICONV_PREFIX="$ICONV_DIR"
! 29: fi
! 30:
! 31: CFLAGS="-I$PHP_ICONV_PREFIX/include $CFLAGS"
! 32: LDFLAGS="-L$PHP_ICONV_PREFIX/$PHP_LIBDIR $LDFLAGS"
! 33:
! 34: if test -r "$PHP_ICONV_PREFIX/include/giconv.h"; then
! 35: PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/giconv.h"
! 36: else
! 37: PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/iconv.h"
! 38: fi
! 39:
! 40: AC_MSG_CHECKING([if iconv is glibc's])
! 41: AC_TRY_LINK([#include <gnu/libc-version.h>],[gnu_get_libc_version();],
! 42: [
! 43: AC_MSG_RESULT(yes)
! 44: iconv_impl_name="glibc"
! 45: ],[
! 46: AC_MSG_RESULT(no)
! 47: ])
! 48:
! 49: if test -z "$iconv_impl_name"; then
! 50: AC_MSG_CHECKING([if using GNU libiconv])
! 51: php_iconv_old_ld="$LDFLAGS"
! 52: LDFLAGS="-liconv $LDFLAGS"
! 53: AC_TRY_RUN([
! 54: #include <$PHP_ICONV_H_PATH>
! 55: int main() {
! 56: printf("%d", _libiconv_version);
! 57: return 0;
! 58: }
! 59: ],[
! 60: AC_MSG_RESULT(yes)
! 61: iconv_impl_name="gnu_libiconv"
! 62: ],[
! 63: AC_MSG_RESULT(no)
! 64: LDFLAGS="$php_iconv_old_ld"
! 65: ],[
! 66: AC_MSG_RESULT(no, cross-compiling)
! 67: LDFLAGS="$php_iconv_old_ld"
! 68: ])
! 69: fi
! 70:
! 71: if test -z "$iconv_impl_name"; then
! 72: AC_MSG_CHECKING([if iconv is Konstantin Chuguev's])
! 73: AC_TRY_LINK([#include <iconv.h>],[iconv_ccs_init(NULL, NULL);],
! 74: [
! 75: AC_MSG_RESULT(yes)
! 76: iconv_impl_name="bsd"
! 77: ],[
! 78: AC_MSG_RESULT(no)
! 79: ])
! 80: fi
! 81:
! 82: if test -z "$iconv_impl_name"; then
! 83: AC_MSG_CHECKING([if using IBM iconv])
! 84: php_iconv_old_ld="$LDFLAGS"
! 85: LDFLAGS="-liconv $LDFLAGS"
! 86: AC_TRY_LINK([#include <iconv.h>],[cstoccsid("");],
! 87: [
! 88: AC_MSG_RESULT(yes)
! 89: iconv_impl_name="ibm"
! 90: ],[
! 91: AC_MSG_RESULT(no)
! 92: LDFLAGS="$php_iconv_old_ld"
! 93: ])
! 94: fi
! 95:
! 96: echo > ext/iconv/php_have_bsd_iconv.h
! 97: echo > ext/iconv/php_have_glibc_iconv.h
! 98: echo > ext/iconv/php_have_libiconv.h
! 99: echo > ext/iconv/php_have_ibm_iconv.h
! 100:
! 101: case "$iconv_impl_name" in
! 102: gnu_libiconv [)]
! 103: PHP_DEFINE([PHP_ICONV_IMPL],[\"libiconv\"],[ext/iconv])
! 104: AC_DEFINE([PHP_ICONV_IMPL],["libiconv"],[Which iconv implementation to use])
! 105: PHP_DEFINE([HAVE_LIBICONV],1,[ext/iconv])
! 106: PHP_ADD_LIBRARY_WITH_PATH(iconv, "$PHP_ICONV_PREFIX/$PHP_LIBDIR", ICONV_SHARED_LIBADD)
! 107: ;;
! 108:
! 109: bsd [)]
! 110: PHP_DEFINE([HAVE_BSD_ICONV],1,[ext/iconv])
! 111: AC_DEFINE([HAVE_BSD_ICONV],1,[Konstantin Chuguev's iconv implementation])
! 112: PHP_DEFINE([PHP_ICONV_IMPL],[\"BSD iconv\"],[ext/iconv])
! 113: AC_DEFINE([PHP_ICONV_IMPL],["BSD iconv"],[Which iconv implementation to use])
! 114: ;;
! 115:
! 116: glibc [)]
! 117: PHP_DEFINE([HAVE_GLIBC_ICONV],1,[ext/iconv])
! 118: AC_DEFINE([HAVE_GLIBC_ICONV],1,[glibc's iconv implementation])
! 119: PHP_DEFINE([PHP_ICONV_IMPL],[\"glibc\"],[ext/iconv])
! 120: AC_DEFINE([PHP_ICONV_IMPL],["glibc"],[Which iconv implementation to use])
! 121: ;;
! 122: ibm [)]
! 123: PHP_DEFINE([HAVE_IBM_ICONV],1,[ext/iconv])
! 124: AC_DEFINE([HAVE_IBM_ICONV],1,[IBM iconv implementation])
! 125: PHP_DEFINE([PHP_ICONV_IMPL],[\"IBM iconv\"],[ext/iconv])
! 126: AC_DEFINE([PHP_ICONV_IMPL],["IBM iconv"],[Which iconv implementation to use])
! 127: ;;
! 128: esac
! 129:
! 130: AC_MSG_CHECKING([if iconv supports errno])
! 131: AC_TRY_RUN([
! 132: #include <$PHP_ICONV_H_PATH>
! 133: #include <errno.h>
! 134:
! 135: int main() {
! 136: iconv_t cd;
! 137: cd = iconv_open( "*blahblah*", "*blahblah*" );
! 138: if (cd == (iconv_t)(-1)) {
! 139: if (errno == EINVAL) {
! 140: return 0;
! 141: } else {
! 142: return 1;
! 143: }
! 144: }
! 145: iconv_close( cd );
! 146: return 2;
! 147: }
! 148: ],[
! 149: AC_MSG_RESULT(yes)
! 150: PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1,[ext/iconv])
! 151: AC_DEFINE([ICONV_SUPPORTS_ERRNO],1,[Whether iconv supports error no or not])
! 152: ],[
! 153: AC_MSG_RESULT(no)
! 154: PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
! 155: AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
! 156: ],[
! 157: AC_MSG_RESULT(no, cross-compiling)
! 158: PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
! 159: AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
! 160: ])
! 161:
! 162: AC_MSG_CHECKING([if your cpp allows macro usage in include lines])
! 163: AC_TRY_COMPILE([
! 164: #define FOO <$PHP_ICONV_H_PATH>
! 165: #include FOO
! 166: ], [], [
! 167: AC_MSG_RESULT([yes])
! 168: PHP_DEFINE([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>],[ext/iconv])
! 169: AC_DEFINE_UNQUOTED([PHP_ICONV_H_PATH], [<$PHP_ICONV_H_PATH>], [Path to iconv.h])
! 170: ], [
! 171: AC_MSG_RESULT([no])
! 172: ])
! 173:
! 174: PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\"])
! 175: PHP_SUBST(ICONV_SHARED_LIBADD)
! 176: PHP_INSTALL_HEADERS([ext/iconv/])
! 177: else
! 178: AC_MSG_ERROR(Please reinstall the iconv library.)
! 179: fi
! 180: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>