[PATCH libXaw3d] lex and yacc: add error checking when yacc is missing

Gaetan Nadon memsize at videotron.ca
Fri Aug 26 06:40:48 PDT 2011


This configuration snippet is copied from app/twm and xgc.
It handles the case when yacc tool is missing but yacc generated code in the
tarball can be used.

Unlike other macros AC_PROG_YACC sets the YACC variable to "yacc"
as a last resort, even if no programs have been found.
Improve error checking by issuing an error message if yacc is not found.
The module cannot build anyway, unless from a published tarball.

If laygram.c is already there, do not abort the configuration
if yacc is missing as it is not needed.

If both generated code and yacc are missing, abort configuration.
Yacc is a required tool to build the package.

The test for YACC_INST is cross-compiling friendly.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 configure.ac |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 03ddb5b..d5b139a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,8 +8,6 @@ AC_CONFIG_SRCDIR([Makefile.am])
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
-AC_PROG_LEX
-AC_PROG_YACC
 
 # Initialize libtool
 AC_PROG_LIBTOOL
@@ -20,6 +18,16 @@ m4_ifndef([XORG_MACROS_VERSION],
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
+# Set-up Lex and Yacc, generated code is distributed 
+AC_PROG_YACC
+AC_PATH_PROG([YACC_INST], $YACC)
+if test ! -f "$srcdir/src/laygram.c"; then
+   if test -z "$YACC_INST"; then
+      AC_MSG_ERROR([yacc not found - unable to compile laygram.y])
+   fi
+fi
+AC_PROG_LEX
+
 # Checks for header files.
 PKG_CHECK_MODULES(X11, [x11 xt xmu])
 AC_CHECK_HEADERS([wctype.h wchar.h widec.h])
-- 
1.7.4.1



More information about the xorg-devel mailing list