automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automake/338: AM_GNU_GETTEXT([external]) support


From: Alexandre Duret-Lutz
Subject: automake/338: AM_GNU_GETTEXT([external]) support
Date: 17 Jul 2002 22:58:13 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I've made the following patch for this.  Comments?

The patch is against branch-1-6.  On HEAD you have to remove the
scan_one_autoconf_file change (last chunk in the automake.in patch),
and reindent a few things.

tests/gettext2.test corresponds to Chuck's report.  (Except that
po/ is still required.)

tests/gettext.test another error I found while writing this patch.
Because of a strange usage of Perl's grep, the error messages about
po/ or intl/ would never be printed.  (At least here.  Since Chuck
has seen these errors, maybe it depends on Perl's version.)


2002-07-17  Alexandre Duret-Lutz  <address@hidden>

        Fix for PR automake/338:
        * automake.in (seen_gettext_external): New variable.
        (handle_gettext): Conditionalize the intl/ check on
        $seen_gettext_external.  Fix grep usage.
        (scan_autoconf_traces, scan_one_autoconf_file): Set
        $seen_gettext_external if `external' is passed to AM_GNU_GETTEXT.
        * tests/gettext.test, tests/gettext2.test: New files.
        * tests/Makefile.am (TESTS): Add gettext.test and gettext2.test.
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1287.2.17
diff -u -r1.1287.2.17 automake.in
--- automake.in 17 Jul 2002 17:06:23 -0000      1.1287.2.17
+++ automake.in 17 Jul 2002 20:36:53 -0000
@@ -369,6 +369,8 @@
 
 # Whether AM_GNU_GETTEXT has been seen in configure.ac.
 my $seen_gettext = 0;
+# Whether AM_GNU_GETTEXT([external]) is used.
+my $seen_gettext_external = 0;
 # Where AM_GNU_GETTEXT appears.
 my $ac_gettext_location;
 
@@ -4153,10 +4155,14 @@
     my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all');
     macro_error ('SUBDIRS',
                 "AM_GNU_GETTEXT used but `po' not in SUBDIRS")
-       if ! grep ('po', @subdirs);
+       if ! grep ($_ eq 'po', @subdirs);
+
+    # intl/ is not required when AM_GNU_GETTEXT is called with
+    # the `external' option.
     macro_error ('SUBDIRS',
                 "AM_GNU_GETTEXT used but `intl' not in SUBDIRS")
-       if ! grep ('intl', @subdirs);
+       if (! $seen_gettext_external
+           && ! grep ($_ eq 'intl', @subdirs));
 
     require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
 }
@@ -4757,6 +4763,7 @@
        {
          $seen_gettext = $here;
          $ac_gettext_location = $here;
+         $seen_gettext_external = grep ($_ eq 'external', @args);
        }
       elsif ($macro eq 'AM_INIT_AUTOMAKE')
        {
@@ -4952,10 +4959,12 @@
        $seen_cc_c_o = $here if /AM_PROG_CC_C_O/;
 
        # Check for NLS support.
-       if (/AM_GNU_GETTEXT/)
+       if (/\bAM_GNU_GETTEXT\b/)
        {
            $seen_gettext = $here;
            $ac_gettext_location = $here;
+           $seen_gettext_external = 1
+               if /\bAM_GNU_GETTEXT\([^\)]*\bexternal\b/;
        }
 
        # Handle configuration headers.  A config header of `[$1]'
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.385.2.15
diff -u -r1.385.2.15 Makefile.am
--- tests/Makefile.am   19 Jun 2002 19:59:05 -0000      1.385.2.15
+++ tests/Makefile.am   17 Jul 2002 20:36:54 -0000
@@ -166,6 +166,8 @@
 gcj2.test \
 gcj3.test \
 gcj4.test \
+gettext.test \
+gettext2.test \
 gnits.test \
 header.test \
 implicit.test \
Index: tests/gettext.test
===================================================================
RCS file: tests/gettext.test
diff -N tests/gettext.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/gettext.test  17 Jul 2002 20:36:55 -0000
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+# Check gettext support.
+
+required='gettext'
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_GNU_GETTEXT
+AC_OUTPUT
+END
+
+: >Makefile.am
+mkdir po intl
+
+$ACLOCAL
+
+
+# po/ and intl/ are required
+
+$AUTOMAKE --add-missing 2>stderr && exit 1
+cat stderr
+grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr
+
+echo 'SUBDIRS = po' >Makefile.am
+$AUTOMAKE --add-missing 2>stderr && exit 1
+cat stderr
+grep 'AM_GNU_GETTEXT.*intl' stderr
+
+echo 'SUBDIRS = intl' >Makefile.am
+$AUTOMAKE --add-missing 2>stderr && exit 1
+cat stderr
+grep 'AM_GNU_GETTEXT.*po' stderr
+
+# Ok.
+
+echo 'SUBDIRS = po intl' >Makefile.am
+$AUTOMAKE --add-missing
Index: tests/gettext2.test
===================================================================
RCS file: tests/gettext2.test
diff -N tests/gettext2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/gettext2.test 17 Jul 2002 20:36:55 -0000
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+# Check gettext `external' support.
+# PR/338, reported by Charles Wilson.
+
+required='gettext'
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >>configure.in <<END
+AM_GNU_GETTEXT([external])
+AC_OUTPUT
+END
+
+: >Makefile.am
+mkdir foo po
+
+$ACLOCAL
+
+# po/ is required, but intl/ isn't.
+
+$AUTOMAKE --add-missing 2>stderr && exit 1
+cat stderr
+grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr
+
+echo 'SUBDIRS = foo' >Makefile.am
+$AUTOMAKE --add-missing 2>stderr && exit 1
+cat stderr
+grep 'AM_GNU_GETTEXT.*po' stderr
+
+# Ok.
+
+echo 'SUBDIRS = po' >Makefile.am
+$AUTOMAKE --add-missing


-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]