[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.6.2 Target Library Configure Scripts

There are a few things you must know in order to write a configure script for a target library. This is just a quick sketch, and beginners shouldn't worry if they don't follow everything here.

The target libraries are configured and built using a newly built target compiler. There may not be any startup files or libraries for this target compiler. In fact, those files will probably be built as part of some target library, which naturally means that they will not exist when your target library is configured.

This means that the configure script for a target library may not use any test which requires doing a link. This unfortunately includes many useful autoconf macros, such as `AC_CHECK_FUNCS'. autoconf macros which do a compile but not a link, such as `AC_CHECK_HEADERS', may be used.

This is a severe restriction, but normally not a fatal one, as target libraries can often assume the presence of other target libraries, and thus know which functions will be available.

As of this writing, the autoconf macro `AC_PROG_CC' does a link to make sure that the compiler works. This may fail in a target library, so target libraries must use a different set of macros to locate the compiler. See the `configure.in' file in a directory like `libiberty' or `libgloss' for an example.

As noted in the previous section, target libraries are sometimes built in directories which are siblings to the host tools, and are sometimes built in a subdirectory. The `--with-target-subdir' configure option will be passed when the library is configured. Its value will be an empty string if the target library is a sibling. Its value will be the name of the subdirectory if the target library is in a subdirectory.

If the overall build is not a native build (i.e., the overall configure used the `--target' option), then the library will be configured with the `--with-cross-host' option. The value of this option will be the host system of the overall build. Recall that the host system of the library will be the target of the overall build. If the overall build is a native build, the `--with-cross-host' option will not be used.

A library which can be built both standalone and as a target library may want to install itself into different directories depending upon the case. When built standalone, or when built native, the library should be installed in `$(libdir)'. When built as a target library which is not native, the library should be installed in `$(tooldir)/lib'. The `--with-cross-host' option may be used to distinguish these cases.

This same test of `--with-cross-host' may be used to see whether it is OK to use link tests in the configure script. If the `--with-cross-host' option is not used, then the library is being built either standalone or native, and a link should work.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html