]> sourceware.org Git - automake.git/commitdiff
2001-08-02 Richard Boulton <richard@tartarus.org>
authorTom Tromey <tromey@redhat.com>
Sat, 4 Aug 2001 04:02:40 +0000 (04:02 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 4 Aug 2001 04:02:40 +0000 (04:02 +0000)
* automake.in (variable_conditions_sub): Handle variable
substitution refs when computing conditions based on subvariable
conditions.  Fixes substitution refs of system variables when sub
variable is conditional.
(SUBST_REF_PATTERN): New global.
* tests/cond16.test: New file: regression test for variable
substitution refs.
* test/Makefile.am (TESTS): Added cond16.test.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/cond16.test [new file with mode: 0755]

index ef972401e27a2f17ad58db03a50ba1598e53ff78..20a78aa8cf68e3bf687859ecc23221c9d7bf9d62 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-08-02  Richard Boulton <richard@tartarus.org>
+
+       * automake.in (variable_conditions_sub): Handle variable
+       substitution refs when computing conditions based on subvariable
+       conditions.  Fixes substitution refs of system variables when sub
+       variable is conditional.
+       (SUBST_REF_PATTERN): New global.
+       * tests/cond16.test: New file: regression test for variable
+       substitution refs.
+       * test/Makefile.am (TESTS): Added cond16.test.
+
 2001-08-03  Tom Tromey  <tromey@redhat.com>
 
        * tests/substref.test: Require GNU make; backed out previous
index cecb270ffef34e95389b97c0311ca0839ff44fc2..ab50ebd6186a45f7eb8fc97c25f1fac070d3eed0 100755 (executable)
@@ -164,6 +164,10 @@ my $INCLUDE_PATTERN = ('^include\s+'
 my $AC_CONFIG_AUX_DIR_PATTERN = 'AC_CONFIG_AUX_DIR\(([^)]+)\)';
 my $AM_INIT_AUTOMAKE_PATTERN = 'AM_INIT_AUTOMAKE\([^,]*,([^,)]+)[,)]';
 my $AM_PACKAGE_VERSION_PATTERN = '^\s*\[?([^]\s]+)\]?\s*$';
+
+# This handles substitution references like ${foo:.a=.b}.
+my $SUBST_REF_PATTERN = "^([^:]*):([^=]*)=(.*)\$";
+
 # Note that there is no AC_PATH_TOOL.  But we don't really care.
 my $AC_CHECK_PATTERN = 'AC_(CHECK|PATH)_(PROG|PROGS|TOOL)\(\[?(\w+)';
 my $AM_MISSING_PATTERN = 'AM_MISSING_PROG\(\[?(\w+)';
@@ -5909,11 +5913,17 @@ sub variable_conditions_sub
            # Handle variable substitutions.
            if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
            {
+               my $varname = $1;
+               if ($varname =~ /$SUBST_REF_PATTERN/o)
+               {
+                   $varname = $1;
+               }
 
                # Here we compute all the conditions under which the
                # subvariable is defined.  Then we go through and add
                # $VCOND to each.
-               my @svc = &variable_conditions_sub ($1, $var);
+               my @svc = &variable_conditions_sub ($varname, $var);
                foreach my $item (@svc)
                {
                    my $val = conditional_string ($vcond, split (' ', $item));
@@ -6102,7 +6112,7 @@ sub value_to_list
 
            my ($from, $to);
            my @temp_list;
-           if ($varname =~ /^([^:]*):([^=]*)=(.*)$/)
+           if ($varname =~ /$SUBST_REF_PATTERN/o)
            {
                $varname = $1;
                $to = $3;
index 7932b2ce6678ba98257627ceb7504824fd9d8aef..3fcf63a9caee36245da1b986620ef9f7c088ce38 100644 (file)
@@ -67,6 +67,7 @@ cond10.test \
 cond11.test \
 cond12.test \
 cond13.test \
+cond16.test \
 condincl.test \
 condincl2.test \
 condlib.test \
index 542e78e8e539c4043524ce18e6d5778941b8fd38..3cc48ad65cf0a0debec0083a860a69b5c53e7627 100644 (file)
@@ -135,6 +135,7 @@ cond10.test \
 cond11.test \
 cond12.test \
 cond13.test \
+cond16.test \
 condincl.test \
 condincl2.test \
 condlib.test \
diff --git a/tests/cond16.test b/tests/cond16.test
new file mode 100755 (executable)
index 0000000..407185d
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+# Test for bug in conditionals in SOURCES with variable substitution references.
+# Report from Richard Boulton
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(hello.c)
+AM_INIT_AUTOMAKE(hello,0.23)
+AC_PROG_CC
+AM_CONDITIONAL(COND1, true)
+AC_OUTPUT(Makefile)
+END
+
+cat > hello.c << 'END'
+END
+
+cat > Makefile.am << 'END'
+
+if COND1
+var = foo.c
+else
+var = foo.c
+endif
+
+bin_PROGRAMS = hell
+hell_SOURCES = $(var:=)
+
+echorule:
+       @echo $(hell_SOURCES) $(hell_OBJECTS)
+
+END
+
+$needs_autoconf
+(gcc -v) > /dev/null 2>&1 || exit 77
+$needs_gnu_make
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+CC='gcc' ./configure
+
+val=`$MAKE --no-print-directory echorule`;
+echo $val
+test "x$val" = "xfoo.c foo.o"
This page took 0.039829 seconds and 5 git commands to generate.