X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fgettext.m4;h=1582da3cde634a2692f304ab0d1feb1a46f37425;hb=9444b2cc75449834d4b397fe9ce99afaf7c16da8;hp=d3b86ec0f4c907bee6920089bb8e96c030f8d7b7;hpb=b733d4578361c78e84b35ce436399577b8ee4286;p=gnulib.git diff --git a/m4/gettext.m4 b/m4/gettext.m4 index d3b86ec0f..1582da3cd 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 107 + +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], @@ -41,16 +48,13 @@ AC_DEFUN(AM_WITH_NLS, if test "$gt_cv_func_gettext_libc" != "yes"; then 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)]) fi if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) + || test "$ac_cv_lib_intl_gettext" = "yes"; then + 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 +84,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 +100,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 +129,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 +144,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 +156,16 @@ AC_DEFUN(AM_WITH_NLS, nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h fi + if test -z "$nls_cv_header_intl"; then + # Clean out junk possibly left behind by a previous configuration. + rm -f intl/libintl.h + fi + AC_CONFIG_LINKS($nls_cv_header_intl:$nls_cv_header_libgt) + 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. @@ -185,6 +200,7 @@ AC_DEFUN(AM_GNU_GETTEXT, [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])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 @@ -194,15 +210,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 @@ -229,6 +245,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 @@ -261,26 +288,32 @@ __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 - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi + changequote(, )dnl + case "$srcdir" in + .) + posrcprefix="../" ;; + /* | [A-Za-z]:*) + posrcprefix="$srcdir/" ;; + *) + posrcprefix="../$srcdir/" ;; + esac + changequote([, ])dnl + rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ])