patchGNU Autoconf Archive - Patches: patch #8452, Add AX_DEBUG_CHECK macro for...


patch #8452: Add AX_DEBUG_CHECK macro for --enable-debug option

Submitter:  None
Submitted:  Sat 10 May 2014 08:30:49 PM UTC
Priority:  5 - Normal Status:  Done
Assigned to:  simons Originator Email:  -email is unavailable-
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

Sat 13 Sep 2014 10:40:34 PM UTC, comment #5: 

Pushed in 280e79f. Thank you very much for the submission!

Peter Simons <simons>
Group administrator
Mon 12 May 2014 05:04:24 PM UTC, comment #4: 

I've added two new arguments: a list of variables to define if debugging is enabled (defaulting to nothing), and a list to define if it isn't (defaulting to NDEBUG).

(file #31363)

Philip Withnall <drbob>
Mon 12 May 2014 12:18:32 AM UTC, comment #3: 

I do like the second optional argument idea.  May be interesting to permit a list of things to define when debugging is disabled, defaulting to just NDEBUG as you suggest, to permit hitting library-by-library debugging-related defines in a single shot.

Anyhow, I'll stay out of it from here.  Thanks for looking over the suggestions.

- Rhys

Rhys Ulerich <rhysu>
Group Member
Sun 11 May 2014 10:31:49 PM UTC, comment #2: 

That all looks useful, and a good improvement on the macro I originally proposed. My only comment would be that it might make sense to allow setting the name of the defined variable using a second optional argument, so people could use, e.g.:


if they wanted to keep NDEBUG and DISABLE_DEBUG-controlled debug messages separate. This second argument would default to NDEBUG to promote standardisation on that.

Philip Withnall <drbob>
Sun 11 May 2014 01:13:55 PM UTC, comment #1: 

I've found a couple of things to be useful in my own versions of such macros.  You may/may not want to include them here, but I figured I'd share my experience.

1) Take --enable-debug=no/info/profile/yes with '', '-g', '-g -pg', '-g -O0' being added into {C,CXX,F,FC,OBJC}FLAGS as a result.
2) Permit controlling what the default behavior of the macro is through an optional argument.
3) Be careful about where the macro can be used relative to compiler checks so that it can influence the default compilation flags.
4) Call the resulting define NDEBUG rather than ENABLE_DEBUG so that it turns off assert calls automatically.

I have attached an example implementing these things.  Like I said, please adopt these ideas if you see fit.

- Rhys

(file #31356)

Rhys Ulerich <rhysu>
Group Member
Sat 10 May 2014 08:30:49 PM UTC, original submission:  

File attached containing a trivial macro to add an --enable-debug option which defines an ENABLE_DEBUG cpp variable if set.

The purpose of splitting this out as a macro is to encourage lots of projects to use the same --enable-debug configure option so that standardised configure arguments can be passed to multiple modules.


#   Copyright © 2000 Martin Baulig
#   Copyright © 2002 Jody Goldberg
#   Copyright © 2014 Philip Withnall

License: LGPLv2.1+



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #31363:  ax_check_enable_debug.m4 added by drbob (4KiB - application/x-m4 - AX_CHECK_ENABLE_DEBUG with variable lists)
file #31356:  ax_check_enable_debug.m4 added by rhysu (4KiB - application/x-m4)
file #31348:  ax_debug_check.m4 added by None (993B - application/x-m4 - AX_DEBUG_CHECK)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by simons (Posted a comment)
  • -email is unavailable- added by drbob (Posted a comment)
  • -email is unavailable- added by rhysu (Updated the item)
  • -email is unavailable- added by None (Submitted the item)

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-10-15 simons StatusReady For Test Done
        Open/ClosedOpen Closed
    2014-09-13 simons StatusNone Ready For Test
        Assigned toNone simons
    2014-05-12 drbob Attached File- Added ax_check_enable_debug.m4, #31363
    2014-05-11 rhysu Attached File- Added ax_check_enable_debug.m4, #31356
    2014-05-10 None Attached File- Added ax_debug_check.m4, #31348

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code