When building m4-1.4.18b on OpenBSD 6.9, with GNU gettext installed,
there is a link error:
CCLD test-posix_spawn-chdir
ld: error: undefined symbol: libintl_gettext
>>> referenced by xalloc-die.c:34 (../../lib/xalloc-die.c:34)
>>> xalloc-die.o:(xalloc_die) in archive ../lib/libm4.a
>>> referenced by error.c:195 (../../lib/error.c:195)
>>> error.o:(error_tail) in archive ../lib/libm4.a
collect2: ld returned 1 exit status
Errors while building
The cause are these dependencies:
test-posix_spawn-chdir.o
-> find_in_path() in findprog.o
-> xmalloc()
-> xalloc_die()
-> libintl_gettext()
This patch to gnulib fixes it. In m4, you'll need to update to the
current gnulib.
2021-05-08 Bruno Haible <[email protected]>
Fix build error when libintl is installed.
* modules/posix_spawn_file_actions_addchdir-tests (Makefile.am): Link
test-posix_spawn-chdir with libintl.
* modules/posix_spawn_file_actions_addfchdir-tests (Makefile.am): Link
test-posix_spawn-fchdir with libintl.
diff --git a/modules/posix_spawn_file_actions_addchdir-tests
b/modules/posix_spawn_file_actions_addchdir-tests
index e554138..d44b3f1 100644
--- a/modules/posix_spawn_file_actions_addchdir-tests
+++ b/modules/posix_spawn_file_actions_addchdir-tests
@@ -19,3 +19,4 @@ TESTS += \
check_PROGRAMS += \
test-posix_spawn_file_actions_addchdir \
test-posix_spawn-chdir
+test_posix_spawn_chdir_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/posix_spawn_file_actions_addfchdir-tests
b/modules/posix_spawn_file_actions_addfchdir-tests
index 2f09934..789a85d 100644
--- a/modules/posix_spawn_file_actions_addfchdir-tests
+++ b/modules/posix_spawn_file_actions_addfchdir-tests
@@ -27,4 +27,5 @@ check_PROGRAMS += test-posix_spawn_file_actions_addfchdir
if POSIX_SPAWN_PORTED
TESTS += test-posix_spawn-fchdir
check_PROGRAMS += test-posix_spawn-fchdir
+test_posix_spawn_fchdir_LDADD = $(LDADD) @LIBINTL@
endif