Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/make/autoconf/test-configure.sh
40948 views
1
#!/bin/bash
2
#
3
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
#
6
# This code is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License version 2 only, as
8
# published by the Free Software Foundation.
9
#
10
# This code is distributed in the hope that it will be useful, but WITHOUT
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
# version 2 for more details (a copy is included in the LICENSE file that
14
# accompanied this code).
15
#
16
# You should have received a copy of the GNU General Public License version
17
# 2 along with this work; if not, write to the Free Software Foundation,
18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
# or visit www.oracle.com if you need additional information or have any
22
# questions.
23
#
24
25
# Arguments passed to us from makefile.
26
AUTOCONF="$1"
27
TOPDIR="$2"
28
TEST_SUPPORT_DIR="$3"
29
30
mkdir -p $TEST_SUPPORT_DIR/test-conf
31
cd $TEST_SUPPORT_DIR/test-conf
32
33
conf_script_dir="$TOPDIR/make/autoconf"
34
generated_script="$TEST_SUPPORT_DIR/generated-test-configure.sh"
35
36
# Generate configure script with test hooks compiled in.
37
echo "Generating test-configure script at $generated_script"
38
cat $conf_script_dir/configure.ac |
39
sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([test.m4])|" | \
40
${AUTOCONF} -W all -I$TOPDIR/test/make/autoconf -I$conf_script_dir - \
41
> $generated_script
42
rm -rf autom4te.cache
43
44
# Sanity check
45
if test ! -s $generated_script; then
46
echo "Error: Failed to generate test-configure script" 1>&2
47
rm -f $generated_script
48
exit 1
49
fi
50
51
# Make sure all shell commands are executed with the C locale
52
export LC_ALL=C
53
54
# Export our null command line
55
CONFIGURE_COMMAND_LINE=""
56
57
# Force autoconf to use bash. This also means we must disable autoconf re-exec.
58
export CONFIG_SHELL=$BASH
59
export _as_can_reexec=no
60
61
# Now transfer control to the script generated by autoconf. This is where the
62
# main work is done.
63
64
RCDIR=`mktemp -dt jdk-build-configure.tmp.XXXXXX` || exit $?
65
trap "rm -rf \"$RCDIR\"" EXIT
66
conf_logfile=./configure.log
67
(exec 3>&1 ; ((. $generated_script --enable-option-checking=fatal 2>&1 1>&3 ) \
68
; echo $? > "$RCDIR/rc" ) \
69
| tee -a $conf_logfile 1>&2 ; exec 3>&-) | tee -a $conf_logfile
70
71
conf_result_code=`cat "$RCDIR/rc"`
72
73
if test $conf_result_code -ne 0; then
74
echo "=============================="
75
echo "Configure tests finished with failure. Result code: $conf_result_code"
76
fi
77
78
exit $conf_result_code
79
80