37 #ifndef GCONFIG_NO_GCONFIG_DEFS
38 #include <gconfig_defs.h>
43 #if !defined(G_WINDOWS) && !defined(G_UNIX)
50 #if defined(G_WINDOWS) && defined(G_UNIX)
51 #error invalid compilation switches - define G_WINDOWS or G_UNIX but not both
56 #if defined(__MINGW32__) && !defined(G_MINGW)
60 #if defined(G_MINGW) && !defined(G_WINDOWS)
61 #error invalid compilation switches - G_MINGW requires G_WINDOWS
63 #if defined(__NetBSD__)
65 #define G_UNIX_NETBSD 1
67 #if defined(__OpenBSD__)
69 #define G_UNIX_OPENBSD 1
71 #if defined(__FreeBSD__)
73 #define G_UNIX_FREEBSD 1
75 #if defined(__APPLE__)
79 #if defined(linux) || defined(__linux__)
80 #define G_UNIX_LINUX 1
85 #if !defined(GCONFIG_HAVE_CXX_ALIGNMENT)
86 #define GCONFIG_HAVE_CXX_ALIGNMENT 1
88 #if !defined(GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE)
90 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 1
92 #if __cplusplus >= 201400L
93 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 1
95 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 0
99 #if !defined(GCONFIG_HAVE_CXX_STRING_VIEW)
100 #define GCONFIG_HAVE_CXX_STRING_VIEW 0
102 #if !defined(GCONFIG_HAVE_SYS_UTSNAME_H)
104 #define GCONFIG_HAVE_SYS_UTSNAME_H 1
106 #define GCONFIG_HAVE_SYS_UTSNAME_H 0
109 #if !defined(GCONFIG_HAVE_SYS_SELECT_H)
111 #define GCONFIG_HAVE_SYS_SELECT_H 1
113 #define GCONFIG_HAVE_SYS_SELECT_H 0
116 #if !defined(GCONFIG_HAVE_SYS_SOCKET_H)
118 #define GCONFIG_HAVE_SYS_SOCKET_H 1
120 #define GCONFIG_HAVE_SYS_SOCKET_H 0
123 #if !defined(GCONFIG_HAVE_SYS_MMAN_H)
125 #define GCONFIG_HAVE_SYS_MMAN_H 1
127 #define GCONFIG_HAVE_SYS_MMAN_H 0
130 #if !defined(GCONFIG_HAVE_NETINET_IN_H)
132 #define GCONFIG_HAVE_NETINET_IN_H 1
134 #define GCONFIG_HAVE_NETINET_IN_H 0
137 #if !defined(GCONFIG_HAVE_NETDB_H)
139 #define GCONFIG_HAVE_NETDB_H 1
141 #define GCONFIG_HAVE_NETDB_H 0
144 #if !defined(GCONFIG_HAVE_ARPA_INET_H)
146 #define GCONFIG_HAVE_ARPA_INET_H 1
148 #define GCONFIG_HAVE_ARPA_INET_H 0
151 #if !defined(GCONFIG_HAVE_LONG_LONG)
152 #define GCONFIG_HAVE_LONG_LONG 1
154 #if !defined(GCONFIG_HAVE_LONG_LONG_LONG)
156 #define GCONFIG_HAVE_LONG_LONG_LONG 0
158 #if !defined(GCONFIG_HAVE_STDINT_H)
159 #define GCONFIG_HAVE_STDINT_H 1
161 #if !defined(GCONFIG_HAVE_INTTYPES_H)
162 #define GCONFIG_HAVE_INTTYPES_H 1
164 #if !defined(GCONFIG_HAVE_INT64)
165 #define GCONFIG_HAVE_INT64 1
167 #if !defined(GCONFIG_HAVE_INT32)
168 #define GCONFIG_HAVE_INT32 1
170 #if !defined(GCONFIG_HAVE_INT16)
171 #define GCONFIG_HAVE_INT16 1
173 #if !defined(GCONFIG_HAVE_DIRENT_H)
174 #define GCONFIG_HAVE_DIRENT_H 1
176 #if !defined(GCONFIG_HAVE_READLINK)
178 #define GCONFIG_HAVE_READLINK 1
180 #define GCONFIG_HAVE_READLINK 0
183 #if !defined(GCONFIG_HAVE_ERRNO_T)
185 #define GCONFIG_HAVE_ERRNO_T 1
187 #define GCONFIG_HAVE_ERRNO_T 0
190 #if !defined(GCONFIG_HAVE_GETENV_S)
191 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(getenv_s)
192 #define GCONFIG_HAVE_GETENV_S 1
194 #define GCONFIG_HAVE_GETENV_S 0
197 #if !defined(GCONFIG_HAVE_PUTENV_S)
198 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(putenv_s)
199 #define GCONFIG_HAVE_PUTENV_S 1
201 #define GCONFIG_HAVE_PUTENV_S 0
204 #if !defined(GCONFIG_HAVE_PUTENV)
205 #define GCONFIG_HAVE_PUTENV 1
207 #if !defined(GCONFIG_HAVE_GETPWNAM)
208 #define GCONFIG_HAVE_GETPWNAM 1
210 #if !defined(GCONFIG_HAVE_GETPWNAM_R)
211 #define GCONFIG_HAVE_GETPWNAM_R 1
213 #if !defined(GCONFIG_HAVE_GETGRNAM)
214 #define GCONFIG_HAVE_GETGRNAM 1
216 #if !defined(GCONFIG_HAVE_GETGRNAM_R)
217 #define GCONFIG_HAVE_GETGRNAM_R 1
219 #if !defined(GCONFIG_HAVE_GMTIME_R)
220 #if defined(G_WINDOWS) && !defined(gmtime_r)
221 #define GCONFIG_HAVE_GMTIME_R 0
223 #define GCONFIG_HAVE_GMTIME_R 1
226 #if !defined(GCONFIG_HAVE_GMTIME_S)
227 #if defined(G_WINDOWS) || defined(gmtime_s)
228 #define GCONFIG_HAVE_GMTIME_S 1
230 #define GCONFIG_HAVE_GMTIME_S 0
233 #if !defined(GCONFIG_HAVE_IPV6)
234 #define GCONFIG_HAVE_IPV6 1
236 #if !defined(GCONFIG_HAVE_EXECVPE)
238 #define GCONFIG_HAVE_EXECVPE 1
240 #define GCONFIG_HAVE_EXECVPE 0
243 #if !defined(GCONFIG_HAVE_RTNETLINK)
245 #define GCONFIG_HAVE_RTNETLINK 1
247 #define GCONFIG_HAVE_RTNETLINK 0
250 #if !defined(GCONFIG_HAVE_NETROUTE)
252 #define GCONFIG_HAVE_NETROUTE 1
254 #define GCONFIG_HAVE_NETROUTE 0
257 #if !defined(GCONFIG_HAVE_LOCALTIME_R)
258 #if defined(G_WINDOWS) && !defined(localtime_r)
259 #define GCONFIG_HAVE_LOCALTIME_R 0
261 #define GCONFIG_HAVE_LOCALTIME_R 1
264 #if !defined(GCONFIG_HAVE_LOCALTIME_S)
265 #if defined(G_WINDOWS) || defined(localtime_s)
266 #define GCONFIG_HAVE_LOCALTIME_S 1
268 #define GCONFIG_HAVE_LOCALTIME_S 0
271 #if !defined(GCONFIG_HAVE_MEMORY_H)
272 #define GCONFIG_HAVE_MEMORY_H 1
274 #if !defined(GCONFIG_HAVE_SETPGRP_BSD)
275 #if defined(G_UNIX_LINUX) || defined(G_UNIX_MAC)
276 #define GCONFIG_HAVE_SETPGRP_BSD 0
278 #define GCONFIG_HAVE_SETPGRP_BSD 1
281 #if !defined(GCONFIG_HAVE_SETGROUPS)
283 #define GCONFIG_HAVE_SETGROUPS 1
285 #define GCONFIG_HAVE_SETGROUPS 0
288 #if !defined(GCONFIG_HAVE_STATBUF_TIMESPEC)
289 #if defined(G_UNIX_MAC)
290 #define GCONFIG_HAVE_STATBUF_TIMESPEC 1
292 #define GCONFIG_HAVE_STATBUF_TIMESPEC 0
295 #if !defined(GCONFIG_HAVE_STATBUF_NSEC)
296 #define GCONFIG_HAVE_STATBUF_NSEC 0
298 #if !defined(GCONFIG_HAVE_SIN6_LEN)
299 #define GCONFIG_HAVE_SIN6_LEN 0
301 #if !defined(GCONFIG_HAVE_SOCKLEN_T)
302 #define GCONFIG_HAVE_SOCKLEN_T 1
304 #if !defined(GCONFIG_HAVE_STDLIB_H)
305 #define GCONFIG_HAVE_STDLIB_H 1
307 #if !defined(GCONFIG_HAVE_STRNCPY_S)
308 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(strncpy_s)
309 #define GCONFIG_HAVE_STRNCPY_S 1
311 #define GCONFIG_HAVE_STRNCPY_S 0
314 #if !defined(GCONFIG_HAVE_STRINGS_H)
315 #define GCONFIG_HAVE_STRINGS_H 1
317 #if !defined(GCONFIG_HAVE_STRING_H)
318 #define GCONFIG_HAVE_STRING_H 1
320 #if !defined(GCONFIG_HAVE_NDIR_H)
321 #define GCONFIG_HAVE_NDIR_H 0
323 #if !defined(GCONFIG_HAVE_SYS_DIR_H)
324 #define GCONFIG_HAVE_SYS_DIR_H 0
326 #if !defined(GCONFIG_HAVE_SYS_NDIR_H)
327 #define GCONFIG_HAVE_SYS_NDIR_H 0
329 #if !defined(GCONFIG_HAVE_SYS_STAT_H)
330 #define GCONFIG_HAVE_SYS_STAT_H 1
332 #if !defined(GCONFIG_HAVE_SYS_WAIT_H)
334 #define GCONFIG_HAVE_SYS_WAIT_H 1
336 #define GCONFIG_HAVE_SYS_WAIT_H 0
339 #if !defined(GCONFIG_HAVE_SYS_TIME_H)
340 #define GCONFIG_HAVE_SYS_TIME_H 1
342 #if !defined(GCONFIG_HAVE_SYS_TYPES_H)
343 #define GCONFIG_HAVE_SYS_TYPES_H 1
345 #if !defined(GCONFIG_HAVE_UNISTD_H)
347 #define GCONFIG_HAVE_UNISTD_H 1
349 #define GCONFIG_HAVE_UNISTD_H 0
352 #if !defined(GCONFIG_HAVE_ERRNO_H)
353 #define GCONFIG_HAVE_ERRNO_H 1
355 #if !defined(GCONFIG_HAVE_NET_IF_H)
357 #define GCONFIG_HAVE_NET_IF_H 1
359 #define GCONFIG_HAVE_NET_IF_H 0
362 #if !defined(GCONFIG_HAVE_WINDOWS_IPHLPAPI_H)
364 #define GCONFIG_HAVE_WINDOWS_IPHLPAPI_H 0
366 #define GCONFIG_HAVE_WINDOWS_IPHLPAPI_H 1
369 #if !defined(GCONFIG_HAVE_GAISTRERROR)
370 #define GCONFIG_HAVE_GAISTRERROR 1
372 #if !defined(GCONFIG_HAVE_INET_NTOP)
373 #define GCONFIG_HAVE_INET_NTOP 1
375 #if !defined(GCONFIG_HAVE_IFNAMETOINDEX)
377 #define GCONFIG_HAVE_IFNAMETOINDEX 1
379 #define GCONFIG_HAVE_IFNAMETOINDEX 0
382 #if !defined(GCONFIG_HAVE_IFNAMETOLUID)
383 #if defined(G_WINDOWS) && !defined(G_MINGW)
384 #define GCONFIG_HAVE_IFNAMETOLUID 1
386 #define GCONFIG_HAVE_IFNAMETOLUID 0
389 #if !defined(GCONFIG_HAVE_IFINDEX)
391 #define GCONFIG_HAVE_IFINDEX 1
393 #define GCONFIG_HAVE_IFINDEX 0
396 #if !defined(GCONFIG_HAVE_INET_PTON)
397 #define GCONFIG_HAVE_INET_PTON 1
399 #if !defined(GCONFIG_HAVE_UID_T)
401 #define GCONFIG_HAVE_UID_T 1
403 #define GCONFIG_HAVE_UID_T 0
406 #if !defined(GCONFIG_HAVE_GID_T)
407 #define GCONFIG_HAVE_GID_T GCONFIG_HAVE_UID_T
409 #if !defined(GCONFIG_HAVE_UINTPTR_T)
410 #define GCONFIG_HAVE_UINTPTR_T 0
412 #if !defined(GCONFIG_HAVE_SSIZE_T)
413 #if defined(G_UNIX) || defined(G_MINGW)
414 #define GCONFIG_HAVE_SSIZE_T 1
416 #define GCONFIG_HAVE_SSIZE_T 0
419 #if !defined(GCONFIG_HAVE_PID_T)
420 #if defined(G_UNIX) || defined(G_MINGW)
421 #define GCONFIG_HAVE_PID_T 1
423 #define GCONFIG_HAVE_PID_T 0
426 #if !defined(GCONFIG_HAVE_GET_WINDOW_LONG_PTR)
428 #define GCONFIG_HAVE_GET_WINDOW_LONG_PTR 1
430 #define GCONFIG_HAVE_GET_WINDOW_LONG_PTR 0
433 #if !defined(GCONFIG_HAVE_MREMAP)
435 #define GCONFIG_HAVE_MREMAP 1
437 #define GCONFIG_HAVE_MREMAP 0
440 #if !defined(GCONFIG_HAVE_TIMERFD)
442 #define GCONFIG_HAVE_TIMERFD 1
444 #define GCONFIG_HAVE_TIMERFD 0
447 #if !defined(GCONFIG_HAVE_PAM)
449 #define GCONFIG_HAVE_PAM 1
451 #define GCONFIG_HAVE_PAM 0
454 #if !defined(GCONFIG_HAVE_PAM_IN_SECURITY)
456 #define GCONFIG_HAVE_PAM_IN_SECURITY 1
458 #define GCONFIG_HAVE_PAM_IN_SECURITY 0
461 #if !defined(GCONFIG_HAVE_PAM_IN_INCLUDE)
462 #define GCONFIG_HAVE_PAM_IN_INCLUDE 0
464 #if !defined(GCONFIG_HAVE_PAM_IN_PAM)
465 #define GCONFIG_HAVE_PAM_IN_PAM 0
467 #if !defined(GCONFIG_PAM_CONST)
468 #if defined(G_UNIX_LINUX) || defined(G_UNIX_BSD)
469 #define GCONFIG_PAM_CONST 1
471 #define GCONFIG_PAM_CONST 0
474 #if !defined(GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO)
476 #define GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO 1
478 #define GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO 0
481 #if !defined(GCONFIG_HAVE_LIBJPEG)
482 #define GCONFIG_HAVE_LIBJPEG 0
484 #if !defined(GCONFIG_HAVE_LIBPNG)
485 #define GCONFIG_HAVE_LIBPNG 0
487 #if !defined(GCONFIG_HAVE_LIBAV)
488 #define GCONFIG_HAVE_LIBAV 0
490 #if !defined(GCONFIG_HAVE_CURSES)
491 #define GCONFIG_HAVE_CURSES 0
493 #if !defined(GCONFIG_HAVE_LIBEXIV)
494 #define GCONFIG_HAVE_LIBEXIV 0
496 #if !defined(GCONFIG_HAVE_V4L)
498 #define GCONFIG_HAVE_V4L 1
500 #define GCONFIG_HAVE_V4L 0
503 #if !defined(GCONFIG_HAVE_LIBV4L)
504 #define GCONFIG_HAVE_LIBV4L 0
506 #if !defined(GCONFIG_HAVE_GETTEXT)
508 #if defined(ENABLE_NLS) && ENABLE_NLS == 1
509 #define GCONFIG_HAVE_GETTEXT 1
511 #define GCONFIG_HAVE_GETTEXT 0
514 #if !defined(GCONFIG_ENABLE_IPV6)
515 #define GCONFIG_ENABLE_IPV6 GCONFIG_HAVE_IPV6
517 #if !defined(GCONFIG_ENABLE_STD_THREAD)
518 #define GCONFIG_ENABLE_STD_THREAD 1
520 #if !defined(GCONFIG_HAVE_SEM_INIT)
521 #if defined(G_UNIX_LINUX) || defined(G_UNIX_FREEBSD)
522 #define GCONFIG_HAVE_SEM_INIT 1
524 #define GCONFIG_HAVE_SEM_INIT 0
527 #if !defined(GCONFIG_HAVE_X11)
529 #define GCONFIG_HAVE_X11 1
531 #define GCONFIG_HAVE_X11 0
534 #if !defined(GCONFIG_HAVE_WAYLAND)
536 #define GCONFIG_HAVE_WAYLAND 0
538 #define GCONFIG_HAVE_WAYLAND 0
541 #if !defined(GCONFIG_HAVE_MBEDTLS)
542 #define GCONFIG_HAVE_MBEDTLS 1
544 #if !defined(GCONFIG_HAVE_MBEDTLS_NET_H)
545 #define GCONFIG_HAVE_MBEDTLS_NET_H 0
547 #if !defined(GCONFIG_MBEDTLS_DISABLE_PSA_HEADER)
549 #define GCONFIG_MBEDTLS_DISABLE_PSA_HEADER 0
551 #define GCONFIG_MBEDTLS_DISABLE_PSA_HEADER 1
554 #if !defined(GCONFIG_HAVE_OPENSSL)
556 #define GCONFIG_HAVE_OPENSSL 1
558 #define GCONFIG_HAVE_OPENSSL 0
561 #if !defined(GCONFIG_HAVE_OPENSSL_MIN_MAX)
562 #define GCONFIG_HAVE_OPENSSL_MIN_MAX 1
564 #if !defined(GCONFIG_HAVE_OPENSSL_SSLv23_METHOD)
565 #define GCONFIG_HAVE_OPENSSL_SSLv23_METHOD 0
567 #if !defined(GCONFIG_HAVE_OPENSSL_SSLv3_METHOD)
568 #define GCONFIG_HAVE_OPENSSL_SSLv3_METHOD 0
570 #if !defined(GCONFIG_HAVE_OPENSSL_TLSv1_1_METHOD)
571 #define GCONFIG_HAVE_OPENSSL_TLSv1_1_METHOD 1
573 #if !defined(GCONFIG_HAVE_OPENSSL_TLSv1_2_METHOD)
574 #define GCONFIG_HAVE_OPENSSL_TLSv1_2_METHOD 1
576 #if !defined(GCONFIG_HAVE_BOOST)
578 #define GCONFIG_HAVE_BOOST 1
580 #define GCONFIG_HAVE_BOOST 0
583 #if !defined(GCONFIG_HAVE_ALSA)
585 #define GCONFIG_HAVE_ALSA 1
587 #define GCONFIG_HAVE_ALSA 0
590 #if !defined(GCONFIG_HAVE_FMEMOPEN)
591 #if !defined(G_UNIX_OPENBSD)
592 #define GCONFIG_HAVE_FMEMOPEN 1
594 #define GCONFIG_HAVE_FMEMOPEN 0
597 #if !defined(GCONFIG_HAVE_IP_MREQN)
598 #if defined(G_UNIX_LINUX) || defined(G_UNIX_FREEBSD)
599 #define GCONFIG_HAVE_IP_MREQN 1
601 #define GCONFIG_HAVE_IP_MREQN 0
604 #if !defined(GCONFIG_HAVE_EXECVPE)
606 #define GCONFIG_HAVE_EXECVPE 1
608 #define GCONFIG_HAVE_EXECVPE 0
611 #if !defined(GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX)
612 #if defined(G_WINDOWS) && !defined(G_MINGW)
613 #define GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX 1
615 #define GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX 0
618 #if !defined(GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX)
619 #if defined(G_WINDOWS) && !defined(G_MINGW)
620 #define GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX 1
622 #define GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX 0
625 #if !defined(GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX)
626 #if defined(G_WINDOWS) && !defined(G_MINGW)
627 #define GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX 1
629 #define GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX 0
632 #if !defined(GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H)
633 #if defined(G_WINDOWS)
634 #define GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H 1
636 #define GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H 0
639 #if !defined(GCONFIG_HAVE_WINDOWS_STARTUP_INFO_EX)
640 #if defined(G_WINDOWS) && !defined(G_MINGW)
641 #define GCONFIG_HAVE_WINDOWS_STARTUP_INFO_EX 1
643 #define GCONFIG_HAVE_WINDOWS_STARTUP_INFO_EX 0
646 #if !defined(GCONFIG_HAVE_DLOPEN)
648 #define GCONFIG_HAVE_DLOPEN 1
650 #define GCONFIG_HAVE_DLOPEN 0
653 #if !defined(GCONFIG_HAVE_FSOPEN)
654 #if defined(G_UNIX) || defined(G_MINGW)
655 #define GCONFIG_HAVE_FSOPEN 0
657 #define GCONFIG_HAVE_FSOPEN 1
660 #if !defined(GCONFIG_HAVE_FOPEN_S)
661 #if defined(G_WINDOWS)
662 #define GCONFIG_HAVE_FOPEN_S 1
664 #define GCONFIG_HAVE_FOPEN_S 0
667 #if !defined(GCONFIG_HAVE_SOPEN)
668 #if defined(G_UNIX) || defined(G_MINGW)
669 #define GCONFIG_HAVE_SOPEN 0
671 #define GCONFIG_HAVE_SOPEN 1
674 #if !defined(GCONFIG_HAVE_SOPEN_S)
675 #if defined(G_UNIX) || defined(G_MINGW)
676 #define GCONFIG_HAVE_SOPEN_S 0
678 #define GCONFIG_HAVE_SOPEN_S 1
681 #if !defined(GCONFIG_HAVE_EXTENDED_OPEN)
682 #if defined(G_UNIX) || defined(G_MINGW)
683 #define GCONFIG_HAVE_EXTENDED_OPEN 0
685 #define GCONFIG_HAVE_EXTENDED_OPEN 1
688 #if !defined(GCONFIG_HAVE_SIGPROCMASK)
690 #define GCONFIG_HAVE_SIGPROCMASK 1
692 #define GCONFIG_HAVE_SIGPROCMASK 0
695 #if !defined(GCONFIG_HAVE_PTHREAD_SIGMASK)
697 #define GCONFIG_HAVE_PTHREAD_SIGMASK 1
699 #define GCONFIG_HAVE_PTHREAD_SIGMASK 0
702 #if !defined(GCONFIG_HAVE_DIRENT_D_TYPE)
703 #if defined(_DIRENT_HAVE_D_TYPE)
704 #define GCONFIG_HAVE_DIRENT_D_TYPE 1
706 #define GCONFIG_HAVE_DIRENT_D_TYPE 0
709 #if !defined(GCONFIG_HAVE_IOVEC_SIMPLE)
711 #define GCONFIG_HAVE_IOVEC_SIMPLE 1
713 #define GCONFIG_HAVE_IOVEC_SIMPLE 0
716 #if !defined(GCONFIG_HAVE_UDS)
718 #define GCONFIG_HAVE_UDS 1
720 #define GCONFIG_HAVE_UDS 0
723 #if !defined(GCONFIG_HAVE_UDS_LEN)
725 #define GCONFIG_HAVE_UDS_LEN 1
727 #define GCONFIG_HAVE_UDS_LEN 0
733 #if defined(G_WINDOWS)
734 #ifndef WIN32_LEAN_AND_MEAN
735 #define WIN32_LEAN_AND_MEAN
737 #include <winsock2.h>
739 #include <ws2tcpip.h>
740 #if GCONFIG_HAVE_WINDOWS_IPHLPAPI_H
741 #include <iphlpapi.h>
743 #if GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H
744 #include <versionhelpers.h>
762 #if defined(G_WINDOWS)
763 #include <shellapi.h>
767 #if GCONFIG_HAVE_SYS_TYPES_H
768 #include <sys/types.h>
770 #if GCONFIG_HAVE_SYS_STAT_H
771 #include <sys/stat.h>
773 #if GCONFIG_HAVE_INTTYPES_H
777 #include <inttypes.h>
780 #if GCONFIG_HAVE_STDINT_H
787 #if GCONFIG_HAVE_UNISTD_H
790 #if GCONFIG_HAVE_ERRNO_H
797 #if GCONFIG_HAVE_SYS_WAIT_H
798 #include <sys/wait.h>
800 #if GCONFIG_HAVE_SYS_UTSNAME_H
801 #include <sys/utsname.h>
803 #if GCONFIG_HAVE_SYS_SELECT_H
804 #include <sys/select.h>
806 #if GCONFIG_HAVE_SYS_SOCKET_H
807 #include <sys/socket.h>
810 #define MSG_NOSIGNAL 0
812 #if GCONFIG_HAVE_SYS_MMAN_H
813 #include <sys/mman.h>
814 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
815 #define MAP_ANONYMOUS MAP_ANON
817 #ifndef MREMAP_MAYMOVE
818 #define MREMAP_MAYMOVE 0
821 #if GCONFIG_HAVE_NETINET_IN_H
822 #include <netinet/in.h>
824 #if GCONFIG_HAVE_NETDB_H
827 #if GCONFIG_HAVE_ARPA_INET_H
828 #include <arpa/inet.h>
830 #if GCONFIG_HAVE_NET_IF_H
833 #if GCONFIG_HAVE_PWD_H
836 #if GCONFIG_HAVE_GRP_H
868 #if ! defined(G_WINDOWS)
869 using BOOL =
unsigned char ;
870 using HDC =
unsigned int ;
871 using HWND =
unsigned int ;
872 using HINSTANCE =
unsigned int ;
873 using HANDLE =
unsigned int ;
874 using TCHAR = wchar_t ;
886 #if defined(G_WINDOWS)
887 #if GCONFIG_HAVE_INT64
888 using g_int64_t = INT64 ;
889 using g_uint64_t = UINT64 ;
891 #if GCONFIG_HAVE_INT32
892 using g_int32_t = INT32 ;
893 using g_uint32_t = UINT32 ;
895 #if GCONFIG_HAVE_INT16
896 using g_int16_t = INT16 ;
897 using g_uint16_t = UINT16 ;
900 #if GCONFIG_HAVE_INT64
901 using g_int64_t = int64_t ;
902 using g_uint64_t = uint64_t ;
904 #if GCONFIG_HAVE_INT32
905 using g_int32_t = int32_t ;
906 using g_uint32_t = uint32_t ;
908 #if GCONFIG_HAVE_INT16
909 using g_int16_t = int16_t ;
910 using g_uint16_t = uint16_t ;
913 #if GCONFIG_HAVE_UINTPTR_T
914 using g_uintptr_t = uintptr_t ;
916 using g_uintptr_t = std::size_t ;
918 #if GCONFIG_HAVE_INT64
919 static_assert(
sizeof(g_int64_t) == 8U ,
"uint64 wrong size" ) ;
920 static_assert(
sizeof(g_uint64_t) == 8U ,
"int64 wrong size" ) ;
922 #if GCONFIG_HAVE_INT32
923 static_assert(
sizeof(g_uint32_t) == 4U ,
"uint32 wrong size" ) ;
924 static_assert(
sizeof(g_int32_t) == 4U ,
"int32 wrong size" ) ;
926 #if GCONFIG_HAVE_INT16
927 static_assert(
sizeof(g_uint16_t) == 2U ,
"uint16 wrong size" ) ;
928 static_assert(
sizeof(g_int16_t) == 2U ,
"int16 wrong size" ) ;
930 static_assert(
sizeof(g_uintptr_t) >=
sizeof(
void*) ,
"" ) ;
934 #if ! GCONFIG_HAVE_UID_T
937 #if ! GCONFIG_HAVE_GID_T
940 #if ! GCONFIG_HAVE_SSIZE_T
942 using ssize_t = SSIZE_T ;
945 using ssize_t = int ;
948 #if ! GCONFIG_HAVE_PID_T
949 using pid_t =
unsigned int ;
951 #if ! GCONFIG_HAVE_SOCKLEN_T
952 using socklen_t = int ;
954 #if ! GCONFIG_HAVE_ERRNO_T
955 using errno_t = int ;
960 #if __cplusplus >= 201700L
961 #define GDEF_NORETURN_LHS [[noreturn]]
962 #define GDEF_UNUSED [[maybe_unused]]
963 #define GDEF_FALLTHROUGH [[fallthrough]];
965 #if defined(__GNUC__) || defined(__clang__)
966 #define GDEF_NORETURN_RHS __attribute__((noreturn))
967 #define GDEF_UNUSED __attribute__((unused))
968 #if defined(__GNUC__) && __GNUC__ >= 7
969 #define GDEF_FALLTHROUGH __attribute__((fallthrough));
971 #if defined(__clang__) && __clang_major__ >= 10
972 #define GDEF_FALLTHROUGH __attribute__((fallthrough));
975 #if defined(_MSC_VER)
976 #define GDEF_NORETURN_LHS __declspec(noreturn)
979 #ifndef GDEF_NORETURN_LHS
980 #define GDEF_NORETURN_LHS
982 #ifndef GDEF_NORETURN_RHS
983 #define GDEF_NORETURN_RHS
988 #ifndef GDEF_FALLTHROUGH
989 #define GDEF_FALLTHROUGH
992 namespace G {
template <
typename... T>
inline void gdef_ignore( T&& ... ) {} }
993 #define GDEF_IGNORE_PARAMS(...) G::gdef_ignore(__VA_ARGS__)
994 #define GDEF_IGNORE_RETURN std::ignore =
995 #define GDEF_IGNORE_PARAM(name) std::ignore = name
996 #define GDEF_IGNORE_VARIABLE(name) std::ignore = name
1000 #if !GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE
1005 template <
typename T,
typename... Args>
1006 std::unique_ptr<T> make_unique( Args&&... args )
1008 return std::unique_ptr<T>(
new T( std::forward<Args>(args)... ) ) ;
1015 #if GCONFIG_ENABLE_STD_THREAD
1023 static constexpr bool using_std_thread = true ;
1024 using thread_type = std::thread ;
1025 using mutex_type = std::mutex ;
1026 using lock_type = std::lock_guard<std::mutex> ;
1027 static bool works() ;
1028 static void yield()
noexcept { std::this_thread::yield() ; }
1038 template <
typename T_fn>
explicit dummy_thread( T_fn fn ) { fn() ; }
1039 template <
typename T_fn,
typename T_arg1> dummy_thread( T_fn fn , T_arg1 arg1 ) { fn(arg1) ; }
1040 template <
typename T_fn,
typename T_arg1,
typename T_arg2> dummy_thread( T_fn fn , T_arg1 arg1 , T_arg2 arg2 ) { fn(arg1,arg2) ; }
1042 bool joinable() const noexcept {
return false ; }
1045 id get_id()
const {
return 0 ; }
1047 class dummy_mutex {} ;
1048 class dummy_lock {
public:
explicit dummy_lock( dummy_mutex & ) {} } ;
1051 static constexpr bool using_std_thread = false ;
1052 using thread_type = G::dummy_thread ;
1053 using mutex_type = G::dummy_mutex ;
1054 using lock_type = G::dummy_lock ;
1055 static bool works() ;
1056 static void yield() noexcept {}
1066 inline constexpr bool is_windows() {
return true ; }
1068 inline constexpr bool is_windows() {
return false ; }
1071 inline constexpr bool is_wine() {
return true ; }
1073 inline constexpr bool is_wine() {
return false ; }
1076 inline constexpr bool is_linux() {
return true ; }
1078 inline constexpr bool is_linux() {
return false ; }
1080 #ifdef G_UNIX_FREEBSD
1081 inline constexpr bool is_free_bsd() {
return true ; }
1083 inline constexpr bool is_free_bsd() {
return false ; }
1085 #ifdef G_UNIX_OPENBSD
1086 inline constexpr bool is_open_bsd() {
return true ; }
1088 inline constexpr bool is_open_bsd() {
return false ; }
1091 inline constexpr bool is_bsd() {
return true ; }
1093 inline constexpr bool is_bsd() {
return false ; }
1100 using g_port_t = g_uint16_t ;
1104 #ifndef AI_NUMERICSERV
1105 #define AI_NUMERICSERV 0
1108 #ifndef MSG_NOSIGNAL
1109 #define MSG_NOSIGNAL 0
1112 #ifndef AI_ADDRCONFIG
1113 #define AI_ADDRCONFIG 0
1117 #define INADDR_NONE 0xffffffff
1123 #if GCONFIG_HAVE_IPV6
1124 inline void gdef_address6_init( sockaddr_in6 & s )
1126 #if GCONFIG_HAVE_SIN6_LEN
1127 s.sin6_len =
sizeof(s) ;
1137 #if ! GCONFIG_HAVE_GAISTRERROR
1138 inline const char * gai_strerror(
int )
1144 namespace GNet {
int inet_pton_imp(
int f ,
const char * p ,
void * result ) ; }
1145 #if ! GCONFIG_HAVE_INET_PTON
1146 inline int inet_pton(
int f ,
const char * p ,
void * result )
1148 return GNet::inet_pton_imp( f , p , result ) ;
1152 namespace GNet {
const char * inet_ntop_imp(
int f ,
void * ap ,
char * buffer , std::size_t n ) ; }
1153 #if ! GCONFIG_HAVE_INET_NTOP
1154 inline const char * inet_ntop(
int f ,
void * ap ,
char * buffer , std::size_t n )
1156 return GNet::inet_ntop_imp( f , ap , buffer , n ) ;
1160 #if GCONFIG_HAVE_PTHREAD_SIGMASK && GCONFIG_ENABLE_STD_THREAD
1162 inline int gdef_pthread_sigmask(
int how ,
const sigset_t * set_p , sigset_t * oldset_p )
noexcept
1164 return pthread_sigmask( how , set_p , oldset_p ) ;
1167 #if GCONFIG_HAVE_SIGPROCMASK
1169 inline int gdef_pthread_sigmask(
int how ,
const sigset_t * set_p , sigset_t * oldset_p )
noexcept
1171 return sigprocmask( how , set_p , oldset_p ) ;
1174 template <
typename... T>
int gdef_pthread_sigmask(T...) noexcept {
return 0 ; }
1178 #if GCONFIG_HAVE_IFNAMETOLUID
1179 #include <iphlpapi.h>
1180 inline unsigned long gdef_if_nametoindex(
const char * p )
1183 if( ConvertInterfaceNameToLuidA( p , &luid ) )
1185 _set_errno( EINVAL ) ;
1188 NET_IFINDEX result = 0 ;
1189 if( ConvertInterfaceLuidToIndex( &luid , &result ) != NO_ERROR )
1191 _set_errno( EINVAL ) ;
1198 #if GCONFIG_HAVE_IFNAMETOINDEX
1199 inline unsigned long gdef_if_nametoindex(
const char * p )
1206 return if_nametoindex( p ) ;
1209 inline unsigned long gdef_if_nametoindex(
const char * )
1212 _set_errno( EINVAL ) ;
1220 #if ! GCONFIG_HAVE_READLINK && !defined(readlink)
1221 inline ssize_t readlink(
const char * ,
char * , std::size_t )
1226 #if ! GCONFIG_HAVE_EXECVPE && !defined(execvpe) && defined(G_UNIX)
1227 inline int execvpe(
const char * ,
char * [] ,
char * [] )
1234 #if GCONFIG_HAVE_GETPWNAM && ! GCONFIG_HAVE_GETPWNAM_R
1236 inline int getpwnam_r(
const char * name ,
struct passwd * pwd ,
1237 char * buf , std::size_t buflen ,
struct passwd ** result )
1239 struct passwd * p = ::getpwnam( name ) ;
1254 #if GCONFIG_HAVE_GETGRNAM && ! GCONFIG_HAVE_GETGRNAM_R
1256 inline int getgrnam_r(
const char * name ,
struct group * grp ,
1257 char * buf , std::size_t buflen ,
struct passwd ** result )
1259 struct group * p = ::getgrnam( name ) ;
1274 #if ! GCONFIG_HAVE_GMTIME_R && !defined(gmtime_r)
1276 inline std::tm * gmtime_r(
const std::time_t * tp , std::tm * tm_p )
1278 #if GCONFIG_HAVE_GMTIME_S || defined(gmtime_s)
1279 errno_t e = gmtime_s( tm_p , tp ) ;
1280 if( e )
return nullptr ;
1283 const struct std::tm * p = std::gmtime( tp ) ;
1284 if( p == 0 )
return nullptr ;
1291 #if ! GCONFIG_HAVE_LOCALTIME_R && !defined(localtime_r)
1293 inline struct std::tm * localtime_r(
const std::time_t * tp ,
struct std::tm * tm_p )
1295 #if GCONFIG_HAVE_LOCALTIME_S || defined(localtime_s)
1296 errno_t e = localtime_s( tm_p , tp ) ;
1297 if( e )
return nullptr ;
1300 const struct std::tm * p = std::localtime( tp ) ;
1301 if( p == 0 )
return nullptr ;
1308 #if ! GCONFIG_HAVE_LOCALTIME_S && !defined(localtime_s)
1310 inline errno_t localtime_s(
struct std::tm * tm_p ,
const std::time_t * tp )
1312 const errno_t e_inval = 22 ;
1313 if( tm_p ==
nullptr )
return e_inval ;
1314 tm_p->tm_sec = tm_p->tm_min = tm_p->tm_hour = tm_p->tm_mday = tm_p->tm_mon =
1315 tm_p->tm_year = tm_p->tm_wday = tm_p->tm_yday = tm_p->tm_isdst = -1 ;
1316 if( tp ==
nullptr || *tp < 0 )
return e_inval ;
1317 const struct std::tm * p = std::localtime( tp ) ;
1318 if( p ==
nullptr )
return e_inval ;
1324 #if ! GCONFIG_HAVE_GMTIME_S && !defined(gmtime_s)
1326 inline errno_t gmtime_s(
struct std::tm * tm_p ,
const std::time_t * tp )
1328 const errno_t e_inval = 22 ;
1329 if( tm_p ==
nullptr )
return e_inval ;
1330 tm_p->tm_sec = tm_p->tm_min = tm_p->tm_hour = tm_p->tm_mday = tm_p->tm_mon =
1331 tm_p->tm_year = tm_p->tm_wday = tm_p->tm_yday = tm_p->tm_isdst = -1 ;
1332 if( tp ==
nullptr || *tp < 0 )
return e_inval ;
1333 const struct std::tm * p = std::gmtime( tp ) ;
1334 if( p ==
nullptr )
return e_inval ;
1340 #if GCONFIG_HAVE_SETGROUPS
1343 inline int setgroups( std::size_t ,
const gid_t * )
1349 #if ! GCONFIG_HAVE_GET_WINDOW_LONG_PTR && defined(G_WINDOWS)
1350 static_assert(
sizeof(
void*) == 4U ,
"" ) ;
1351 const int GWLP_HINSTANCE = GWL_HINSTANCE ;
1352 const int GWLP_WNDPROC = GWL_WNDPROC ;
1353 const int DWLP_USER = DWL_USER ;
1354 inline LONG_PTR GetWindowLongPtr( HWND h ,
int id )
1356 return static_cast<LONG_PTR
>(::GetWindowLong(h,
id)) ;
1358 inline LONG_PTR SetWindowLongPtr( HWND h ,
int id , LONG_PTR value )
1360 return static_cast<LONG_PTR
>(::SetWindowLong(h,
id,
static_cast<LONG
>(value))) ;
1364 #if ! GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H && defined(G_WINDOWS)
1365 inline bool IsWindowsVistaOrGreater()
1367 WORD major = HIBYTE( _WIN32_WINNT_VISTA ) ;
1368 WORD minor = LOBYTE( _WIN32_WINNT_VISTA ) ;
1369 OSVERSIONINFOEXW info {} ;
1370 info.dwOSVersionInfoSize =
sizeof(info) ;
1371 info.dwMajorVersion = major ;
1372 info.dwMinorVersion = minor ;
1373 return !! VerifyVersionInfoW( &info , VER_MAJORVERSION | VER_MINORVERSION ,
1374 VerSetConditionMask( VerSetConditionMask(0,VER_MAJORVERSION,VER_GREATER_EQUAL) ,
1375 VER_MINORVERSION , VER_GREATER_EQUAL ) ) ;
1379 #if ! GCONFIG_HAVE_MREMAP && defined(G_UNIX)
1380 inline void * mremap(
void * , std::size_t , std::size_t ,
int )
1383 return (
void*)(-1) ;
1387 #if GCONFIG_HAVE_SETPGRP_BSD && defined(G_UNIX)
1388 inline int setpgrp()
1390 return ::setpgrp( 0 , 0 ) ;
1394 #if ! GCONFIG_HAVE_CXX_ALIGNMENT
1398 inline void * align(
size_t align ,
size_t size ,
void * & ptr_inout ,
size_t & space )
noexcept
1400 const auto ptr =
reinterpret_cast<uintptr_t
>( ptr_inout ) ;
1401 const auto aligned = ( ptr - 1U + align ) & -align ;
1402 const auto diff = aligned - ptr ;
1403 if( (size + diff) > space )
1410 ptr_inout =
reinterpret_cast<void*
>( aligned ) ;
Helper class for std::thread capabilities.