Skip to content

Commit dc028f2

Browse files
committedJan 18, 2024
8323008: filter out harmful -std* flags added by autoconf from CXX
Backport-of: 68c4286026bc2c0ec0f594e0b96fe03fe5624d6d
1 parent 51d944e commit dc028f2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎make/autoconf/toolchain.m4

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -373,6 +373,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION],
373373
# This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2"
374374
CFLAGS="$ORG_CFLAGS"
375375
CXXFLAGS="$ORG_CXXFLAGS"
376+
377+
# filter out some unwanted additions autoconf may add to CXX; we saw this on macOS with autoconf 2.72
378+
UTIL_GET_NON_MATCHING_VALUES(cxx_filtered, $CXX, -std=c++11 -std=gnu++11)
379+
CXX="$cxx_filtered"
376380
])
377381

378382
# Check if a compiler is of the toolchain type we expect, and save the version

‎make/autoconf/util.m4

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -199,7 +199,7 @@ AC_DEFUN([UTIL_GET_NON_MATCHING_VALUES],
199199
if test -z "$legal_values"; then
200200
$1="$2"
201201
else
202-
result=`$GREP -Fvx "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
202+
result=`$GREP -Fvx -- "$legal_values" <<< "$values_to_check" | $GREP -v '^$'`
203203
$1=${result//$'\n'/ }
204204
fi
205205
])
@@ -226,7 +226,7 @@ AC_DEFUN([UTIL_GET_MATCHING_VALUES],
226226
if test -z "$illegal_values"; then
227227
$1=""
228228
else
229-
result=`$GREP -Fx "$illegal_values" <<< "$values_to_check" | $GREP -v '^$'`
229+
result=`$GREP -Fx -- "$illegal_values" <<< "$values_to_check" | $GREP -v '^$'`
230230
$1=${result//$'\n'/ }
231231
fi
232232
])

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jan 18, 2024

@openjdk-notifier[bot]
Please sign in to comment.