config: add a knob to use the mold linker for packages
[openwrt/staging/wigyori.git] / config / check-hostcxx.sh
diff --git a/config/check-hostcxx.sh b/config/check-hostcxx.sh
new file mode 100755 (executable)
index 0000000..442f4cf
--- /dev/null
@@ -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