Path: blob/master/test/make/autoconf/test-configure.sh
40948 views
#!/bin/bash1#2# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#2324# Arguments passed to us from makefile.25AUTOCONF="$1"26TOPDIR="$2"27TEST_SUPPORT_DIR="$3"2829mkdir -p $TEST_SUPPORT_DIR/test-conf30cd $TEST_SUPPORT_DIR/test-conf3132conf_script_dir="$TOPDIR/make/autoconf"33generated_script="$TEST_SUPPORT_DIR/generated-test-configure.sh"3435# Generate configure script with test hooks compiled in.36echo "Generating test-configure script at $generated_script"37cat $conf_script_dir/configure.ac |38sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([test.m4])|" | \39${AUTOCONF} -W all -I$TOPDIR/test/make/autoconf -I$conf_script_dir - \40> $generated_script41rm -rf autom4te.cache4243# Sanity check44if test ! -s $generated_script; then45echo "Error: Failed to generate test-configure script" 1>&246rm -f $generated_script47exit 148fi4950# Make sure all shell commands are executed with the C locale51export LC_ALL=C5253# Export our null command line54CONFIGURE_COMMAND_LINE=""5556# Force autoconf to use bash. This also means we must disable autoconf re-exec.57export CONFIG_SHELL=$BASH58export _as_can_reexec=no5960# Now transfer control to the script generated by autoconf. This is where the61# main work is done.6263RCDIR=`mktemp -dt jdk-build-configure.tmp.XXXXXX` || exit $?64trap "rm -rf \"$RCDIR\"" EXIT65conf_logfile=./configure.log66(exec 3>&1 ; ((. $generated_script --enable-option-checking=fatal 2>&1 1>&3 ) \67; echo $? > "$RCDIR/rc" ) \68| tee -a $conf_logfile 1>&2 ; exec 3>&-) | tee -a $conf_logfile6970conf_result_code=`cat "$RCDIR/rc"`7172if test $conf_result_code -ne 0; then73echo "=============================="74echo "Configure tests finished with failure. Result code: $conf_result_code"75fi7677exit $conf_result_code787980