diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index a4bfe3797e70a38e786f2e98890b22886c9c91b2..d14a3e1571fd8eabd0e333ac944fbbf463f52148 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -622,6 +622,14 @@ AC_PATH_PROGS(READELF, [readelf greadelf]) AC_PATH_PROG(HG, hg) AC_PATH_PROG(STAT, stat) AC_PATH_PROG(TIME, time) +# Check if it's GNU time +IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'` +if test "x$IS_GNU_TIME" != x; then + IS_GNU_TIME=yes +else + IS_GNU_TIME=no +fi +AC_SUBST(IS_GNU_TIME) if test "x$OPENJDK_TARGET_OS" = "xwindows"; then BASIC_REQUIRE_PROG(COMM, comm) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 09da06b8b90eeb7d09b18b8b205770255b5cf595..369616c98729b9afb4cb3fb566a62d398720099c 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -799,6 +799,7 @@ OS_VERSION_MAJOR PKG_CONFIG CODESIGN XATTR +IS_GNU_TIME TIME STAT HG @@ -3785,7 +3786,7 @@ fi #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1372413413 +DATE_WHEN_GENERATED=1372413705 ############################################################################### # @@ -10472,6 +10473,14 @@ $as_echo "no" >&6; } fi +# Check if it's GNU time +IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'` +if test "x$IS_GNU_TIME" != x; then + IS_GNU_TIME=yes +else + IS_GNU_TIME=no +fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 272a003673f54918d2d527635f1308e7c3144a6d..c30fd35dc18ca327ea08d52da98a355e20bb756f 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -510,6 +510,7 @@ TAR:=@TAR@ TAIL:=@TAIL@ TEE:=@TEE@ TIME:=@TIME@ +IS_GNU_TIME:=@IS_GNU_TIME@ TR:=@TR@ TOUCH:=@TOUCH@ UNIQ:=@UNIQ@ diff --git a/common/makefiles/MakeBase.gmk b/common/makefiles/MakeBase.gmk index 98a56f86cd141d47e326de5d3566d6bc0b309a59..d2bf4aaabee9d7bf54f194357a5608543ade332d 100644 --- a/common/makefiles/MakeBase.gmk +++ b/common/makefiles/MakeBase.gmk @@ -332,9 +332,11 @@ define SetupLogging # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make # For each target executed, will print # Building (from ) ( newer) - # but with a limit of 20 on , to avoid cluttering logs too much (and causing a crash on Cygwin). - OLD_SHELL:=$$(SHELL) - WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL) + # but with a limit of 20 on , to avoid cluttering logs too much + # (and causing a crash on Cygwin). + # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris. + # Only use time if it's GNU time which supports format and output file. + WRAPPER_SHELL:=/bin/bash $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log /bin/bash SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) endif # Never remove warning messages; this is just for completeness