In order to detect the architecture of the host where you build your
package with autoconf
we suggest the following setup:
- Prepare a directory
Library/Autoconf
in your source directory. - Copy the files
install-sh
,config.guess
andconfig.sub
shipped withautomake
. - Add the statement
AC_CONFIG_AUX_DIR([Library/Autoconf])
to yourconfigure.ac
. - Add the statement
AC_CANONICAL_BUILD()
to yourconfigure.ac
. - Analyse the content of the variables
build
, and its three individual partsbuild_cpu
,build_vendor
, andbuild_os
to map this triple to the architecture classification used by your package. - Use the
AC_SUBST
macro to define appropriately theARCHITECTURE_NATIVE
variable.
Architecture specific configuration files can be stored in the
directory pointed to by the variable PACKAGELIBRARYARCHITECTURE
whose
implicit value is ${SRCDIR}/Library/Configuration
.
If the variable ARCHITECTURE
is defined then a file
${ARCHITECTURE}.mk
containing architecture-specific settings must
exist in the architecture specific configuration file library. This
file is then processed by each module of the package. An error is
triggered if this file does not exist.
If a configuration is used and the variable
CONFIGURATION
is also defined, then a file
${CONFIGURATION}_${ARCHITECTURE}.mk
might exist in the directory
pointed to by the variable PACKAGELIBRARYCONFIGURATION
. This file is
optional.
If available, a cross-compiler can be used to cross-compile a package.
By repeatedly calling make build
with distinct values of
ARCHITECTURE
, the same package can be built for several
architectures.
To do so, we only need to be sure that the OBJDIR mechanism
is configured so that the variable ${ARCHITECTUREDIR}
is part of the
objdir-path and of DESTDIR
if we also use the install
target.
The command make display-architecture
prepares a report giving the
values of the variables used when handling architectures.