ax_cxx_dtor_after_atexit

Synopsis

AX_CXX_DTOR_AFTER_ATEXIT

Description

If the C++ compiler calls global destructors after atexit functions, define HAVE_DTOR_AFTER_ATEXIT.

Conformant behavior is to have global destructors after atexit

Per Paragraph 3.6.3/1 of the C++11 Standard:

Destructors (12.4) for initialized objects [..] with static storage duration are called as a result of returning from main and as a result of calling std::exit (18.5).

And per Paragraph 3.6.3/3:

If the completion of the initialization of an object with static storage duration is sequenced before a call to std::atexit [..], the call to the function passed to std::atexit is sequenced before the call to the destructor for the object.

WARNING: If cross-compiling, the test cannot be performed, the default action is to define HAVE_DTOR_AFTER_ATEXIT.

Source Code

Download the latest version of ax_cxx_dtor_after_atexit.m4 or browse the macro’s revision history.

License

Copyright © 2008 Todd Veldhuizen
Copyright © 2008 Luc Maisonobe 

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.