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?
相关问题
- X-I.: command not found, and failed to build certa
- Query pkg-config variable through autotools
- Build m4, autoconf, automake, libtool on unix
- How do I link a shared library with --as-needed wi
- Linking against external libraries in gstreamer pl
相关文章
- Autotools include path
- Automake Variables to tidy up Makefile.am
- argument order in cygwin gcc 4.3 matters when link
- automake Environment Variable Condition
- Adding a custom installation directory option to A
- Autoconf check for program and fail if not found
- How do I get rid of LD_LIBRARY_PATH at run-time?
- Correcting the GCC command line ordering using Aut
Of course it is. You can configure a default compiler in configure.ac and if the user wants to use another compiler, he (or she) can pass it to the
./configure
script.You'll find more about it here: How to use autotools.
The part that might be interesting for you is at the middle of the page:
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
in configure.ac before the invocation of AC_PROG_CC.
I would do this:
This will look for the compilers in the order specified, unless overridden with an argument to ./configure
Usually you can just run
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.