author | ohair |
Tue, 18 Sep 2012 11:29:16 -0700 | |
changeset 13697 | 5262b00bc10c |
parent 13132 | bd88bb8dd3af |
child 14111 | 2a82ecb35fc7 |
permissions | -rw-r--r-- |
13132 | 1 |
#!/bin/sh |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
2 |
|
13132 | 3 |
CONFIGURE_COMMAND_LINE="$@" |
4 |
conf_script_dir=`dirname $0` |
|
13697 | 5 |
|
6 |
if [ "$CUSTOM_CONFIG_DIR" = "" ]; then |
|
7 |
conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf" |
|
8 |
else |
|
9 |
conf_custom_script_dir=$CUSTOM_CONFIG_DIR |
|
10 |
fi |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
11 |
|
13132 | 12 |
### |
13 |
### Test that the generated configure is up-to-date |
|
14 |
### |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
15 |
|
13132 | 16 |
# On Solaris /bin/sh doesn't support test -nt but /usr/bin/test does. |
17 |
TEST=`which test` |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
18 |
|
13132 | 19 |
print_error_not_up_to_date() { |
20 |
echo "Error: The configure source files is newer than the generated files." |
|
21 |
echo "Please run 'sh autogen.sh' to update the generated files." |
|
13697 | 22 |
echo "Note that this test might trigger incorrectly sometimes due to hg timestamps". |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
23 |
} |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
24 |
|
13697 | 25 |
# NOTE: This test can occasionally go wrong due to the way mercurial handles |
26 |
# timestamps. It it supposed to aid during development of build-infra, but should |
|
27 |
# go away before making this the default build system. |
|
13132 | 28 |
for file in configure.ac *.m4 ; do |
29 |
if $TEST $file -nt generated-configure.sh; then |
|
30 |
print_error_not_up_to_date |
|
31 |
exit 1 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
32 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
33 |
done |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
34 |
|
13697 | 35 |
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then |
36 |
# If custom source configure is available, make sure it is up-to-date as well. |
|
37 |
for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do |
|
38 |
if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then |
|
13132 | 39 |
print_error_not_up_to_date |
40 |
exit 1 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
41 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
42 |
done |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
43 |
|
13697 | 44 |
# Test if open configure is newer than custom configure, if so, custom needs to |
45 |
# be regenerated. This test is required to ensure consistency with custom source. |
|
13132 | 46 |
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3` |
13697 | 47 |
conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh | cut -d" " -f 3` |
48 |
if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then |
|
49 |
echo "Error: The generated configure file contains changes not present in the custom generated file." |
|
50 |
echo "Please run 'sh autogen.sh' to update the generated files." |
|
13132 | 51 |
exit 1 |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
52 |
fi |
13132 | 53 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
54 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
55 |
|
13697 | 56 |
# Autoconf calls the configure script recursively sometimes. |
57 |
# Don't start logging twice in that case |
|
58 |
if $TEST "x$conf_debug_configure" = xtrue; then |
|
59 |
conf_debug_configure=recursive |
|
60 |
fi |
|
13132 | 61 |
### |
62 |
### Process command-line arguments |
|
63 |
### |
|
64 |
conf_processed_arguments= |
|
65 |
conf_openjdk_target= |
|
66 |
conf_extra_cflags= |
|
67 |
conf_extra_cxxflags= |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
68 |
|
13132 | 69 |
for conf_option |
70 |
do |
|
71 |
case $conf_option in |
|
72 |
--openjdk-target=*) |
|
73 |
conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'` |
|
74 |
continue ;; |
|
75 |
--with-extra-cflags=*) |
|
76 |
conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'` |
|
77 |
continue ;; |
|
78 |
--with-extra-cxxflags=*) |
|
79 |
conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'` |
|
80 |
continue ;; |
|
13697 | 81 |
--debug-configure) |
82 |
if $TEST "x$conf_debug_configure" != xrecursive; then |
|
83 |
conf_debug_configure=true |
|
84 |
export conf_debug_configure |
|
85 |
fi |
|
86 |
continue ;; |
|
13132 | 87 |
*) |
88 |
conf_processed_arguments="$conf_processed_arguments $conf_option" ;; |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
89 |
esac |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
90 |
|
13132 | 91 |
case $conf_option in |
92 |
-build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*) |
|
93 |
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; |
|
94 |
-target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) |
|
95 |
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; |
|
96 |
-host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*) |
|
97 |
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; |
|
98 |
esac |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
99 |
done |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
100 |
|
13132 | 101 |
if $TEST "x$conf_legacy_crosscompile" != "x"; then |
102 |
if $TEST "x$conf_openjdk_target" != "x"; then |
|
103 |
echo "Error: Specifying --openjdk-target together with autoconf" |
|
104 |
echo "legacy cross-compilation flags is not supported." |
|
105 |
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile." |
|
106 |
echo "The recommended use is just --openjdk-target." |
|
107 |
exit 1 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
108 |
else |
13132 | 109 |
echo "Warning: You are using legacy autoconf cross-compilation flags." |
110 |
echo "It is recommended that you use --openjdk-target instead." |
|
111 |
echo "" |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
112 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
113 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
114 |
|
13132 | 115 |
if $TEST "x$conf_openjdk_target" != "x"; then |
116 |
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess` |
|
117 |
conf_processed_arguments="--build=$conf_build_platform --host=$conf_openjdk_target --target=$conf_openjdk_target $conf_processed_arguments" |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
118 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
119 |
|
13132 | 120 |
# Make configure exit with error on invalid options as default. |
121 |
# Can be overridden by --disable-option-checking, since we prepend our argument |
|
122 |
# and later options override earlier. |
|
123 |
conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments" |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
124 |
|
13132 | 125 |
### |
126 |
### Call the configure script |
|
127 |
### |
|
13697 | 128 |
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then |
129 |
# Custom source configure available; run that instead |
|
130 |
echo Running custom generated-configure.sh |
|
131 |
conf_script_to_run=$conf_custom_script_dir/generated-configure.sh |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
132 |
else |
13697 | 133 |
echo Running generated-configure.sh |
134 |
conf_script_to_run=$conf_script_dir/generated-configure.sh |
|
135 |
fi |
|
136 |
||
137 |
if $TEST "x$conf_debug_configure" != x; then |
|
138 |
# Turn on shell debug output if requested (initial or recursive) |
|
139 |
set -x |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
140 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
141 |
|
13697 | 142 |
if $TEST "x$conf_debug_configure" = xtrue; then |
143 |
# Turn on logging, but don't turn on twice when called recursive |
|
144 |
conf_debug_logfile=./debug-configure.log |
|
145 |
(exec 3>&1 ; (. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile |
|
146 |
else |
|
147 |
. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" |
|
148 |
fi |
|
149 |
||
150 |
conf_result_code=$? |
|
13132 | 151 |
### |
152 |
### Post-processing |
|
153 |
### |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
154 |
|
13132 | 155 |
# Move the log file to the output root, if this was successfully created |
156 |
if $TEST -d "$OUTPUT_ROOT"; then |
|
157 |
mv -f config.log "$OUTPUT_ROOT" 2> /dev/null |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
158 |
fi |
13697 | 159 |
|
160 |
exit $conf_result_code |