]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix conditional rules competing with config.status rules.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 17 Jun 2008 22:16:25 +0000 (00:16 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 17 Jun 2008 22:16:25 +0000 (00:16 +0200)
* automake.in (handle_configure): Teach targets about the
conditional config.status rule.
* tests/cond39.test: Adjust test to expose this.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
automake.in
tests/cond39.test

index 927437de0ad7cf4b34051e8567564fd3a923c13c..0742b758245cc2565698f10e5c4d5aac04270ef3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-06-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix conditional rules competing with config.status rules.
+       * automake.in (handle_configure): Teach targets about the
+       conditional config.status rule.
+       * tests/cond39.test: Adjust test to expose this.
+
        For AC_CONFIG_LINKS(X,X), do not clean X in a non-VPATH build.
        * automake.in (rewrite_inputs_into_dependencies): Do distribute
        inputs where input and output name are equal.  This relies on
index dc431feeb5a4c39d830a56fded27b86642fe5222..c49045fb9a9408b8f1611e2f8473db51393df918 100755 (executable)
@@ -4201,8 +4201,13 @@ sub handle_configure ($$$@)
       next if (substitute_ac_subst_variables $local) =~ /\$/;
 
       my $condstr = '';
-      $condstr = $ac_config_files_condition{$lfile}->subst_string
-        if ($ac_config_files_condition{$lfile});
+      my $cond = $ac_config_files_condition{$lfile};
+      if (defined $cond)
+        {
+         $condstr = $cond->subst_string;
+         Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond,
+                                 $ac_config_files_location{$file});
+        }
       $output_rules .= ($condstr . $local . ': '
                        . '$(top_builddir)/config.status '
                        . "@rewritten_inputs\n"
index 93f0363fd114b2cf18322bc5b71167b94879cddd..1431ed11e75312d56dea83162b3495ab776c491d 100755 (executable)
 . ./defs
 set -e
 
+mkdir sub
+
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_CONDITIONAL([COND], [test "$COND" = true])
 AM_COND_IF([COND], [],
-          [AC_CONFIG_FILES([prog], [chmod 755 prog])])
+          [AC_CONFIG_FILES([prog1], [chmod 755 prog1])
+           AC_CONFIG_FILES([sub/prog2], [chmod 755 sub/prog2])])
+AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
+SUBDIRS = sub
 if COND
-bin_PROGRAMS = prog
-prog_SOURCES = prog.c
+bin_PROGRAMS = prog1
+prog1_SOURCES = prog.c
 else
-# FIXME: the next line is still needed to get automake to output the
-# bin_PROGRAMS above in the right condition only.
-prog:
-bin_SCRIPTS = prog
-CLEANFILES = prog
+bin_SCRIPTS = prog1
+CLEANFILES = prog1
+endif
+
+sure-exist:
+       test -f prog1 || test -f prog1$(EXEEXT)
+       test -f sub/prog2 || test -f sub/prog2$(EXEEXT)
+
+sure-not-exist:
+       test ! -f prog1 && test ! -f prog1$(EXEEXT)
+       test ! -f sub/prog2 && test ! -f sub/prog2$(EXEEXT)
+END
+
+cat >sub/Makefile.am <<'END'
+if COND
+bin_PROGRAMS = prog2
+prog2_SOURCES = prog.c
+else
+bin_SCRIPTS = prog2
+CLEANFILES = prog2
 endif
 END
 
@@ -48,12 +68,15 @@ cat >prog.c <<'END'
 int main () { return 42; }
 END
 
-cat >prog.in <<'END'
+cat >prog1.in <<'END'
 #! /bin/sh
 bindir='@bindir@'
 echo "hi, this is $0, and bindir is $bindir"
 END
 
+cp prog.c sub
+cp prog1.in sub/prog2.in
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
@@ -62,17 +85,25 @@ $AUTOMAKE --add-missing
 $MAKE 2>stderr
 cat stderr
 grep 'overriding commands' stderr && exit 1
-./prog && exit 1
+$MAKE sure-exist
+./prog1 && exit 1
+./sub/prog2 && exit 1
 $MAKE clean
+$MAKE sure-not-exist
 $MAKE
-./prog && exit 1
+$MAKE sure-exist
+./prog1 && exit 1
+./sub/prog2 && exit 1
 $MAKE distclean
 
 ./configure COND=false
 $MAKE 2>stderr
 cat stderr
 grep 'overriding commands' stderr && exit 1
-./prog
+./prog1
+./sub/prog2
 $MAKE clean
+$MAKE sure-not-exist
 $MAKE
-./prog
+./prog1
+./sub/prog2