Re: C++, assert and NDEBUG

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

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux