erikj@458: #!/bin/sh ohair@425: erikj@458: CONFIGURE_COMMAND_LINE="$@" erikj@458: conf_script_dir=`dirname $0` erikj@458: conf_closed_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf" erikj@458: erikj@458: ### erikj@458: ### Test that the generated configure is up-to-date erikj@458: ### erikj@458: erikj@458: # On Solaris /bin/sh doesn't support test -nt but /usr/bin/test does. erikj@458: TEST=`which test` erikj@458: erikj@458: print_error_not_up_to_date() { erikj@458: echo "Error: The configure source files is newer than the generated files." erikj@458: echo "Please run 'sh autogen.sh' to update the generated files." erikj@458: } erikj@458: erikj@458: for file in configure.ac *.m4 ; do erikj@458: if $TEST $file -nt generated-configure.sh; then erikj@458: print_error_not_up_to_date erikj@458: exit 1 erikj@458: fi erikj@458: done erikj@458: erikj@458: if $TEST -e $conf_closed_script_dir/generated-configure.sh; then erikj@458: # If closed source configure is available, make sure it is up-to-date as well. erikj@458: for file in configure.ac *.m4 $conf_closed_script_dir/*.m4; do erikj@458: if $TEST $file -nt $conf_closed_script_dir/generated-configure.sh; then erikj@458: print_error_not_up_to_date erikj@458: exit 1 erikj@458: fi erikj@458: done erikj@458: erikj@458: # Test if open configure is newer than closed configure, if so, closed needs to erikj@458: # be regenerated. erikj@458: conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3` erikj@458: conf_closed_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_closed_script_dir/generated-configure.sh | cut -d" " -f 3` erikj@458: if $TEST $conf_open_configure_timestamp -gt $conf_closed_configure_timestamp; then erikj@458: print_error_not_up_to_date erikj@458: exit 1 erikj@458: fi erikj@458: ohair@425: fi ohair@425: erikj@458: ### erikj@458: ### Process command-line arguments erikj@458: ### erikj@458: conf_processed_arguments= erikj@458: conf_openjdk_target= erikj@458: conf_extra_cflags= erikj@458: conf_extra_cxxflags= ohair@425: erikj@458: for conf_option ohair@425: do erikj@458: case $conf_option in erikj@458: --openjdk-target=*) erikj@458: conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'` erikj@458: continue ;; erikj@458: --with-extra-cflags=*) erikj@458: conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'` erikj@458: continue ;; erikj@458: --with-extra-cxxflags=*) erikj@458: conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'` erikj@458: continue ;; erikj@458: *) erikj@458: conf_processed_arguments="$conf_processed_arguments $conf_option" ;; ohair@425: esac ohair@425: erikj@458: case $conf_option in erikj@458: -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*) erikj@458: conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; erikj@458: -target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) erikj@458: conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; erikj@458: -host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*) erikj@458: conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;; ohair@425: esac ohair@425: done ohair@425: erikj@458: if $TEST "x$conf_legacy_crosscompile" != "x"; then erikj@458: if $TEST "x$conf_openjdk_target" != "x"; then erikj@458: echo "Error: Specifying --openjdk-target together with autoconf" erikj@458: echo "legacy cross-compilation flags is not supported." erikj@458: echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile." erikj@458: echo "The recommended use is just --openjdk-target." erikj@458: exit 1 erikj@458: else erikj@458: echo "Warning: You are using legacy autoconf cross-compilation flags." erikj@458: echo "It is recommended that you use --openjdk-target instead." erikj@458: echo "" ohair@425: fi ohair@425: fi ohair@425: erikj@458: if $TEST "x$conf_openjdk_target" != "x"; then erikj@458: conf_build_platform=`sh $conf_script_dir/build-aux/config.guess` erikj@458: conf_processed_arguments="--build=$conf_build_platform --host=$conf_openjdk_target --target=$conf_openjdk_target $conf_processed_arguments" ohair@425: fi ohair@425: erikj@458: # Make configure exit with error on invalid options as default. erikj@458: # Can be overridden by --disable-option-checking, since we prepend our argument erikj@458: # and later options override earlier. erikj@458: conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments" ohair@425: erikj@458: ### erikj@458: ### Call the configure script erikj@458: ### erikj@458: if $TEST -e $conf_closed_script_dir/generated-configure.sh; then erikj@458: # Closed source configure available; run that instead erikj@458: . $conf_closed_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" erikj@458: else erikj@458: . $conf_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags" ohair@425: fi ohair@425: erikj@458: ### erikj@458: ### Post-processing erikj@458: ### ohair@425: erikj@458: # Move the log file to the output root, if this was successfully created erikj@458: if $TEST -d "$OUTPUT_ROOT"; then erikj@458: mv -f config.log "$OUTPUT_ROOT" 2> /dev/null ohair@425: fi