aboutsummaryrefslogtreecommitdiff
path: root/config/check-hostcxx.sh
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2023-01-27 17:13:15 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2023-07-04 20:25:40 +0200
commit65a716bb95baa3b2617bafe6a86173da8cea7933 (patch)
tree166e2fe6b62a31cd1d48293ec39d3d769ce6b696 /config/check-hostcxx.sh
parentd026b19cdcda50766e1ecc350fdc7c542e0f1c73 (diff)
config: add a knob to use the mold linker for packages
Building it requires gcc >= 10.2 or clang >= 12. Using sstrip with its -z argument can produce non-working binaries, like a segfaulting `getrandom`, so don't allow that combination. Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'config/check-hostcxx.sh')
-rwxr-xr-xconfig/check-hostcxx.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/config/check-hostcxx.sh b/config/check-hostcxx.sh
new file mode 100755
index 0000000000..442f4cfb40
--- /dev/null
+++ b/config/check-hostcxx.sh
@@ -0,0 +1,12 @@
+cat << EOF | "$STAGING_DIR_HOST/bin/g++" -c -x c++ -o /dev/null - >/dev/null 2>&1
+#if __clang__
+ #if __clang_major__ < $3
+ #error "clang too old"
+ #endif
+#else
+ #if __GNUC__ < $1 || (__GNUC__ == $1 && (__GNUC_MINOR__ < $2))
+ #error "gcc too old"
+ #endif
+#endif
+EOF
+[ $? -eq 0 ] && echo y || echo n