configure: Support ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable

Message ID 87tuux9i5y.fsf@redhat.com
State New
Headers
Series configure: Support ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable |

Commit Message

Dodji Seketeli Oct. 14, 2020, 11:11 a.m. UTC
  Hello,

When working in development environments with compiler versions that
might be very bleeding edge (like the Fedora Rawhide distribution) it
might be worthwhile to disable all compiler optimization to have a
better debugging experience.  In practice, I bumped into this need
again and again.

So I am adding this ABIGAIL_NO_OPTIMIZATION_DEBUG environment variable
to basically allow the "-g -O0" combination, if need be.

This patch obviously doesn't change any existing behaviour if the user
doesn't set this newly introduced environment variable.

	* configure.ac: Set the CXXFLAGS and CFLAGS to "-g -O0 -Wall
	-Wextra -Werror" if the ABIGAIL_NO_OPTIMIZATION_DEBUG is set.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Applied to master.
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/configure.ac b/configure.ac
index 904a726e..84a781a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -626,6 +626,11 @@  if test x$ABIGAIL_DEBUG != x; then
     CXXFLAGS="$CXXFLAGS -Og -g3 -ggdb"
 fi
 
+if test x$ABIGAIL_NO_OPTIMIZATION_DEBUG != x; then
+   CFLAGS="-g -O0 -Wall -Wextra -Werror"
+   CXXFLAGS="-g -O0 -Wall -Wextra -Werror"
+fi
+
 if test x$ENABLE_ASAN = xyes; then
     CFLAGS="$CFLAGS -fsanitize=address"
     CXXFLAGS="$CXXFLAGS -fsanitize=address"