]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: fix spurious failures due to missing 'yywrap()' function
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 24 Oct 2011 21:18:34 +0000 (23:18 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 25 Oct 2011 09:00:19 +0000 (11:00 +0200)
The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
the "lex library" expected to provide a `yywrap' function (function
which is required to link most lex-generated programs).  On the
contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
fail, configure declares that no lex library is needed, and simply
proceeds with the configuration process -- only for the build to
possibly fail later, at make time.

This behaviour is intended; the Autoconf manual reads:
 ``You are encouraged to use Flex in your sources, since it is
   both more pleasant to use than plain Lex and the C source it
   produces is portable.  In order to ensure portability, however,
   you must either provide a function `yywrap' or, if you don't use
   it (e.g., your scanner has no `#include'-like feature), simply
   include a `%noyywrap' statement in the scanner's source.''

This AC_PROG_LEX behaviour is causing some spurious failures of
the Automake testsuite in environments which lack a proper library
providing `yywrap' (this happens for example on Fedora-based
systems).   The proper workaround is to simply provide a fall-back
implementation of `yywrap' in our lexers.

See also partially-overlapping commit `v1.11-871-geb147a1' (from
the 'testsuite-work' branch), which was motivated by similar
spurious failures experienced when cross-compiling.

Reported by Jim Meyering:
<http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>

* tests/cond35.test: Provide a dummy `yywrap' function.
* tests/lex3.test: Likewise.
* tests/lexvpath.test: Likewise.
* tests/silent-lex-generic.test: Likewise.
* tests/silent-lex-gcc.test: Likewise.

ChangeLog
tests/cond35.test
tests/lex3.test
tests/lexvpath.test
tests/silent-lex-gcc.test
tests/silent-lex-generic.test

index 8dea9ebe2e0a5404769aae74b83dc953694bc6bb..a4b823fa01b83f1b5168678c34925a550b05ba01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2011-10-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures due to missing 'yywrap()' function
+
+       The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
+       the "lex library" expected to provide a `yywrap' function (function
+       which is required to link most lex-generated programs).  On the
+       contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
+       fail, configure declares that no lex library is needed, and simply
+       proceeds with the configuration process -- only for the build to
+       possibly fail later, at make time.
+
+       This behaviour is intended; the Autoconf manual reads:
+        ``You are encouraged to use Flex in your sources, since it is
+          both more pleasant to use than plain Lex and the C source it
+          produces is portable.  In order to ensure portability, however,
+          you must either provide a function `yywrap' or, if you don't use
+          it (e.g., your scanner has no `#include'-like feature), simply
+          include a `%noyywrap' statement in the scanner's source.''
+
+       This AC_PROG_LEX behaviour is causing some spurious failures of
+       the Automake testsuite in environments which lack a proper library
+       providing `yywrap' (this happens for example on Fedora-based
+       systems).   The proper workaround is to simply provide a fall-back
+       implementation of `yywrap' in our lexers.
+
+       See also partially-overlapping commit `v1.11-871-geb147a1' (from
+       the 'testsuite-work' branch), which was motivated by similar
+       spurious failures experienced when cross-compiling.
+
+       Reported by Jim Meyering:
+       <http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>
+
+       * tests/cond35.test: Provide a dummy `yywrap' function.
+       * tests/lex3.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise.
+
 2011-10-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix spurious failure with FreeBSD make and Yacc in VPATH
index c3c5f0bb593eca582c10e689524a70c72817d94f..776c9e144618ab6e6fe0e91e023b7dd1b2a4c341 100755 (executable)
@@ -59,6 +59,12 @@ test `grep tparse.h: Makefile.in | wc -l` = 1
 cat > tscan.l << 'END'
 %%
 "END"   return EOF;
+%%
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 cat > tparse.y << 'END'
index f7028646d9054da61a6f052448caf536faf1f183..4714472dcb47969881268a754591c12b63a37594 100755 (executable)
@@ -53,6 +53,12 @@ main ()
   else
     return 1;
 }
+
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 $ACLOCAL
index 300a476db7214a0bbee671823c717e120cd482db..65565f6767c843a9cba31fabfd1691b712423384 100755 (executable)
@@ -53,6 +53,11 @@ END
 
 cat > foo.c << 'END'
 int main () { return 0; }
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
 END
 
 $ACLOCAL
index a55f3580253cecc25694b0e7d898a31de10f9da8..5ab5ecd9e3920e25acb2d1d621f343ebed91fa18 100755 (executable)
@@ -55,6 +55,9 @@ cat > foo.l <<'EOF'
 "END"   return EOF;
 .
 %%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+int   main (void) { return 0; }
 EOF
 cp foo.l sub/bar.l
 
index a61969827bd6e3222007b4f69991778180e4e27a..582f529ff73e8e8c9d152c90fc4ea06509bfe06d 100755 (executable)
@@ -55,6 +55,9 @@ cat > foo.l <<'EOF'
 "END"   return EOF;
 .
 %%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+int   main (void) { return 0; }
 EOF
 cp foo.l sub/bar.l