common/autoconf/configure

Tue, 03 Jul 2012 16:11:12 -0700

author
erikj
date
Tue, 03 Jul 2012 16:11:12 -0700
changeset 458
c8d320b48626
parent 445
efd26e051e50
child 478
2ba6f4da4bf3
permissions
-rw-r--r--

7181504: Update of latest build-infra Makefiles
Reviewed-by: ohair

erikj@458 1 #!/bin/sh
ohair@425 2
erikj@458 3 CONFIGURE_COMMAND_LINE="$@"
erikj@458 4 conf_script_dir=`dirname $0`
erikj@458 5 conf_closed_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
erikj@458 6
erikj@458 7 ###
erikj@458 8 ### Test that the generated configure is up-to-date
erikj@458 9 ###
erikj@458 10
erikj@458 11 # On Solaris /bin/sh doesn't support test -nt but /usr/bin/test does.
erikj@458 12 TEST=`which test`
erikj@458 13
erikj@458 14 print_error_not_up_to_date() {
erikj@458 15 echo "Error: The configure source files is newer than the generated files."
erikj@458 16 echo "Please run 'sh autogen.sh' to update the generated files."
erikj@458 17 }
erikj@458 18
erikj@458 19 for file in configure.ac *.m4 ; do
erikj@458 20 if $TEST $file -nt generated-configure.sh; then
erikj@458 21 print_error_not_up_to_date
erikj@458 22 exit 1
erikj@458 23 fi
erikj@458 24 done
erikj@458 25
erikj@458 26 if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
erikj@458 27 # If closed source configure is available, make sure it is up-to-date as well.
erikj@458 28 for file in configure.ac *.m4 $conf_closed_script_dir/*.m4; do
erikj@458 29 if $TEST $file -nt $conf_closed_script_dir/generated-configure.sh; then
erikj@458 30 print_error_not_up_to_date
erikj@458 31 exit 1
erikj@458 32 fi
erikj@458 33 done
erikj@458 34
erikj@458 35 # Test if open configure is newer than closed configure, if so, closed needs to
erikj@458 36 # be regenerated.
erikj@458 37 conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_script_dir/generated-configure.sh | cut -d" " -f 3`
erikj@458 38 conf_closed_configure_timestamp=`grep DATE_WHEN_GENERATED: $conf_closed_script_dir/generated-configure.sh | cut -d" " -f 3`
erikj@458 39 if $TEST $conf_open_configure_timestamp -gt $conf_closed_configure_timestamp; then
erikj@458 40 print_error_not_up_to_date
erikj@458 41 exit 1
erikj@458 42 fi
erikj@458 43
ohair@425 44 fi
ohair@425 45
erikj@458 46 ###
erikj@458 47 ### Process command-line arguments
erikj@458 48 ###
erikj@458 49 conf_processed_arguments=
erikj@458 50 conf_openjdk_target=
erikj@458 51 conf_extra_cflags=
erikj@458 52 conf_extra_cxxflags=
ohair@425 53
erikj@458 54 for conf_option
ohair@425 55 do
erikj@458 56 case $conf_option in
erikj@458 57 --openjdk-target=*)
erikj@458 58 conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
erikj@458 59 continue ;;
erikj@458 60 --with-extra-cflags=*)
erikj@458 61 conf_extra_cflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
erikj@458 62 continue ;;
erikj@458 63 --with-extra-cxxflags=*)
erikj@458 64 conf_extra_cxxflags=`expr "X$conf_option" : '[^=]*=\(.*\)'`
erikj@458 65 continue ;;
erikj@458 66 *)
erikj@458 67 conf_processed_arguments="$conf_processed_arguments $conf_option" ;;
ohair@425 68 esac
ohair@425 69
erikj@458 70 case $conf_option in
erikj@458 71 -build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
erikj@458 72 conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
erikj@458 73 -target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
erikj@458 74 conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
erikj@458 75 -host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*)
erikj@458 76 conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
ohair@425 77 esac
ohair@425 78 done
ohair@425 79
erikj@458 80 if $TEST "x$conf_legacy_crosscompile" != "x"; then
erikj@458 81 if $TEST "x$conf_openjdk_target" != "x"; then
erikj@458 82 echo "Error: Specifying --openjdk-target together with autoconf"
erikj@458 83 echo "legacy cross-compilation flags is not supported."
erikj@458 84 echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile."
erikj@458 85 echo "The recommended use is just --openjdk-target."
erikj@458 86 exit 1
erikj@458 87 else
erikj@458 88 echo "Warning: You are using legacy autoconf cross-compilation flags."
erikj@458 89 echo "It is recommended that you use --openjdk-target instead."
erikj@458 90 echo ""
ohair@425 91 fi
ohair@425 92 fi
ohair@425 93
erikj@458 94 if $TEST "x$conf_openjdk_target" != "x"; then
erikj@458 95 conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
erikj@458 96 conf_processed_arguments="--build=$conf_build_platform --host=$conf_openjdk_target --target=$conf_openjdk_target $conf_processed_arguments"
ohair@425 97 fi
ohair@425 98
erikj@458 99 # Make configure exit with error on invalid options as default.
erikj@458 100 # Can be overridden by --disable-option-checking, since we prepend our argument
erikj@458 101 # and later options override earlier.
erikj@458 102 conf_processed_arguments="--enable-option-checking=fatal $conf_processed_arguments"
ohair@425 103
erikj@458 104 ###
erikj@458 105 ### Call the configure script
erikj@458 106 ###
erikj@458 107 if $TEST -e $conf_closed_script_dir/generated-configure.sh; then
erikj@458 108 # Closed source configure available; run that instead
erikj@458 109 . $conf_closed_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
erikj@458 110 else
erikj@458 111 . $conf_script_dir/generated-configure.sh $conf_processed_arguments --with-extra-cflags="$conf_extra_cflags" --with-extra-cxxflags="$conf_extra_cxxflags"
ohair@425 112 fi
ohair@425 113
erikj@458 114 ###
erikj@458 115 ### Post-processing
erikj@458 116 ###
ohair@425 117
erikj@458 118 # Move the log file to the output root, if this was successfully created
erikj@458 119 if $TEST -d "$OUTPUT_ROOT"; then
erikj@458 120 mv -f config.log "$OUTPUT_ROOT" 2> /dev/null
ohair@425 121 fi

mercurial