autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++, assert and NDEBUG


From: William Pursell
Subject: Re: C++, assert and NDEBUG
Date: Sun, 28 Mar 2010 19:07:19 -1000
User-agent: Thunderbird 2.0.0.24 (Macintosh/20100228)

Steve Searle wrote:
> I have started using autotools for the C++ applications I create (very
> much as an amateur). I typically use assert statements during
> development, and would disable these by using -DNDEBUG when the release
> version is built. How should I configure things so that when a user
> installs from the tarball they compile by default with the -DNDEBUG
> option?

You shouldn't.  You have 2 reasonable choices:
1) Invoke AC_HEADER_ASSERT in configure.ac, giving the
   user the option to pass --disable-assert to configure.
2) Do nothing, and allow the user to pass CPPFLAGS=-DNDEBUG
   to configure.

You might choose to set -DNDEBUG in AM_CPPFLAGS, but
it really is best to let the user do it.  If you want
to ensure that assertions are disabled in binary
builds, then add the appropriate argument to the
configure invocation in the build file (eg, debian/rules
or a spec file).


-- 
William Pursell




reply via email to

[Prev in Thread] Current Thread [Next in Thread]