Meson doesn't define HAVE_LOCALE_T for mscv
Hello all,
Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl script does.
Please find attached a patch for so.
Regards,
Juan José Santamaría Flecha
Attachments:
0001-meson-define-HAVE_LOCALE_T-for-mscv.patchapplication/octet-stream; name=0001-meson-define-HAVE_LOCALE_T-for-mscv.patchDownload
From 07c2d68447335dab42c81afa80a4a637a4bb7947 Mon Sep 17 00:00:00 2001
From: Juan Jose Santamaria Flecha <juanjo.santamaria@gmail.com>
Date: Tue, 8 Nov 2022 16:17:08 -0500
Subject: [PATCH] meson define HAVE_LOCALE_T for mscv
Meson doesn't see the redefinition of locale_t done in
src/include/port/win32_port.h, so is not defining HAVE_LOCALE_T,
HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the current
src/tools/msvc/build.pl script does.
---
meson.build | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/meson.build b/meson.build
index bfacbdc..d109d02 100644
--- a/meson.build
+++ b/meson.build
@@ -2199,6 +2199,8 @@ if cc.has_type('locale_t', prefix: '#include <locale.h>')
elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
cdata.set('HAVE_LOCALE_T', 1)
cdata.set('LOCALE_T_IN_XLOCALE', 1)
+elif cc.get_id() == 'msvc'
+ cdata.set('HAVE_LOCALE_T', 1)
endif
# Check if the C compiler understands typeof or a variant. Define
@@ -2411,6 +2413,12 @@ if cc.has_function('syslog', args: test_c_args) and \
endif
+if cc.get_id() == 'msvc'
+ cdata.set('HAVE_WCSTOMBS_L', 1)
+ cdata.set('HAVE_MBSTOWCS_L', 1)
+endif
+
+
# if prerequisites for unnamed posix semas aren't fulfilled, fall back to sysv
# semaphores
if sema_kind == 'unnamed_posix' and \
--
2.11.0
On 10.11.22 10:59, Juan José Santamaría Flecha wrote:
Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl <http://build.pl> script does.Please find attached a patch for so.
committed
Hi,
On 2022-11-10 10:59:41 +0100, Juan Jos� Santamar�a Flecha wrote:
Meson doesn't see the redefinition of locale_t done
in src/include/port/win32_port.h, so is not defining
HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the
current src/tools/msvc/build.pl script does.Please find attached a patch for so.
Hm. Is it right that the changes are only done for msvc? win32_port.h defines
the types for mingw as well afaict.
Greetings,
Andres Freund
On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de> wrote:
Hm. Is it right that the changes are only done for msvc? win32_port.h
defines
the types for mingw as well afaict.Yes, it does, but configure does nothing with them, so adding those
defines is a new feature for MinGW but a correction for MSVC.
PFA a patch for MinGW.
I've seen that when building with meson on MinGW the output for version()
is 'PostgreSQL 16devel on x86_64, compiled by gcc-12.2.0', which is not
wrong but I cannot tell that it was done on MinGW. Should we include the
'host_system' in PG_VERSION_STR?
Regards,
Juan José Santamaría Flecha
Attachments:
0001-meson-define-HAVE_LOCALE_T-for-MinGW.patchapplication/octet-stream; name=0001-meson-define-HAVE_LOCALE_T-for-MinGW.patchDownload
From 63518625dafbc43095903f24ced7179bee0dbf47 Mon Sep 17 00:00:00 2001
From: Juan Jose Santamaria Flecha <juanjo.santamaria@gmail.com>
Date: Tue, 15 Nov 2022 09:05:19 -0500
Subject: [PATCH] meson define HAVE_LOCALE_T for MinGW
Add manual override to define HAVE_LOCALE_T, HAVE_WCSTOMBS_L and
HAVE_MBSTOWCS_L on MinGW.
---
meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 0583820..259240f 100644
--- a/meson.build
+++ b/meson.build
@@ -2200,7 +2200,7 @@ if cc.has_type('locale_t', prefix: '#include <locale.h>')
elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
cdata.set('HAVE_LOCALE_T', 1)
cdata.set('LOCALE_T_IN_XLOCALE', 1)
-elif cc.get_id() == 'msvc'
+elif host_system == 'windows'
cdata.set('HAVE_LOCALE_T', 1)
endif
@@ -2415,7 +2415,7 @@ endif
# MSVC has replacements defined in src/include/port/win32_port.h.
-if cc.get_id() == 'msvc'
+if host_system == 'windows'
cdata.set('HAVE_WCSTOMBS_L', 1)
cdata.set('HAVE_MBSTOWCS_L', 1)
endif
--
2.11.0
Hi,
On 2022-11-15 15:35:31 +0100, Juan Jos� Santamar�a Flecha wrote:
I've seen that when building with meson on MinGW the output for version()
is 'PostgreSQL 16devel on x86_64, compiled by gcc-12.2.0', which is not
wrong but I cannot tell that it was done on MinGW. Should we include the
'host_system' in PG_VERSION_STR?
I don't think we should print mingw - that's really just redundant with
gcc. But including host_system seems like a good idea. Not sure why I didn't
do that.
Greetings,
Andres Freund
Hi,
Hm, the quoting was odd, making me think you had written a separate email
about the define issue. Hence the separate email...
On 2022-11-15 15:35:31 +0100, Juan Jos� Santamar�a Flecha wrote:
On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de> wrote:
Hm. Is it right that the changes are only done for msvc? win32_port.h
defines the types for mingw as well afaict.
Yes, it does, but configure does nothing with them, so adding those
defines is a new feature for MinGW but a correction for MSVC.
Any chance you checked if autoconf already detects locale_t with mingw?
Possible that mingw supplies one of the relevant headers...
Otherwise it looks like a sensible improvement to me.
Greetings,
Andres Freund
On Tue, Nov 15, 2022 at 8:53 PM Andres Freund <andres@anarazel.de> wrote:
I don't think we should print mingw - that's really just redundant with
gcc. But including host_system seems like a good idea. Not sure why I
didn't
do that.I'll open a new thread for this. Also, I think this is skipping
collate.linux.utf.sql and infinite_recurse.sql tests in their intended
platforms.
Regards,
Juan José Santamaría Flecha
On Tue, Nov 15, 2022 at 9:02 PM Andres Freund <andres@anarazel.de> wrote:
On 2022-11-15 15:35:31 +0100, Juan José Santamaría Flecha wrote:
On Tue, Nov 15, 2022 at 1:49 AM Andres Freund <andres@anarazel.de>
wrote:
Hm. Is it right that the changes are only done for msvc? win32_port.h
defines the types for mingw as well afaict.Yes, it does, but configure does nothing with them, so adding those
defines is a new feature for MinGW but a correction for MSVC.Any chance you checked if autoconf already detects locale_t with mingw?
Possible that mingw supplies one of the relevant headers...Otherwise it looks like a sensible improvement to me.
I've checked the autoconf version of pg_config.h and it's not detected.
Also, manually inspecting <locale.h> I see no definition of locale_t in
MinGW.
Regards,
Juan José Santamaría Flecha