[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sr #107986] autoconf should reject or specifically warn about obvio

From: David A. Wheeler
Subject: Re: [sr #107986] autoconf should reject or specifically warn about obviously wrong configure.ac files
Date: Sun, 18 Mar 2012 14:06:27 -0400 (EDT)

Eric Blake said:
> Follow-up Comment #1, sr #107986 (project autoconf):
> 1. AC_INIT is essential, AC_OUTPUT is optional but useful; and makes the most
> sense if any AC_CONFIG_ were used.  It's probably possible to wire up
> something along those lines (for AC_INIT: have the autoconf driver trace
> AC_INIT, and error out if the trace was not present; ... Patches welcome.

Okay, below is a git format-patch for AC_INIT as described above.  With this 
patch, if "autoconf" is invoked using an empty "configure.ac" (for example), it 
correctly fails and reports:
  autoconf: error: Failed to use AC_INIT in the input file configure.ac.

HOWEVER, autoreconf seems to ignore and hide ALL errors returned by autoconf, 
including this one, so "autoreconf -i" doesn't error out as I expected.  That 
behavior seems fundamentally wrong.  Is that the *expected* behavior?  Or am I 
missing something obvious?

--- David A. Wheeler


From fa2c21b986684fb4620b38d744487610849612af Mon Sep 17 00:00:00 2001
From: "David A. Wheeler" <address@hidden>
Date: Sun, 18 Mar 2012 14:02:29 -0400
Subject: [PATCH] autoconf: Fail if AC_INIT not used

 bin/autoconf.as |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/bin/autoconf.as b/bin/autoconf.as
index aa85394..48dc105 100644
--- a/bin/autoconf.as
+++ b/bin/autoconf.as
@@ -183,6 +183,14 @@ esac
 # Unless specified, the output is stdout.
 test -z "$outfile" && outfile=-

+# Check to ensure there is an AC_INIT, via autom4te's tracing capabilities.
+eval set x "$autom4te_options" \
+  --language=autoconf --output=\"-\" "--trace=AC_INIT" \"\$infile\"
+if test -z "$traces"  && test -z "`"$AUTOM4TE" "$@"`" ; then
+  AS_ERROR([Failed to use [AC_INIT] in the input file $[]infile.])
 # Run autom4te with expansion.
 eval set x "$autom4te_options" \
   --language=autoconf --output=\"\$outfile\" "$traces" \"\$infile\"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]