// include/libcwd/timestamp-sys.h.  Generated from sys.h.in by configure.
// $Header$
//
// Copyright (C) 2000 - 2003, by
// 
// Carlo Wood, Run on IRC <carlo@alinoe.com>
// RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
//
// This file may be distributed under the terms of the Q Public License
// version 1.0 as appearing in the file LICENSE.QPL included in the
// packaging of this file.
//

//
// NOTE:
//
// This header file was generated with the `configure' script of libcwd-0.99.47
// If you change your system header files (like glibc or kernel header)
// it might be needed to regenerate it.
//

/** \file libcwd/sys.h
 * Do not include this header file directly, instead include a custom \link preparation "sys.h" \endlink.
 */

#ifndef LIBCWD_SYS_H
#define LIBCWD_SYS_H

namespace libcwd {
  /**
   * \brief Offset to __builtin_return_address() needed to get the correct line number from location_ct.
   *
   * \par Example
   * \code
   * libcwd::location_ct loc((char*)__builtin_return_address(0) + libcwd::builtin_return_address_offset);
   * \endcode
   */
  int const builtin_return_address_offset = -1;
}

//
// Compilers and preprocessor used.  Put here to cause a recompile when changed.
// CC    : gcc version 4.2.1 20070719  [FreeBSD]
// CXX   : gcc version 4.2.1 20070719  [FreeBSD]
// CXXCPP: gcc version 4.2.1 20070719  [FreeBSD]
//

//
// Sanity check - if this is defined then _REENTRANT will be defined regardless
// and that won't work.
//
#ifdef __GTHREADS
#error No, no, no... "sys.h" has to be the VERY first header file you include.  Before ANY other (system) header file.
#endif

//
// g++ 3.4 (20030816) defines _REENTRANT regardless when including
// certain standard libstdc++ header files.  Therefore we can ONLY
// test on _REENTRANT here, before including any other header file.
//
#if defined(_REENTRANT) || defined(_THREAD_SAFE)
// Some (broken) third party libraries include -D_REENTRANT in the
// pkg-config --cflags output (for example, several X libraries).
// Therefore we can't even rely here on it anymore.  Instead use
// our own define to know if this is a threaded application or not.
#ifndef LIBCWD_THREAD_SAFE
// This could be a #warning -- if gcc SHOWED warnings in system headers.
#error Please use -DLIBCWD_THREAD_SAFE on the command line if you intend to link with libcwd_r! \
       To fix this error, remove -D_REENTRANT (and/or -D_THREAD_SAFE) from your compile flags \
       when you are compiling a single threaded application (and link with libcwd), or add \
       -DLIBCWD_THREAD_SAFE to the compile flags (and link with libcwd_r). Alternatively you \
       can suppress this warning by adding -DLIBCWD_THREAD_SAFE=0 (and link with libcwd). \
       You are strongly advised to use pkg-config to determine the correct flags \
       (see example-project/m4/CW_LIB_LIBCWD.m4)!
#endif	// LIBCWD_THREAD_SAFE

#else	// !(defined(_REENTRANT) || defined(_THREAD_SAFE))

#ifndef LIBCWD_THREAD_SAFE
#define LIBCWD_THREAD_SAFE 0
#elif LIBCWD_THREAD_SAFE
// This could be a #warning -- if gcc SHOWED warnings in system headers.
#error LIBCWD_THREAD_SAFE is set, which implies the use of threads. \
       You should also define _REENTRANT (or _THREAD_SAFE on some OS) for the sake of other libraries in this case! \
       Add -D_REENTRANT -pthread to your CXXFLAGS for threaded applications.
#endif

#endif	// defined(_REENTRANT) || defined(_THREAD_SAFE)

#if LIBCWD_THREAD_SAFE && !defined(_GNU_SOURCE)
#error Sorry, libcwd_r uses GNU extensions, also in the header files.
#error Therefore you must also define _GNU_SOURCE when you are linking with -lcwd_r.
#error Please add #define _GNU_SOURCE to your "sys.h", see reference-manual/preparation.html#preparation_step2.
#endif

#endif /* LIBCWD_SYS_H */
