Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/intltool/ChangeLog,v
retrieving revision 1.240
diff -u -r1.240 ChangeLog
--- ChangeLog	20 Apr 2002 16:28:51 -0000	1.240
+++ ChangeLog	1 May 2002 12:11:01 -0000
@@ -1,3 +1,15 @@
+2002-05-01  Abel Cheung  <maddog@linux.org.hk>
+
+	* intltool-update.in.in:
+	- Attempt to read configure.ac if configure.in is not found.
+	- Perform variable substitutions when determining package name.
+	(fixes #66155 and #78926)
+
+2002-03-13  Carlos Perelló Marín <carlos@gnome-db.org>
+
+	* intltool-update.in.in: We look also at AC_INIT to get the package
+	name.
+
 2002-04-20  Kenneth Rohde Christiansen  <kenneth@gnu.org>
 
 	* doc/I18N-HOWTO: Updated.
Index: intltool-update.in.in
===================================================================
RCS file: /cvs/gnome/intltool/intltool-update.in.in,v
retrieving revision 1.65
diff -u -r1.65 intltool-update.in.in
--- intltool-update.in.in	15 Apr 2002 20:25:18 -0000	1.65
+++ intltool-update.in.in	1 May 2002 12:11:01 -0000
@@ -560,6 +560,8 @@
     if ($base_dirname =~ /^po(-.+)?$/) {
         if (-f "../configure.in") {
             $conf_in = "../configure.in";
+	} elsif (-f "../configure.ac") {
+	    $conf_in = "../configure.ac";
         } else {
 	    my $makefile_source;
 	    local (*IN);
@@ -580,19 +582,33 @@
 	    $conf_in || die "Cannot find top_srcdir in Makefile."
         }
 
+	my %varhash = ();
         my $conf_source; {
            local (*IN);
-           local $/; # slurp mode
            open (IN, "<$conf_in") || die "can't open $conf_in: $!";
+           while (<IN>) {
+              if (/^(\w+)=(\S+)/) { $varhash{$1} = $2 };
+           }
+           seek (IN, 0, 0);
+           local $/; # slurp mode
            $conf_source = <IN>;
         }
 
 	my $name = "";
-	$name = $1 if $conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+)/m;
-	$name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=(\S+)/m;
-	if ($name =~ /^[\$](\S+)/) {
-            return $1 if $conf_source =~ /^\s*$1=(\S*)/m;
-        }
+	$name = $1 if $conf_source =~ /^AM_INIT_AUTOMAKE\(\[?([\$\w]+)/m;
+	if ($conf_source =~ /^AC_INIT\(\[?([\$\w]+)\]?\s*,/m) {
+	    $name = $1;
+	    $varhash{"AC_PACKAGE_NAME"} = $1;
+	}
+	$name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=([\$\w]+)/m;
+
+	$name = "\$AC_PACKAGE_NAME" if "$name" eq "AC_PACKAGE_NAME";
+
+	while ($name =~ /[\$](\w+)/) {
+	    if (exists $varhash{$1}) {
+		$name =~ s/[\$](\w+)/$varhash{$1}/;
+	    }
+	}
 	return $name if $name;
     }
 
