gzip: enable weird ftello() bug workaround even if not __sun
[unleashed-userland.git] / make-rules / configure.mk
blob03bd29a1a94930ff3714b80ac187bf407d3f0aa3
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
21 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
22 # Copyright 2011 EveryCity Ltd. All rights reserved.
26 # Rules and Macros for building opens source software that uses configure /
27 # GNU auto* tools to configure their build for the system they are on. This
28 # uses GNU Make to build the components to take advantage of the viewpath
29 # support and build multiple version (32/64 bit) from a shared source.
31 # To use these rules, include ../make-rules/configure.mk in your Makefile
32 # and define "build", "install", and "test" targets appropriate to building
33 # your component.
34 # Ex:
36 # build: $(SOURCE_DIR)/build/$(MACH32)/.built \
37 # $(SOURCE_DIR)/build/$(MACH64)/.built
39 # install: $(SOURCE_DIR)/build/$(MACH32)/.installed \
40 # $(SOURCE_DIR)/build/$(MACH64)/.installed
42 # test: $(SOURCE_DIR)/build/$(MACH32)/.tested \
43 # $(SOURCE_DIR)/build/$(MACH64)/.tested
45 # Any additional pre/post configure, build, or install actions can be specified
46 # in your make file by setting them in on of the following macros:
47 # COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
48 # COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
49 # COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
50 # COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
52 # If component specific make targets need to be used for build or install, they
53 # can be specified in
54 # COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
55 # COMPONENT_TEST_TARGETS
58 CONFIGURE_PREFIX = /usr
60 CONFIGURE_BINDIR.32 = $(CONFIGURE_PREFIX)/bin
61 CONFIGURE_BINDIR.64 = $(CONFIGURE_PREFIX)/bin/$(MACH64)
62 CONFIGURE_LIBDIR.32 = $(CONFIGURE_PREFIX)/lib
63 CONFIGURE_LIBDIR.64 = $(CONFIGURE_PREFIX)/lib/$(MACH64)
64 CONFIGURE_SBINDIR.32 = $(CONFIGURE_PREFIX)/sbin
65 CONFIGURE_SBINDIR.64 = $(CONFIGURE_PREFIX)/sbin/$(MACH64)
66 CONFIGURE_MANDIR = $(CONFIGURE_PREFIX)/share/man
67 CONFIGURE_LOCALEDIR = $(CONFIGURE_PREFIX)/share/locale
68 # all texinfo documentation seems to go to /usr/share/info no matter what
69 CONFIGURE_INFODIR = /usr/share/info
70 CONFIGURE_INCLUDEDIR = /usr/include
72 CONFIGURE_ENV = CC="$(CC)"
73 CONFIGURE_ENV += CXX="$(CXX)"
74 CONFIGURE_ENV += F77="$(F77)"
75 CONFIGURE_ENV += FC="$(FC)"
76 CONFIGURE_ENV += CFLAGS="$(CFLAGS)"
77 CONFIGURE_ENV += CXXFLAGS="$(CXXFLAGS)"
78 CONFIGURE_ENV += FFLAGS="$(F77FLAGS)"
79 CONFIGURE_ENV += FCFLAGS="$(FCFLAGS)"
80 CONFIGURE_ENV += LDFLAGS="$(LDFLAGS)"
81 CONFIGURE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
83 # Rewrite absolute source-code paths into relative for ccache, so that any
84 # workspace with a shared CCACHE_DIR can benefit when compiling a component
85 ifneq ($(strip $(CCACHE)),)
86 CONFIGURE_ENV += CCACHE="$(CCACHE)"
87 CONFIGURE_OPTIONS += CCACHE="$(CCACHE)"
88 CONFIGURE_ENV += CC_gcc_32="$(CC_gcc_32)"
89 CONFIGURE_ENV += CC_gcc_64="$(CC_gcc_32)"
90 CONFIGURE_ENV += CXX_gcc_32="$(CXX_gcc_64)"
91 CONFIGURE_ENV += CXX_gcc_64="$(CXX_gcc_64)"
92 CONFIGURE_OPTIONS += CC_gcc_32="$(CC_gcc_32)"
93 CONFIGURE_OPTIONS += CC_gcc_64="$(CC_gcc_32)"
94 CONFIGURE_OPTIONS += CXX_gcc_32="$(CXX_gcc_64)"
95 CONFIGURE_OPTIONS += CXX_gcc_64="$(CXX_gcc_64)"
96 CONFIGURE_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
97 CONFIGURE_OPTIONS.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
99 ifneq ($(strip $(CCACHE_DIR)),)
100 CONFIGURE_ENV += CCACHE_DIR="$(CCACHE_DIR)"
101 CONFIGURE_OPTIONS += CCACHE_DIR="$(CCACHE_DIR)"
102 endif
104 ifneq ($(strip $(CCACHE_LOGFILE)),)
105 CONFIGURE_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
106 CONFIGURE_OPTIONS += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
107 endif
109 endif
111 CONFIGURE_DEFAULT_DIRS?=yes
113 CONFIGURE_OPTIONS += CC="$(CC)"
114 CONFIGURE_OPTIONS += CXX="$(CXX)"
115 CONFIGURE_OPTIONS += F77="$(F77)"
116 CONFIGURE_OPTIONS += FC="$(FC)"
117 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
118 CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)"
119 CONFIGURE_OPTIONS += FFLAGS="$(F77FLAGS)"
120 CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)"
121 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
122 CONFIGURE_OPTIONS += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
124 CONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX)
125 ifeq ($(CONFIGURE_DEFAULT_DIRS),yes)
126 CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
127 CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
128 CONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS))
129 CONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS))
130 endif
131 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
133 COMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR)
135 $(BUILD_DIR_32)/.configured: BITS=32
136 $(BUILD_DIR_64)/.configured: BITS=64
138 CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
139 ifeq ($(strip $(PARFAIT_BUILD)),yes)
140 # parfait creates '*.bc' files which can confuse configure's
141 # object/exe extension detection. which we really don't need it
142 # to do anyway, so we'll just tell it what they are.
143 CONFIGURE_ENV += ac_cv_objext=o
144 CONFIGURE_ENV += ac_cv_exeext=""
145 # this is fixed in the clang compiler but we can't use it yet
146 CONFIGURE_ENV += ac_cv_header_stdbool_h=yes
147 endif
150 # temporarily work around some issues
151 CONFIGURE_ENV += "ac_cv_func_realloc_0_nonnull=yes"
152 COMPONENT_BUILD_ENV += "ac_cv_func_realloc_0_nonnull=yes"
154 UPDATE_AUX_FILES = for f in $$(find $(SOURCE_DIR) -type f '(' -name config.guess -o -name config.sub ')'); do install -m 0755 /usr/share/automake-1.11/$$(basename $$f) $$f; done
155 # if the package is using libtool ("LT_INIT", or one of its deprecated
156 # aliases), then remove the package's libtool.m4 if any (system one gets used),
157 # regenerate aclocal.m4 (aclocal), and regenerate configure (autoconf). we must
158 # do this to get the unleashed-specific checks into configure.
159 LIBTOOL_AUTORECONF = if grep -wq -e LT_INIT -e 'A[CM]_PROG_LIBTOOL' $(SOURCE_DIR)/configure.ac; then cd $(SOURCE_DIR) && rm -f configure aclocal.m4 libtool.m4 */libtool.m4 && aclocal && autoconf; fi
161 # configure the unpacked source for building 32 and 64 bit version
162 CONFIGURE_SCRIPT = $(SOURCE_DIR)/configure
163 $(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep
164 ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
165 $(COMPONENT_PRE_CONFIGURE_ACTION)
166 if [ "$$(uname -s)" = "Unleashed" ]; then $(UPDATE_AUX_FILES); fi
167 if [ "$$(uname -s)" = "Unleashed" ]; then $(LIBTOOL_AUTORECONF); fi
168 (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) \
169 $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS))
170 $(COMPONENT_POST_CONFIGURE_ACTION)
171 $(TOUCH) $@
173 # build the configured source
174 $(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
175 $(COMPONENT_PRE_BUILD_ACTION)
176 (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
177 $(MAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \
178 $(COMPONENT_BUILD_TARGETS))
179 $(COMPONENT_POST_BUILD_ACTION)
180 ifeq ($(strip $(PARFAIT_BUILD)),yes)
181 -$(PARFAIT) build
182 endif
183 $(TOUCH) $@
185 # install the built source into a prototype area
186 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
187 $(COMPONENT_PRE_INSTALL_ACTION)
188 (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(MAKE) \
189 $(COMPONENT_INSTALL_GMAKE_ARGS) \
190 $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS))
191 $(COMPONENT_POST_INSTALL_ACTION)
192 $(TOUCH) $@
194 # test the built source
195 $(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
196 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
197 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
198 $(COMPONENT_PRE_TEST_ACTION)
199 -(cd $(COMPONENT_TEST_DIR) ; \
200 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
201 $(COMPONENT_TEST_CMD) \
202 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
203 &> $(COMPONENT_TEST_OUTPUT)
204 $(COMPONENT_POST_TEST_ACTION)
205 $(COMPONENT_TEST_CREATE_TRANSFORMS)
206 $(COMPONENT_TEST_PERFORM_TRANSFORM)
207 $(COMPONENT_TEST_COMPARE)
208 $(COMPONENT_TEST_CLEANUP)
209 $(TOUCH) $@
211 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
212 $(COMPONENT_PRE_TEST_ACTION)
213 (cd $(COMPONENT_TEST_DIR) ; \
214 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
215 $(COMPONENT_TEST_CMD) \
216 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
217 $(COMPONENT_POST_TEST_ACTION)
218 $(COMPONENT_TEST_CLEANUP)
219 $(TOUCH) $@
221 ifeq ($(strip $(PARFAIT_BUILD)),yes)
222 parfait: install
223 -$(PARFAIT) build
224 else
225 parfait:
226 $(MAKE) PARFAIT_BUILD=yes parfait
227 endif
229 clean::
230 $(RM) -r $(BUILD_DIR) $(PROTO_DIR)