PosixSource.h 1.37 KB
Newer Older
1 2
/* -----------------------------------------------------------------------------
 *
3
 * (c) The GHC Team, 1998-2005
4 5 6 7 8 9 10 11
 *
 * Include this file into sources which should not need any non-Posix services.
 * That includes most RTS C sources.
 * ---------------------------------------------------------------------------*/

#ifndef POSIXSOURCE_H
#define POSIXSOURCE_H

Ian Lynagh's avatar
Ian Lynagh committed
12 13
#include <ghcplatform.h>

14
#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
15 16
#define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE   600
17 18 19 20
#else
#define _POSIX_SOURCE   1
#define _POSIX_C_SOURCE 199506L
#define _XOPEN_SOURCE   500
21 22 23 24 25 26 27
// FreeBSD takes a different approach to _ISOC99_SOURCE: on FreeBSD it
// means "I want *just* C99 things", whereas on GNU libc and Solaris
// it means "I also want C99 things".  
//
// On both GNU libc and FreeBSD, _ISOC99_SOURCE is implied by
// _XOPEN_SOURCE==600, but on Solaris it is an error to omit it.
#define _ISOC99_SOURCE
28 29 30 31
// Defining __USE_MINGW_ANSI_STDIO is the most portable way to tell
// mingw that we want to use the standard %lld style format specifiers,
// rather than the Windows %I64d style
#define __USE_MINGW_ANSI_STDIO 1
32 33
#endif

Ian Lynagh's avatar
Ian Lynagh committed
34 35 36 37 38 39 40 41
#if defined(darwin_HOST_OS)
/* If we don't define this the including sysctl breaks with things like
    /usr/include/bsm/audit.h:224:0:
         error: syntax error before 'u_char'
*/
#define _DARWIN_C_SOURCE 1
#endif

42
#endif /* POSIXSOURCE_H */