unicode test programs don't build with meson

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-10-18T10:11:00Z
Lists: pgsql-hackers
The test programs in src/common/unicode/ (case_test, category_test, 
norm_test), don't build with meson if the nls option is enabled, because 
a libintl dependency is missing.

(pg_strerror_r() in src/port/strerror.c makes a gettext call, so in that 
sense libpgport has a dependency on libintl.)

The makefiles are ok, because they just link all programs against all 
libraries that configure finds, more or less, but meson needs explicit 
dependencies declared.

I can see a few ways to fix that, so I'm looking for feedback on which 
way is best.

1) Add libintl directly to the affected programs, like

  case_test = executable('case_test',
    ['case_test.c'],
-  dependencies: [frontend_port_code, icu],
+  dependencies: [frontend_port_code, icu, libintl],
    include_directories: inc,
    link_with: [common_static, pgport_static],
    build_by_default: false,

etc.

2) Add libintl as a dependency of frontend_port_code:

--- a/meson.build
+++ b/meson.build
@@ -2986,7 +2986,7 @@ subdir('config')
  frontend_port_code = declare_dependency(
    compile_args: ['-DFRONTEND'],
    include_directories: [postgres_inc],
-  dependencies: os_deps,
+  dependencies: [os_deps, libintl],
  )

3) Add libintl to os_deps directly?

4) Change the dependencies of the test programs to something like

--- a/src/common/unicode/meson.build
+++ b/src/common/unicode/meson.build
@@ -75,7 +75,7 @@ inc = include_directories('.')

  norm_test = executable('norm_test',
    ['norm_test.c', norm_test_table],
-  dependencies: [frontend_port_code],
+  dependencies: [frontend_code],
    include_directories: inc,
    link_with: [common_static, pgport_static],
    build_by_default: false,

Or something else, or some combination?




Commits

  1. meson: Add missing dependency to unicode test programs