xref: /PHP-8.1/ext/gettext/config.m4 (revision 75fb7486)
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    test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
9  done
10
11  if test -z "$GETTEXT_DIR"; then
12    AC_MSG_ERROR(Cannot locate header file libintl.h)
13  fi
14
15  GETTEXT_LIBDIR=$GETTEXT_DIR/$PHP_LIBDIR
16  GETTEXT_INCDIR=$GETTEXT_DIR/include
17
18  O_LDFLAGS=$LDFLAGS
19  LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
20  AC_CHECK_LIB(intl, bindtextdomain, [
21	GETTEXT_LIBS=intl
22	GETTEXT_CHECK_IN_LIB=intl
23	],
24	AC_CHECK_LIB(c, bindtextdomain, [
25		GETTEXT_LIBS=
26		GETTEXT_CHECK_IN_LIB=c
27	],[
28		AC_MSG_ERROR(Unable to find required gettext library)
29	])
30  )
31
32  AC_DEFINE(HAVE_LIBINTL,1,[ ])
33  PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
34  PHP_SUBST(GETTEXT_SHARED_LIBADD)
35
36  PHP_ADD_INCLUDE($GETTEXT_INCDIR)
37
38  AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext,  [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])])
39  AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dngettext,  [AC_DEFINE(HAVE_DNGETTEXT, 1, [ ])])
40  AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dcngettext,  [AC_DEFINE(HAVE_DCNGETTEXT, 1, [ ])])
41  AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset,  [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])])
42  LDFLAGS=$O_LDFLAGS
43
44  if test -n "$GETTEXT_LIBS"; then
45    PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
46  fi
47fi
48