Make gettext extension compilable as shared module.

This commit is contained in:
Sascha Schumann 2000-05-23 22:26:51 +00:00
parent 9a8a9d774e
commit cab5f6afb8
3 changed files with 39 additions and 37 deletions

View File

@ -1,5 +1,7 @@
LTLIBRARY_NAME = libgettext.la
LTLIBRARY_SOURCES = gettext.c
LTLIBRARY_SHARED_NAME = gettext.la
LTLIBRARY_SHARED_LIBADD = $(GETTEXT_SHARED_LIBADD)
include $(top_srcdir)/build/dynlib.mk

View File

@ -2,44 +2,40 @@ dnl $Id$
dnl config.m4 for extension gettext
dnl don't forget to call PHP_EXTENSION(gettext)
AC_MSG_CHECKING(whether to include GNU gettext support)
AC_ARG_WITH(gettext,
PHP_ARG_WITH(gettext,whether to include GNU gettext support,
[ --with-gettext[=DIR] Include GNU gettext support. DIR is the gettext
install directory, defaults to /usr/local],
[
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
GETTEXT_INCDIR=/usr/local/include
test -f /usr/local/include/libintl.h && GETTEXT_INCDIR=/usr/local/include/
GETTEXT_LIBDIR=/usr/local/lib
else
GETTEXT_INCDIR=$withval/include
test -f $withval/include/libintl.h && GETTEXT_INCDIR=$withval/include
GETTEXT_LIBDIR=$withval/lib
install directory, defaults to /usr/local])
if test "$PHP_GETTEXT" != "no"; then
for i in /usr /usr/local $PHP_GETTEXT; do
if test -r $i/include/libintl.h; then
GETTEXT_DIR=$i
fi
GETTEXT_INCLUDE=-I$GETTEXT_INCDIR
GETTEXT_LFLAGS=-L$GETTEXT_LIBDIR
O_CPPFLAGS="$CPPFLAGS"
O_LDFLAGS=$LDFLAGS
CPPFLAGS="$CPPFLAGS -I$GETTEXT_INCDIR"
LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
GETTEXT_LIBS=
AC_MSG_RESULT(yes)
AC_CHECK_LIB(intl, bindtextdomain, GETTEXT_LIBS="-lintl",[
AC_CHECK_LIB(c, bindtextdomain, GETTEXT_LIBS=,[
AC_MSG_ERROR(Unable to find required gettext library)
],)
],)
done
AC_DEFINE(HAVE_LIBINTL,1,[ ])
PHP_EXTENSION(gettext)
EXTRA_LIBS="$EXTRA_LIBS $GETTEXT_LFLAGS $GETTEXT_LIBS"
INCLUDES="$INCLUDES $GETTEXT_INCLUDE"
else
AC_MSG_RESULT(no)
if test -z "$GETTEXT_DIR"; then
AC_MSG_ERROR(Cannot locate header file libintl.h)
fi
],[
AC_MSG_RESULT(no)
])
GETTEXT_LIBDIR=$GETTEXT_DIR/lib
GETTEXT_INCDIR=$GETTEXT_DIR/include
O_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
AC_CHECK_LIB(intl, bindtextdomain, GETTEXT_LIBS="intl",[
AC_CHECK_LIB(c, bindtextdomain, GETTEXT_LIBS= ,[
AC_MSG_ERROR(Unable to find required gettext library)
])
])
LDFLAGS="$O_LDFLAGS"
AC_DEFINE(HAVE_LIBINTL,1,[ ])
PHP_EXTENSION(gettext, $ext_shared)
PHP_SUBST(GETTEXT_SHARED_LIBADD)
if test -n "$GETTEXT_LIBS"; then
AC_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
fi
AC_ADD_INCLUDE($GETTEXT_INCDIR)
fi

View File

@ -41,6 +41,10 @@ zend_module_entry php_gettext_module_entry = {
"gettext", php_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_GETTEXT
ZEND_GET_MODULE(php_gettext)
#endif
PHP_MINFO_FUNCTION(gettext)
{
php_info_print_table_start();