我的 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?
编辑:@ldav1s,比较字符串“bison -y”并不通用,因为 AC_PROG_YACC 同时检查 bison/byacc。所以,我在想是否可以在显示“否”时放置 AC_MSG_ERROR。所以寻找类似的东西:
AC_PROG_YACC
if test "x$YACC" = "xno"; then
AC_MSG_ERROR([Please install bison before installing.])
fi
我也是