changeset 49731:1a87516db0b7

8201508: Macosx builds fail in GenerateLinkOptData.gmk Reviewed-by: tbell
author erikj
date Thu, 12 Apr 2018 15:26:59 -0700
parents 09905cd87bb2
children ae568aefc5aa
files make/autoconf/basics.m4
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/basics.m4	Thu Apr 12 14:03:46 2018 -0700
+++ b/make/autoconf/basics.m4	Thu Apr 12 15:26:59 2018 -0700
@@ -107,10 +107,16 @@
 [
   # grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
   # Notice that the original variant fails on SLES 10 and 11
+  # Some grep versions (at least bsd) behaves strangely on the base case with
+  # no legal_values, so make it explicit.
   values_to_check=`$ECHO $2 | $TR ' ' '\n'`
   legal_values=`$ECHO $3 | $TR ' ' '\n'`
-  result=`$GREP -Fvx "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
-  $1=${result//$'\n'/ }
+  if test -z "$legal_values"; then
+    $1="$2"
+  else
+    result=`$GREP -Fvx "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
+    $1=${result//$'\n'/ }
+  fi
 ])
 
 ###############################################################################