mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Simplify checking for xlocale.h
Instead of XXX_IN_XLOCALE_H for several features XXX, let's just include <xlocale.h> if HAVE_XLOCALE_H. The reason for the extra complication was apparently that some old glibc systems also had an <xlocale.h>, and you weren't supposed to include it directly, but it's gone now (as far as I can tell it was harmless to do so anyway). Author: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/CWZBBRR6YA8D.8EHMDRGLCKCD%40neon.tech
This commit is contained in:
@ -81,58 +81,3 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_SA_LEN],
|
|||||||
[#include <sys/types.h>
|
[#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
])])# PGAC_STRUCT_SOCKADDR_MEMBERS
|
])])# PGAC_STRUCT_SOCKADDR_MEMBERS
|
||||||
|
|
||||||
|
|
||||||
# PGAC_TYPE_LOCALE_T
|
|
||||||
# ------------------
|
|
||||||
# Check for the locale_t type and find the right header file. macOS
|
|
||||||
# needs xlocale.h; standard is locale.h, but glibc <= 2.25 also had an
|
|
||||||
# xlocale.h file that we should not use, so we check the standard
|
|
||||||
# header first.
|
|
||||||
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" = 'yes (in xlocale.h)'; then
|
|
||||||
AC_DEFINE(LOCALE_T_IN_XLOCALE, 1,
|
|
||||||
[Define to 1 if `locale_t' requires <xlocale.h>.])
|
|
||||||
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
|
|
||||||
|
104
configure
vendored
104
configure
vendored
@ -13219,7 +13219,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h mbarrier.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/ucred.h termios.h ucred.h
|
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h mbarrier.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/ucred.h termios.h ucred.h xlocale.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
@ -14547,55 +14547,6 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t" >&5
|
|
||||||
$as_echo_n "checking for locale_t... " >&6; }
|
|
||||||
if ${pgac_cv_type_locale_t+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <locale.h>
|
|
||||||
locale_t x;
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
pgac_cv_type_locale_t=yes
|
|
||||||
else
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <xlocale.h>
|
|
||||||
locale_t x;
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
pgac_cv_type_locale_t='yes (in xlocale.h)'
|
|
||||||
else
|
|
||||||
pgac_cv_type_locale_t=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_type_locale_t" >&5
|
|
||||||
$as_echo "$pgac_cv_type_locale_t" >&6; }
|
|
||||||
if test "$pgac_cv_type_locale_t" = 'yes (in xlocale.h)'; then
|
|
||||||
|
|
||||||
$as_echo "#define LOCALE_T_IN_XLOCALE 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# MSVC doesn't cope well with defining restrict to __restrict, the
|
# MSVC doesn't cope well with defining restrict to __restrict, the
|
||||||
# spelling it understands, because it conflicts with
|
# spelling it understands, because it conflicts with
|
||||||
# __declspec(restrict). Therefore we define pg_restrict to the
|
# __declspec(restrict). Therefore we define pg_restrict to the
|
||||||
@ -15082,59 +15033,6 @@ if test x"$pgac_cv_var_int_timezone" = xyes ; then
|
|||||||
|
|
||||||
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
|
$as_echo "#define HAVE_INT_TIMEZONE 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wcstombs_l declaration" >&5
|
|
||||||
$as_echo_n "checking for wcstombs_l declaration... " >&6; }
|
|
||||||
if ${pgac_cv_func_wcstombs_l+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <locale.h>
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
#ifndef wcstombs_l
|
|
||||||
(void) wcstombs_l;
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
pgac_cv_func_wcstombs_l='yes'
|
|
||||||
else
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <xlocale.h>
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
#ifndef wcstombs_l
|
|
||||||
(void) wcstombs_l;
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
pgac_cv_func_wcstombs_l='yes (in xlocale.h)'
|
|
||||||
else
|
|
||||||
pgac_cv_func_wcstombs_l='no'
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_func_wcstombs_l" >&5
|
|
||||||
$as_echo "$pgac_cv_func_wcstombs_l" >&6; }
|
|
||||||
if test "$pgac_cv_func_wcstombs_l" = 'yes (in xlocale.h)'; then
|
|
||||||
|
|
||||||
$as_echo "#define WCSTOMBS_L_IN_XLOCALE 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
||||||
|
@ -1446,6 +1446,7 @@ AC_CHECK_HEADERS(m4_normalize([
|
|||||||
sys/ucred.h
|
sys/ucred.h
|
||||||
termios.h
|
termios.h
|
||||||
ucred.h
|
ucred.h
|
||||||
|
xlocale.h
|
||||||
]))
|
]))
|
||||||
|
|
||||||
if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
|
if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
|
||||||
@ -1608,8 +1609,6 @@ PGAC_UNION_SEMUN
|
|||||||
AC_CHECK_TYPES(socklen_t, [], [], [#include <sys/socket.h>])
|
AC_CHECK_TYPES(socklen_t, [], [], [#include <sys/socket.h>])
|
||||||
PGAC_STRUCT_SOCKADDR_SA_LEN
|
PGAC_STRUCT_SOCKADDR_SA_LEN
|
||||||
|
|
||||||
PGAC_TYPE_LOCALE_T
|
|
||||||
|
|
||||||
# MSVC doesn't cope well with defining restrict to __restrict, the
|
# MSVC doesn't cope well with defining restrict to __restrict, the
|
||||||
# spelling it understands, because it conflicts with
|
# spelling it understands, because it conflicts with
|
||||||
# __declspec(restrict). Therefore we define pg_restrict to the
|
# __declspec(restrict). Therefore we define pg_restrict to the
|
||||||
@ -1708,7 +1707,6 @@ fi
|
|||||||
##
|
##
|
||||||
|
|
||||||
PGAC_VAR_INT_TIMEZONE
|
PGAC_VAR_INT_TIMEZONE
|
||||||
PGAC_FUNC_WCSTOMBS_L
|
|
||||||
|
|
||||||
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
||||||
# symbols that that library has no business exposing to the world. Pending
|
# symbols that that library has no business exposing to the world. Pending
|
||||||
|
33
meson.build
33
meson.build
@ -2403,6 +2403,7 @@ header_checks = [
|
|||||||
'sys/ucred.h',
|
'sys/ucred.h',
|
||||||
'termios.h',
|
'termios.h',
|
||||||
'ucred.h',
|
'ucred.h',
|
||||||
|
'xlocale.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach header : header_checks
|
foreach header : header_checks
|
||||||
@ -2546,15 +2547,6 @@ else
|
|||||||
cdata.set('STRERROR_R_INT', false)
|
cdata.set('STRERROR_R_INT', false)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Find the right header file for the locale_t type. macOS needs xlocale.h;
|
|
||||||
# standard is locale.h, but glibc <= 2.25 also had an xlocale.h file that
|
|
||||||
# we should not use so we check the standard header first. MSVC has a
|
|
||||||
# replacement defined in src/include/port/win32_port.h.
|
|
||||||
if not cc.has_type('locale_t', prefix: '#include <locale.h>') and \
|
|
||||||
cc.has_type('locale_t', prefix: '#include <xlocale.h>')
|
|
||||||
cdata.set('LOCALE_T_IN_XLOCALE', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Check if the C compiler understands typeof or a variant. Define
|
# Check if the C compiler understands typeof or a variant. Define
|
||||||
# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
|
# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
|
||||||
foreach kw : ['typeof', '__typeof__', 'decltype']
|
foreach kw : ['typeof', '__typeof__', 'decltype']
|
||||||
@ -2580,29 +2572,6 @@ int main(void)
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
wcstombs_l_test = '''
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <locale.h>
|
|
||||||
@0@
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
#ifndef wcstombs_l
|
|
||||||
(void) wcstombs_l;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
if (not cc.compiles(wcstombs_l_test.format(''),
|
|
||||||
name: 'wcstombs_l') and
|
|
||||||
cc.compiles(wcstombs_l_test.format('#include <xlocale.h>'),
|
|
||||||
name: 'wcstombs_l in xlocale.h'))
|
|
||||||
cdata.set('WCSTOMBS_L_IN_XLOCALE', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# MSVC doesn't cope well with defining restrict to __restrict, the spelling it
|
# MSVC doesn't cope well with defining restrict to __restrict, the spelling it
|
||||||
# understands, because it conflicts with __declspec(restrict). Therefore we
|
# understands, because it conflicts with __declspec(restrict). Therefore we
|
||||||
# define pg_restrict to the appropriate definition, which presumably won't
|
# define pg_restrict to the appropriate definition, which presumably won't
|
||||||
|
@ -71,6 +71,9 @@
|
|||||||
#include <fcntl.h> /* ensure O_BINARY is available */
|
#include <fcntl.h> /* ensure O_BINARY is available */
|
||||||
#endif
|
#endif
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#ifdef HAVE_XLOCALE_H
|
||||||
|
#include <xlocale.h>
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -499,6 +499,9 @@
|
|||||||
/* Define to 1 if the assembler supports X86_64's POPCNTQ instruction. */
|
/* Define to 1 if the assembler supports X86_64's POPCNTQ instruction. */
|
||||||
#undef HAVE_X86_64_POPCNTQ
|
#undef HAVE_X86_64_POPCNTQ
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <xlocale.h> header file. */
|
||||||
|
#undef HAVE_XLOCALE_H
|
||||||
|
|
||||||
/* Define to 1 if you have XSAVE intrinsics. */
|
/* Define to 1 if you have XSAVE intrinsics. */
|
||||||
#undef HAVE_XSAVE_INTRINSICS
|
#undef HAVE_XSAVE_INTRINSICS
|
||||||
|
|
||||||
@ -559,9 +562,6 @@
|
|||||||
/* Define to the appropriate printf length modifier for 64-bit ints. */
|
/* Define to the appropriate printf length modifier for 64-bit ints. */
|
||||||
#undef INT64_MODIFIER
|
#undef INT64_MODIFIER
|
||||||
|
|
||||||
/* Define to 1 if `locale_t' requires <xlocale.h>. */
|
|
||||||
#undef LOCALE_T_IN_XLOCALE
|
|
||||||
|
|
||||||
/* Define as the maximum alignment requirement of any C data type. */
|
/* Define as the maximum alignment requirement of any C data type. */
|
||||||
#undef MAXIMUM_ALIGNOF
|
#undef MAXIMUM_ALIGNOF
|
||||||
|
|
||||||
@ -748,9 +748,6 @@
|
|||||||
/* Define to 1 to build with ZSTD support. (--with-zstd) */
|
/* Define to 1 to build with ZSTD support. (--with-zstd) */
|
||||||
#undef USE_ZSTD
|
#undef USE_ZSTD
|
||||||
|
|
||||||
/* Define to 1 if `wcstombs_l' requires <xlocale.h>. */
|
|
||||||
#undef WCSTOMBS_L_IN_XLOCALE
|
|
||||||
|
|
||||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
#ifndef _PG_LOCALE_
|
#ifndef _PG_LOCALE_
|
||||||
#define _PG_LOCALE_
|
#define _PG_LOCALE_
|
||||||
|
|
||||||
#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
|
|
||||||
#include <xlocale.h>
|
|
||||||
#endif
|
|
||||||
#ifdef USE_ICU
|
#ifdef USE_ICU
|
||||||
#include <unicode/ucol.h>
|
#include <unicode/ucol.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,9 +13,6 @@
|
|||||||
#ifndef CHAR_BIT
|
#ifndef CHAR_BIT
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef LOCALE_T_IN_XLOCALE
|
|
||||||
#include <xlocale.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum COMPAT_MODE
|
enum COMPAT_MODE
|
||||||
{
|
{
|
||||||
|
@ -23,10 +23,6 @@
|
|||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LOCALE_T_IN_XLOCALE
|
|
||||||
#include <xlocale.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mb/pg_wchar.h"
|
#include "mb/pg_wchar.h"
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user