【问题标题】:How do I save ./configure command line build options?如何保存 ./configure 命令行构建选项?
【发布时间】:2017-12-31 14:24:46
【问题描述】:

我正在通过运行构建程序

./configure --example-option-1 --example-option-2 --etc

然后

make && make install

有没有办法保存那些./configure 选项,以便下次我运行./configure 时默认应用它们?

也就是说,稍后我可能想运行

./configure --example-option-3

并且之前保存的选项也适用。或者更好的是,将--example-option-3 添加到同一个“选项文件”中,然后再次运行./configure

【问题讨论】:

    标签: makefile configure


    【解决方案1】:

    您可以通过xargs 来实现这一点,该xargs 从标准输入中获取要执行的命令的参数。

    用于将配置保存到文件config

    echo --example-option-1 --example-option-2 --etc | tee config | xargs ./configure
    

    也就是说,文件config 将包含在echo 的命令行中给出的参数:

    $ cat config
    --example-option-1 --example-option-2 --etc
    

    用于从此文件config检索保存的配置:

    cat config | xargs ./configure
    

    也就是说,./configure 将使用通过xargs 在标准输入处获得的参数执行。

    如果稍后,您想应用保存的配置和附加选项--example-option-3,则:

    cat config | xargs ./configure --example-option-3
    

    【讨论】:

      【解决方案2】:

      您没有确切说明为什么要重新运行 configure,而只是指出 configure 创建了一个 config.status 脚本。该脚本将使用您最初提供的配置选项重新创建所有模板文件。

      您还可以使用 config.status --recheck 命令重新运行 configure,使用与最初提供的相同的命令行选项集。

      当然,如果您使用 automake,生成的 makefile 将包含在任何模板或 configure.ac 被修改时自动更新所有这些文件的规则,因此您不必手动进行;只需运行make

      因此,如果您已经配置了目录,则不需要任何特殊的东西来使用相同的参数重做配置。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多