autotools.mk: add yet another aclocal path
[openwrt/staging/chunkeey.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 PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
10 PKG_REMOVE_FILES?=aclocal.m4
11
12 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
13
14 # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
15 # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
16 define libtool_remove_files
17 find $(1) -name '*.la' | $(XARGS) rm -f;
18 endef
19
20 define autoreconf
21 (cd $(PKG_BUILD_DIR); \
22 $(patsubst %,rm -f %;,$(PKG_REMOVE_FILES)) \
23 $(foreach p,$(PKG_AUTOMAKE_PATHS), \
24 if [ -x $(p)/autogen.sh ]; then \
25 $(p)/autogen.sh || true; \
26 elif [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
27 [ -f $(p)/aclocal.m4 ] && [ ! -f $(p)/acinclude.m4 ] && mv aclocal.m4 acinclude.m4; \
28 [ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
29 $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
30 -B $(STAGING_DIR_HOST)/share/aclocal \
31 -B $(STAGING_DIR)/host/share/aclocal \
32 -B $(STAGING_DIR)/usr/share/aclocal \
33 $(patsubst %,-I %,$(PKG_LIBTOOL_PATHS)) $(PKG_LIBTOOL_PATHS) || true; \
34 fi; \
35 ) \
36 );
37 endef
38
39 Hooks/InstallDev/Post += libtool_remove_files
40
41 ifneq ($(filter libtool,$(PKG_FIXUP)),)
42 PKG_BUILD_DEPENDS += libtool
43 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
44 Hooks/Configure/Pre += autoreconf
45 endif
46 endif
47
48 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
49 PKG_BUILD_DEPENDS += libtool
50 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
51 Hooks/Configure/Pre += autoreconf
52 endif
53 endif
54
55 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
56 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
57 Hooks/Configure/Pre += autoreconf
58 endif
59 endif