xref: /freebsd/contrib/pkgconf/libpkgconf/stdinc.h (revision a3cefe7f2b4df0f70ff92d4570ce18e517af43ec)
1 /*
2  * stdinc.h
3  * pull in standard headers (including portability hacks)
4  *
5  * Copyright (c) 2012 pkgconf authors (see AUTHORS).
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * This software is provided 'as is' and without any warranty, express or
12  * implied.  In no event shall the authors be liable for any damages arising
13  * from the use of this software.
14  */
15 
16 #ifndef LIBPKGCONF_STDINC_H
17 #define LIBPKGCONF_STDINC_H
18 
19 #include <ctype.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <stddef.h>
23 #include <stdbool.h>
24 #include <stdarg.h>
25 #include <string.h>
26 #include <sys/types.h>
27 #include <stdint.h>
28 #include <errno.h>
29 
30 #ifdef _WIN32
31 # define WIN32_LEAN_AND_MEAN
32 # include <windows.h>
33 # include <malloc.h>
34 # define PATH_DEV_NULL	"nul"
35 # ifdef _WIN64
36 #  ifndef __MINGW32__
37 #   define SIZE_FMT_SPECIFIER	"%I64u"
38 #  else
39 #   define SIZE_FMT_SPECIFIER	"%llu"
40 #  endif
41 # else
42 #  define SIZE_FMT_SPECIFIER	"%u"
43 # endif
44 # ifndef ssize_t
45 # ifndef __MINGW32__
46 #  include <BaseTsd.h>
47 # else
48 #  include <basetsd.h>
49 # endif
50 #  define ssize_t SSIZE_T
51 # endif
52 # ifndef __MINGW32__
53 #  include "win-dirent.h"
54 # else
55 # include <dirent.h>
56 # endif
57 # define PKGCONF_ITEM_SIZE (_MAX_PATH + 1024)
58 #else
59 # define PATH_DEV_NULL	"/dev/null"
60 # define SIZE_FMT_SPECIFIER	"%zu"
61 # ifdef __HAIKU__
62 #  include <FindDirectory.h>
63 # endif
64 # include <dirent.h>
65 # include <unistd.h>
66 # include <limits.h>
67 # include <strings.h>
68 # ifdef PATH_MAX
69 #  define PKGCONF_ITEM_SIZE (PATH_MAX + 1024)
70 # else
71 #  define PKGCONF_ITEM_SIZE (4096 + 1024)
72 # endif
73 #endif
74 
75 #endif
76