summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2011-08-26 08:43:28 -0400
committerGaetan Nadon <memsize@videotron.ca>2011-09-01 13:38:44 -0400
commitaaa7de6f16d2f36b2ef9fd30a77abb7cd697ea5d (patch)
treef137329352dc70b4ab516ce34acc502e2f8478ca /configure.ac
parent25f85dd2171e3c0810a5555c99e7fe3870566f0a (diff)
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 <memsize@videotron.ca>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files 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])