Discussion:
flex and bison in autoconf
Rudra Banerjee
2013-05-29 19:25:41 UTC
Permalink
Hello friends,
My configure.ac is:

AC_PREREQ(2.69)
AC_INIT([mkbib], [2.1], [***@yahoo.com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 subdir-objects foreign])

# Checks for programs.
AC_PROG_CC

AC_PROG_YACC
#if test x"$YACC" != x"yes"; then
# AC_MSG_ERROR([Please install bison before installing.])
#fi
AC_PROG_LEX
if test "x$LEX" != xflex; then
AC_MSG_ERROR([Please install flex before installing.])
fi

AC_CONFIG_MACRO_DIR([m4])
GNOME_DOC_INIT

# Compiling sources with per-target flags requires AM_PROG_CC_C_O
AM_PROG_CC_C_O
AC_PROG_INSTALL

#AC_PROG_LIBTOOL
PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4 >= 2.26)
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)

AM_PATH_GTK_3_0([3.4.0],,AC_MSG_ERROR([Gtk+ 3.0.0 or higher required.]))

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
help/Makefile
])
AC_OUTPUT

The problem is, while running ./configure built from this file, do check
existence of YACC (as bison, when the 3 line following AC_PROG_YACC, it
is showing unary error), but is not exiting once error is detected. As,
the run, it shows:
checking for bison... no
checking for byacc... no

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating help/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

So, how can I make configure.ac to stop for missing bison ?
Andrejs Cainikovs
2013-11-29 13:37:51 UTC
Permalink
Hi,
Post by Rudra Banerjee
AC_PROG_YACC
#if test x"$YACC" != x"yes"; then
# AC_MSG_ERROR([Please install bison before installing.])
#fi
AC_PROG_LEX
if test "x$LEX" != xflex; then
AC_MSG_ERROR([Please install flex before installing.])
fi
...
Post by Rudra Banerjee
The problem is, while running ./configure built from this file, do check
existence of YACC (as bison, when the 3 line following AC_PROG_YACC, it
is showing unary error), but is not exiting once error is detected. As,
checking for bison... no
checking for byacc... no
Obviously, your check is wrong, YACC is never set to 'yes'. Have a
peek into autoconf manual to figure out by yourself:
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Particular-Programs.html#Particular-Programs

Regards,
Andrejs Cainikovs.

Loading...