您可以通過configure
---這可以是任何可執行的頂級腳本玩有些偷偷摸摸的技巧。如果你有它,也就不用擔心autoconf
(我應該補充說我非常喜歡那些工具)。
因此,configure
可以只是一個shell腳本,或者甚至是一個通過#!/usr/bin/Rscript
執行的R腳本,您可以在其中測試OS和/或編譯器。當且僅當星星對齊時加上-mpopcnt
,否則你不會。
而且,你是兼容的。
我的博客上講述的是同樣的想法,一旦in this post它有這個例子刪除一個C++ 14開關:
#!/bin/bash
## Travis can let us run R 3.4.0 (from CRAN and the PPAs) but this R version
## does not know about C++14. Even though we can select CXX_STD = C++14, R
## will fail as the version we use there was built in too old an environment,
## namely Ubuntu "trusty" 14.04.
##
## So we install g++-6 from another repo and rely on the fact that is
## defaults to C++14. Sadly, we need R to not fail and hence, just on
## Travis, remove the C++14 instruction
if [[ "${CI}" == "true" ]]; then
if [[ "${TRAVIS}" == "true" ]]; then
echo "** Overriding src/Makevars and removing C++14 on Travis only"
sed -i 's|CXX_STD = CXX14||' src/Makevars
fi
fi
您可以使用完全相同的邏輯添加要開關加。