mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-11 19:20:40 +08: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:
parent
ee4859123e
commit
9c2a6c5a5f
@ -81,58 +81,3 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_SA_LEN],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
])])# 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
|
||||
|
||||
|
||||
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 :
|
||||
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"
|
||||
@ -14547,55 +14547,6 @@ _ACEOF
|
||||
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
|
||||
# spelling it understands, because it conflicts with
|
||||
# __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
|
||||
|
||||
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
|
||||
|
||||
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
||||
|
@ -1446,6 +1446,7 @@ AC_CHECK_HEADERS(m4_normalize([
|
||||
sys/ucred.h
|
||||
termios.h
|
||||
ucred.h
|
||||
xlocale.h
|
||||
]))
|
||||
|
||||
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>])
|
||||
PGAC_STRUCT_SOCKADDR_SA_LEN
|
||||
|
||||
PGAC_TYPE_LOCALE_T
|
||||
|
||||
# MSVC doesn't cope well with defining restrict to __restrict, the
|
||||
# spelling it understands, because it conflicts with
|
||||
# __declspec(restrict). Therefore we define pg_restrict to the
|
||||
@ -1708,7 +1707,6 @@ fi
|
||||
##
|
||||
|
||||
PGAC_VAR_INT_TIMEZONE
|
||||
PGAC_FUNC_WCSTOMBS_L
|
||||
|
||||
# Some versions of libedit contain strlcpy(), setproctitle(), and other
|
||||
# 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',
|
||||
'termios.h',
|
||||
'ucred.h',
|
||||
'xlocale.h',
|
||||
]
|
||||
|
||||
foreach header : header_checks
|
||||
@ -2546,15 +2547,6 @@ else
|
||||
cdata.set('STRERROR_R_INT', false)
|
||||
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
|
||||
# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
|
||||
foreach kw : ['typeof', '__typeof__', 'decltype']
|
||||
@ -2580,29 +2572,6 @@ int main(void)
|
||||
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
|
||||
# understands, because it conflicts with __declspec(restrict). Therefore we
|
||||
# define pg_restrict to the appropriate definition, which presumably won't
|
||||
|
@ -71,6 +71,9 @@
|
||||
#include <fcntl.h> /* ensure O_BINARY is available */
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
|
@ -499,6 +499,9 @@
|
||||
/* Define to 1 if the assembler supports X86_64's POPCNTQ instruction. */
|
||||
#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. */
|
||||
#undef HAVE_XSAVE_INTRINSICS
|
||||
|
||||
@ -559,9 +562,6 @@
|
||||
/* Define to the appropriate printf length modifier for 64-bit ints. */
|
||||
#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. */
|
||||
#undef MAXIMUM_ALIGNOF
|
||||
|
||||
@ -748,9 +748,6 @@
|
||||
/* Define to 1 to build with ZSTD support. (--with-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
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
|
@ -12,9 +12,6 @@
|
||||
#ifndef _PG_LOCALE_
|
||||
#define _PG_LOCALE_
|
||||
|
||||
#if defined(LOCALE_T_IN_XLOCALE) || defined(WCSTOMBS_L_IN_XLOCALE)
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
#ifdef USE_ICU
|
||||
#include <unicode/ucol.h>
|
||||
#endif
|
||||
|
@ -13,9 +13,6 @@
|
||||
#ifndef CHAR_BIT
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifdef LOCALE_T_IN_XLOCALE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
enum COMPAT_MODE
|
||||
{
|
||||
|
@ -23,10 +23,6 @@
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef LOCALE_T_IN_XLOCALE
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#include "mb/pg_wchar.h"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user