For PR automake/220:
authorTom Tromey <tromey@redhat.com>
Sun, 30 Dec 2001 20:07:36 +0000 (20:07 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 30 Dec 2001 20:07:36 +0000 (20:07 +0000)
* tests/Makefile.am (TESTS): Added pr220.test.
* tests/pr220.test: New file.
* m4/cond.m4 (AM_CONDITIONAL): Cause config.status to fail if
conditional was never run.

ChangeLog
m4/cond.m4
tests/Makefile.am
tests/Makefile.in
tests/pr220.test [new file with mode: 0755]

index 952e9ec..bd03a8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2001-12-30  Tom Tromey  <tromey@redhat.com>
 
+       For PR automake/220:
+       * tests/Makefile.am (TESTS): Added pr220.test.
+       * tests/pr220.test: New file.
+       * m4/cond.m4 (AM_CONDITIONAL): Cause config.status to fail if
+       conditional was never run.
+
        For PR automake/260:
        * lib/depcomp (tru64): Correctly handle libtool case.
        From doreille@smr.ch.
index 21537a4..04ca58f 100644 (file)
@@ -35,4 +35,9 @@ if $2; then
 else
   $1_TRUE='#'
   $1_FALSE=
-fi])
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([conditional \"$1\" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
index d3ffdd4..f5d82ec 100644 (file)
@@ -239,6 +239,7 @@ pluseq7.test \
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr220.test \
 pr266.test \
 pr279.test \
 pr279-2.test \
index e166e5c..32266a2 100644 (file)
@@ -312,6 +312,7 @@ pluseq7.test \
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr220.test \
 pr266.test \
 pr279.test \
 pr279-2.test \
diff --git a/tests/pr220.test b/tests/pr220.test
new file mode 100755 (executable)
index 0000000..c151201
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+# Test for PR automake/220.
+. $srcdir/defs || exit 1
+
+cat >main.c <<EOF
+int main() { return 0; }
+EOF
+
+cat > Makefile.am << 'EOF'
+if NEVER_TRUE
+NEVER_DEFINED = missingfile.c
+endif
+
+bin_PROGRAMS = main
+main_SOURCES = main.c $(NEVER_DEFINED)
+EOF
+
+cat > configure.in << 'EOF'
+AC_INIT(main.c)
+AM_INIT_AUTOMAKE(test_am, 1.0)
+AC_PROG_CC
+AC_ARG_ENABLE(foo,
+[  --enanble-foo          Enable foo],
+[ if test "foo" = "bar" ; then
+    AM_CONDITIONAL(NEVER_TRUE, true)
+  else
+    AM_CONDITIONAL(NEVER_TRUE, false)
+  fi
+])
+AC_OUTPUT(Makefile)
+EOF
+
+# Fail gracefully if no gcc.
+(gcc -v) > /dev/null 2>&1 || exit 77
+
+touch README NEWS AUTHORS ChangeLog
+
+mkdir build
+
+$ACLOCAL \
+   && $AUTOCONF \
+   && $AUTOMAKE -a || exit 1
+
+cd build
+# configure should fail since we've done something invalid.
+CC='gcc' ../configure && exit 1
+exit 0