X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fgettext.m4;h=0decdf705c87140ab2d664b4a9f3606ee048c352;hb=365c522e3a5b3ae36005ab1d7f3a8bfbb0a9dee7;hp=9361d77ee73b3d32cc4c240fdfc94c86efaca061;hpb=44ec9731a3e3e51d6bc1d19b782ab32beb14d94f;p=gnulib.git diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 9361d77ee..0decdf705 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,7 +1,14 @@ # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. -# serial 1 +# serial 106 + +AC_PREREQ(2.13) dnl Minimum Autoconf version required. AC_DEFUN(AM_WITH_NLS, [AC_MSG_CHECKING([whether NLS is requested]) @@ -16,7 +23,7 @@ AC_DEFUN(AM_WITH_NLS, dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS) + AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested.]) AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], @@ -43,14 +50,21 @@ AC_DEFUN(AM_WITH_NLS, AC_CHECK_LIB(intl, bindtextdomain, [AC_CACHE_CHECK([for gettext in libintl], gt_cv_func_gettext_libintl, - [AC_TRY_LINK([], [return (int) gettext ("")], - gt_cv_func_gettext_libintl=yes, - gt_cv_func_gettext_libintl=no)])]) + [AC_CHECK_LIB(intl, gettext, + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)], + gt_cv_func_gettext_libintl=no)]) + + if test "$gt_cv_func_gettext_libintl" = yes; then + LIBS="$LIBS -lintl" + fi + fi if test "$gt_cv_func_gettext_libc" = "yes" \ || test "$gt_cv_func_gettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) + AC_DEFINE(HAVE_GETTEXT, 1, + [Define to 1 if you have gettext and don't want to use GNU gettext.]) AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then @@ -80,7 +94,8 @@ AC_DEFUN(AM_WITH_NLS, dnl No gettext in C library. Try catgets next. AC_CHECK_LIB(i, main) AC_CHECK_FUNC(catgets, - [AC_DEFINE(HAVE_CATGETS) + [AC_DEFINE(HAVE_CATGETS, 1, + [Define as 1 if you have catgets and don't want to use GNU gettext.]) INTLOBJS="\$(CATOBJS)" AC_PATH_PROG(GENCAT, gencat, no)dnl if test "$GENCAT" != "no"; then @@ -95,7 +110,7 @@ AC_DEFUN(AM_WITH_NLS, CATOBJEXT=.cat INSTOBJEXT=.cat DATADIRNAME=lib - INTLDEPS="../intl/libintl.a" + INTLDEPS='$(top_builddir)/intl/libintl.a' INTLLIBS=$INTLDEPS LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h @@ -124,7 +139,7 @@ AC_DEFUN(AM_WITH_NLS, CATOBJEXT=.gmo INSTOBJEXT=.mo DATADIRNAME=share - INTLDEPS="../intl/libintl.a" + INTLDEPS='$(top_builddir)/intl/libintl.a' INTLLIBS=$INTLDEPS LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h @@ -139,7 +154,7 @@ AC_DEFUN(AM_WITH_NLS, : ; else AC_MSG_RESULT( - [found xgettext programs is not GNU xgettext; ignore it]) + [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi @@ -151,6 +166,16 @@ AC_DEFUN(AM_WITH_NLS, nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h fi + if test -z "$nsl_cv_header_intl"; then + # Clean out junk possibly left behind by a previous configuration. + rm -f intl/libintl.h + fi + AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + # If this is used in GNU gettext we have to set USE_NLS to `yes' # because some of the sources are only built for this goal. @@ -184,8 +209,8 @@ AC_DEFUN(AM_WITH_NLS, AC_DEFUN(AM_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([AC_C_INLINE])dnl @@ -195,15 +220,15 @@ AC_DEFUN(AM_GNU_GETTEXT, AC_REQUIRE([AC_FUNC_MMAP])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h values.h]) +unistd.h sys/param.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -__argz_count __argz_stringify __argz_next]) +strdup __argz_count __argz_stringify __argz_next]) if test "${ac_cv_func_stpcpy+set}" != "set"; then AC_CHECK_FUNCS(stpcpy) fi if test "${ac_cv_func_stpcpy}" = "yes"; then - AC_DEFINE(HAVE_STPCPY) + AC_DEFINE(HAVE_STPCPY, 1, [Define to 1 if you have the stpcpy function.]) fi AM_LC_MESSAGES @@ -230,6 +255,17 @@ __argz_count __argz_stringify __argz_next]) fi fi + dnl The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + dnl Determine which catalog format we have (if any is needed) dnl For now we know about two different formats: dnl Linux libc-5 and the normal X/Open format @@ -262,26 +298,33 @@ __argz_count __argz_stringify __argz_next]) dnl find the mkinstalldirs script in another subdir but ($top_srcdir). dnl Try to locate is. MKINSTALLDIRS= - if test $ac_aux_dir; then + if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi - if test -z $MKINSTALLDIRS; then + if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) + dnl *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. test -d po || mkdir po if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + changequote(, )dnl + if test "x`echo $srcdir | sed -e 's@^[A-z]:@@' -e 's@/.*@@'`" = "x"; then posrcprefix="$srcdir/" else posrcprefix="../$srcdir/" fi + changequote([, ])dnl else posrcprefix="../" fi + rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ])