summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorPeter Kümmel <syntheticpp@gmx.net>2014-09-30 09:50:22 +0200
committerPeter Kümmel <syntheticpp@gmx.net>2014-10-02 19:45:00 +0200
commitd5576b1cb8422e38716c99aab34622b5dc23437c (patch)
treea92b5fb65db9a3cb6c2d233d01ef078ca0e48d2b /configure
parent7dd394a16c51d11cd3ce91e288253ad137190994 (diff)
Add support for gcc/clang's sanitize features
GCC and Clang support compiler intrinsic error detections tools: address, memory, thread, undefined Let users conveniently enable it in qmake, for instance with CONFIG += sanitizer sanitize_address Also add a -sanitize [...] option to configure to use it by default for both the Qt libraries, and user applications. [ChangeLog][configure] Added support for GCC/Clang -fsanitize= options Change-Id: Ie5418abcdf41842566df510d7707e41739e66f87 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure49
1 files changed, 49 insertions, 0 deletions
diff --git a/configure b/configure
index bcde69eca5..d610759ae2 100755
--- a/configure
+++ b/configure
@@ -716,6 +716,11 @@ CFG_PULSEAUDIO=auto
CFG_COREWLAN=auto
CFG_ICU=auto
CFG_FORCE_ASSERTS=no
+CFG_SANITIZERS=none
+CFG_SANITIZE_ADDRESS=no
+CFG_SANITIZE_THREAD=no
+CFG_SANITIZE_MEMORY=no
+CFG_SANITIZE_UNDEFINED=no
CFG_PCRE=auto
QPA_PLATFORM_GUARD=yes
CFG_CXX11=auto
@@ -887,6 +892,7 @@ while [ "$#" -gt 0 ]; do
-qpa| \
-qconfig| \
-qreal| \
+ -sanitize| \
-xkb-config-root| \
-android-sdk| \
-android-ndk| \
@@ -1158,6 +1164,25 @@ while [ "$#" -gt 0 ]; do
print "\"$result\"";' "$CFG_QREAL"`
fi
;;
+ sanitize)
+ if [ "$VAL" = "address" ]; then
+ CFG_SANITIZE_ADDRESS=yes
+ elif [ "$VAL" = "thread" ]; then
+ CFG_SANITIZE_THREAD=yes
+ elif [ "$VAL" = "memory" ]; then
+ CFG_SANITIZE_MEMORY=yes
+ elif [ "$VAL" = "undefined" ]; then
+ CFG_SANITIZE_UNDEFINED=yes
+ else
+ echo "Unknown sanitizer: '$VAL'"
+ ERROR=true
+ fi
+ if [ "$CFG_SANITIZERS" = "none" ]; then
+ CFG_SANITIZERS=$VAL
+ else
+ CFG_SANITIZERS="$CFG_SANITIZERS $VAL"
+ fi
+ ;;
sysroot)
CFG_SYSROOT="$VAL"
;;
@@ -2466,6 +2491,8 @@ Additional options:
-force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
+ -sanitize [address|thread|memory|undefined] Enables the specified compiler sanitizer.
+
-device <name> ............... Cross-compile for device <name> (experimental)
-device-option <key=value> ... Add device specific options for the device mkspec
(experimental)
@@ -5816,6 +5843,27 @@ if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
QT_CONFIG="$QT_CONFIG force_asserts"
fi
+if [ "$CFG_SANITIZERS" != "none" ]; then
+
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitizer"
+
+ if [ "$CFG_SANITIZE_ADDRESS" = "yes" ]; then
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_address"
+ fi
+
+ if [ "$CFG_SANITIZE_THREAD" = "yes" ]; then
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_thread"
+ fi
+
+ if [ "$CFG_SANITIZE_MEMORY" = "yes" ]; then
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_memory"
+ fi
+
+ if [ "$CFG_SANITIZE_UNDEFINED" = "yes" ]; then
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_undefined"
+ fi
+fi
+
if [ "$CFG_PCRE" = "qt" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG pcre"
fi
@@ -6503,6 +6551,7 @@ else
echo " Mode ................... $build_mode"
fi
unset build_mode release
+echo " Using sanitizer(s)...... $CFG_SANITIZERS"
echo " Using C++11 ............ $CFG_CXX11"
echo " Using gold linker....... $CFG_USE_GOLD_LINKER"
echo " Using PCH .............. $CFG_PRECOMPILE"