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

 
 

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

Submitted by:  None
Submitted on:  Sat 10 May 2014 08:30:49 PM UTC  
 
Priority: 5 - NormalStatus: None
Assigned to: NoneOriginator Email: -unavailable-
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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.:

AX_CHECK_ENABLE_DEBUG([yes],[DISABLE_DEBUG])

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>
Project 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.

Usage: AX_DEBUG_CHECK()

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

License: LGPLv2.1+

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31363:  ax_check_enable_debug.m4 added by drbob (4kB - application/x-m4 - AX_CHECK_ENABLE_DEBUG with variable lists)
file #31356:  ax_check_enable_debug.m4 added by rhysu (4kB - 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
  • -unavailable- added by drbob (Posted a comment)
  • -unavailable- added by rhysu (Updated the item)
  • -unavailable- added by None (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 12 May 2014 05:04:24 PM UTCdrbobAttached File-=>Added ax_check_enable_debug.m4, #31363
    Sun 11 May 2014 01:13:55 PM UTCrhysuAttached File-=>Added ax_check_enable_debug.m4, #31356
    Sat 10 May 2014 08:30:49 PM UTCNoneAttached File-=>Added ax_debug_check.m4, #31348

    Back to the top


    Powered by Savane 3.1-cleanup