Add GUC for temporarily disabling event triggers
[pgsql.git] / config / c-library.m4
blobaa8223d2ef0e98cd08f57fbb2479dc4d2088a5e7
1 # Macros that test various C library quirks
2 # config/c-library.m4
5 # PGAC_VAR_INT_TIMEZONE
6 # ---------------------
7 # Check if the global variable `timezone' exists. If so, define
8 # HAVE_INT_TIMEZONE.
9 AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
10 [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
11 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>
12 int res;],
13   [#ifndef __CYGWIN__
14 res = timezone / 60;
15 #else
16 res = _timezone / 60;
17 #endif])],
18   [pgac_cv_var_int_timezone=yes],
19   [pgac_cv_var_int_timezone=no])])
20 if test x"$pgac_cv_var_int_timezone" = xyes ; then
21   AC_DEFINE(HAVE_INT_TIMEZONE, 1,
22             [Define to 1 if you have the global variable 'int timezone'.])
23 fi])# PGAC_VAR_INT_TIMEZONE
26 # PGAC_STRUCT_TIMEZONE
27 # ------------------
28 # Figure out how to get the current timezone.  If `struct tm' has a
29 # `tm_zone' member, define `HAVE_STRUCT_TM_TM_ZONE'.  Unlike the
30 # standard macro AC_STRUCT_TIMEZONE, we don't check for `tzname[]' if
31 # not found, since we don't use it.  (We use `int timezone' as a
32 # fallback.)
33 AC_DEFUN([PGAC_STRUCT_TIMEZONE],
34 [AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
35 #include <time.h>
37 ])# PGAC_STRUCT_TIMEZONE
40 # PGAC_FUNC_STRERROR_R_INT
41 # ---------------------------
42 # Check if strerror_r() returns int (POSIX) rather than char * (GNU libc).
43 # If so, define STRERROR_R_INT.
44 # The result is uncertain if strerror_r() isn't provided,
45 # but we don't much care.
46 AC_DEFUN([PGAC_FUNC_STRERROR_R_INT],
47 [AC_CACHE_CHECK(whether strerror_r returns int,
48 pgac_cv_func_strerror_r_int,
49 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <string.h>],
50 [[char buf[100];
51   switch (strerror_r(1, buf, sizeof(buf)))
52   { case 0: break; default: break; }
53 ]])],
54 [pgac_cv_func_strerror_r_int=yes],
55 [pgac_cv_func_strerror_r_int=no])])
56 if test x"$pgac_cv_func_strerror_r_int" = xyes ; then
57   AC_DEFINE(STRERROR_R_INT, 1,
58             [Define to 1 if strerror_r() returns int.])
60 ])# PGAC_FUNC_STRERROR_R_INT
63 # PGAC_UNION_SEMUN
64 # ----------------
65 # Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
66 # If it doesn't then one could define it as
67 # union semun { int val; struct semid_ds *buf; unsigned short *array; }
68 AC_DEFUN([PGAC_UNION_SEMUN],
69 [AC_CHECK_TYPES([union semun], [], [],
70 [#include <sys/types.h>
71 #include <sys/ipc.h>
72 #include <sys/sem.h>
73 ])])# PGAC_UNION_SEMUN
76 # PGAC_STRUCT_SOCKADDR_MEMBERS
77 # ----------------------------
78 # Check if struct sockaddr and subtypes have 4.4BSD-style length.
79 AC_DEFUN([PGAC_STRUCT_SOCKADDR_SA_LEN],
80 [AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [],
81 [#include <sys/types.h>
82 #include <sys/socket.h>
83 ])])# PGAC_STRUCT_SOCKADDR_MEMBERS
86 # PGAC_TYPE_LOCALE_T
87 # ------------------
88 # Check for the locale_t type and find the right header file.  macOS
89 # needs xlocale.h; standard is locale.h, but glibc <= 2.25 also had an
90 # xlocale.h file that we should not use, so we check the standard
91 # header first.
92 AC_DEFUN([PGAC_TYPE_LOCALE_T],
93 [AC_CACHE_CHECK([for locale_t], pgac_cv_type_locale_t,
94 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
95 [#include <locale.h>
96 locale_t x;],
97 [])],
98 [pgac_cv_type_locale_t=yes],
99 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
100 [#include <xlocale.h>
101 locale_t x;],
102 [])],
103 [pgac_cv_type_locale_t='yes (in xlocale.h)'],
104 [pgac_cv_type_locale_t=no])])])
105 if test "$pgac_cv_type_locale_t" = 'yes (in xlocale.h)'; then
106   AC_DEFINE(LOCALE_T_IN_XLOCALE, 1,
107             [Define to 1 if `locale_t' requires <xlocale.h>.])
108 fi])# PGAC_TYPE_LOCALE_T
111 # PGAC_FUNC_WCSTOMBS_L
112 # --------------------
113 # Try to find a declaration for wcstombs_l().  It might be in stdlib.h
114 # (following the POSIX requirement for wcstombs()), or in locale.h, or in
115 # xlocale.h.  If it's in the latter, define WCSTOMBS_L_IN_XLOCALE.
117 AC_DEFUN([PGAC_FUNC_WCSTOMBS_L],
118 [AC_CACHE_CHECK([for wcstombs_l declaration], pgac_cv_func_wcstombs_l,
119 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
120 [#include <stdlib.h>
121 #include <locale.h>],
122 [#ifndef wcstombs_l
123 (void) wcstombs_l;
124 #endif])],
125 [pgac_cv_func_wcstombs_l='yes'],
126 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
127 [#include <stdlib.h>
128 #include <locale.h>
129 #include <xlocale.h>],
130 [#ifndef wcstombs_l
131 (void) wcstombs_l;
132 #endif])],
133 [pgac_cv_func_wcstombs_l='yes (in xlocale.h)'],
134 [pgac_cv_func_wcstombs_l='no'])])])
135 if test "$pgac_cv_func_wcstombs_l" = 'yes (in xlocale.h)'; then
136   AC_DEFINE(WCSTOMBS_L_IN_XLOCALE, 1,
137             [Define to 1 if `wcstombs_l' requires <xlocale.h>.])
138 fi])# PGAC_FUNC_WCSTOMBS_L