38 #include <gconfig_defs.h>
42 #if !defined(G_WINDOWS) && !defined(G_UNIX)
49 #if defined(G_WINDOWS) && defined(G_UNIX)
50 #error invalid compilation switches - define G_WINDOWS or G_UNIX but not both
55 #if defined(__MINGW32__) && !defined(G_MINGW)
59 #if defined(G_MINGW) && !defined(G_WINDOWS)
60 #error invalid compilation switches - G_MINGW requires G_WINDOWS
62 #if defined(__NetBSD__)
64 #define G_UNIX_NETBSD 1
66 #if defined(__OpenBSD__)
68 #define G_UNIX_OPENBSD 1
70 #if defined(__FreeBSD__)
72 #define G_UNIX_FREEBSD 1
74 #if defined(__APPLE__)
78 #if defined(linux) || defined(__linux__)
79 #define G_UNIX_LINUX 1
84 #define G_COMPILER_CXX_11 1
88 #if !defined(GCONFIG_HAVE_CXX_NULLPTR)
89 #define GCONFIG_HAVE_CXX_NULLPTR 1
91 #if !defined(GCONFIG_HAVE_CXX_CONSTEXPR)
92 #define GCONFIG_HAVE_CXX_CONSTEXPR 1
94 #if !defined(GCONFIG_HAVE_CXX_ENUM_CLASS)
95 #define GCONFIG_HAVE_CXX_ENUM_CLASS 1
97 #if !defined(GCONFIG_HAVE_CXX_NOEXCEPT)
98 #define GCONFIG_HAVE_CXX_NOEXCEPT 1
100 #if !defined(GCONFIG_HAVE_CXX_OVERRIDE)
101 #define GCONFIG_HAVE_CXX_OVERRIDE 1
103 #if !defined(GCONFIG_HAVE_CXX_FINAL)
104 #define GCONFIG_HAVE_CXX_FINAL 1
106 #if !defined(GCONFIG_HAVE_CXX_ALIGNMENT)
107 #define GCONFIG_HAVE_CXX_ALIGNMENT 1
109 #if !defined(GCONFIG_HAVE_CXX_SHARED_PTR)
110 #define GCONFIG_HAVE_CXX_SHARED_PTR 1
112 #if !defined(GCONFIG_HAVE_CXX_STD_THREAD)
113 #define GCONFIG_HAVE_CXX_STD_THREAD 1
115 #if !defined(GCONFIG_HAVE_CXX_TYPE_TRAITS_MAKE_UNSIGNED)
116 #define GCONFIG_HAVE_CXX_TYPE_TRAITS_MAKE_UNSIGNED 1
118 #if !defined(GCONFIG_HAVE_CXX_EMPLACE)
119 #define GCONFIG_HAVE_CXX_EMPLACE 1
121 #if !defined(GCONFIG_HAVE_CXX_MOVE)
122 #define GCONFIG_HAVE_CXX_MOVE 1
124 #if !defined(GCONFIG_HAVE_CXX_DELETED)
125 #define GCONFIG_HAVE_CXX_DELETED 1
127 #if !defined(GCONFIG_HAVE_CXX_DEFAULTED)
128 #define GCONFIG_HAVE_CXX_DEFAULTED
130 #if !defined(GCONFIG_HAVE_CXX_INITIALIZER_LIST)
131 #define GCONFIG_HAVE_CXX_INITIALIZER_LIST 1
133 #if !defined(GCONFIG_HAVE_CXX_STD_WSTRING)
134 #define GCONFIG_HAVE_CXX_STD_WSTRING 1
136 #if !defined(GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE)
137 #if defined(_MSC_VER)
138 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 1
140 #if __cplusplus >= 201400L
141 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 1
143 #define GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE 0
147 #if !defined(GCONFIG_HAVE_SYS_UTSNAME_H)
149 #define GCONFIG_HAVE_SYS_UTSNAME_H 1
151 #define GCONFIG_HAVE_SYS_UTSNAME_H 0
154 #if !defined(GCONFIG_HAVE_SYS_SELECT_H)
156 #define GCONFIG_HAVE_SYS_SELECT_H 1
158 #define GCONFIG_HAVE_SYS_SELECT_H 0
161 #if !defined(GCONFIG_HAVE_SYS_SOCKET_H)
163 #define GCONFIG_HAVE_SYS_SOCKET_H 1
165 #define GCONFIG_HAVE_SYS_SOCKET_H 0
168 #if !defined(GCONFIG_HAVE_SYS_MMAN_H)
170 #define GCONFIG_HAVE_SYS_MMAN_H 1
172 #define GCONFIG_HAVE_SYS_MMAN_H 0
175 #if !defined(GCONFIG_HAVE_NETINET_IN_H)
177 #define GCONFIG_HAVE_NETINET_IN_H 1
179 #define GCONFIG_HAVE_NETINET_IN_H 0
182 #if !defined(GCONFIG_HAVE_NETDB_H)
184 #define GCONFIG_HAVE_NETDB_H 1
186 #define GCONFIG_HAVE_NETDB_H 0
189 #if !defined(GCONFIG_HAVE_ARPA_INET_H)
191 #define GCONFIG_HAVE_ARPA_INET_H 1
193 #define GCONFIG_HAVE_ARPA_INET_H 0
196 #if !defined(GCONFIG_HAVE_LONG_LONG)
197 #define GCONFIG_HAVE_LONG_LONG 1
199 #if !defined(GCONFIG_HAVE_LONG_LONG_LONG)
201 #define GCONFIG_HAVE_LONG_LONG_LONG 0
203 #if !defined(GCONFIG_HAVE_STDINT_H)
204 #define GCONFIG_HAVE_STDINT_H 1
206 #if !defined(GCONFIG_HAVE_INTTYPES_H)
207 #define GCONFIG_HAVE_INTTYPES_H 1
209 #if !defined(GCONFIG_HAVE_INT64)
210 #define GCONFIG_HAVE_INT64 1
212 #if !defined(GCONFIG_HAVE_INT32)
213 #define GCONFIG_HAVE_INT32 1
215 #if !defined(GCONFIG_HAVE_INT16)
216 #define GCONFIG_HAVE_INT16 1
218 #if !defined(GCONFIG_HAVE_DIRENT_H)
219 #define GCONFIG_HAVE_DIRENT_H 1
221 #if !defined(GCONFIG_HAVE_READLINK)
223 #define GCONFIG_HAVE_READLINK 1
225 #define GCONFIG_HAVE_READLINK 0
228 #if !defined(GCONFIG_HAVE_ERRNO_T)
230 #define GCONFIG_HAVE_ERRNO_T 1
232 #define GCONFIG_HAVE_ERRNO_T 0
235 #if !defined(GCONFIG_HAVE_GETENV_S)
236 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(getenv_s)
237 #define GCONFIG_HAVE_GETENV_S 1
239 #define GCONFIG_HAVE_GETENV_S 0
242 #if !defined(GCONFIG_HAVE_PUTENV_S)
243 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(putenv_s)
244 #define GCONFIG_HAVE_PUTENV_S 1
246 #define GCONFIG_HAVE_PUTENV_S 0
249 #if !defined(GCONFIG_HAVE_PUTENV)
250 #define GCONFIG_HAVE_PUTENV 1
252 #if !defined(GCONFIG_HAVE_GETPWNAM)
253 #define GCONFIG_HAVE_GETPWNAM 1
255 #if !defined(GCONFIG_HAVE_GETPWNAM_R)
256 #define GCONFIG_HAVE_GETPWNAM_R 1
258 #if !defined(GCONFIG_HAVE_GETGRNAM)
259 #define GCONFIG_HAVE_GETGRNAM 1
261 #if !defined(GCONFIG_HAVE_GETGRNAM_R)
262 #define GCONFIG_HAVE_GETGRNAM_R 1
264 #if !defined(GCONFIG_HAVE_GMTIME_R)
265 #if defined(G_WINDOWS) && !defined(gmtime_r)
266 #define GCONFIG_HAVE_GMTIME_R 0
268 #define GCONFIG_HAVE_GMTIME_R 1
271 #if !defined(GCONFIG_HAVE_GMTIME_S)
272 #if defined(G_WINDOWS) || defined(gmtime_s)
273 #define GCONFIG_HAVE_GMTIME_S 1
275 #define GCONFIG_HAVE_GMTIME_S 0
278 #if !defined(GCONFIG_HAVE_IPV6)
279 #define GCONFIG_HAVE_IPV6 1
281 #if !defined(GCONFIG_HAVE_EXECVPE)
283 #define GCONFIG_HAVE_EXECVPE 1
285 #define GCONFIG_HAVE_EXECVPE 0
288 #if !defined(GCONFIG_HAVE_RTNETLINK)
290 #define GCONFIG_HAVE_RTNETLINK 1
292 #define GCONFIG_HAVE_RTNETLINK 0
295 #if !defined(GCONFIG_HAVE_NETROUTE)
297 #define GCONFIG_HAVE_NETROUTE 1
299 #define GCONFIG_HAVE_NETROUTE 0
302 #if !defined(GCONFIG_HAVE_LOCALTIME_R)
303 #if defined(G_WINDOWS) && !defined(localtime_r)
304 #define GCONFIG_HAVE_LOCALTIME_R 0
306 #define GCONFIG_HAVE_LOCALTIME_R 1
309 #if !defined(GCONFIG_HAVE_LOCALTIME_S)
310 #if defined(G_WINDOWS) || defined(localtime_s)
311 #define GCONFIG_HAVE_LOCALTIME_S 1
313 #define GCONFIG_HAVE_LOCALTIME_S 0
316 #if !defined(GCONFIG_HAVE_MEMORY_H)
317 #define GCONFIG_HAVE_MEMORY_H 1
319 #if !defined(GCONFIG_HAVE_SETPGRP_BSD)
320 #if defined(G_UNIX_LINUX) || defined(G_UNIX_MAC)
321 #define GCONFIG_HAVE_SETPGRP_BSD 0
323 #define GCONFIG_HAVE_SETPGRP_BSD 1
326 #if !defined(GCONFIG_HAVE_SETGROUPS)
328 #define GCONFIG_HAVE_SETGROUPS 1
330 #define GCONFIG_HAVE_SETGROUPS 0
333 #if !defined(GCONFIG_HAVE_STATBUF_TIMESPEC)
334 #if defined(G_UNIX_MAC)
335 #define GCONFIG_HAVE_STATBUF_TIMESPEC 1
337 #define GCONFIG_HAVE_STATBUF_TIMESPEC 0
340 #if !defined(GCONFIG_HAVE_STATBUF_NSEC)
341 #define GCONFIG_HAVE_STATBUF_NSEC 0
343 #if !defined(GCONFIG_HAVE_SIN6_LEN)
344 #define GCONFIG_HAVE_SIN6_LEN 0
346 #if !defined(GCONFIG_HAVE_SOCKLEN_T)
347 #define GCONFIG_HAVE_SOCKLEN_T 1
349 #if !defined(GCONFIG_HAVE_STDLIB_H)
350 #define GCONFIG_HAVE_STDLIB_H 1
352 #if !defined(GCONFIG_HAVE_STRNCPY_S)
353 #if ( defined(G_WINDOWS) && !defined(G_MINGW) ) || defined(strncpy_s)
354 #define GCONFIG_HAVE_STRNCPY_S 1
356 #define GCONFIG_HAVE_STRNCPY_S 0
359 #if !defined(GCONFIG_HAVE_STRINGS_H)
360 #define GCONFIG_HAVE_STRINGS_H 1
362 #if !defined(GCONFIG_HAVE_STRING_H)
363 #define GCONFIG_HAVE_STRING_H 1
365 #if !defined(GCONFIG_HAVE_NDIR_H)
366 #define GCONFIG_HAVE_NDIR_H 0
368 #if !defined(GCONFIG_HAVE_SYS_DIR_H)
369 #define GCONFIG_HAVE_SYS_DIR_H 0
371 #if !defined(GCONFIG_HAVE_SYS_NDIR_H)
372 #define GCONFIG_HAVE_SYS_NDIR_H 0
374 #if !defined(GCONFIG_HAVE_SYS_STAT_H)
375 #define GCONFIG_HAVE_SYS_STAT_H 1
377 #if !defined(GCONFIG_HAVE_SYS_WAIT_H)
379 #define GCONFIG_HAVE_SYS_WAIT_H 1
381 #define GCONFIG_HAVE_SYS_WAIT_H 0
384 #if !defined(GCONFIG_HAVE_SYS_TIME_H)
385 #define GCONFIG_HAVE_SYS_TIME_H 1
387 #if !defined(GCONFIG_HAVE_SYS_TYPES_H)
388 #define GCONFIG_HAVE_SYS_TYPES_H 1
390 #if !defined(GCONFIG_HAVE_UNISTD_H)
392 #define GCONFIG_HAVE_UNISTD_H 1
394 #define GCONFIG_HAVE_UNISTD_H 0
397 #if !defined(GCONFIG_HAVE_ERRNO_H)
398 #define GCONFIG_HAVE_ERRNO_H 1
400 #if !defined(GCONFIG_HAVE_NET_IF_H)
402 #define GCONFIG_HAVE_NET_IF_H 1
404 #define GCONFIG_HAVE_NET_IF_H 0
407 #if !defined(GCONFIG_HAVE_WINDOWS_IPHLPAPI_H)
409 #define GCONFIG_HAVE_WINDOWS_IPHLPAPI_H 0
411 #define GCONFIG_HAVE_WINDOWS_IPHLPAPI_H 1
414 #if !defined(GCONFIG_HAVE_GAISTRERROR)
415 #define GCONFIG_HAVE_GAISTRERROR 1
417 #if !defined(GCONFIG_HAVE_INET_NTOP)
418 #define GCONFIG_HAVE_INET_NTOP 1
420 #if !defined(GCONFIG_HAVE_IFNAMETOINDEX)
421 #define GCONFIG_HAVE_IFNAMETOINDEX 1
423 #if !defined(GCONFIG_HAVE_IFNAMETOLUID)
425 #define GCONFIG_HAVE_IFNAMETOLUID 0
427 #define GCONFIG_HAVE_IFNAMETOLUID 1
430 #if !defined(GCONFIG_HAVE_INET_PTON)
431 #define GCONFIG_HAVE_INET_PTON 1
433 #if !defined(GCONFIG_HAVE_UID_T)
435 #define GCONFIG_HAVE_UID_T 1
437 #define GCONFIG_HAVE_UID_T 0
440 #if !defined(GCONFIG_HAVE_GID_T)
441 #define GCONFIG_HAVE_GID_T GCONFIG_HAVE_UID_T
443 #if !defined(GCONFIG_HAVE_UINTPTR_T)
444 #define GCONFIG_HAVE_UINTPTR_T 0
446 #if !defined(GCONFIG_HAVE_SSIZE_T)
447 #if defined(G_UNIX) || defined(G_MINGW)
448 #define GCONFIG_HAVE_SSIZE_T 1
450 #define GCONFIG_HAVE_SSIZE_T 0
453 #if !defined(GCONFIG_HAVE_PID_T)
454 #if defined(G_UNIX) || defined(G_MINGW)
455 #define GCONFIG_HAVE_PID_T 1
457 #define GCONFIG_HAVE_PID_T 0
460 #if !defined(GCONFIG_HAVE_GET_WINDOW_LONG_PTR)
462 #define GCONFIG_HAVE_GET_WINDOW_LONG_PTR 1
464 #define GCONFIG_HAVE_GET_WINDOW_LONG_PTR 0
467 #if !defined(GCONFIG_HAVE_MREMAP)
469 #define GCONFIG_HAVE_MREMAP 1
471 #define GCONFIG_HAVE_MREMAP 0
474 #if !defined(GCONFIG_HAVE_TIMERFD)
476 #define GCONFIG_HAVE_TIMERFD 1
478 #define GCONFIG_HAVE_TIMERFD 0
481 #if !defined(GCONFIG_HAVE_PAM)
483 #define GCONFIG_HAVE_PAM 1
485 #define GCONFIG_HAVE_PAM 0
488 #if !defined(GCONFIG_HAVE_PAM_IN_SECURITY)
490 #define GCONFIG_HAVE_PAM_IN_SECURITY 1
492 #define GCONFIG_HAVE_PAM_IN_SECURITY 0
495 #if !defined(GCONFIG_HAVE_PAM_IN_INCLUDE)
496 #define GCONFIG_HAVE_PAM_IN_INCLUDE 0
498 #if !defined(GCONFIG_HAVE_PAM_IN_PAM)
499 #define GCONFIG_HAVE_PAM_IN_PAM 0
501 #if !defined(GCONFIG_PAM_CONST)
502 #if defined(G_UNIX_LINUX) || defined(G_UNIX_BSD)
503 #define GCONFIG_PAM_CONST 1
505 #define GCONFIG_PAM_CONST 0
508 #if !defined(GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO)
510 #define GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO 1
512 #define GCONFIG_HAVE_GET_NATIVE_SYSTEM_INFO 0
515 #if !defined(GCONFIG_HAVE_LIBJPEG)
516 #define GCONFIG_HAVE_LIBJPEG 0
518 #if !defined(GCONFIG_HAVE_LIBPNG)
519 #define GCONFIG_HAVE_LIBPNG 0
521 #if !defined(GCONFIG_HAVE_LIBAV)
522 #define GCONFIG_HAVE_LIBAV 0
524 #if !defined(GCONFIG_HAVE_CURSES)
525 #define GCONFIG_HAVE_CURSES 0
527 #if !defined(GCONFIG_HAVE_LIBEXIV)
528 #define GCONFIG_HAVE_LIBEXIV 0
530 #if !defined(GCONFIG_HAVE_V4L)
532 #define GCONFIG_HAVE_V4L 1
534 #define GCONFIG_HAVE_V4L 0
537 #if !defined(GCONFIG_HAVE_LIBV4L)
538 #define GCONFIG_HAVE_LIBV4L 0
540 #if !defined(GCONFIG_HAVE_GETTEXT)
541 #define GCONFIG_HAVE_GETTEXT 0
543 #if !defined(GCONFIG_ENABLE_IPV6)
544 #define GCONFIG_ENABLE_IPV6 GCONFIG_HAVE_IPV6
546 #if !defined(GCONFIG_ENABLE_STD_THREAD)
547 #define GCONFIG_ENABLE_STD_THREAD 1
549 #if !defined(GCONFIG_HAVE_SEM_INIT)
550 #if defined(G_UNIX_LINUX) || defined(G_UNIX_FREEBSD)
551 #define GCONFIG_HAVE_SEM_INIT 1
553 #define GCONFIG_HAVE_SEM_INIT 0
556 #if !defined(GCONFIG_HAVE_X11)
558 #define GCONFIG_HAVE_X11 1
560 #define GCONFIG_HAVE_X11 0
563 #if !defined(GCONFIG_HAVE_MBEDTLS)
564 #define GCONFIG_HAVE_MBEDTLS 1
566 #if !defined(GCONFIG_HAVE_MBEDTLS_NET_H)
567 #define GCONFIG_HAVE_MBEDTLS_NET_H 0
569 #if !defined(GCONFIG_HAVE_OPENSSL)
571 #define GCONFIG_HAVE_OPENSSL 1
573 #define GCONFIG_HAVE_OPENSSL 0
576 #if !defined(GCONFIG_HAVE_OPENSSL_MIN_MAX)
577 #define GCONFIG_HAVE_OPENSSL_MIN_MAX 1
579 #if !defined(GCONFIG_HAVE_OPENSSL_SSLv23_METHOD)
580 #define GCONFIG_HAVE_OPENSSL_SSLv23_METHOD 0
582 #if !defined(GCONFIG_HAVE_OPENSSL_SSLv3_METHOD)
583 #define GCONFIG_HAVE_OPENSSL_SSLv3_METHOD 0
585 #if !defined(GCONFIG_HAVE_OPENSSL_TLSv1_1_METHOD)
586 #define GCONFIG_HAVE_OPENSSL_TLSv1_1_METHOD 1
588 #if !defined(GCONFIG_HAVE_OPENSSL_TLSv1_2_METHOD)
589 #define GCONFIG_HAVE_OPENSSL_TLSv1_2_METHOD 1
591 #if !defined(GCONFIG_HAVE_BOOST)
593 #define GCONFIG_HAVE_BOOST 1
595 #define GCONFIG_HAVE_BOOST 0
598 #if !defined(GCONFIG_HAVE_ALSA)
600 #define GCONFIG_HAVE_ALSA 1
602 #define GCONFIG_HAVE_ALSA 0
605 #if !defined(GCONFIG_HAVE_FMEMOPEN)
606 #if !defined(G_UNIX_OPENBSD)
607 #define GCONFIG_HAVE_FMEMOPEN 1
609 #define GCONFIG_HAVE_FMEMOPEN 0
612 #if !defined(GCONFIG_HAVE_IP_MREQN)
613 #if defined(G_UNIX_LINUX) || defined(G_UNIX_FREEBSD)
614 #define GCONFIG_HAVE_IP_MREQN 1
616 #define GCONFIG_HAVE_IP_MREQN 0
619 #if !defined(GCONFIG_HAVE_EXECVPE)
621 #define GCONFIG_HAVE_EXECVPE 1
623 #define GCONFIG_HAVE_EXECVPE 0
626 #if !defined(GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX)
627 #if defined(G_WINDOWS) && !defined(G_MINGW)
628 #define GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX 1
630 #define GCONFIG_HAVE_WINDOWS_CREATE_WAITABLE_TIMER_EX 0
633 #if !defined(GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX)
634 #if defined(G_WINDOWS) && !defined(G_MINGW)
635 #define GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX 1
637 #define GCONFIG_HAVE_WINDOWS_CREATE_EVENT_EX 0
640 #if !defined(GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX)
641 #if defined(G_WINDOWS) && !defined(G_MINGW)
642 #define GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX 1
644 #define GCONFIG_HAVE_WINDOWS_INIT_COMMON_CONTROLS_EX 0
647 #if !defined(GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H)
648 #if defined(G_WINDOWS)
649 #define GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H 1
651 #define GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H 0
654 #if !defined(GCONFIG_HAVE_DLOPEN)
656 #define GCONFIG_HAVE_DLOPEN 1
658 #define GCONFIG_HAVE_DLOPEN 0
661 #if !defined(GCONFIG_HAVE_FSOPEN)
662 #if defined(G_UNIX) || defined(G_MINGW)
663 #define GCONFIG_HAVE_FSOPEN 0
665 #define GCONFIG_HAVE_FSOPEN 1
668 #if !defined(GCONFIG_HAVE_SOPEN)
669 #if defined(G_UNIX) || defined(G_MINGW)
670 #define GCONFIG_HAVE_SOPEN 0
672 #define GCONFIG_HAVE_SOPEN 1
675 #if !defined(GCONFIG_HAVE_SOPEN_S)
676 #if defined(G_UNIX) || defined(G_MINGW)
677 #define GCONFIG_HAVE_SOPEN_S 0
679 #define GCONFIG_HAVE_SOPEN_S 1
682 #if !defined(GCONFIG_HAVE_EXTENDED_OPEN)
683 #if defined(G_UNIX) || defined(G_MINGW)
684 #define GCONFIG_HAVE_EXTENDED_OPEN 0
686 #define GCONFIG_HAVE_EXTENDED_OPEN 1
689 #if !defined(GCONFIG_HAVE_SIGPROCMASK)
691 #define GCONFIG_HAVE_SIGPROCMASK 1
693 #define GCONFIG_HAVE_SIGPROCMASK 0
696 #if !defined(GCONFIG_HAVE_PTHREAD_SIGMASK)
698 #define GCONFIG_HAVE_PTHREAD_SIGMASK 1
700 #define GCONFIG_HAVE_PTHREAD_SIGMASK 0
703 #if !defined(GCONFIG_HAVE_UDS)
705 #define GCONFIG_HAVE_UDS 1
707 #define GCONFIG_HAVE_UDS 0
713 #if defined(G_WINDOWS)
714 #ifndef WIN32_LEAN_AND_MEAN
715 #define WIN32_LEAN_AND_MEAN
717 #include <winsock2.h>
719 #include <ws2tcpip.h>
720 #if GCONFIG_HAVE_WINDOWS_IPHLPAPI_H
721 #include <iphlpapi.h>
723 #if GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H
724 #include <versionhelpers.h>
742 #if defined(G_WINDOWS)
743 #include <shellapi.h>
747 #if GCONFIG_HAVE_SYS_TYPES_H
748 #include <sys/types.h>
750 #if GCONFIG_HAVE_SYS_STAT_H
751 #include <sys/stat.h>
753 #if GCONFIG_HAVE_INTTYPES_H
757 #include <inttypes.h>
760 #if GCONFIG_HAVE_STDINT_H
767 #if GCONFIG_HAVE_UNISTD_H
770 #if GCONFIG_HAVE_ERRNO_H
777 #if GCONFIG_HAVE_SYS_WAIT_H
778 #include <sys/wait.h>
780 #if GCONFIG_HAVE_SYS_UTSNAME_H
781 #include <sys/utsname.h>
783 #if GCONFIG_HAVE_SYS_SELECT_H
784 #include <sys/select.h>
786 #if GCONFIG_HAVE_SYS_SOCKET_H
787 #include <sys/socket.h>
790 #define MSG_NOSIGNAL 0
792 #if GCONFIG_HAVE_SYS_MMAN_H
793 #include <sys/mman.h>
794 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
795 #define MAP_ANONYMOUS MAP_ANON
797 #ifndef MREMAP_MAYMOVE
798 #define MREMAP_MAYMOVE 0
801 #if GCONFIG_HAVE_NETINET_IN_H
802 #include <netinet/in.h>
804 #if GCONFIG_HAVE_NETDB_H
807 #if GCONFIG_HAVE_ARPA_INET_H
808 #include <arpa/inet.h>
810 #if GCONFIG_HAVE_NET_IF_H
813 #if GCONFIG_HAVE_PWD_H
816 #if GCONFIG_HAVE_GRP_H
850 #if ! defined(G_WINDOWS)
851 using BOOL =
unsigned char ;
852 using HDC =
unsigned int ;
853 using HWND =
unsigned int ;
854 using HINSTANCE =
unsigned int ;
855 using HANDLE =
unsigned int ;
856 using TCHAR = wchar_t ;
868 #if defined(G_WINDOWS)
869 #if GCONFIG_HAVE_INT64
870 using g_int64_t = INT64 ;
871 using g_uint64_t = UINT64 ;
873 #if GCONFIG_HAVE_INT32
874 using g_int32_t = INT32 ;
875 using g_uint32_t = UINT32 ;
877 #if GCONFIG_HAVE_INT16
878 using g_int16_t = INT16 ;
879 using g_uint16_t = UINT16 ;
882 #if GCONFIG_HAVE_INT64
883 using g_int64_t = int64_t ;
884 using g_uint64_t = uint64_t ;
886 #if GCONFIG_HAVE_INT32
887 using g_int32_t = int32_t ;
888 using g_uint32_t = uint32_t ;
890 #if GCONFIG_HAVE_INT16
891 using g_int16_t = int16_t ;
892 using g_uint16_t = uint16_t ;
895 #if GCONFIG_HAVE_UINTPTR_T
896 using g_uintptr_t = uintptr_t ;
898 using g_uintptr_t = std::size_t ;
901 #if GCONFIG_HAVE_INT64
902 static_assert(
sizeof(g_int64_t) == 8U ,
"uint64 wrong size" ) ;
903 static_assert(
sizeof(g_uint64_t) == 8U ,
"int64 wrong size" ) ;
905 #if GCONFIG_HAVE_INT32
906 static_assert(
sizeof(g_uint32_t) == 4U ,
"uint32 wrong size" ) ;
907 static_assert(
sizeof(g_int32_t) == 4U ,
"int32 wrong size" ) ;
909 #if GCONFIG_HAVE_INT16
910 static_assert(
sizeof(g_uint16_t) == 2U ,
"uint16 wrong size" ) ;
911 static_assert(
sizeof(g_int16_t) == 2U ,
"int16 wrong size" ) ;
913 static_assert(
sizeof(g_uintptr_t) >=
sizeof(
void*) ,
"uintptr_t wrong size; try using g_uintptr_t = unsigned long" ) ;
918 #if ! GCONFIG_HAVE_UID_T
921 #if ! GCONFIG_HAVE_GID_T
924 #if ! GCONFIG_HAVE_SSIZE_T
926 using ssize_t = SSIZE_T ;
929 using ssize_t = int ;
932 #if ! GCONFIG_HAVE_PID_T
933 using pid_t =
unsigned int ;
935 #if ! GCONFIG_HAVE_SOCKLEN_T
936 using socklen_t = int ;
938 #if ! GCONFIG_HAVE_ERRNO_T
939 using errno_t = int ;
944 #if __cplusplus >= 201700L
945 #define GDEF_UNUSED [[maybe_unused]]
946 #define GDEF_NORETURN [[noreturn]]
947 #define GDEF_FALLTHROUGH [[fallthrough]]
949 #if defined(__GNUC__) || defined(__clang__)
950 #define GDEF_UNUSED __attribute__((__unused__))
951 #define GDEF_NORETURN __attribute__((__noreturn__))
960 #ifndef GDEF_NORETURN
961 #define GDEF_NORETURN
963 #ifndef GDEF_FALLTHROUGH
964 #define GDEF_FALLTHROUGH
968 namespace G {
template <
typename... T>
inline void ignore( T&& ... ) {} }
969 #define GDEF_IGNORE_PARAMS(...) G::ignore(__VA_ARGS__)
970 #define GDEF_IGNORE_RETURN std::ignore =
971 #define GDEF_IGNORE_PARAM(name) std::ignore = name
976 #if !GCONFIG_HAVE_CXX_STD_MAKE_UNIQUE
981 template <
typename T,
typename... Args>
982 std::unique_ptr<T> make_unique( Args&&... args )
984 return std::unique_ptr<T>(
new T( std::forward<Args>(args)... ) ) ;
991 #if GCONFIG_ENABLE_STD_THREAD
999 static constexpr bool using_std_thread = true ;
1000 using thread_type = std::thread ;
1001 using mutex_type = std::mutex ;
1002 using lock_type = std::lock_guard<std::mutex> ;
1003 static bool works() ;
1004 static void yield()
noexcept { std::this_thread::yield() ; }
1014 template <
typename T_fn>
explicit dummy_thread( T_fn fn ) { fn() ; }
1015 template <
typename T_fn,
typename T_arg1> dummy_thread( T_fn fn , T_arg1 arg1 ) { fn(arg1) ; }
1016 template <
typename T_fn,
typename T_arg1,
typename T_arg2> dummy_thread( T_fn fn , T_arg1 arg1 , T_arg2 arg2 ) { fn(arg1,arg2) ; }
1018 bool joinable() const noexcept {
return false ; }
1021 id get_id()
const {
return 0 ; }
1023 class dummy_mutex {} ;
1024 class dummy_lock {
public:
explicit dummy_lock( dummy_mutex & ) {} } ;
1027 static constexpr bool using_std_thread = false ;
1028 using thread_type = G::dummy_thread ;
1029 using mutex_type = G::dummy_mutex ;
1030 using lock_type = G::dummy_lock ;
1031 static bool works() ;
1032 static void yield() noexcept {}
1042 inline constexpr bool is_windows() {
return true ; }
1044 inline constexpr bool is_windows() {
return false ; }
1047 inline constexpr bool is_linux() {
return true ; }
1049 inline constexpr bool is_linux() {
return false ; }
1051 #ifdef G_UNIX_FREEBSD
1052 inline constexpr bool is_free_bsd() {
return true ; }
1054 inline constexpr bool is_free_bsd() {
return false ; }
1056 #ifdef G_UNIX_OPENBSD
1057 inline constexpr bool is_open_bsd() {
return true ; }
1059 inline constexpr bool is_open_bsd() {
return false ; }
1062 inline constexpr bool is_bsd() {
return true ; }
1064 inline constexpr bool is_bsd() {
return false ; }
1071 using g_port_t = g_uint16_t ;
1075 #ifndef AI_NUMERICSERV
1076 #define AI_NUMERICSERV 0
1079 #ifndef MSG_NOSIGNAL
1080 #define MSG_NOSIGNAL 0
1083 #ifndef AI_ADDRCONFIG
1084 #define AI_ADDRCONFIG 0
1088 #define INADDR_NONE 0xffffffff
1094 #if GCONFIG_HAVE_IPV6
1095 inline void gdef_address6_init( sockaddr_in6 & s )
1097 #if GCONFIG_HAVE_SIN6_LEN
1098 s.sin6_len =
sizeof(s) ;
1108 #if ! GCONFIG_HAVE_GAISTRERROR
1109 inline const char * gai_strerror(
int )
1115 namespace GNet {
int inet_pton_imp(
int f ,
const char * p ,
void * result ) ; }
1116 #if ! GCONFIG_HAVE_INET_PTON
1117 inline int inet_pton(
int f ,
const char * p ,
void * result )
1119 return GNet::inet_pton_imp( f , p , result ) ;
1123 namespace GNet {
const char * inet_ntop_imp(
int f ,
void * ap ,
char * buffer , std::size_t n ) ; }
1124 #if ! GCONFIG_HAVE_INET_NTOP
1125 inline const char * inet_ntop(
int f ,
void * ap ,
char * buffer , std::size_t n )
1127 return GNet::inet_ntop_imp( f , ap , buffer , n ) ;
1131 #if GCONFIG_HAVE_PTHREAD_SIGMASK && GCONFIG_ENABLE_STD_THREAD
1133 inline int gdef_pthread_sigmask(
int how ,
const sigset_t * set_p , sigset_t * oldset_p )
noexcept
1135 return pthread_sigmask( how , set_p , oldset_p ) ;
1138 #if GCONFIG_HAVE_SIGPROCMASK
1140 inline int gdef_pthread_sigmask(
int how ,
const sigset_t * set_p , sigset_t * oldset_p )
noexcept
1142 return sigprocmask( how , set_p , oldset_p ) ;
1145 template <
typename... T>
int gdef_pthread_sigmask(T...) noexcept {
return 0 ; }
1149 #if GCONFIG_HAVE_IFNAMETOLUID
1150 #include <iphlpapi.h>
1151 inline unsigned long gdef_if_nametoindex(
const char * p )
1154 if( ConvertInterfaceNameToLuidA( p , &luid ) )
1156 _set_errno( EINVAL ) ;
1159 NET_IFINDEX result = 0 ;
1160 if( ConvertInterfaceLuidToIndex( &luid , &result ) != NO_ERROR )
1162 _set_errno( EINVAL ) ;
1169 #if GCONFIG_HAVE_IFNAMETOINDEX
1170 inline unsigned long gdef_if_nametoindex(
const char * p )
1177 return if_nametoindex( p ) ;
1180 inline unsigned long gdef_if_nametoindex(
const char * )
1183 _set_errno( EINVAL ) ;
1191 #if ! GCONFIG_HAVE_READLINK && !defined(readlink)
1192 inline ssize_t readlink(
const char * ,
char * , std::size_t )
1197 #if ! GCONFIG_HAVE_EXECVPE && !defined(execvpe) && defined(G_UNIX)
1198 inline int execvpe(
const char * ,
char * [] ,
char * [] )
1205 #if GCONFIG_HAVE_GETPWNAM && ! GCONFIG_HAVE_GETPWNAM_R
1207 inline int getpwnam_r(
const char * name ,
struct passwd * pwd ,
1208 char * buf , std::size_t buflen ,
struct passwd ** result )
1210 struct passwd * p = ::getpwnam( name ) ;
1225 #if GCONFIG_HAVE_GETGRNAM && ! GCONFIG_HAVE_GETGRNAM_R
1227 inline int getgrnam_r(
const char * name ,
struct group * grp ,
1228 char * buf , std::size_t buflen ,
struct passwd ** result )
1230 struct group * p = ::getgrnam( name ) ;
1245 #if ! GCONFIG_HAVE_GMTIME_R && !defined(gmtime_r)
1247 inline std::tm * gmtime_r(
const std::time_t * tp , std::tm * tm_p )
1249 #if GCONFIG_HAVE_GMTIME_S || defined(gmtime_s)
1250 errno_t e = gmtime_s( tm_p , tp ) ;
1251 if( e )
return nullptr ;
1254 const struct std::tm * p = std::gmtime( tp ) ;
1255 if( p == 0 )
return nullptr ;
1262 #if ! GCONFIG_HAVE_LOCALTIME_R && !defined(localtime_r)
1264 inline struct std::tm * localtime_r(
const std::time_t * tp ,
struct std::tm * tm_p )
1266 #if GCONFIG_HAVE_LOCALTIME_S || defined(localtime_s)
1267 errno_t e = localtime_s( tm_p , tp ) ;
1268 if( e )
return nullptr ;
1271 const struct std::tm * p = std::localtime( tp ) ;
1272 if( p == 0 )
return nullptr ;
1279 #if ! GCONFIG_HAVE_LOCALTIME_S && !defined(localtime_s)
1281 inline errno_t localtime_s(
struct std::tm * tm_p ,
const std::time_t * tp )
1283 const errno_t e_inval = 22 ;
1284 if( tm_p ==
nullptr )
return e_inval ;
1285 tm_p->tm_sec = tm_p->tm_min = tm_p->tm_hour = tm_p->tm_mday = tm_p->tm_mon =
1286 tm_p->tm_year = tm_p->tm_wday = tm_p->tm_yday = tm_p->tm_isdst = -1 ;
1287 if( tp ==
nullptr || *tp < 0 )
return e_inval ;
1288 const struct std::tm * p = std::localtime( tp ) ;
1289 if( p ==
nullptr )
return e_inval ;
1295 #if ! GCONFIG_HAVE_GMTIME_S && !defined(gmtime_s)
1297 inline errno_t gmtime_s(
struct std::tm * tm_p ,
const std::time_t * tp )
1299 const errno_t e_inval = 22 ;
1300 if( tm_p ==
nullptr )
return e_inval ;
1301 tm_p->tm_sec = tm_p->tm_min = tm_p->tm_hour = tm_p->tm_mday = tm_p->tm_mon =
1302 tm_p->tm_year = tm_p->tm_wday = tm_p->tm_yday = tm_p->tm_isdst = -1 ;
1303 if( tp ==
nullptr || *tp < 0 )
return e_inval ;
1304 const struct std::tm * p = std::gmtime( tp ) ;
1305 if( p ==
nullptr )
return e_inval ;
1311 #if GCONFIG_HAVE_SETGROUPS
1314 inline int setgroups( std::size_t ,
const gid_t * )
1320 #if ! GCONFIG_HAVE_GET_WINDOW_LONG_PTR && defined(G_WINDOWS)
1321 static_assert(
sizeof(
void*) == 4U ,
"unexpected pointer size" ) ;
1322 const int GWLP_HINSTANCE = GWL_HINSTANCE ;
1323 const int GWLP_WNDPROC = GWL_WNDPROC ;
1324 const int DWLP_USER = DWL_USER ;
1325 inline LONG_PTR GetWindowLongPtr( HWND h ,
int id )
1327 return static_cast<LONG_PTR
>(::GetWindowLong(h,
id)) ;
1329 inline LONG_PTR SetWindowLongPtr( HWND h ,
int id , LONG_PTR value )
1331 return static_cast<LONG_PTR
>(::SetWindowLong(h,
id,
static_cast<LONG
>(value))) ;
1335 #if ! GCONFIG_HAVE_WINDOWS_VERSIONHELPERS_H && defined(G_WINDOWS)
1336 inline bool IsWindowsVistaOrGreater()
1338 WORD major = HIBYTE( _WIN32_WINNT_VISTA ) ;
1339 WORD minor = LOBYTE( _WIN32_WINNT_VISTA ) ;
1340 OSVERSIONINFOEXW info {} ;
1341 info.dwOSVersionInfoSize =
sizeof(info) ;
1342 info.dwMajorVersion = major ;
1343 info.dwMinorVersion = minor ;
1344 return !! VerifyVersionInfoW( &info , VER_MAJORVERSION | VER_MINORVERSION ,
1345 VerSetConditionMask( VerSetConditionMask(0,VER_MAJORVERSION,VER_GREATER_EQUAL) ,
1346 VER_MINORVERSION , VER_GREATER_EQUAL ) ) ;
1350 #if ! GCONFIG_HAVE_MREMAP && defined(G_UNIX)
1351 inline void * mremap(
void * , std::size_t , std::size_t ,
int )
1354 return (
void*)(-1) ;
1358 #if GCONFIG_HAVE_SETPGRP_BSD && defined(G_UNIX)
1359 inline int setpgrp()
1361 return ::setpgrp( 0 , 0 ) ;
1365 #if ! GCONFIG_HAVE_CXX_ALIGNMENT
1369 inline void *
align(
size_t align ,
size_t size ,
void * & ptr_inout ,
size_t & space )
noexcept
1371 const auto ptr =
reinterpret_cast<uintptr_t
>( ptr_inout ) ;
1372 const auto aligned = ( ptr - 1U +
align ) & -
align ;
1373 const auto diff = aligned - ptr ;
1374 if( (size + diff) > space )
1381 ptr_inout =
reinterpret_cast<void*
>( aligned ) ;
void * align(const char *buffer, std::size_t buffer_size)
Returns a pointer inside the given buffer that is aligned for values of type T.
Helper class for std::thread capabilities.