autoconf-patches
[Top][All Lists]
Advanced

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

Re: autoreconf should use gettextize --intl


From: Akim Demaille
Subject: Re: autoreconf should use gettextize --intl
Date: 14 Mar 2002 18:32:43 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

>>>>> "Andreas" == Andreas Schwab <address@hidden> writes:

|> ?  I don't use 0.41, so I need more precisions (or some code ;).

Andreas> What is "0.41" referring to?  Current version of gettext is
Andreas> 0.11.1.

Sorry, I meant 0.11 indeed.

I'm applying the following patch.  Don't hesitate adjusting it.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * bin/autoreconf.in (&study_gettextize): New.
        (&autoreconf): Handle newest gettextize.
        Rerun aclocal if needed.
        Suggested by Andreas Schwab.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.224
diff -u -u -r1.224 NEWS
--- NEWS 11 Mar 2002 14:38:59 -0000 1.224
+++ NEWS 14 Mar 2002 17:23:37 -0000
@@ -1,4 +1,9 @@
 * Major changes in Autoconf 2.53a                       -*- outline -*-
+
+** Executables
+
+- autoreconf is adjusted to GNU Gettext 0.11.
+
 
 * Major changes in Autoconf 2.53
 
Index: bin/autoreconf.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoreconf.in,v
retrieving revision 1.89
diff -u -u -r1.89 autoreconf.in
--- bin/autoreconf.in 8 Mar 2002 11:46:31 -0000 1.89
+++ bin/autoreconf.in 14 Mar 2002 17:23:37 -0000
@@ -91,6 +91,9 @@
 my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
 my $gettextize = $ENV{'GETTEXTIZE'} || 'gettextize';
 
+# Does gettextize support --no-changelog and --intl?
+my $gettextize_intl_p;
+my $gettextize_no_changelog_p;
 
 # --install -- as --add-missing in other tools.
 my $install = 0;
@@ -102,6 +105,8 @@
 # The directory where autoreconf was run.
 my $cwd = cwd;
 
+
+
 ## ---------- ##
 ## Routines.  ##
 ## ---------- ##
@@ -179,6 +184,29 @@
 }
 
 
+# &study_gettextize
+# -----------------
+# See what options gettextize supports.
+sub study_gettextize ()
+{
+  return
+    if defined $gettextize_no_changelog_p && defined $gettextize_intl_p;
+
+  $gettextize_no_changelog_p = 0;
+  $gettextize_intl_p = 0;
+
+  my $usage = new Autom4te::XFile ("$gettextize --help |");
+  while ($_ = $usage->getline)
+    {
+      $gettextize_no_changelog_p = 1 if /--no-changelog/;
+      $gettextize_intl_p = 1         if /--intl/;
+    }
+
+  $gettextize .= " --no-changelog" if $gettextize_no_changelog_p;
+}
+
+
+
 # &autoreconf ($DIRECTORY)
 # ------------------------
 # Reconf the $DIRECTORY.
@@ -266,6 +294,9 @@
        if -f 'aclocal.m4t';
     }
 
+  # We might have to rerun aclocal if Libtool or Gettext import new
+  # macros.
+  my $rerun_alocal = 0;
 
 
   # ------------------------------- #
@@ -276,6 +307,8 @@
   # between two --trace, that's useless.  If there is no AC_INIT, then
   # we are not interested: it looks like a Cygnus thingy.
   my $uses_gettext;
+  # Starting at GNU Gettext 0.11, libintl is optional.
+  my $uses_libintl;
   my $uses_libtool;
   my $uses_autoheader;
   my @subdir;
@@ -289,7 +322,11 @@
   while ($_ = $traces->getline)
     {
       $uses_autoconf = 1            if /AC_INIT/;
-      $uses_gettext = 1             if /AM_GNU_GETTEXT/;
+      if (/AM_GNU_GETTEXT/)
+       {
+         $uses_gettext = 1;
+         $uses_libintl = !/external/;
+       }
       $uses_libtool = 1             if /AC_PROG_LIBTOOL/;
       $uses_autoheader = 1          if /AC_CONFIG_HEADERS/;
       push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
@@ -319,17 +356,54 @@
     {
       verbose "$configure_ac: not using Gettext";
     }
-  elsif (-d 'intl' && !$force)
-    {
-      verbose "$configure_ac: not running gettextize: `intl' is already 
present";
-    }
-  elsif ($install)
+  elsif (!$install)
     {
-      xsystem ($gettextize);
+      verbose "$configure_ac: not running gettextize: --install not given";
     }
   else
     {
-      verbose "$configure_ac: not running gettextize: --install not given";
+      # See if gettextize supports --intl and --no-changelog.
+      study_gettextize;
+
+      # Old and new gettext are really different :(
+      if ($gettextize_intl_p)
+       {
+         # Gettext >= 0.11.
+         if ($uses_libintl)
+           {
+             if (-d 'intl' && !$force)
+               {
+                 verbose ("$configure_ac: not running gettextize: ",
+                          "`intl' is already present");
+               }
+             else
+               {
+                 xsystem "$gettextize --intl";
+                 $rerun_alocal = 1;
+               }
+           }
+         else
+           {
+             # Always run modern gettextizes, as they update/import
+             # several files.
+             xsystem "$gettextize";
+             $rerun_alocal = 1;
+           }
+       }
+      else
+       {
+         # Gettext < 0.11.
+         if (-d 'intl' && !$force)
+           {
+             verbose ("$configure_ac: not running gettextize: ",
+                      "`intl' is already present");
+           }
+         else
+           {
+             xsystem "$gettextize --intl";
+             $rerun_alocal = 1;
+           }
+       }
     }
 
 
@@ -344,6 +418,7 @@
   elsif ($install)
     {
       xsystem ($libtoolize);
+      $rerun_alocal = 1;
     }
   else
     {
@@ -366,6 +441,27 @@
       # update the file or not.  In fact, the effect of `$force' is already
       # included in `$automake' via `--no-force'.
       xsystem ($automake);
+    }
+
+
+  # ------------------- #
+  # Rerunning aclocal.  #
+  # ------------------- #
+
+  # If we re-installed Libtool or Gettext, the macros might have changed.
+  if ($rerun_alocal)
+    {
+      if (!$uses_aclocal)
+       {
+         verbose "$configure_ac: not using aclocal";
+       }
+      else
+       {
+         xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t");
+         # aclocal may produce no output.
+         update_file ('aclocal.m4t', 'aclocal.m4')
+           if -f 'aclocal.m4t';
+       }
     }
 
 



reply via email to

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