summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2025-07-26 14:18:21 -0400
committerTavian Barnes <tavianator@tavianator.com>2025-07-26 14:19:39 -0400
commitc412de44136e10a346759de27e739406564d1bad (patch)
treeff81325512a633a0ad65405493c1790cd980583e /build
parent6d0240aa07076819cf454d13a21c3e1e0d13c6bf (diff)
downloadbfs-c412de44136e10a346759de27e739406564d1bad.tar.xz
build/flags-if: Handle -std=* specially
Diffstat (limited to 'build')
-rwxr-xr-xbuild/flags-if.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/build/flags-if.sh b/build/flags-if.sh
index 4cbfbc9..f7b4f33 100755
--- a/build/flags-if.sh
+++ b/build/flags-if.sh
@@ -33,11 +33,23 @@ OUTPUT=""
OLD_FLAGS=" $XCPPFLAGS $XCFLAGS $XLDFLAGS $XLDLIBS "
add_flag() {
- if [ "${OLD_FLAGS#* $1 }" = "$OLD_FLAGS" ]; then
- FLAGS="${FLAGS}${FLAGS:+ }$1"
- else
- return 1
- fi
+ case "$1" in
+ -std=*)
+ # Don't overwrite -std=* flags
+ case "$OLD_FLAGS" in
+ *\ -std=*)
+ return 1
+ ;;
+ esac
+ ;;
+ *)
+ if [ "${OLD_FLAGS#* $1 }" != "$OLD_FLAGS" ]; then
+ return 1
+ fi
+ ;;
+ esac
+
+ FLAGS="${FLAGS}${FLAGS:+ }$1"
}
try_cc() {