如何使用英特尔编译器编译autotools?

Dav*_*man 9 automake autoconf autotools

我希望我的代码可以使用英特尔编译器或gcc/g ++进行编译,具体取决于configure参数.这可能吗?我需要在configure.ac和Makefile.am文件中放置什么来实现这一目标?

fre*_*ull 13

我会这样做:

AC_PROG_CC([icc gcc])
Run Code Online (Sandbox Code Playgroud)

这将按指定的顺序查找编译器,除非使用./configure的参数覆盖

$ ./confgure CC=gcc
Run Code Online (Sandbox Code Playgroud)


Wil*_*ell 11

如果要在编译时使用gcc以外的编译器,请将'CC =/path/to/compiler'作为参数传递给configure.(也就是说,运行./configure CC =/path.不要使用CC =/path ./configure形式.)如果你想让默认编译器不是gcc,你可以放

CC=${CC-/path/to/default/compiler}

在调用AC_PROG_CC之前的configure.ac中.