[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RTEMS/autoconf



Hi,

I've encountered a very nasty problem with RTEMS and its interaction
with autoconf:

In brief:

Most autoconfiscated packages can *not* be built with RTEMS, because
RTEMS has "main" in its libraries.


In detail:

Autoconf uses a m4-macro called AC_TRY_LINK when checking for
library-symbols. In conjunction with other macros (e.g. AC_CHECK_FUNCS),
this macro is used to link pieces of c-code containing declarations of
symbols and a "main"-function.

E.g. to check for presence of "strdup", such a piece of c-code looks
similar to the fragment below:

char* strdup();
void main( )
{
  strdup();
}

If linking succeeds, this indicates a symbol is present on an OS and can
be used for configuration of a package.


RTEMS has "main" in its libraries, therefore any attempt to link a piece
of code like the example above will fail (duplicate symbol "main").
Autoconf interprets this as "symbol not present", thus indicating a
feature can not be used for the package to be configured.

=> All packages applying autoconf and exploiting AC_TRY_LINK are doomed
to deliver invalid configuration results. (There are even more autoconf
related problems, but this one is 100% fatal.)

A real showstopper, IMO.


To work around this problem, I can imagine a few solutions:
1. Removing "main" from RTEMS libraries (implies major redesign of rtems
internals and application code!)
2. Applying target-specific, probably linker dependent and non-portable
linker trickery (implies additional trouble with autoconf and Makefiles
in general)
3. Patching autoconf, i.e. supplying our own patched set of macros to
override autoconf's default macros (This is what we do for RTEMS
itself).
4. Trying to get it offically fixed in autoconf (Some thing like, if
"main" is in system-libraries then rename the main function generated by
autoconf to another non-proprietary entry point, eg. _exit or similar)


Opinions? Proposals?

Ralf

--
Ralf Corsepius
Forschungsinstitut fuer Anwendungsorientierte Wissensverarbeitung (FAW)
Helmholtzstr. 16, 89081 Ulm, Germany     Tel: +49/731/501-8690
mailto:corsepiu at faw.uni-ulm.de           FAX: +49/731/501-999
http://www.faw.uni-ulm.de