Using autoconf on bear metal

Daniel Santos via Bug reports for autoconf <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
Hello all,

When using a toolchain w/o a libc, AC_PROG_CC fails with "cannot compile
executables" because the link fails with an unresolved reference to
"_exit".  While these types of embedded projects don't have much to
really configure, the rest of autotools can be very helpful.

So for "bear metal" (and I'm imagining a bear with an electric guitar
and head banging), I've found that this can be a work-around:

CC=${host}-gcc
m4_define([_AC_COMPILER_EXEEXT],[])
AC_PROG_CC

The first problem is that if I pass --host=arm-noen-eabi (misspeled) and
run w/o this, then configure succeeds, but only because it built my code
with the native compiler.  I would suggest this is a bug.

Redefining _AC_COMPILER_EXEEXT elides the check for building executables
(because we inherently cannot and shouldn't) and relies upon
_AC_COMPILER_OBJEXT for the actual validation.  The only side-effect is
a some-what misleading error message upon failure:

checking for suffix of object files... configure: error: in
`/home/daniel/proj/embedded/candleLight/fw/build/autotools':
configure: error: cannot compute suffix of object files: cannot compile

Sorry for all the spelling puns -- unless you were amused, in which case
well aren't I -annoying-, I mean clever?

Thanks,
Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.