8188768: Fix interaction between make and autoconf after consolidation

Reviewed-by: erikj, tbell
This commit is contained in:
Magnus Ihse Bursie 2017-10-05 11:02:18 +02:00
parent 9abc252e51
commit ecd3cd8f8c
4 changed files with 36 additions and 37 deletions

View File

@ -137,15 +137,16 @@ ifeq ($(HAS_SPEC),)
# The spec files depend on the autoconf source code. This check makes sure # The spec files depend on the autoconf source code. This check makes sure
# the configuration is up to date after changes to configure. # the configuration is up to date after changes to configure.
CUSTOM_CONFIG_DIR ?= $(topdir)/closed/autoconf $(SPECS): $(wildcard $(topdir)/make/autoconf/*) \
$(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*))
$(SPECS): $(wildcard $(topdir)/common/autoconf/*) $(wildcard $(CUSTOM_CONFIG_DIR)/*)
ifeq ($(CONF_CHECK), fail) ifeq ($(CONF_CHECK), fail)
@echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." @echo Error: The configuration is not up to date for \
"'$(lastword $(subst /, , $(dir $@)))'."
$(call PrintConfCheckFailed) $(call PrintConfCheckFailed)
@exit 2 @exit 2
else ifeq ($(CONF_CHECK), auto) else ifeq ($(CONF_CHECK), auto)
@echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." @echo Note: The configuration is not up to date for \
"'$(lastword $(subst /, , $(dir $@)))'."
@( cd $(topdir) && \ @( cd $(topdir) && \
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
@ -266,6 +267,7 @@ else # HAS_SPEC=true
$(ECHO) "Re-running configure using default settings" $(ECHO) "Re-running configure using default settings"
endif endif
( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \ ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
$(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) ) $(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) )
############################################################################## ##############################################################################

View File

@ -35,8 +35,9 @@ _INITSUPPORT_GMK := 1
ifeq ($(HAS_SPEC),) ifeq ($(HAS_SPEC),)
# Include the corresponding closed file, if present. # Include the corresponding closed file, if present.
# Normal hook mechanism cannot be used since we have no SPEC. ifneq ($(CUSTOM_MAKE_DIR), )
-include $(topdir)/../closed/make/InitSupport.gmk -include $(CUSTOM_MAKE_DIR)/InitSupport.gmk
endif
############################################################################## ##############################################################################
# Helper functions for the initial part of Init.gmk, before the spec file is # Helper functions for the initial part of Init.gmk, before the spec file is

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -52,15 +52,6 @@ else
TIMESTAMP=`date +%s` TIMESTAMP=`date +%s`
fi fi
if test "x$CUSTOM_CONFIG_DIR" = "x"; then
topdir=`cd $script_dir/../.. >/dev/null && pwd`
custom_script_dir="$topdir/closed/autoconf"
else
custom_script_dir=$CUSTOM_CONFIG_DIR
fi
custom_hook=$custom_script_dir/custom-hook.m4
AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`" AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
if test "x${AUTOCONF}" = x; then if test "x${AUTOCONF}" = x; then
@ -75,11 +66,16 @@ echo "Using autoconf at ${AUTOCONF} [$autoconf_version]"
echo "Generating generated-configure.sh" echo "Generating generated-configure.sh"
generate_configure_script "$script_dir/generated-configure.sh" 'cat' generate_configure_script "$script_dir/generated-configure.sh" 'cat'
if test -e $custom_hook; then if test "x$CUSTOM_CONFIG_DIR" != "x"; then
custom_hook=$CUSTOM_CONFIG_DIR/custom-hook.m4
if test ! -e $custom_hook; then
echo "CUSTOM_CONFIG_DIR set but $CUSTOM_CONFIG_DIR/custom-hook.m4 not present"
echo "Error: Cannot continue" 1>&2
exit 1
fi
# We have custom sources available; also generate configure script # We have custom sources available; also generate configure script
# with custom hooks compiled in. # with custom hooks compiled in.
echo "Generating custom generated-configure.sh" echo "Generating custom generated-configure.sh"
generate_configure_script "$custom_script_dir/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"' generate_configure_script "$CUSTOM_CONFIG_DIR/generated-configure.sh" 'sed -e "s|#CUSTOM_AUTOCONF_INCLUDE|m4_include([$custom_hook])|"'
else
echo "(No custom hook found at $custom_hook)"
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -46,10 +46,12 @@ export _as_can_reexec=no
conf_script_dir="$TOPDIR/make/autoconf" conf_script_dir="$TOPDIR/make/autoconf"
if [ "$CUSTOM_CONFIG_DIR" = "" ]; then if test "x$CUSTOM_CONFIG_DIR" != x; then
conf_custom_script_dir="$TOPDIR/closed/autoconf" if test ! -e $CUSTOM_CONFIG_DIR/generated-configure.sh; then
else echo "CUSTOM_CONFIG_DIR not pointing to a proper custom config dir."
conf_custom_script_dir="$CUSTOM_CONFIG_DIR" echo "Error: Cannot continue" 1>&2
exit 1
fi
fi fi
### ###
@ -76,10 +78,10 @@ check_autoconf_timestamps() {
fi fi
done done
if test -e $conf_custom_script_dir/generated-configure.sh; then if test "x$CUSTOM_CONFIG_DIR" != x; then
# If custom source configure is available, make sure it is up-to-date as well. # If custom source configure is available, make sure it is up-to-date as well.
for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $conf_custom_script_dir/*.m4; do for file in $conf_script_dir/configure.ac $conf_script_dir/*.m4 $CUSTOM_CONFIG_DIR/*.m4; do
if test $file -nt $conf_custom_script_dir/generated-configure.sh; then if test $file -nt $CUSTOM_CONFIG_DIR/generated-configure.sh; then
echo "Warning: The configure source files is newer than the custom generated files." echo "Warning: The configure source files is newer than the custom generated files."
run_autogen_or_fail run_autogen_or_fail
fi fi
@ -93,11 +95,9 @@ check_hg_updates() {
if test "x$conf_updated_autoconf_files" != x; then if test "x$conf_updated_autoconf_files" != x; then
echo "Configure source code has been updated, checking time stamps" echo "Configure source code has been updated, checking time stamps"
check_autoconf_timestamps check_autoconf_timestamps
fi elif test "x$CUSTOM_CONFIG_DIR" != x; then
if test -e $conf_custom_script_dir; then
# If custom source configure is available, make sure it is up-to-date as well. # If custom source configure is available, make sure it is up-to-date as well.
conf_custom_updated_autoconf_files=`cd $conf_custom_script_dir && hg status -mard 2> /dev/null | grep autoconf` conf_custom_updated_autoconf_files=`cd $CUSTOM_CONFIG_DIR && hg status -mard 2> /dev/null | grep autoconf`
if test "x$conf_custom_updated_autoconf_files" != x; then if test "x$conf_custom_updated_autoconf_files" != x; then
echo "Configure custom source code has been updated, checking time stamps" echo "Configure custom source code has been updated, checking time stamps"
check_autoconf_timestamps check_autoconf_timestamps
@ -109,11 +109,11 @@ check_hg_updates() {
# Check for local changes # Check for local changes
check_hg_updates check_hg_updates
if test -e $conf_custom_script_dir/generated-configure.sh; then if test "x$CUSTOM_CONFIG_DIR" != x; then
# Test if open configure is newer than custom configure, if so, custom needs to # Test if open configure is newer than custom configure, if so, custom needs to
# be regenerated. This test is required to ensure consistency with custom source. # be regenerated. This test is required to ensure consistency with custom source.
conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh | cut -d"=" -f 2` conf_open_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_script_dir/generated-configure.sh | cut -d"=" -f 2`
conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $conf_custom_script_dir/generated-configure.sh | cut -d"=" -f 2` conf_custom_configure_timestamp=`grep DATE_WHEN_GENERATED= $CUSTOM_CONFIG_DIR/generated-configure.sh | cut -d"=" -f 2`
if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then if test $conf_open_configure_timestamp -gt $conf_custom_configure_timestamp; then
echo "Warning: The generated configure file contains changes not present in the custom generated file." echo "Warning: The generated configure file contains changes not present in the custom generated file."
run_autogen_or_fail run_autogen_or_fail
@ -241,10 +241,10 @@ conf_processed_arguments=("--enable-option-checking=fatal" "${conf_processed_arg
### ###
### Call the configure script ### Call the configure script
### ###
if test -e $conf_custom_script_dir/generated-configure.sh; then if test "x$CUSTOM_CONFIG_DIR" != x; then
# Custom source configure available; run that instead # Custom source configure available; run that instead
echo "Running custom generated-configure.sh" echo "Running custom generated-configure.sh"
conf_script_to_run=$conf_custom_script_dir/generated-configure.sh conf_script_to_run=$CUSTOM_CONFIG_DIR/generated-configure.sh
else else
echo "Running generated-configure.sh" echo "Running generated-configure.sh"
conf_script_to_run=$conf_script_dir/generated-configure.sh conf_script_to_run=$conf_script_dir/generated-configure.sh