autotools.mk: remove autom4ate.cache directory when autoreconf-ing
[openwrt/openwrt.git] / include / autotools.mk
1 #
2 # Copyright (C) 2007-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
9
10 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
11
12 # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
13 # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
14 define libtool_remove_files
15 find $(1) -name '*.la' | $(XARGS) rm -f;
16 endef
17
18 define autoreconf
19 (cd $(PKG_BUILD_DIR); \
20 $(patsubst %,rm -f %;,$(PKG_REMOVE_FILES)) \
21 if [ -x ./autogen.sh ]; then \
22 ./autogen.sh || true; \
23 elif [ -f ./configure.ac ] || [ -f ./configure.in ]; then \
24 [ -f ./aclocal.m4 ] && [ ! -f ./acinclude.m4 ] && mv aclocal.m4 acinclude.m4; \
25 [ -d ./autom4te.cache ] && rm -rf autom4te.cache; \
26 $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
27 -B $(STAGING_DIR)/host/share/aclocal \
28 $(patsubst %,-I %,$(PKG_LIBTOOL_PATHS)) $(PKG_LIBTOOL_PATHS) || true; \
29 fi \
30 );
31 endef
32
33 Hooks/InstallDev/Post += libtool_remove_files
34
35 ifneq ($(filter libtool,$(PKG_FIXUP)),)
36 PKG_BUILD_DEPENDS += libtool
37 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
38 Hooks/Configure/Pre += autoreconf
39 endif
40 endif
41
42 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
43 PKG_BUILD_DEPENDS += libtool
44 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
45 Hooks/Configure/Pre += autoreconf
46 endif
47 endif
48
49 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
50 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
51 Hooks/Configure/Pre += autoreconf
52 endif
53 endif