我的configure.ac是:
AC_PREREQ(2.69)
AC_INIT([mkbib], [2.1], [bnrj.rudra@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
问题是,在运行从此文件构建的./configure时,请检查 存在YACC(作为野牛,当AC_PROG_YACC之后的3行时,它 显示一元错误),但一旦检测到错误就不会退出。如, 跑步,它显示:
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
那么,我怎样才能让configure.ac停下来寻找遗失的野牛并做一些AC_MSG_ERROR
而不是创建一个不会被编译的Makefile?
AC_PROG_YACC
if test "x$YACC" = "xno"; then
AC_MSG_ERROR([Please install bison before installing.])
fi
所以,我是
答案 0 :(得分:1)
经过测试和检查。当没有找到野牛/ byacc / yacc时停止。
AC_PROG_YACC
if test x"$YACC" = "xyacc"; then
AC_CHECK_PROG([YACC_EXISTS], [yacc], [yes], [no])
if test x"$YACC_EXISTS" != xyes; then
AC_MSG_ERROR([[bison/byacc/yacc not found.
Please install bison]])
fi
fi
这是为了线程的完整性。
答案 1 :(得分:1)
这个问题的存在是因为autoconf sets LEX
to ':'
if it can't find a lex,因为假设生成的文件将被分发(通常是使用make dist
生成的tarball的情况,但是如果你直接生成tarball则不然)
所有这些其他解决方案似乎都假设$YACC
是'yacc'
,如果存在的话。也许是一个更通用的解决方案:
AC_PROG_YACC
AC_PATH_PROG(YACC_INST, $YACC)
if test -z "$YACC_INST"; then
AC_MSG_ERROR([yacc not found])
fi
答案 2 :(得分:0)
通过修复注释掉的代码,并添加更多代码:
my_YACC=$YACC
AC_PROG_YACC
if test -z "$my_YACC" -a x"$YACC" = x"yacc"; then
AC_MSG_ERROR([Please install bison/byacc before installing.])
fi
答案 3 :(得分:-1)
啊....对不起!这个问题已经解决了。
AC_PROG_YACC
if test "x$YACC" = "xno"; then
AC_MSG_ERROR([Please install bison before installing.])
fi