【问题标题】:Conditionally copying script from system to install directory有条件地从系统复制脚本到安装目录
【发布时间】:2015-07-01 10:12:31
【问题描述】:

我在系统中有一个脚本,我可能想将它安装到我的安装目录中,但是我只想在发布模式下执行此操作。所以我有一个配置标志--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"])

然后我有另一个配置标志,以便用户可以使用脚本的路径来指示配置:

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 的路径。

【问题讨论】:

  • 副手它看起来很合理,尽管我认为您不希望将“dist_”用于显然不属于您的项目的脚本。我将首先查看 Makefile 以了解 RELEASE 是如何定义的。

标签: autoconf automake


【解决方案1】:

原来的问题是条件附加到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

【讨论】:

    猜你喜欢
    • 2020-07-10
    • 1970-01-01
    • 1970-01-01
    • 2013-06-09
    • 2015-05-29
    • 2016-04-03
    • 1970-01-01
    相关资源
    最近更新 更多