我在系统中有一个脚本,我可能想要安装到我的安装目录中,但是我只想在发布模式下执行此操作。所以我有一个配置标志--enable-release
来控制它:
AC_ARG_ENABLE(release,
AC_HELP_STRING([--enable-release],
[enable release build, default: no]),
[case "${enableval}" in
yes) release=yes ;;
no) release=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-release]) ;;
esac],
[release=no])
if test "x$release" != xno; then
AC_DEFINE([PRODUCT_RELEASE], [1],
[Define if we are preparing a release build.])
fi
AM_CONDITIONAL([RELEASE], [test "x$release != xno"])
然后我有另一个配置标志,以便用户可以使用脚本路径指示configure:
AC_ARG_WITH(script-path,
AS_HELP_STRING(--with-script-path,[Path of script binaries]),
AC_SUBST(SCRIPTPATH,[$withval]))
AC_PATH_PROG([SMTSCRIPT], [cvc4], [no], [$SCRIPTPATH:$PATH])
if test "x$ac_cv_path_SMTSCRIPT" != xno; then
AC_DEFINE([HAVE_SCRIPT], [1],
[Define if we could find SMT script in path.])
if test "x$release" != xno; then
SMTSCRIPT_CPPFLAGS="-DSOLVERBIN=\"\\\"$ac_cv_path_SMTSCRIPT\\\"\""
else
SMTSCRIPT_CPPFLAGS="-DSCRIPTBIN=\"\\\"$bindir/cvc4\\\"\""
fi
AC_SUBST([SMTSCRIPT_CPPFLAGS])
fi
在Makefile.am中我尝试过:
dist_bin_SCRIPTS = $(top_srcdir)/scripts/asmWrapper.py $(top_srcdir)/scripts/live_bar.py
if RELEASE
dist_bin_SCRIPTS += $(SCRIPTPATH)/cvc4
endif
不幸的是,automake似乎忽略了我的if和dist_bin_SCRIPT
永远不会附加到cvc4的路径。
答案 0 :(得分:0)
事实证明,条件附加到dist_bin_SCRIPTS
的标签。这有效:
dist_bin_SCRIPTS = $(top_srcdir)/scripts/asmWrapper.py $(top_srcdir)/scripts/live_bar.py
if RELEASE
dist_bin_SCRIPTS += $(SCRIPTPATH)/cvc4
endif