summaryrefslogtreecommitdiff
path: root/make/lazy_configure.mk
blob: c74f216de0a399aed42e33ec0a6b5dc681e5e686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ``Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
# AB. All Rights Reserved.''
# 
#     $Id$
#

ifndef EXPECTED_AUTOCONF_VERSION
EXPECTED_AUTOCONF_VERSION=2.59
endif
SAVE_ARGS=$(ERL_TOP)/make/save_args
CONFIG_STATUS=$(CONFIGURE_DIR)/$(TARGET)/config.status
SAVED_CONFIG_FLAGS_FILE=$(CONFIGURE_DIR)/$(TARGET)/lazy.config.flags
SAVED_CONFIG_LOG=$(CONFIGURE_DIR)/$(TARGET)/config.log
CONFIG_CACHE_FILE=$(CONFIGURE_DIR)/$(TARGET)/lazy.config.cache
ALL_CONFIG_FLAGS=$(CONFIGURE_FLAGS) --no-create --no-recursion --cache-file=$(CONFIG_CACHE_FILE)

lazy_configure: save_config_flags $(CONFIG_STATUS)
	rm -f $(CONFIGURE_DIR)/config.log
	cd $(CONFIGURE_DIR) && $(CONFIG_STATUS)
	cat $(CONFIGURE_DIR)/config.log >> $(SAVED_CONFIG_LOG)
	rm -f $(CONFIGURE_DIR)/config.log

save_config_flags:
	$(SAVE_ARGS) $(SAVED_CONFIG_FLAGS_FILE) --- $(ALL_CONFIG_FLAGS)

$(SAVED_CONFIG_FLAGS_FILE): save_config_flags

$(CONFIGURE_DIR)/configure: $(CONFIGURE_DIR)/configure.in $(EXTRA_CONFIGURE_DEPENDENCIES)
	rm -f $(CONFIG_CACHE_FILE)
	@ exp_ac_vsn=$(EXPECTED_AUTOCONF_VERSION) ;                                \
	ac_vsn_blob=`autoconf --version` ;                                         \
	ac_vsn=`echo x$$ac_vsn_blob | sed "s|[^0-9]*\([0-9][^ \t\n]*\).*|\1|"` ;   \
	case "$$ac_vsn" in                                                         \
	    $$exp_ac_vsn)                                                          \
		;;                                                                 \
	    *)                                                                     \
		echo "***************************************************"  1>&2 ; \
		echo "***************************************************"  1>&2 ; \
		echo "*** WARNING: System might fail to configure or"       1>&2 ; \
		echo "***          might be erroneously configured"         1>&2 ; \
		echo "***          since autoconf version $$ac_vsn is used" 1>&2 ; \
		echo "***          instead of version $$exp_ac_vsn!"        1>&2 ; \
		echo "***************************************************"  1>&2 ; \
		echo "***************************************************"  1>&2 ; \
		;;                                                                 \
	esac
	cd $(CONFIGURE_DIR) && autoconf -f

$(CONFIGURE_DIR)/config.h.in: $(CONFIGURE_DIR)/configure.in $(CONFIGURE_DIR)/aclocal.m4
	cd $(CONFIGURE_DIR) && autoheader ./configure.in > ./config.h.in

$(CONFIG_STATUS): $(SAVED_CONFIG_FLAGS_FILE) $(CONFIGURE_DIR)/configure $(EXTRA_CONFIG_STATUS_DEPENDENCIES)
	rm -f $(CONFIGURE_DIR)/config.log
	cd $(CONFIGURE_DIR) && CONFIG_STATUS=$(CONFIG_STATUS) ./configure $(ALL_CONFIG_FLAGS)
	rm -f $(SAVED_CONFIG_LOG)
	mv $(CONFIGURE_DIR)/config.log $(SAVED_CONFIG_LOG)

lazy_configure_target_clean:
	rm -f $(CONFIG_STATUS)
	rm -f $(CONFIG_CACHE_FILE)
	rm -f $(SAVED_CONFIG_FLAGS_FILE)
	rm -f $(SAVED_CONFIG_LOG)

lazy_configure_clean: lazy_configure_target_clean
	rm -f $(CONFIGURE_DIR)/configure
	test ! -f $(CONFIGURE_DIR)/acconfig.h || rm -f $(CONFIGURE_DIR)/config.h.in

.PHONY: lazy_configure save_config_flags lazy_configure_clean