From aaa7de6f16d2f36b2ef9fd30a77abb7cd697ea5d Mon Sep 17 00:00:00 2001 From: Gaetan Nadon Date: Fri, 26 Aug 2011 08:43:28 -0400 Subject: lex and yacc: add error checking when yacc is missing 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 --- configure.ac | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 03ddb5b..28decd4 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]) -- cgit v1.2.3