Index: NEWS
===================================================================
RCS file: /cvs/gnome/intltool/NEWS,v
retrieving revision 1.42
diff -u -r1.42 NEWS
--- NEWS	14 Jun 2004 09:40:25 -0000	1.42
+++ NEWS	14 Jun 2004 11:07:31 -0000
@@ -1,5 +1,7 @@
 Version 0.31
 
+* Support for running intltool-update without autoconf setup, or using
+  po/Makevars file (as used in gettext). 
 * New XML merging (compatible with pre-0.27.2 intltool) - bug
   #130802. (Danilo Segan)
 * Entity decoding and encoding is not done anymore for XML (part of
Index: intltool-update.in.in
===================================================================
RCS file: /cvs/gnome/intltool/intltool-update.in.in,v
retrieving revision 1.107
diff -u -r1.107 intltool-update.in.in
--- intltool-update.in.in	13 Jun 2004 00:25:46 -0000	1.107
+++ intltool-update.in.in	14 Jun 2004 11:07:37 -0000
@@ -857,7 +857,34 @@
 
     if ($base_dirname =~ /^po(-.+)?$/) 
     {
-	if (-f "../configure.ac") 
+	if (-f "Makevars") 
+	{
+	    my $makefile_source;
+
+	    local (*IN);
+	    open (IN, "<Makevars") || die "can't open Makevars: $!";
+
+	    while (<IN>) 
+	    {
+		if (/^top_builddir[ \t]*=/) 
+		{
+		    $src_dir = $_;
+		    $src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/;
+
+		    chomp $src_dir;
+                    if (-f "$src_dir" . "/configure.ac") {
+                        $conf_in = "$src_dir" . "/configure.ac" . "\n";
+                    } else {
+                        $conf_in = "$src_dir" . "/configure.in" . "\n";
+                    }
+		    last;
+		}
+	    }
+	    close IN;
+
+	    $conf_in || die "Cannot find top_builddir in Makevars.";
+	}
+	elsif (-f "../configure.ac") 
 	{
 	    $conf_in = "../configure.ac";
 	} 
@@ -870,7 +897,7 @@
 	    my $makefile_source;
 
 	    local (*IN);
-	    open IN, "<Makefile" || die "can't open Makefile: $!";
+	    open (IN, "<Makefile") || return;
 
 	    while (<IN>) 
 	    {
@@ -890,7 +917,7 @@
 	    $conf_in || die "Cannot find top_srcdir in Makefile.";
 	}
 
-	open (CONF, "<$conf_in") || die "can't open $conf_in: $!";
+	open (CONF, "<$conf_in");
     }
     else
     {
@@ -902,20 +929,21 @@
 
 sub FindPackageName
 {
+    my $version;
+    my $domain = &FindMakevarsDomain;
+    my $name = $domain || "untitled";
+
     &CONF_Handle_Open;
 
     my $conf_source; {
 	local (*IN);
-	open (IN, "<&CONF") || die "can't open configure.in/configure.ac: $!";
+	open (IN, "<&CONF") || return $name;
 	seek (IN, 0, 0);
 	local $/; # slurp mode
 	$conf_source = <IN>;
 	close IN;
     }
 
-    my $name = "untitled";
-    my $version;
-
     # priority for getting package name:
     # 1. GETTEXT_PACKAGE
     # 2. first argument of AC_INIT (with >= 2 arguments)
@@ -948,7 +976,9 @@
     # used in configure.in/ac without the '$'
     $name =~ s/AC_/\$AC_/g;
     $name =~ s/\$\$/\$/g;
-    
+
+    $name = $domain if $domain;
+
     $name = SubstituteVariable ($name);
     $name =~ s/^["'](.*)["']$/$1/;
 
@@ -960,17 +990,37 @@
 {
 
     my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_";
-    my $make_source; { 
+    my $varname = "XGETTEXT_OPTIONS";
+    my $make_source; {
 	local (*IN);
-	open (IN, "<Makefile.in.in") || return $keywords;
+	open (IN, "<Makevars") || (open(IN, "<Makefile.in.in") && ($varname = "XGETTEXT_KEYWORDS")) || return $keywords;
 	seek (IN, 0, 0);
 	local $/; # slurp mode
 	$make_source = <IN>;
 	close IN;
     }
 
-    # \s makes this not work, why?
-    $keywords = $1 if $make_source =~ /^XGETTEXT_KEYWORDS[ ]*=\[?([^\n\]]+)/m;
+    $keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m;
     
     return $keywords;
+}
+
+sub FindMakevarsDomain
+{
+
+    my $domain = "";
+    my $makevars_source; { 
+	local (*IN);
+	open (IN, "<Makevars") || return $domain;
+	seek (IN, 0, 0);
+	local $/; # slurp mode
+	$makevars_source = <IN>;
+	close IN;
+    }
+
+    $domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]]+)/m;
+    $domain =~ s/^\s+//;
+    $domain =~ s/\s+$//;
+    
+    return $domain;
 }
