8079891: Store configure log in $BUILD/configure.log
authorihse
Mon, 11 May 2015 13:45:39 +0200
changeset 30417 581a2762eef1
parent 30416 6216eb71e929
child 30418 aa3cd6848aa0
8079891: Store configure log in $BUILD/configure.log Reviewed-by: erikj
common/autoconf/basics.m4
common/autoconf/configure
common/autoconf/configure.ac
common/autoconf/generated-configure.sh
common/autoconf/help.m4
--- a/common/autoconf/basics.m4	Mon May 11 16:39:31 2015 +0530
+++ b/common/autoconf/basics.m4	Mon May 11 13:45:39 2015 +0200
@@ -1054,3 +1054,29 @@
 
   AC_SUBST(BASH_ARGS)
 ])
+
+# Code to run after AC_OUTPUT
+AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
+[
+  # Try to move config.log (generated by autoconf) to the configure-support directory.
+  if test -e ./config.log; then
+    $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
+  fi
+
+  # Rotate our log file (configure.log)
+  if test -e "$OUTPUT_ROOT/configure.log.old"; then
+    $RM -f "$OUTPUT_ROOT/configure.log.old"
+  fi
+  if test -e "$OUTPUT_ROOT/configure.log"; then
+    $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+  fi
+
+  # Move configure.log from current directory to the build output root
+  if test -e ./configure.log; then
+    echo found it
+    $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+  fi
+
+  # Make the compare script executable
+  $CHMOD +x $OUTPUT_ROOT/compare.sh
+])
--- a/common/autoconf/configure	Mon May 11 16:39:31 2015 +0530
+++ b/common/autoconf/configure	Mon May 11 13:45:39 2015 +0200
@@ -255,13 +255,10 @@
   set -x
 fi
 
-if test "x$conf_debug_configure" = xtrue; then
-  # Turn on logging, but don't turn on twice when called recursive
-  conf_debug_logfile=./debug-configure.log
-  (exec 3>&1 ; (. $conf_script_to_run "${conf_processed_arguments[@]}" 2>&1 1>&3 ) | tee -a $conf_debug_logfile 1>&2 ; exec 3>&-) | tee -a $conf_debug_logfile
-else
-  ( . $conf_script_to_run "${conf_processed_arguments[@]}" )
-fi
+# Now transfer control to the script generated by autoconf. This is where the
+# main work is done.
+conf_logfile=./configure.log
+(exec 3>&1 ; (. $conf_script_to_run "${conf_processed_arguments[@]}" 2>&1 1>&3 ) | tee -a $conf_logfile 1>&2 ; exec 3>&-) | tee -a $conf_logfile
 
 conf_result_code=$?
 ###
--- a/common/autoconf/configure.ac	Mon May 11 16:39:31 2015 +0530
+++ b/common/autoconf/configure.ac	Mon May 11 13:45:39 2015 +0200
@@ -265,15 +265,10 @@
 
 # Create the actual output files. Now the main work of configure is done.
 AC_OUTPUT
+
+# After AC_OUTPUT, we need to do final work
 CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
-
-# Try to move the config.log file to the output directory.
-if test -e ./config.log; then
-  $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
-fi
-
-# Make the compare script executable
-$CHMOD +x $OUTPUT_ROOT/compare.sh
+BASIC_POST_CONFIG_OUTPUT
 
 # Finally output some useful information to the user
 HELP_PRINT_SUMMARY_AND_WARNINGS
--- a/common/autoconf/generated-configure.sh	Mon May 11 16:39:31 2015 +0530
+++ b/common/autoconf/generated-configure.sh	Mon May 11 13:45:39 2015 +0200
@@ -3500,6 +3500,9 @@
 # Check for support for specific options in bash
 
 
+# Code to run after AC_OUTPUT
+
+
 #
 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4363,7 +4366,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1431074105
+DATE_WHEN_GENERATED=1431344623
 
 ###############################################################################
 #
@@ -54207,14 +54210,31 @@
 fi
 
 
-
-# Try to move the config.log file to the output directory.
-if test -e ./config.log; then
-  $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
-fi
-
-# Make the compare script executable
-$CHMOD +x $OUTPUT_ROOT/compare.sh
+# After AC_OUTPUT, we need to do final work
+
+
+  # Try to move config.log (generated by autoconf) to the configure-support directory.
+  if test -e ./config.log; then
+    $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
+  fi
+
+  # Rotate our log file (configure.log)
+  if test -e "$OUTPUT_ROOT/configure.log.old"; then
+    $RM -f "$OUTPUT_ROOT/configure.log.old"
+  fi
+  if test -e "$OUTPUT_ROOT/configure.log"; then
+    $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+  fi
+
+  # Move configure.log from current directory to the build output root
+  if test -e ./configure.log; then
+    echo found it
+    $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+  fi
+
+  # Make the compare script executable
+  $CHMOD +x $OUTPUT_ROOT/compare.sh
+
 
 # Finally output some useful information to the user
 
@@ -54308,14 +54328,20 @@
 
 
 
-if test -e "$OUTPUT_ROOT/config.log"; then
-  $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1
-  if test $? -eq 0; then
-    printf "The following warnings were produced. Repeated here for convenience:\n"
-    # We must quote sed expression (using []) to stop m4 from eating the [].
-    $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e  's/^configure:[0-9]*: //'
-    printf "\n"
-  fi
-fi
-
-
+  # Locate config.log.
+  if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
+    CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
+  elif test -e "./config.log"; then
+    CONFIG_LOG_PATH="."
+  fi
+
+  if test -e "$CONFIG_LOG_PATH/config.log"; then
+    $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
+    if test $? -eq 0; then
+      printf "The following warnings were produced. Repeated here for convenience:\n"
+      # We must quote sed expression (using []) to stop m4 from eating the [].
+      $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e  's/^configure:[0-9]*: //'
+      printf "\n"
+    fi
+  fi
+
--- a/common/autoconf/help.m4	Mon May 11 16:39:31 2015 +0530
+++ b/common/autoconf/help.m4	Mon May 11 13:45:39 2015 +0200
@@ -212,7 +212,7 @@
   if test "x$TOOLCHAIN_VERSION" != "x"; then
     print_version=" $TOOLCHAIN_VERSION"
   fi
-  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" 
+  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
   printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
   printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
 
@@ -263,14 +263,20 @@
 
 AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS],
 [
-if test -e "$OUTPUT_ROOT/config.log"; then
-  $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1
-  if test $? -eq 0; then
-    printf "The following warnings were produced. Repeated here for convenience:\n"
-    # We must quote sed expression (using []) to stop m4 from eating the [].
-    $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
-    printf "\n"
+  # Locate config.log.
+  if test -e "$CONFIGURESUPPORT_OUTPUTDIR/config.log"; then
+    CONFIG_LOG_PATH="$CONFIGURESUPPORT_OUTPUTDIR"
+  elif test -e "./config.log"; then
+    CONFIG_LOG_PATH="."
   fi
-fi
 
+  if test -e "$CONFIG_LOG_PATH/config.log"; then
+    $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" > /dev/null 2>&1
+    if test $? -eq 0; then
+      printf "The following warnings were produced. Repeated here for convenience:\n"
+      # We must quote sed expression (using []) to stop m4 from eating the [].
+      $GREP '^configure:.*: WARNING:' "$CONFIG_LOG_PATH/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ]
+      printf "\n"
+    fi
+  fi
 ])