[include] autotools.mk: support autoreconf at different paths, introduce PKG_AUTOMAKE...
[openwrt/svn-archive/archive.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 $(patsubst %,-I %,$(PKG_LIBTOOL_PATHS)) $(PKG_LIBTOOL_PATHS) || true; \
33 fi; \
34 ) \
35 );
36 endef
37
38 Hooks/InstallDev/Post += libtool_remove_files
39
40 ifneq ($(filter libtool,$(PKG_FIXUP)),)
41 PKG_BUILD_DEPENDS += libtool
42 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
43 Hooks/Configure/Pre += autoreconf
44 endif
45 endif
46
47 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
48 PKG_BUILD_DEPENDS += libtool
49 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
50 Hooks/Configure/Pre += autoreconf
51 endif
52 endif
53
54 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
55 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
56 Hooks/Configure/Pre += autoreconf
57 endif
58 endif