host-autotools-package = $(call inner-autotools-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
################################################################################
# Autotools package infrastructure
# This file implements an infrastructure that eases development of
# package .mk files for autotools packages. It should be used for all
# packages that use the autotools as their build system.
# See the Buildroot documentation for details on the usage of this
# In terms of implementation, this autotools infrastructure requires
# the .mk file to only specify metadata information about the
# package: name, version, download URL, etc.
# We still allow the package .mk file to override what the different
# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
# already defined, it is used as the list of commands to perform to
# build the package, instead of the default autotools behaviour. The
# package can also define some post operation hooks.
################################################################################
# Utility function to upgrade config.sub and config.guess files
# argument 1 : directory into which config.guess and config.sub need
# to be updated. Note that config.sub and config.guess are searched
# recursively in this directory.
for file in config.guess config.sub; do \
for i in $$(find $(1) -name $$file); do \
cp support/gnuconfig/$$file $$i; \
# This function generates the ac_cv_file_<foo> value for a given
# filename. This is needed to convince configure script doing
# AC_CHECK_FILE() tests that the file actually exists, since such
# tests cannot be done in a cross-compilation context. This function
# takes as argument the path of the file. An example usage is:
# $(call AUTOCONF_AC_CHECK_FILE_VAL,/dev/random)=yes
AUTOCONF_AC_CHECK_FILE_VAL = ac_cv_file_$(subst -,_,$(subst /,_,$(subst .,_,$(1))))
# Hook to update config.sub and config.guess if needed
define UPDATE_CONFIG_HOOK
@$(call MESSAGE,"Updating config.sub and config.guess")
$(call CONFIG_UPDATE,$(@D))
# Hook to patch libtool to make it work properly for cross-compilation
define LIBTOOL_PATCH_HOOK
@$(call MESSAGE,"Patching libtool")
$(Q)for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \