How do I get autotools to compile with the Intel compiler?
Solution 1
If you want to use a compiler other than gcc when you compile, pass 'CC=/path/to/compiler' as an argument to configure. (That is, run ./configure CC=/path. Do not use the form CC=/path ./configure.) If you want the default compiler to be something other than gcc, you can put
CC=${CC-/path/to/default/compiler}
in configure.ac before the invocation of AC_PROG_CC.
Solution 2
I would do this:
AC_PROG_CC([icc gcc])
This will look for the compilers in the order specified, unless overridden with an argument to ./configure
$ ./confgure CC=gcc
Solution 3
Usually you can just run
bash $ CC=icc ./configure
to use lcc, or any other compiler as the C compiler, provided the rest of the configure and build process doesn't use any gcc'ism.
Related videos on Youtube
Daisy Sophia Hollman
I have been involved in the ISO-C++ standard committee since 2016. He has been a part of a number of different papers in that time, including mdspan, atomic_ref, and—most prominently—executors and futures. Since finishing my Ph.D. in computational quantum chemistry at the University of Georgia in 2013, I have mostly worked on programming models for computational science, data science, and related fields. I joined Sandia National Labs in 2014 and have worked on several different programming models projects since then. I like to make computers do cool things. In addition to my work on C++, I like Python, Ruby, Markdown, Mathematica, and generally any other language that brings something interesting to the table.
Updated on June 04, 2022Comments
-
Daisy Sophia Hollman almost 2 years
I want my code to compile with the Intel compiler(s) or with gcc/g++ depending on a configure argument. Is this possible? What do I need to put in my configure.ac and Makefile.am files to make this happen?
-
William Pursell over 14 yearsIt is better to use: $ ./configure CC=icc. If you pass CC as an argument to configure then re-configuring with config-status will work. If you set CC in the environment, then it will not.
-
William Pursell almost 8 yearsThis is not a good approach. Use AC_PROG_CC as advised by freedrull instead.