1PHP_ARG_WITH([gettext], 2 [for GNU gettext support], 3 [AS_HELP_STRING([[--with-gettext[=DIR]]], 4 [Include GNU gettext support])]) 5 6if test "$PHP_GETTEXT" != "no"; then 7 for i in $PHP_GETTEXT /usr/local /usr; do 8 AS_IF([test -r $i/include/libintl.h], [GETTEXT_DIR=$i; break;]) 9 done 10 11 AS_VAR_IF([GETTEXT_DIR],, 12 [AC_MSG_ERROR([Cannot locate header file libintl.h])]) 13 14 GETTEXT_LIBDIR=$GETTEXT_DIR/$PHP_LIBDIR 15 GETTEXT_INCDIR=$GETTEXT_DIR/include 16 17 O_LDFLAGS=$LDFLAGS 18 LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR" 19 AC_CHECK_LIB([intl], [bindtextdomain], [ 20 GETTEXT_LIBS=intl 21 GETTEXT_CHECK_IN_LIB=intl 22 ], 23 [AC_CHECK_LIB([c], [bindtextdomain], [ 24 GETTEXT_LIBS= 25 GETTEXT_CHECK_IN_LIB=c 26 ], 27 [AC_MSG_FAILURE([Unable to find required intl library for gettext.])])]) 28 29 AC_DEFINE([HAVE_LIBINTL], [1], [Define to 1 if you have the 'intl' library.]) 30 PHP_NEW_EXTENSION([gettext], [gettext.c], [$ext_shared]) 31 PHP_SUBST([GETTEXT_SHARED_LIBADD]) 32 33 PHP_ADD_INCLUDE([$GETTEXT_INCDIR]) 34 35 AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB], [ngettext], 36 [AC_DEFINE([HAVE_NGETTEXT], [1], 37 [Define to 1 if you have the 'ngettext' function.])]) 38 AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB], [dngettext], 39 [AC_DEFINE([HAVE_DNGETTEXT], [1], 40 [Define to 1 if you have the 'dngettext' function.])]) 41 AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB], [dcngettext], 42 [AC_DEFINE([HAVE_DCNGETTEXT], [1], 43 [Define to 1 if you have the 'dcngettext' function.])]) 44 AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB], [bind_textdomain_codeset], 45 [AC_DEFINE([HAVE_BIND_TEXTDOMAIN_CODESET], [1], 46 [Define to 1 if you have the 'bind_textdomain_codeset' function.])]) 47 LDFLAGS=$O_LDFLAGS 48 49 AS_VAR_IF([GETTEXT_LIBS],,, 50 [PHP_ADD_LIBRARY_WITH_PATH([$GETTEXT_LIBS], 51 [$GETTEXT_LIBDIR], 52 [GETTEXT_SHARED_LIBADD])]) 53fi 54