X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fgettext.m4;h=d0b484543b8bafdf6766e0d6d232a5c70ba09282;hb=refs%2Ftags%2FFILEUTILS-4_0-b4;hp=555431f2e1258c266298916224139dee87622043;hpb=d46c7f034928a12fd0bf723f4f03762422abdd45;p=gnulib.git diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 555431f2e..d0b484543 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,7 +1,12 @@ # 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 2 +# serial 105 AC_DEFUN(AM_WITH_NLS, [AC_MSG_CHECKING([whether NLS is requested]) @@ -43,9 +48,15 @@ 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" \ @@ -95,7 +106,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 +135,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 +150,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 +162,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,6 +205,7 @@ 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_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl @@ -194,9 +216,9 @@ 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) @@ -229,6 +251,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,10 +294,10 @@ __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) @@ -288,5 +321,4 @@ __argz_count __argz_stringify __argz_next]) rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES - chmod a-w po/POTFILES ])