diff options
| author | Pierre Pronchery <khorben@FreeBSD.org> | 2026-06-24 19:47:19 +0000 |
|---|---|---|
| committer | Pierre Pronchery <khorben@FreeBSD.org> | 2026-06-29 05:21:29 +0000 |
| commit | ebcc78644e0cbc4141807c0887ef8d902cb91bb4 (patch) | |
| tree | da5efe7c3c9ae0f140e24a1b69833a476fb09f01 /libpkgconf/stdinc.h | |
| parent | 6294b6ab217a2d5f1d2bc23a64505a228294c508 (diff) | |
Diffstat (limited to 'libpkgconf/stdinc.h')
| -rw-r--r-- | libpkgconf/stdinc.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/libpkgconf/stdinc.h b/libpkgconf/stdinc.h index 31284ed88261..4bc0596cb88e 100644 --- a/libpkgconf/stdinc.h +++ b/libpkgconf/stdinc.h @@ -2,6 +2,8 @@ * stdinc.h * pull in standard headers (including portability hacks) * + * SPDX-License-Identifier: pkgconf + * * Copyright (c) 2012 pkgconf authors (see AUTHORS). * * Permission to use, copy, modify, and/or distribute this software for any @@ -16,6 +18,11 @@ #ifndef LIBPKGCONF_STDINC_H #define LIBPKGCONF_STDINC_H +/* make POSIX/BSD declarations (e.g. strdup) visible even under a strict -std= */ +#ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE +#endif + #include <ctype.h> #include <stdio.h> #include <stdlib.h> @@ -31,15 +38,29 @@ # define WIN32_LEAN_AND_MEAN # include <windows.h> # include <malloc.h> +# include <io.h> /* for _setmode() */ +# include <fcntl.h> # define PATH_DEV_NULL "nul" -# ifdef _WIN64 -# ifndef __MINGW32__ -# define SIZE_FMT_SPECIFIER "%I64u" +# ifdef _MSC_VER +# if _MSC_VER >= 1900 +# define SIZE_FMT_SPECIFIER "%zu" # else -# define SIZE_FMT_SPECIFIER "%llu" +# ifdef _WIN64 +# define SIZE_FMT_SPECIFIER "%I64u" +# else +# define SIZE_FMT_SPECIFIER "%u" +# endif # endif # else -# define SIZE_FMT_SPECIFIER "%u" +# ifdef _WIN64 +# ifndef __MINGW32__ +# define SIZE_FMT_SPECIFIER "%I64u" +# else +# define SIZE_FMT_SPECIFIER "%llu" +# endif +# else +# define SIZE_FMT_SPECIFIER "%u" +# endif # endif # ifndef ssize_t # ifndef __MINGW32__ @@ -52,9 +73,14 @@ # ifndef __MINGW32__ # include "win-dirent.h" # else -# include <dirent.h> +# include <dirent.h> # endif # define PKGCONF_ITEM_SIZE (_MAX_PATH + 1024) +# define PKG_CONFIG_PATH_SEP_S ";" +# define PKG_DIR_SEP_S '\\' +# define strcasecmp _stricmp +# define strncasecmp _strnicmp +# define realpath(N,R) _fullpath((R),(N),_MAX_PATH) #else # define PATH_DEV_NULL "/dev/null" # define SIZE_FMT_SPECIFIER "%zu" @@ -65,11 +91,18 @@ # include <unistd.h> # include <limits.h> # include <strings.h> +# include <fcntl.h> // open +# include <libgen.h> // basename/dirname +# include <sys/stat.h> // lstat, S_ISLNK +# include <unistd.h> // close, readlinkat +# include <string.h> # ifdef PATH_MAX # define PKGCONF_ITEM_SIZE (PATH_MAX + 1024) # else # define PKGCONF_ITEM_SIZE (4096 + 1024) # endif +# define PKG_CONFIG_PATH_SEP_S ":" +# define PKG_DIR_SEP_S '/' #endif #endif |
