ipq40xx: essedma: Disable TCP segmentation offload for IPv6
[openwrt/openwrt.git] / include / autotools.mk
1 #
2 # Copyright (C) 2007-2012 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 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
9
10 # delete *.la-files from staging_dir - we can not yet remove respective lines within all package
11 # Makefiles, since backfire still uses libtool v1.5.x which (may) require those files
12 define libtool_remove_files
13 find $(1) -name '*.la' | $(XARGS) rm -f;
14 endef
15
16
17 AM_TOOL_PATHS:= \
18 AUTOM4TE=$(STAGING_DIR_HOST)/bin/autom4te \
19 AUTOCONF=$(STAGING_DIR_HOST)/bin/autoconf \
20 AUTOMAKE=$(STAGING_DIR_HOST)/bin/automake \
21 ACLOCAL=$(STAGING_DIR_HOST)/bin/aclocal \
22 AUTOHEADER=$(STAGING_DIR_HOST)/bin/autoheader \
23 LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
24 LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
25 M4=$(STAGING_DIR_HOST)/bin/m4 \
26 AUTOPOINT=true
27
28 # 1: build dir
29 # 2: remove files
30 # 3: automake paths
31 # 4: libtool paths
32 # 5: extra m4 dirs
33 define autoreconf
34 (cd $(1); \
35 $(patsubst %,rm -f %;,$(2)) \
36 $(foreach p,$(3), \
37 if [ -f $(p)/configure.ac ] || [ -f $(p)/configure.in ]; then \
38 [ -d $(p)/autom4te.cache ] && rm -rf autom4te.cache; \
39 [ -e $(p)/config.rpath ] || \
40 ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
41 touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
42 $(AM_TOOL_PATHS) \
43 LIBTOOLIZE='$(STAGING_DIR_HOST)/bin/libtoolize --install' \
44 $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
45 $(if $(word 2,$(3)),--no-recursive) \
46 -B $(STAGING_DIR_HOST)/share/aclocal \
47 $(patsubst %,-I %,$(5)) \
48 $(patsubst %,-I %,$(4)) $(p) || true; \
49 fi; \
50 ) \
51 );
52 endef
53
54 # 1: build dir
55 define patch_libtool
56 @(cd $(1); \
57 for lt in $$$$($$(STAGING_DIR_HOST)/bin/find . -name ltmain.sh); do \
58 lt_version="$$$$($$(STAGING_DIR_HOST)/bin/sed -ne 's,^[[:space:]]*VERSION="\?\([0-9]\.[0-9]\+\).*,\1,p' $$$$lt)"; \
59 case "$$$$lt_version" in \
60 1.5|2.2|2.4) echo "autotools.mk: Found libtool v$$$$lt_version - applying patch to $$$$lt"; \
61 (cd $$$$(dirname $$$$lt) && $$(PATCH) -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
62 *) echo "autotools.mk: error: Unsupported libtool version v$$$$lt_version - cannot patch $$$$lt"; exit 1 ;; \
63 esac; \
64 done; \
65 );
66 endef
67
68
69 PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
70 PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
71 PKG_MACRO_PATHS?=m4
72 PKG_REMOVE_FILES?=aclocal.m4
73
74 Hooks/InstallDev/Post += libtool_remove_files
75
76 define autoreconf_target
77 $(strip $(call autoreconf, \
78 $(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
79 $(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
80 $(STAGING_DIR)/host/share/aclocal $(STAGING_DIR_HOSTPKG)/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
81 endef
82
83 define patch_libtool_target
84 $(strip $(call patch_libtool, \
85 $(PKG_BUILD_DIR)))
86 endef
87
88 define gettext_version_target
89 (cd $(PKG_BUILD_DIR) && \
90 GETTEXT_VERSION=$(shell $(STAGING_DIR_HOSTPKG)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -ne '1s/.*\([0-9]\.[0-9]\{2\}\.[0-9]\).*/\1/p' ) && \
91 $(STAGING_DIR_HOST)/bin/sed \
92 -i $(PKG_BUILD_DIR)/configure.ac \
93 -e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
94 $(STAGING_DIR_HOSTPKG)/bin/autopoint --force \
95 );
96 endef
97
98 ifneq ($(filter gettext-version,$(PKG_FIXUP)),)
99 Hooks/Configure/Pre += gettext_version_target
100 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
101 Hooks/Configure/Pre += autoreconf_target
102 endif
103 endif
104
105 ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
106 Hooks/Configure/Pre += patch_libtool_target
107 endif
108
109 ifneq ($(filter libtool,$(PKG_FIXUP)),)
110 PKG_BUILD_DEPENDS += libtool gettext libiconv
111 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
112 Hooks/Configure/Pre += autoreconf_target
113 endif
114 endif
115
116 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
117 PKG_BUILD_DEPENDS += libtool gettext libiconv
118 ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
119 Hooks/Configure/Pre += autoreconf_target
120 endif
121 endif
122
123 ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
124 ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
125 Hooks/Configure/Pre += autoreconf_target
126 endif
127 endif
128
129
130 HOST_FIXUP?=$(PKG_FIXUP)
131 HOST_LIBTOOL_PATHS?=$(if $(PKG_LIBTOOL_PATHS),$(PKG_LIBTOOL_PATHS),.)
132 HOST_AUTOMAKE_PATHS?=$(if $(PKG_AUTOMAKE_PATHS),$(PKG_AUTOMAKE_PATHS),.)
133 HOST_MACRO_PATHS?=$(if $(PKG_MACRO_PATHS),$(PKG_MACRO_PATHS),m4)
134 HOST_REMOVE_FILES?=$(PKG_REMOVE_FILES)
135
136 define autoreconf_host
137 $(strip $(call autoreconf, \
138 $(HOST_BUILD_DIR), $(HOST_REMOVE_FILES), \
139 $(HOST_AUTOMAKE_PATHS), $(HOST_LIBTOOL_PATHS), \
140 $(HOST_MACRO_PATHS)))
141 endef
142
143 define patch_libtool_host
144 $(strip $(call patch_libtool, \
145 $(HOST_BUILD_DIR)))
146 endef
147
148 ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
149 Hooks/HostConfigure/Pre += patch_libtool_host
150 endif
151
152 ifneq ($(filter patch-libtool,$(HOST_FIXUP)),)
153 Hooks/HostConfigure/Pre += $(strip $(call patch_libtool,$(HOST_BUILD_DIR)))
154 endif
155
156 ifneq ($(filter libtool,$(HOST_FIXUP)),)
157 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
158 Hooks/HostConfigure/Pre += autoreconf_host
159 endif
160 endif
161
162 ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
163 ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
164 Hooks/HostConfigure/Pre += autoreconf_host
165 endif
166 endif
167
168 ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
169 ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
170 Hooks/HostConfigure/Pre += autoreconf_host
171 endif
172 endif