aboutsummaryrefslogtreecommitdiff
path: root/configure.sh
diff options
context:
space:
mode:
Diffstat (limited to 'configure.sh')
-rwxr-xr-xconfigure.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/configure.sh b/configure.sh
index b9779c2..e4a142d 100755
--- a/configure.sh
+++ b/configure.sh
@@ -1,8 +1,9 @@
1#!/bin/sh 1#!/bin/sh
2 2
3detect() { cc -march=native -dM -E - < /dev/null | grep "$1"; } 3detectarch() { cc -march=native -dM -E - </dev/null | grep "$1"; }
4detectsan() { cc -fsanitize=$1 -dM -E -x c - </dev/null | grep "SANITIZE"; }
4 5
5[ -n "$(detect __AVX2__)" ] && detected="AVX2" 6[ -n "$(detectarch __AVX2__)" ] && detected="AVX2"
6 7
7TYPE=${TYPE-"$detected"} 8TYPE=${TYPE-"$detected"}
8 9
@@ -11,7 +12,10 @@ echo "Using CUBE_$TYPE"
11STD="-std=c99" 12STD="-std=c99"
12WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function" 13WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function"
13[ "$TYPE" = "AVX2" ] && AVX="-mavx2" 14[ "$TYPE" = "AVX2" ] && AVX="-mavx2"
14[ "$(uname)" = "Linux" ] && SAN="-fsanitize=address -fsanitize=undefined" 15
16[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address"
17[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined"
18SAN="$ADDR $UNDEF"
15 19
16CFLAGS="$STD $WFLAGS $AVX -O3" 20CFLAGS="$STD $WFLAGS $AVX -O3"
17DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG" 21DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG"

Generated with cgit - Back to sebastiano.tronto.net