summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorT. Wouters <thomas@python.org>2017-05-22 23:30:49 (GMT)
committerGitHub <noreply@github.com>2017-05-22 23:30:49 (GMT)
commitddbfa2c35b298a56f0b813656745bca9cb7334f1 (patch)
tree9016b96669e130e30bac6d92cb428f31ea08fa3d /configure.ac
parent0c4aca54dcf0c54f299c78aa71fe8f48ff04f9d9 (diff)
downloadcpython-ddbfa2c35b298a56f0b813656745bca9cb7334f1.zip
cpython-ddbfa2c35b298a56f0b813656745bca9cb7334f1.tar.gz
cpython-ddbfa2c35b298a56f0b813656745bca9cb7334f1.tar.bz2
Add --with-assertions configure flag to enable C assertions(#1731)
Defaults to 'no', but as before assertions are implied by --with-pydebug.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index e065ce5..5aa52d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1251,6 +1251,27 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
fi],
[AC_MSG_RESULT(no)])
+# Check for --with-assertions. Py_DEBUG implies assertions, but also changes
+# the ABI. This allows enabling assertions without changing the ABI.
+assertions='false'
+AC_MSG_CHECKING(for --with-assertions)
+AC_ARG_WITH(assertions,
+ AC_HELP_STRING([--with-assertions], [build with C assertions enabled]),
+[
+if test "$withval" != no
+then
+ assertions='true'
+fi],
+[])
+if test "$assertions" = 'true'; then
+ AC_MSG_RESULT(yes)
+elif test "$Py_DEBUG" = 'true'; then
+ assertions='true'
+ AC_MSG_RESULT(implied by --with-pydebug)
+else
+ AC_MSG_RESULT(no)
+fi
+
# Enable optimization flags
AC_SUBST(DEF_MAKE_ALL_RULE)
AC_SUBST(DEF_MAKE_RULE)
@@ -1868,7 +1889,7 @@ case "$CC" in
;;
esac
-if test "$Py_DEBUG" = 'true'; then
+if test "$assertions" = 'true'; then
:
else
OPT="-DNDEBUG $OPT"