1# sourced to find alternate names for things 2 3source ./configure 4 5if [ -z "$(command -v "${CROSS_COMPILE}${CC}")" ] 6then 7 echo "No ${CROSS_COMPILE}${CC} found" >&2 8 exit 1 9fi 10 11if [ -z "$SED" ] 12then 13 [ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed 14fi 15 16# Tell linker to do dead code elimination at function level 17if [ "$(uname)" == "Darwin" ] 18then 19 : ${LDOPTIMIZE:=-Wl,-dead_strip} ${STRIP:=strip} 20else 21 : ${LDOPTIMIZE:=-Wl,--gc-sections -Wl,--as-needed} ${STRIP:=strip -s -R .note* -R .comment} 22fi 23 24# Address Sanitizer 25if [ ! -z "$ASAN" ]; then 26 # Turn ASan on and disable most optimization to get more readable backtraces. 27 # (Technically ASAN is just "-fsanitize=address" and the rest is optional.) 28 ASAN_FLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls" 29 CFLAGS="$CFLAGS $ASAN_FLAGS" 30 HOSTCC="$HOSTCC $ASAN_FLAGS" 31 NOSTRIP=1 32 # Ignore leaks on exit. TODO 33 export ASAN_OPTIONS="detect_leaks=0" 34 unset ASAN 35fi 36 37# Centos 7 bug workaround, EOL June 30 2024. TODO 38DASHN=-n; wait -n 2>/dev/null; [ $? -eq 2 ] && unset DASHN 39 40# If the build is using gnu tools, make them behave less randomly. 41export LANG=c 42export LC_ALL=C 43