Skip to content

Commit 4442046

Browse files
committed
8035495: Improvements in autoconf integration
Reviewed-by: ihse, mduigou, tbell
1 parent 2b3bf09 commit 4442046

File tree

9 files changed

+227
-172
lines changed

9 files changed

+227
-172
lines changed

common/autoconf/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -24,4 +24,4 @@
2424
# This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
2525
# GENERATED FILE, DO NOT EDIT
2626
SPEC:=@OUTPUT_ROOT@/spec.gmk
27-
include @SRC_ROOT@/Makefile
27+
include @TOPDIR@/Makefile

common/autoconf/autogen.sh

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@
2222
# questions.
2323
#
2424

25+
generate_configure_script() {
26+
# First create a header
27+
cat > $1 << EOT
28+
#!/bin/bash
29+
#
30+
# ##########################################################
31+
# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ###
32+
# ##########################################################
33+
#
34+
EOT
35+
# Then replace "magic" variables in configure.ac and append the output
36+
# from autoconf. $2 is either cat (just a no-op) or a filter.
37+
cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
38+
eval $2 | ${AUTOCONF} -W all -I$script_dir - >> $1
39+
rm -rf autom4te.cache
40+
}
41+
2542
script_dir=`dirname $0`
2643

2744
# Create a timestamp as seconds since epoch
@@ -36,7 +53,8 @@ else
3653
fi
3754

3855
if test "x$CUSTOM_CONFIG_DIR" = "x"; then
39-
custom_script_dir="$script_dir/../../jdk/make/closed/autoconf"
56+
topdir=`cd $script_dir/../.. >/dev/null && pwd`
57+
custom_script_dir="$topdir/jdk/make/closed/autoconf"
4058
else
4159
custom_script_dir=$CUSTOM_CONFIG_DIR
4260
fi
@@ -45,25 +63,23 @@ custom_hook=$custom_script_dir/custom-hook.m4
4563

4664
AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
4765

48-
echo "Autoconf found: ${AUTOCONF}"
49-
5066
if test "x${AUTOCONF}" = x; then
51-
echo You need autoconf installed to be able to regenerate the configure script
52-
echo Error: Cannot find autoconf 1>&2
67+
echo "You need autoconf installed to be able to regenerate the configure script"
68+
echo "Error: Cannot find autoconf" 1>&2
5369
exit 1
5470
fi
5571

56-
echo Generating generated-configure.sh with ${AUTOCONF}
57-
cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | ${AUTOCONF} -W all -I$script_dir - > $script_dir/generated-configure.sh
58-
rm -rf autom4te.cache
72+
autoconf_version=`$AUTOCONF --version | head -1`
73+
echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
74+
75+
echo "Generating generated-configure.sh"
76+
generate_configure_script "$script_dir/generated-configure.sh" 'cat'
5977

6078
if test -e $custom_hook; then
61-
echo Generating custom generated-configure.sh
6279
# We have custom sources available; also generate configure script
6380
# with custom hooks compiled in.
64-
cat $script_dir/configure.ac | sed -e "s|@DATE_WHEN_GENERATED@|$TIMESTAMP|" | \
65-
sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|" | ${AUTOCONF} -W all -I$script_dir - > $custom_script_dir/generated-configure.sh
66-
rm -rf autom4te.cache
81+
echo "Generating custom generated-configure.sh"
82+
generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
6783
else
68-
echo No custom hook found: $custom_hook
84+
echo "(No custom hook found at $custom_hook)"
6985
fi

common/autoconf/basics.m4

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -418,28 +418,29 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
418418
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
419419
AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
420420
[
421+
# We get the top-level directory from the supporting wrappers.
422+
AC_MSG_CHECKING([for top-level directory])
423+
AC_MSG_RESULT([$TOPDIR])
424+
BASIC_FIXUP_PATH(TOPDIR)
425+
AC_SUBST(TOPDIR)
426+
427+
# SRC_ROOT is a traditional alias for TOPDIR.
428+
SRC_ROOT=$TOPDIR
429+
421430
# Locate the directory of this script.
422-
SCRIPT="[$]0"
423-
AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD -L`
431+
AUTOCONF_DIR=$TOPDIR/common/autoconf
424432
425-
# Where is the source? It is located two levels above the configure script.
433+
# Save the current directory this script was started from
426434
CURDIR="$PWD"
427-
cd "$AUTOCONF_DIR/../.."
428-
SRC_ROOT="`$THEPWDCMD -L`"
435+
BASIC_FIXUP_PATH(CURDIR)
429436
430437
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
431438
PATH_SEP=";"
432439
BASIC_CHECK_PATHS_WINDOWS
433440
else
434441
PATH_SEP=":"
435442
fi
436-
437-
AC_SUBST(SRC_ROOT)
438443
AC_SUBST(PATH_SEP)
439-
cd "$CURDIR"
440-
441-
BASIC_FIXUP_PATH(SRC_ROOT)
442-
BASIC_FIXUP_PATH(CURDIR)
443444
444445
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
445446
# Add extra search paths on solaris for utilities like ar and as etc...
@@ -493,13 +494,17 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
493494
[ CONF_NAME=${with_conf_name} ])
494495
495496
# Test from where we are running configure, in or outside of src root.
497+
AC_MSG_CHECKING([where to store configuration])
496498
if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
497499
|| test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" \
498500
|| test "x$CURDIR" = "x$SRC_ROOT/make" ; then
499501
# We are running configure from the src root.
500502
# Create a default ./build/target-variant-debuglevel output root.
501503
if test "x${CONF_NAME}" = x; then
504+
AC_MSG_RESULT([in default location])
502505
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
506+
else
507+
AC_MSG_RESULT([in build directory with custom name])
503508
fi
504509
OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}"
505510
$MKDIR -p "$OUTPUT_ROOT"
@@ -515,6 +520,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
515520
CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
516521
fi
517522
OUTPUT_ROOT="$CURDIR"
523+
AC_MSG_RESULT([in current directory])
518524
519525
# WARNING: This might be a bad thing to do. You need to be sure you want to
520526
# have a configuration in this directory. Do some sanity checks!

common/autoconf/compare.sh.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@ UNIQ="@UNIQ@"
6464
UNPACK200="@FIXPATH@ @BOOT_JDK@/bin/unpack200"
6565
UNZIP="@UNZIP@"
6666

67-
SRC_ROOT="@SRC_ROOT@"
67+
SRC_ROOT="@TOPDIR@"
6868

6969
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
7070
PATH="@VS_PATH@"

common/autoconf/configure

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,29 @@
2222
# questions.
2323
#
2424

25-
if test "x$BASH_VERSION" = x; then
26-
echo This script needs bash to run.
27-
echo It is recommended to use the configure script in the source tree root instead.
25+
if test "x$1" != xCHECKME; then
26+
echo "This script cannot be run directly."
27+
echo "Use the 'configure' script in the top-level directory instead."
2828
exit 1
2929
fi
3030

3131
# Force autoconf to use bash. This also means we must disable autoconf re-exec.
3232
export CONFIG_SHELL=$BASH
3333
export _as_can_reexec=no
3434

35-
conf_script_dir=`dirname $0`
35+
# Now the next argument is the absolute top-level directory path.
36+
# The TOPDIR variable is passed on to configure.ac.
37+
TOPDIR="$2"
38+
# Remove these two arguments to get to the user supplied arguments
39+
shift
40+
shift
41+
42+
conf_script_dir="$TOPDIR/common/autoconf"
3643

3744
if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
38-
conf_custom_script_dir="$conf_script_dir/../../jdk/make/closed/autoconf"
45+
conf_custom_script_dir="$TOPDIR/jdk/make/closed/autoconf"
3946
else
40-
conf_custom_script_dir=$CUSTOM_CONFIG_DIR
47+
conf_custom_script_dir="$CUSTOM_CONFIG_DIR"
4148
fi
4249

4350
###
@@ -230,10 +237,10 @@ conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arg
230237
###
231238
if test -e $conf_custom_script_dir/generated-configure.sh; then
232239
# Custom source configure available; run that instead
233-
echo Running custom generated-configure.sh
240+
echo "Running custom generated-configure.sh"
234241
conf_script_to_run=$conf_custom_script_dir/generated-configure.sh
235242
else
236-
echo Running generated-configure.sh
243+
echo "Running generated-configure.sh"
237244
conf_script_to_run=$conf_script_dir/generated-configure.sh
238245
fi
239246

common/autoconf/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
AC_PREREQ([2.69])
3434
AC_INIT(OpenJDK, jdk8, [email protected],,http://openjdk.java.net)
3535

36-
AC_CONFIG_AUX_DIR([build-aux])
36+
AC_CONFIG_AUX_DIR([common/autoconf/build-aux])
3737
m4_include([build-aux/pkg.m4])
3838

3939
# Include these first...

0 commit comments

Comments
 (0)