【问题标题】:How to use HAVE_BOOST in ax_boost_base如何在 ax_boost_base 中使用 HAVE_BOOST
【发布时间】:2021-09-12 10:17:13
【问题描述】:

ax_boost_base page 表示它设置了 HAVE_BOOST。所以我在我的 configure.ac 文件中尝试了它:

AX_BOOST_BASE([1.48],, [AC_MSG_ERROR([libfoo needs Boost, but it was not found in your system])])
AC_MSG_NOTICE(["HAVE_BOOST value"])
AC_MSG_NOTICE([$HAVE_BOOST])

当我运行configure 时,HAVE_BOOST 似乎没有任何价值:

checking for boostlib >= 1.48 (104800)... yes
configure: "HAVE_BOOST value"
configure:

如何在我的 configure.ac 中使用这个 HAVE_BOOST?具体来说,如果设置了 HAVE_BOOST,我想将一个文件附加到我的 AC_OUTPUT 中。例如,如果没有设置 HAVE_BOOST,那么我想要:

AC_OUTPUT([
Makefile 
include/Makefile
comm/Makefile
ordinary_app/Makefile
])

但是如果设置了 HAVE_BOOST,那么我想要这个:

AC_OUTPUT([
Makefile 
include/Makefile
comm/Makefile
ordinary_app/Makefile
boost_enabled_app/Makefile

【问题讨论】:

    标签: c++ boost makefile configure


    【解决方案1】:

    您错过了将结果设置回某个变量。你可以试试这个

    AX_BOOST_BASE([1.48],
    [have_boost=yes],
    [AC_MSG_ERROR([libfoo needs Boost, but it was not found in your system])]
    )
    AC_MSG_NOTICE(["have_boost value"])
    AC_MSG_NOTICE([$have_boost])
    

    HAVE_BOOST 在 m4 宏 ax_boost_base 中设置,使用将在 config.h 中生成的 AC_DEFINE。它不是一个 shell 变量。 最终你可以使用 var $have_boost 来得到你想要的

    if test "$have_boost" != yes; then
        AC_OUTPUT([
        Makefile 
        include/Makefile
        comm/Makefile
        ordinary_app/Makefile
        ])
    else
        AC_OUTPUT([
        Makefile 
        include/Makefile
        comm/Makefile
        ordinary_app/Makefile
        boost_enabled_app/Makefile
        ])
    fi
    

    【讨论】:

      猜你喜欢
      • 2014-01-24
      • 2014-03-27
      • 1970-01-01
      • 2014-11-02
      • 2021-06-04
      • 2017-01-30
      • 2016-10-01
      • 2018-02-20
      • 2017-09-10
      相关资源
      最近更新 更多