autoconf help
Ralf Corsepius
corsepiu at faw.uni-ulm.de
Sat Jan 19 04:52:13 UTC 2002
Am Fre, 2002-01-18 um 19.28 schrieb Glen Cornell:
> I'm trying to incorporate the xfree86 loader into the rtems tree at the
> location:
>
> c/src/libmisc/loader
>
> I've managed to create a Makefile.ac that uses conditionals to support the
> target object file formats such as in the example below:
>
> if elf_loader
> # Using the elf loader:
> ELF_SRCS = elfloader.c
> ELF_FLAGS = -DELF_SUPPORT
> endif
>
> My question is that how do I set up the conditional in my configure.in script?
> How do I know what object file formats are supported by the cross compiler?
IMO, the actual question you are looking for is
"Does the currently used toolchain apply elf?"
> I > thought that this might be a starting point:
>
> AM_CONDITIONAL(elf_loader, i386-rtems-objdump --info | grep elf)
Here, you are trying to analyze if objdump supports elf.
This actually is irrelevant wrt. the question above, because several
targets can support several different object-formats and because objdump
might also not be available for a given target.
I.e. while objdump --info might report to support elf, CC actually could
be using a different object format.
> Is there an easier/better way?
I am not aware about any general autoconf-check for this purpose. May-be
you might want to ask the autoconf list (autoconf at gnu.org) on this
topic.
What could be done wrt. RTEMS is to patch gcc to let rtems-gccs provide
a preprocessor symbol for using elf, similar to what gcc does for Linux:
Linux's gcc provides -D__ELF__, which can be applied in autoconf-macros
to checking for using ELF this way:
AC_MSG_CHECKING([for elf])
AC_TRY_COMPILE([],
[#ifndef __ELF__
choke me
#endif],
[rtems_cv_elf=yes],
[rtems_cv_elf=no])
AC_MSG_RESULT([$rtems_cv_elf])
As a temporary work-around and for testing you could simply add
-D__ELF__ to your gcc's spec's *predefines:-rule to avoid having to
patch gcc:
..
/opt/rtems/lib/gcc-lib/<target>-rtems/<version>/specs
*predefines:
... -D__ELF__ ...
..
> One last question, how do I specify the proper cross objdump to use?
Inside of RTEMS configure.acs it normally is contained in a shell
variable called ${OBJDUMP}
I.e. you can use ${OBJDUMP} inside of RTEMS's configure.acs.
But also note, that OBJDUMP is considered to be an optional tool and
therefore might also not be present in particular cases.
Other approaches would be to
1. Leave the decision to the user and add a --enable-... option to
libmisc/configure.ac
2. Hard-code the ability to support your work into configure.ac or into
a RTEMS-specific autoconf macro.
I.e. base the decision on the contents of $host and map it into
"SUPPORTS_ELF" - I don't like this approach, but it would be a feasible
and easily implementable work-around to get things (and you) going.
Ralf
More information about the users
mailing list