2012-07-03 23:11:12 +00:00
|
|
|
#!/bin/sh
|
2012-04-10 15:18:28 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
CONFIGURE_COMMAND_LINE="$@"
|
|
|
|
conf_script_dir=`dirname $0`
|
2012-09-18 18:29:16 +00:00
|
|
|
|
|
|
|
if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
|
|
|
|
conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
|
|
|
|
else
|
|
|
|
conf_custom_script_dir=$CUSTOM_CONFIG_DIR
|
|
|
|
fi
|
2012-04-10 15:18:28 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
###
|
|
|
|
### Test that the generated configure is up-to-date
|
|
|
|
###
|
2012-04-10 15:18:28 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
# On Solaris /bin/sh doesn't support test -nt but /usr/bin/test does.
|
|
|
|
TEST=`which test`
|
2012-06-08 03:25:06 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
print_error_not_up_to_date() {
|
|
|
|
echo "Error: The configure source files is newer than the generated files."
|
|
|
|
echo "Please run 'sh autogen.sh' to update the generated files."
|
2012-09-18 18:29:16 +00:00
|
|
|
echo "Note that this test might trigger incorrectly sometimes due to hg timestamps".
|
2012-06-08 03:25:06 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# NOTE: This test can occasionally go wrong due to the way mercurial handles
|
|
|
|
# timestamps. It it supposed to aid during development of build-infra, but should
|
|
|
|
# go away before making this the default build system.
|
2012-07-03 23:11:12 +00:00
|
|
|
for file in configure.ac *.m4 ; do
|
|
|
|
if $TEST $file -nt generated-configure.sh; then
|
|
|
|
print_error_not_up_to_date
|
|
|
|
exit 1
|
2012-04-10 15:18:28 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
|
|
|
|
# If custom source configure is available, make sure it is up-to-date as well.
|
|
|
|
for file in configure.ac *.m4 $conf_custom_script_dir/*.m4; do
|
|
|
|
if $TEST $file -nt $conf_custom_script_dir/generated-configure.sh; then
|
2012-07-03 23:11:12 +00:00
|
|
|
print_error_not_up_to_date
|
|
|
|
exit 1
|
|
|
|
fi
|
2012-04-10 15:18:28 +00:00
|
|
|
done
|
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Test if open configure is newer than custom configure, if so, custom needs to
|
|
|
|
# be regenerated. This test is required to ensure consistency with custom source.
|
2012-07-03 23:11:12 +00:00
|
|
|
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3`
|
2012-09-18 18:29:16 +00:00
|
|
|
conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_custom_script_dir/generated-configure.sh | cut -d" " -f 3`
|
|
|
|
if $TEST $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
|
|
|
|
echo "Error: The generated configure file contains changes not present in the custom generated file."
|
|
|
|
echo "Please run 'sh autogen.sh' to update the generated files."
|
2012-07-03 23:11:12 +00:00
|
|
|
exit 1
|
2012-04-10 15:18:28 +00:00
|
|
|
fi
|
2012-07-03 23:11:12 +00:00
|
|
|
|
2012-04-10 15:18:28 +00:00
|
|
|
fi
|
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Autoconf calls the configure script recursively sometimes.
|
|
|
|
# Don't start logging twice in that case
|
|
|
|
if $TEST "x$conf_debug_configure" = xtrue; then
|
|
|
|
conf_debug_configure=recursive
|
|
|
|
fi
|
2012-07-03 23:11:12 +00:00
|
|
|
###
|
|
|
|
### Process command-line arguments
|
|
|
|
###
|
|
|
|
conf_processed_arguments=
|
|
|
|
conf_openjdk_target=
|
|
|
|
conf_extra_cflags=
|
|
|
|
conf_extra_cxxflags=
|
2012-04-10 15:18:28 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
for conf_option
|
2012-04-10 15:18:28 +00:00
|
|
|
do
|
2012-07-03 23:11:12 +00:00
|
|
|
case $conf_option in
|
|
|
|
--openjdk-target=*)
|
|
|
|
conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
|
|
|
|
continue ;;
|
|
|
|
--with-extra-cflags=*)
|
|
|
|
conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
|
|
|
|
continue ;;
|
|
|
|
--with-extra-cxxflags=*)
|
|
|
|
conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
|
|
|
|
continue ;;
|
2012-09-18 18:29:16 +00:00
|
|
|
--debug-configure)
|
|
|
|
if $TEST "x$conf_debug_configure" != xrecursive; then
|
|
|
|
conf_debug_configure=true
|
|
|
|
export conf_debug_configure
|
|
|
|
fi
|
|
|
|
continue ;;
|
2012-04-10 15:18:28 +00:00
|
|
|
*)
|
2012-07-03 23:11:12 +00:00
|
|
|
conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
|
2012-04-10 15:18:28 +00:00
|
|
|
esac
|
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
case $conf_option in
|
|
|
|
-build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
|
|
|
|
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
|
|
|
-target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
|
|
|
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
|
|
|
-host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*)
|
|
|
|
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
2012-04-10 15:18:28 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
if $TEST "x$conf_legacy_crosscompile" != "x"; then
|
|
|
|
if $TEST "x$conf_openjdk_target" != "x"; then
|
|
|
|
echo "Error: Specifying --openjdk-target together with autoconf"
|
|
|
|
echo "legacy cross-compilation flags is not supported."
|
|
|
|
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile."
|
|
|
|
echo "The recommended use is just --openjdk-target."
|
|
|
|
exit 1
|
2012-04-10 15:18:28 +00:00
|
|
|
else
|
2012-07-03 23:11:12 +00:00
|
|
|
echo "Warning: You are using legacy autoconf cross-compilation flags."
|
|
|
|
echo "It is recommended that you use --openjdk-target instead."
|
|
|
|
echo ""
|
2012-04-10 15:18:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
if $TEST "x$conf_openjdk_target" != "x"; then
|
|
|
|
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
|
|
|
|
conf_processed_arguments="--build=$conf_build_platform --host=$conf_openjdk_target --target=$conf_openjdk_target $conf_processed_arguments"
|
2012-04-10 15:18:28 +00:00
|
|
|
fi
|
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
# Make configure exit with error on invalid options as default.
|
|
|
|
# Can be overridden by --disable-option-checking, since we prepend our argument
|
|
|
|
# and later options override earlier.
|
|
|
|
conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments"
|
2012-06-08 03:25:06 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
###
|
|
|
|
### Call the configure script
|
|
|
|
###
|
2012-09-18 18:29:16 +00:00
|
|
|
if $TEST -e $conf_custom_script_dir/generated-configure.sh; then
|
|
|
|
# Custom source configure available; run that instead
|
|
|
|
echo Running custom generated-configure.sh
|
|
|
|
conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
|
|
|
|
else
|
|
|
|
echo Running generated-configure.sh
|
|
|
|
conf_script_to_run=$conf_script_dir/generated-configure.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $TEST "x$conf_debug_configure" != x; then
|
|
|
|
# Turn on shell debug output if requested (initial or recursive)
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $TEST "x$conf_debug_configure" = xtrue; then
|
|
|
|
# Turn on logging, but don't turn on twice when called recursive
|
|
|
|
conf_debug_logfile=./debug-configure.log
|
|
|
|
(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
|
2012-06-08 03:25:06 +00:00
|
|
|
else
|
2012-09-18 18:29:16 +00:00
|
|
|
. $conf_script_to_run $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
|
2012-06-08 03:25:06 +00:00
|
|
|
fi
|
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
conf_result_code=$?
|
2012-07-03 23:11:12 +00:00
|
|
|
###
|
|
|
|
### Post-processing
|
|
|
|
###
|
2012-06-08 03:25:06 +00:00
|
|
|
|
2012-07-03 23:11:12 +00:00
|
|
|
# Move the log file to the output root, if this was successfully created
|
|
|
|
if $TEST -d "$OUTPUT_ROOT"; then
|
|
|
|
mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
|
2012-06-08 03:25:06 +00:00
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
|
|
|
|
exit $conf_result_code
|