Search code examples
cross-compilingautoconf

How to get "build" and "target" C compiler with autoconf


In a cross environment, AC_PROG_CC finds the name of the target C compiler. In my setup I need to build some tools which run on the build machine, not on the target, so I also need a build system C compiler. I wonder if there is something like AC_PROG_CC to find the name of the build C compiler and also to set proper CFLAGS and linker flags.

Or should I have a separate configure file for the tools which run on the host and call autoconf recursively?

Many thanks for sharing your insights in this!


Solution

  • In my setup I need to build some tools which run on the build machine, not on the target, so I also need a build system C compiler. I wonder if there is something like AC_PROG_CC to find the name of the build C compiler and also to set proper CFLAGS and linker flags.

    AX_PROG_CC_FOR_BUILD is probably what you need since you want to set CFLAGS.

    Or should I have a separate configure file for the tools which run on the host and call autoconf recursively?

    That's sort of what AX_PROC_CC_FOR_BUILD does.