FIX: valgrind newline semantics after 3.5.0 (partial)
[nobug.git] / doc / using.txt
blob4030efb873e8f6ea5c121dcda9007f3be81854c2
1 HEAD- Using NoBug;;
3 Your application will have to include the header file 'nobug.h' before NoBug
4 can be used:
6 [source,sh]
7 ----------------
8 #include "nobug.h"
9 ----------------
11 Then you'll have to link the appropriate library to your application.  
13 A number of different libraries are available to link depending on whether you
14 require to statically or dynamically link, or whether your application is multi
15 or single threaded.
17 Compiling must also select a xref:buildlevel[build level], otherwise an error
18 will be reported. Many aspects of NoBug can be configured by overriding macros before
19 'nobug.h' is included.
21 A project using NoBug can use autoconf to check for execinfo and
22 valgrind.
24  AC_CHECK_HEADER([execinfo.h], AC_DEFINE(HAVE_EXECINFO_H))
25  PKG_HAVE_DEFINE_WITH_MODULES(VALGRIND, [valgrind])
27 For Multithreaded programs, you should also check for the availability of pthreads
28 and flavour
30  ACX_PTHREAD
32 When the resulting `HAVE_PTHREAD`, `HAVE_EXECINFO_H` and
33 `HAVE_VALGRIND_H` are defined by the configure script, the
34 relevant features become available.
36 NoBug then defines `NOBUG_USE_PTHREAD`, `NOBUG_USE_VALGRIND` and
37 `NOBUG_USE_EXECINFO` to 1. If you do not want to use any of these features in
38 NoBug, you can override these macros by setting to 0 before including nobug.h.
40 If `NVALGRIND` is defined, there will be no support for valgrind.
42 To use NoBug with single threaded programmes, link 'libnobug' to your project;
43 multi-threaded programmes should link 'libnobugmt'. Both libraries must
44 be initialized with `NOBUG_INIT` before any features can be used or any thread is
45 created. This is discussed in more detail in the
46 xref:multithreading[multithreading] chapter.
48 There are many other macros which can be set and overridden by the user to
49 control behavior. Your help would be appreciated in expanding this documentation
50 if you find some features useful; or simply contact any of the authors.
54 .Using Nobug from a Project using autoconf
55 [source,sh]
56 ----------------
57 PKG_CHECK_MODULES(NOBUGMT_LUMIERA, [nobugmt >= 0.3rc1],
58                                  AC_DEFINE(HAVE_NOBUGMT_H),
59                                  AC_MSG_ERROR([NoBug pkg-config metadata missing])
61 ----------------