00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef LIBCWD_SYS_H
00028 #define LIBCWD_SYS_H
00029
00030 namespace libcwd {
00039 int const builtin_return_address_offset = -1;
00040 }
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifdef __GTHREADS
00054 #error No, no, no... "sys.h" has to be the VERY first header file you include. Before ANY other (system) header file.
00055 #endif
00056
00057
00058
00059
00060
00061
00062 #if defined(_REENTRANT) || defined(_THREAD_SAFE)
00063
00064
00065
00066
00067 #ifndef LIBCWD_THREAD_SAFE
00068
00069 #error Please use -DLIBCWD_THREAD_SAFE on the command line if you intend to link with libcwd_r! \
00070 To fix this error, remove -D_REENTRANT (and/or -D_THREAD_SAFE) from your compile flags \
00071 when you are compiling a single threaded application (and link with libcwd), or add \
00072 -DLIBCWD_THREAD_SAFE to the compile flags (and link with libcwd_r). Alternatively you \
00073 can suppress this warning by adding -DLIBCWD_THREAD_SAFE=0 (and link with libcwd). \
00074 You are strongly advised to use pkg-config to determine the correct flags \
00075 (see example-project/m4/CW_LIB_LIBCWD.m4)!
00076 #endif // LIBCWD_THREAD_SAFE
00077
00078 #else // !(defined(_REENTRANT) || defined(_THREAD_SAFE))
00079
00080 #ifndef LIBCWD_THREAD_SAFE
00081 #define LIBCWD_THREAD_SAFE 0
00082 #elif LIBCWD_THREAD_SAFE
00083
00084 #error LIBCWD_THREAD_SAFE is set, which implies the use of threads. \
00085 You should also define _REENTRANT (or _THREAD_SAFE on some OS) for the sake of other libraries in this case! \
00086 Add -D_REENTRANT -pthread to your CXXFLAGS for threaded applications.
00087 #endif
00088
00089 #endif // defined(_REENTRANT) || defined(_THREAD_SAFE)
00090
00091 #if LIBCWD_THREAD_SAFE && !defined(_GNU_SOURCE)
00092 #error Sorry, libcwd_r uses GNU extensions, also in the header files.
00093 #error Therefore you must also define _GNU_SOURCE when you are linking with -lcwd_r.
00094 #error Please add #define _GNU_SOURCE to your "sys.h", see reference-manual/preparation.html#preparation_step2.
00095 #endif
00096
00097 #endif