[njs] Added extra configure options for debug builds.
Dmitry Volyntsev
xeioex at nginx.com
Wed Nov 13 16:32:59 UTC 2019
details: https://hg.nginx.org/njs/rev/077e125e31c1
branches:
changeset: 1236:077e125e31c1
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed Nov 13 18:27:06 2019 +0300
description:
Added extra configure options for debug builds.
diffstat:
auto/cc | 20 ++++++++++++++++++++
auto/help | 14 ++++++++++----
auto/options | 9 ++++++++-
3 files changed, 38 insertions(+), 5 deletions(-)
diffs (102 lines):
diff -r 96d99066e8e5 -r 077e125e31c1 auto/cc
--- a/auto/cc Wed Nov 13 15:31:41 2019 +0300
+++ b/auto/cc Wed Nov 13 18:27:06 2019 +0300
@@ -99,6 +99,11 @@ case $NJS_CC_NAME in
# Debug.
NJS_CFLAGS="$NJS_CFLAGS -g"
+
+ if [ "$NJS_ADDRESS_SANITIZER" = "YES" ]; then
+ NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address"
+ NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer"
+ fi
;;
clang)
@@ -135,6 +140,12 @@ case $NJS_CC_NAME in
# error on PowerPC Clang.
NJS_CFLAGS="$NJS_CFLAGS -g"
fi
+
+ if [ "$NJS_ADDRESS_SANITIZER" = "YES" ]; then
+ NJS_CFLAGS="$NJS_CFLAGS -fsanitize=address"
+ NJS_CFLAGS="$NJS_CFLAGS -fno-omit-frame-pointer"
+ NJS_CFLAGS="$NJS_CFLAGS -fsanitize-address-use-after-scope"
+ fi
;;
SunC)
@@ -147,6 +158,10 @@ case $NJS_CC_NAME in
NJS_CFLAGS="$NJS_CFLAGS -errwarn=%all"
# Debug.
NJS_CFLAGS="$NJS_CFLAGS -g"
+
+ if [ "$NJS_ADDRESS_SANITIZER" = "YES" ]; then
+ echo " - Address sanitizer is not supported by $NJS_CC_NAME"
+ fi
;;
*)
@@ -154,5 +169,10 @@ case $NJS_CC_NAME in
esac
+if [ "$NJS_DEBUG" = "YES" ]; then
+ njs_define=NJS_DEBUG . auto/define
+ njs_define=NJS_DEBUG_MEMORY . auto/define
+fi
+
# Stop on error exit status again.
set -e
diff -r 96d99066e8e5 -r 077e125e31c1 auto/help
--- a/auto/help Wed Nov 13 15:31:41 2019 +0300
+++ b/auto/help Wed Nov 13 18:27:06 2019 +0300
@@ -7,9 +7,15 @@ cat << END
./configure options:
- --cc=FILE set C compiler filename, default: "$CC"
- --cc-opt=OPTIONS set additional C compiler options
- --ld-opt=OPTIONS set additional linker options
- --ar=FILE set static linking program, default: "$AR"
+ --cc=FILE set C compiler filename, default: "$CC"
+ --cc-opt=OPTIONS set additional C compiler options, \
+default: "$NJS_CC_OPT"
+ --ld-opt=OPTIONS set additional linker options, \
+default: "$NJS_LD_OPT"
+ --ar=FILE set static linking program, default: "$AR"
+ --debug=YES enables additional runtime checks, \
+default: "$NJS_DEBUG"
+ --address-sanitizer=YES enables build with address sanitizer, \
+default: "$NJS_ADDRESS_SANITIZER"
END
diff -r 96d99066e8e5 -r 077e125e31c1 auto/options
--- a/auto/options Wed Nov 13 15:31:41 2019 +0300
+++ b/auto/options Wed Nov 13 18:27:06 2019 +0300
@@ -3,10 +3,14 @@
# Copyright (C) NGINX, Inc.
-NJS_CONFIGURE_OPTIONS=
NJS_CC_OPT=${NJS_CC_OPT:--O}
NJS_LD_OPT=${NJS_CC_OPT:--O}
+NJS_DEBUG=NO
+NJS_ADDRESS_SANITIZER=NO
+
+NJS_CONFIGURE_OPTIONS=
+
for njs_option
do
case "$njs_option" in
@@ -20,6 +24,9 @@ do
--ld-opt=*) NJS_LD_OPT="$value" ;;
--ar=*) AR="$value" ;;
+ --debug=*) NJS_DEBUG="$value" ;;
+ --address-sanitizer=*) NJS_ADDRESS_SANITIZER="$value" ;;
+
--help)
. auto/help
exit 0
More information about the nginx-devel
mailing list