2000-06-11 15:40:09 +04:00
|
|
|
# Macros that test various C library quirks
|
2010-09-21 00:08:53 +04:00
|
|
|
# config/c-library.m4
|
2000-06-11 15:40:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_VAR_INT_TIMEZONE
|
|
|
|
# ---------------------
|
|
|
|
# Check if the global variable `timezone' exists. If so, define
|
|
|
|
# HAVE_INT_TIMEZONE.
|
|
|
|
AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
|
|
|
|
[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
|
2015-07-02 19:21:23 +03:00
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <time.h>
|
2001-01-10 20:07:18 +03:00
|
|
|
int res;],
|
2004-09-08 23:43:12 +04:00
|
|
|
[#ifndef __CYGWIN__
|
|
|
|
res = timezone / 60;
|
|
|
|
#else
|
|
|
|
res = _timezone / 60;
|
2015-07-02 19:21:23 +03:00
|
|
|
#endif])],
|
2000-06-11 15:40:09 +04:00
|
|
|
[pgac_cv_var_int_timezone=yes],
|
|
|
|
[pgac_cv_var_int_timezone=no])])
|
|
|
|
if test x"$pgac_cv_var_int_timezone" = xyes ; then
|
2013-06-15 22:11:43 +04:00
|
|
|
AC_DEFINE(HAVE_INT_TIMEZONE, 1,
|
|
|
|
[Define to 1 if you have the global variable 'int timezone'.])
|
2000-06-11 15:40:09 +04:00
|
|
|
fi])# PGAC_VAR_INT_TIMEZONE
|
|
|
|
|
|
|
|
|
2003-05-22 20:39:30 +04:00
|
|
|
# PGAC_STRUCT_TIMEZONE
|
|
|
|
# ------------------
|
|
|
|
# Figure out how to get the current timezone. If `struct tm' has a
|
2019-10-07 17:28:56 +03:00
|
|
|
# `tm_zone' member, define `HAVE_STRUCT_TM_TM_ZONE'. Unlike the
|
|
|
|
# standard macro AC_STRUCT_TIMEZONE, we don't check for `tzname[]' if
|
|
|
|
# not found, since we don't use it. (We use `int timezone' as a
|
|
|
|
# fallback.)
|
2003-05-22 20:39:30 +04:00
|
|
|
AC_DEFUN([PGAC_STRUCT_TIMEZONE],
|
2019-10-07 17:28:56 +03:00
|
|
|
[AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
|
2016-08-30 19:00:00 +03:00
|
|
|
#include <time.h>
|
2019-10-07 17:28:56 +03:00
|
|
|
])
|
2003-05-22 20:39:30 +04:00
|
|
|
])# PGAC_STRUCT_TIMEZONE
|
|
|
|
|
|
|
|
|
2004-06-08 02:39:45 +04:00
|
|
|
# PGAC_FUNC_STRERROR_R_INT
|
|
|
|
# ---------------------------
|
2018-09-27 01:23:13 +03:00
|
|
|
# Check if strerror_r() returns int (POSIX) rather than char * (GNU libc).
|
|
|
|
# If so, define STRERROR_R_INT.
|
|
|
|
# The result is uncertain if strerror_r() isn't provided,
|
|
|
|
# but we don't much care.
|
2004-06-08 02:39:45 +04:00
|
|
|
AC_DEFUN([PGAC_FUNC_STRERROR_R_INT],
|
|
|
|
[AC_CACHE_CHECK(whether strerror_r returns int,
|
2008-08-21 17:53:28 +04:00
|
|
|
pgac_cv_func_strerror_r_int,
|
2015-07-02 19:21:23 +03:00
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <string.h>],
|
2018-09-27 01:23:13 +03:00
|
|
|
[[char buf[100];
|
|
|
|
switch (strerror_r(1, buf, sizeof(buf)))
|
|
|
|
{ case 0: break; default: break; }
|
|
|
|
]])],
|
2008-08-21 17:53:28 +04:00
|
|
|
[pgac_cv_func_strerror_r_int=yes],
|
|
|
|
[pgac_cv_func_strerror_r_int=no])])
|
|
|
|
if test x"$pgac_cv_func_strerror_r_int" = xyes ; then
|
2013-06-15 22:11:43 +04:00
|
|
|
AC_DEFINE(STRERROR_R_INT, 1,
|
2018-09-27 01:23:13 +03:00
|
|
|
[Define to 1 if strerror_r() returns int.])
|
2004-06-08 02:39:45 +04:00
|
|
|
fi
|
|
|
|
])# PGAC_FUNC_STRERROR_R_INT
|
|
|
|
|
|
|
|
|
2000-06-11 15:40:09 +04:00
|
|
|
# PGAC_UNION_SEMUN
|
|
|
|
# ----------------
|
|
|
|
# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
|
|
|
|
# If it doesn't then one could define it as
|
|
|
|
# union semun { int val; struct semid_ds *buf; unsigned short *array; }
|
|
|
|
AC_DEFUN([PGAC_UNION_SEMUN],
|
2002-03-30 03:59:52 +03:00
|
|
|
[AC_CHECK_TYPES([union semun], [], [],
|
2002-03-29 20:32:55 +03:00
|
|
|
[#include <sys/types.h>
|
2000-06-11 15:40:09 +04:00
|
|
|
#include <sys/ipc.h>
|
2017-02-26 02:10:09 +03:00
|
|
|
#include <sys/sem.h>
|
2022-08-13 14:34:12 +03:00
|
|
|
])])# PGAC_UNION_SEMUN
|
2000-06-11 15:40:09 +04:00
|
|
|
|
|
|
|
|
2022-08-22 07:47:17 +03:00
|
|
|
# PGAC_STRUCT_SOCKADDR_MEMBERS
|
|
|
|
# ----------------------------
|
|
|
|
# Check if struct sockaddr and subtypes have 4.4BSD-style length.
|
|
|
|
AC_DEFUN([PGAC_STRUCT_SOCKADDR_SA_LEN],
|
|
|
|
[AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [],
|
2003-06-24 03:52:00 +04:00
|
|
|
[#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2022-08-22 07:47:17 +03:00
|
|
|
])])# PGAC_STRUCT_SOCKADDR_MEMBERS
|
2003-06-24 03:52:00 +04:00
|
|
|
|
2003-06-12 11:36:51 +04:00
|
|
|
|
2011-02-09 00:04:18 +03:00
|
|
|
# PGAC_TYPE_LOCALE_T
|
|
|
|
# ------------------
|
Refer to OS X as "macOS", except for the port name which is still "darwin".
We weren't terribly consistent about whether to call Apple's OS "OS X"
or "Mac OS X", and the former is probably confusing to people who aren't
Apple users. Now that Apple has rebranded it "macOS", follow their lead
to establish a consistent naming pattern. Also, avoid the use of the
ancient project name "Darwin", except as the port code name which does not
seem desirable to change. (In short, this patch touches documentation and
comments, but no actual code.)
I didn't touch contrib/start-scripts/osx/, either. I suspect those are
obsolete and due for a rewrite, anyway.
I dithered about whether to apply this edit to old release notes, but
those were responsible for quite a lot of the inconsistencies, so I ended
up changing them too. Anyway, Apple's being ahistorical about this,
so why shouldn't we be?
2016-09-25 22:40:57 +03:00
|
|
|
# Check for the locale_t type and find the right header file. macOS
|
|
|
|
# needs xlocale.h; standard is locale.h, but glibc also has an
|
2011-02-09 00:04:18 +03:00
|
|
|
# xlocale.h file that we should not use.
|
|
|
|
#
|
|
|
|
AC_DEFUN([PGAC_TYPE_LOCALE_T],
|
|
|
|
[AC_CACHE_CHECK([for locale_t], pgac_cv_type_locale_t,
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <locale.h>
|
|
|
|
locale_t x;],
|
|
|
|
[])],
|
|
|
|
[pgac_cv_type_locale_t=yes],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <xlocale.h>
|
|
|
|
locale_t x;],
|
|
|
|
[])],
|
|
|
|
[pgac_cv_type_locale_t='yes (in xlocale.h)'],
|
|
|
|
[pgac_cv_type_locale_t=no])])])
|
|
|
|
if test "$pgac_cv_type_locale_t" != no; then
|
|
|
|
AC_DEFINE(HAVE_LOCALE_T, 1,
|
|
|
|
[Define to 1 if the system has the type `locale_t'.])
|
|
|
|
fi
|
|
|
|
if test "$pgac_cv_type_locale_t" = 'yes (in xlocale.h)'; then
|
|
|
|
AC_DEFINE(LOCALE_T_IN_XLOCALE, 1,
|
|
|
|
[Define to 1 if `locale_t' requires <xlocale.h>.])
|
Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>.
Previously, we included <xlocale.h> only if necessary to get the definition
of type locale_t. According to notes in PGAC_TYPE_LOCALE_T, this is
important because on some versions of glibc that file supplies an
incompatible declaration of locale_t. (This info may be obsolete, because
on my RHEL6 box that seems to be the *only* definition of locale_t; but
there may still be glibc's in the wild for which it's a live concern.)
It turns out though that on FreeBSD and maybe other BSDen, you can get
locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from
<xlocale.h>. This was leaving us compiling calls to mbstowcs_l() and
friends with no visible prototype, which causes a warning and could
possibly cause actual trouble, since it's not declared to return int.
Hence, adjust the configure checks so that we'll include <xlocale.h>
either if it's necessary to get type locale_t or if it's necessary to
get a declaration of mbstowcs_l().
Report and patch by Aleksander Alekseev, somewhat whacked around by me.
Back-patch to all supported branches, since we have been using
mbstowcs_l() since 9.1.
2016-03-15 20:19:57 +03:00
|
|
|
fi])# PGAC_TYPE_LOCALE_T
|
|
|
|
|
|
|
|
|
|
|
|
# PGAC_FUNC_WCSTOMBS_L
|
|
|
|
# --------------------
|
|
|
|
# Try to find a declaration for wcstombs_l(). It might be in stdlib.h
|
|
|
|
# (following the POSIX requirement for wcstombs()), or in locale.h, or in
|
|
|
|
# xlocale.h. If it's in the latter, define WCSTOMBS_L_IN_XLOCALE.
|
|
|
|
#
|
|
|
|
AC_DEFUN([PGAC_FUNC_WCSTOMBS_L],
|
|
|
|
[AC_CACHE_CHECK([for wcstombs_l declaration], pgac_cv_func_wcstombs_l,
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <stdlib.h>
|
|
|
|
#include <locale.h>],
|
|
|
|
[#ifndef wcstombs_l
|
|
|
|
(void) wcstombs_l;
|
|
|
|
#endif])],
|
|
|
|
[pgac_cv_func_wcstombs_l='yes'],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <stdlib.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <xlocale.h>],
|
|
|
|
[#ifndef wcstombs_l
|
|
|
|
(void) wcstombs_l;
|
|
|
|
#endif])],
|
|
|
|
[pgac_cv_func_wcstombs_l='yes (in xlocale.h)'],
|
|
|
|
[pgac_cv_func_wcstombs_l='no'])])])
|
|
|
|
if test "$pgac_cv_func_wcstombs_l" = 'yes (in xlocale.h)'; then
|
|
|
|
AC_DEFINE(WCSTOMBS_L_IN_XLOCALE, 1,
|
|
|
|
[Define to 1 if `wcstombs_l' requires <xlocale.h>.])
|
|
|
|
fi])# PGAC_FUNC_WCSTOMBS_L
|