8295192: Use original configure command line when called from a script
Reviewed-by: erikj
This commit is contained in:
parent
cf07eaeb92
commit
552d8a2821
36
bin/jib.sh
36
bin/jib.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -135,6 +135,28 @@ install_jib() {
|
||||
echo "${data_string}" > "${install_data}"
|
||||
}
|
||||
|
||||
# Returns a shell-escaped version of the argument given.
|
||||
shell_quote() {
|
||||
if [[ -n "$1" ]]; then
|
||||
# Uses only shell-safe characters? No quoting needed.
|
||||
# '=' is a zsh meta-character, but only in word-initial position.
|
||||
if echo "$1" | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\.:,%/+=_-]\{1,\}$' > /dev/null \
|
||||
&& ! echo "$1" | grep '^=' > /dev/null; then
|
||||
quoted="$1"
|
||||
else
|
||||
if echo "$1" | grep "[\'!]" > /dev/null; then
|
||||
# csh does history expansion within single quotes, but not
|
||||
# when backslash-escaped!
|
||||
local quoted_quote="'\\''" quoted_exclam="'\\!'"
|
||||
word="${1//\'/${quoted_quote}}"
|
||||
word="${1//\!/${quoted_exclam}}"
|
||||
fi
|
||||
quoted="'$1'"
|
||||
fi
|
||||
echo "$quoted"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main body starts here
|
||||
|
||||
setup_url
|
||||
@ -151,4 +173,16 @@ if [ -z "${JIB_SRC_DIR}" ]; then
|
||||
export JIB_SRC_DIR="${mydir}/../"
|
||||
fi
|
||||
|
||||
|
||||
# Save the original command line
|
||||
conf_quoted_arguments=()
|
||||
for conf_option; do
|
||||
conf_quoted_arguments=("${conf_quoted_arguments[@]}" "$(shell_quote "$conf_option")")
|
||||
done
|
||||
export REAL_CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}"
|
||||
|
||||
myfulldir="$(cd "${mydir}" > /dev/null && pwd)"
|
||||
export REAL_CONFIGURE_COMMAND_EXEC_FULL="$BASH $myfulldir/$myname"
|
||||
export REAL_CONFIGURE_COMMAND_EXEC_SHORT="$myname"
|
||||
|
||||
${installed_jib_script} "$@"
|
||||
|
@ -277,15 +277,20 @@ else # HAS_SPEC=true
|
||||
$(ECHO) $(CONFIGURE_COMMAND_LINE)
|
||||
|
||||
reconfigure:
|
||||
ifneq ($(CONFIGURE_COMMAND_LINE), )
|
||||
ifneq ($(REAL_CONFIGURE_COMMAND_EXEC_FULL), )
|
||||
$(ECHO) "Re-running configure using original command line '$(REAL_CONFIGURE_COMMAND_EXEC_SHORT) $(REAL_CONFIGURE_COMMAND_LINE)'"
|
||||
$(eval RECONFIGURE_COMMAND := $(REAL_CONFIGURE_COMMAND_EXEC_FULL) $(REAL_CONFIGURE_COMMAND_LINE))
|
||||
else ifneq ($(CONFIGURE_COMMAND_LINE), )
|
||||
$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
|
||||
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE))
|
||||
else
|
||||
$(ECHO) "Re-running configure using default settings"
|
||||
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure)
|
||||
endif
|
||||
( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
|
||||
CUSTOM_ROOT="$(CUSTOM_ROOT)" \
|
||||
CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
|
||||
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
|
||||
$(RECONFIGURE_COMMAND) )
|
||||
|
||||
##############################################################################
|
||||
# The main target, for delegating into Main.gmk
|
||||
|
@ -31,6 +31,11 @@ AC_DEFUN_ONCE([BASIC_INIT],
|
||||
[
|
||||
# Save the original command line. This is passed to us by the wrapper configure script.
|
||||
AC_SUBST(CONFIGURE_COMMAND_LINE)
|
||||
# We might have the original command line if the wrapper was called by some
|
||||
# other script.
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_SHORT)
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_FULL)
|
||||
AC_SUBST(REAL_CONFIGURE_COMMAND_LINE)
|
||||
# AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
|
||||
AC_SUBST(AUTOCONF)
|
||||
# Save the path variable before it gets changed
|
||||
|
@ -278,6 +278,11 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
|
||||
printf "using default settings.\n"
|
||||
fi
|
||||
|
||||
if test "x$REAL_CONFIGURE_COMMAND_EXEC_FULL" != x; then
|
||||
printf "\n"
|
||||
printf "The original configure invocation was '$REAL_CONFIGURE_COMMAND_EXEC_SHORT $REAL_CONFIGURE_COMMAND_LINE'.\n"
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
printf "Configuration summary:\n"
|
||||
printf "* Name: $CONF_NAME\n"
|
||||
|
@ -35,6 +35,11 @@ CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
||||
# The current directory when configure was run
|
||||
CONFIGURE_START_DIR:=@CONFIGURE_START_DIR@
|
||||
|
||||
# How configure was originally called, if not called directly
|
||||
REAL_CONFIGURE_COMMAND_EXEC_SHORT := @REAL_CONFIGURE_COMMAND_EXEC_SHORT@
|
||||
REAL_CONFIGURE_COMMAND_EXEC_FULL := @REAL_CONFIGURE_COMMAND_EXEC_FULL@
|
||||
REAL_CONFIGURE_COMMAND_LINE := @REAL_CONFIGURE_COMMAND_LINE@
|
||||
|
||||
# A self-referential reference to this file.
|
||||
SPEC:=@SPEC@
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user