--- old/common/autoconf/basics.m4 2014-11-26 15:46:27.017748971 +0100 +++ new/common/autoconf/basics.m4 2014-11-26 15:46:26.921744991 +0100 @@ -987,3 +987,26 @@ IS_RECONFIGURE=no fi ]) + +# Check for support for specific options in bash +AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS], +[ + # Test if bash supports pipefail. + AC_MSG_CHECKING([if bash supports pipefail]) + if ${BASH} -c 'set -o pipefail'; then + BASH_ARGS="$BASH_ARGS -o pipefail" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + + AC_MSG_CHECKING([if bash supports errexit (-e)]) + if ${BASH} -e -c 'true'; then + BASH_ARGS="$BASH_ARGS -e" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + + AC_SUBST(BASH_ARGS) +]) --- old/common/autoconf/configure.ac 2014-11-26 15:46:27.429766053 +0100 +++ new/common/autoconf/configure.ac 2014-11-26 15:46:27.341762404 +0100 @@ -113,6 +113,7 @@ # Setup tools that requires more complex handling, or that is not needed by the configure script. BASIC_SETUP_COMPLEX_TOOLS +BASIC_CHECK_BASH_OPTIONS # Check if pkg-config is available. PKG_PROG_PKG_CONFIG --- old/common/autoconf/spec.gmk.in 2014-11-26 15:46:27.829782637 +0100 +++ new/common/autoconf/spec.gmk.in 2014-11-26 15:46:27.741778989 +0100 @@ -78,6 +78,11 @@ OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@ OUTPUT_SYNC:=@OUTPUT_SYNC@ +# Override the shell with bash +BASH:=@BASH@ +BASH_ARGS:=@BASH_ARGS@ +SHELL:=$(BASH) $(BASH_ARGS) + # The "human readable" name of this configuration CONF_NAME:=@CONF_NAME@ @@ -502,7 +507,6 @@ # Tools adhering to a minimal and common standard of posix compliance. AWK:=@AWK@ BASENAME:=@BASENAME@ -BASH:=@BASH@ CAT:=@CAT@ CCACHE:=@CCACHE@ # CD is going away, but remains to cater for legacy makefiles. --- old/make/common/JavaCompilation.gmk 2014-11-26 15:46:28.249800050 +0100 +++ new/make/common/JavaCompilation.gmk 2014-11-26 15:46:28.153796069 +0100 @@ -126,17 +126,20 @@ $1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES)) # On windows, a lot of includes/excludes risk making the command line too long, so # writing the grep patterns to files. + # Grep returns 1 if nothing is matched. Do not fail the build for this. ifneq (,$$($1_INCLUDES)) $1_GREP_INCLUDE_PATTERNS:=$$(call EscapeDollar, \ $$(foreach src,$$($1_SRCS), $$(addprefix $$(src)/,$$($1_INCLUDES)))) # If there are a lot of include patterns, output to file to shorten command lines ifeq ($$(word 20,$$($1_GREP_INCLUDE_PATTERNS)),) - $1_GREP_INCLUDES:=| $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS)) + $1_GREP_INCLUDES:=| ( $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS)) \ + || test "$$$$?" = "1" ) else $1_GREP_INCLUDE_OUTPUT:=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_include $$(NEWLINE) \ $$(call ListPathsSafely,$1_GREP_INCLUDE_PATTERNS,\n, \ >> $$($1_BIN)/_the.$$($1_JARNAME)_include) - $1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include + $1_GREP_INCLUDES:=| ( $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include \ + || test "$$$$?" = "1" ) endif endif ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES)) @@ -145,12 +148,14 @@ $$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))) # If there are a lot of include patterns, output to file to shorten command lines ifeq ($$(word 20,$$($1_GREP_EXCLUDE_PATTERNS)),) - $1_GREP_EXCLUDES:=| $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS)) + $1_GREP_EXCLUDES:=| ( $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS)) \ + || test "$$$$?" = "1" ) else $1_GREP_EXCLUDE_OUTPUT=$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_exclude $$(NEWLINE) \ $$(call ListPathsSafely,$1_GREP_EXCLUDE_PATTERNS,\n, \ >> $$($1_BIN)/_the.$$($1_JARNAME)_exclude) - $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude + $1_GREP_EXCLUDES:=| ( $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude \ + || test "$$$$?" = "1" ) endif endif @@ -224,7 +229,8 @@ # The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file. ifeq (,$$($1_SKIP_METAINF)) $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS), \ - ( $(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ + ( ( $(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null || true ) \ + | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ $$($1_BIN)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE) ) endif # The capture deletes macro finds all deleted files and concatenates them. The resulting file @@ -250,7 +256,8 @@ ifeq (,$$($1_SKIP_METAINF)) $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \ - ( $(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ + ( ( $(FIND) $$(src)/META-INF -type f 2> /dev/null || true ) \ + | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ $$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) ) endif $1_SUPDATE_CONTENTS=$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)