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