]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Fix a build issue on AIX.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Nov 2023 11:40:54 +0000 (12:40 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 17 Nov 2023 11:44:38 +0000 (12:44 +0100)
How to reproduce:
$ cd gettext-20231111
$ ~/build-64-gcc --disable-shared
$ (cd build-64-gcc && gmake install)
$ cd ..
$ cd gettext-0.22.3
$ ~/build-64-gcc
=> Fails with "ERROR: Undefined symbol: .syntax_check_message_list"
because the link uses $PREFIX/lib/libgettextsrc.a, which is a non-shared
library that does not export 'syntax_check_message_list'.

* gettext-tools/configure.ac (INSTALL_PRIVATE_LIBRARIES): New conditional.
* gettext-tools/src/Makefile.am (noinst_LTLIBRARIES): Define as alternative to
lib_LTLIBRARIES.
(install-exec-clean): Remove rule.
* gettext-tools/gnulib-lib/Makefile.am (lib_LTLIBRARIES): Initialize.
* gnulib-local/modules/gettext-tools-misc (Makefile.am): Define
noinst_LTLIBRARIES as alternative to lib_LTLIBRARIES. Remove
'install-exec-clean' rule.

gettext-tools/configure.ac
gettext-tools/gnulib-lib/Makefile.am
gettext-tools/src/Makefile.am
gnulib-local/modules/gettext-tools-misc

index e3aa58abd575b935d461afb5c40692b883d920bb..4a4203c767520ccdb65643445460a2dca3dac163 100644 (file)
@@ -129,6 +129,13 @@ case "$host_os" in
 esac
 AM_CONDITIONAL([WINDOWS_NATIVE], [test $is_windows_native = yes])
 
+dnl Package-private libraries do not need to be installed when we build only
+dnl static libraries. Don't install them in this case. This avoids a build
+dnl error on AIX with --enable-shared, when some other version of GNU gettext,
+dnl built with --disable-shared, is already installed in the same $prefix and
+dnl the CFLAGS or LDFLAGS happen to contain "-L$prefix/lib".
+AM_CONDITIONAL([INSTALL_PRIVATE_LIBRARIES], [test "$enable_shared" = yes])
+
 dnl Checks for libraries.
 
 dnl These are the only lines required to internationalize the package.
index e9c517fe9d0945a6cae4f2aa3334f4f2f8ee6de0..ab729cdde7504e12afb16d614cd57004a3862899 100644 (file)
@@ -26,6 +26,7 @@ DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 SUFFIXES =
 
+lib_LTLIBRARIES =
 noinst_LTLIBRARIES =
 
 # Extra files to be installed.
index 3850e250940d788c515e1eb782b3ea17ee01cf4a..f77129d6f1ca4dac37314fd1e9069526acacfade 100644 (file)
@@ -33,7 +33,13 @@ recode-sr-latin
 
 noinst_PROGRAMS = hostname urlget cldr-plurals
 
+if INSTALL_PRIVATE_LIBRARIES
+# Specify that libgettextsrc should be installed in $(libdir).
 lib_LTLIBRARIES = libgettextsrc.la
+else
+# Specify that libgettextsrc should not be installed.
+noinst_LTLIBRARIES = libgettextsrc.la
+endif
 
 noinst_HEADERS = \
   pos.h message.h po-error.h po-xerror.h po-gram.h po-charset.h \
@@ -351,14 +357,6 @@ if RELOCATABLE_VIA_LD
 libgettextsrc_la_LDFLAGS += `$(RELOCATABLE_LDFLAGS) $(libdir)`
 endif
 
-# No need to install libgettextsrc.a, except on AIX.
-install-exec-hook: install-exec-clean
-install-exec-clean:
-       case "@host_os@" in \
-         aix*) ;; \
-         *) $(RM) $(DESTDIR)$(libdir)/libgettextsrc.a ;; \
-       esac
-
 # Compile-time flags for particular source files.
 msgmerge_CFLAGS = $(AM_CFLAGS) $(OPENMP_CFLAGS)
 msgmerge_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CFLAGS)
index 6e9b3412c50d3313890e8928bbec9dd9f84be4d4..3975ac67643bd40ce9dc5b80c18542e8bd0ea10d 100644 (file)
@@ -10,8 +10,13 @@ configure.ac:
 
 Makefile.am:
 
-# Specify that libgettextlib should installed in $(libdir).
-lib_LTLIBRARIES = libgettextlib.la
+if INSTALL_PRIVATE_LIBRARIES
+# Specify that libgettextlib should be installed in $(libdir).
+lib_LTLIBRARIES += libgettextlib.la
+else
+# Specify that libgettextlib should not be installed.
+noinst_LTLIBRARIES += libgettextlib.la
+endif
 
 # Need $(LTLIBUNISTRING) because ulc_width_linebreaks, uc_width, etc. may be
 # taken from libunistring, when the configure option --with-libunistring-prefix
@@ -31,14 +36,6 @@ lib_LDFLAGS += -Wl,--export-all-symbols
 AM_CPPFLAGS += @GETTEXTLIB_EXPORTS_FLAGS@
 endif
 
-# No need to install libgettextlib.a, except on AIX.
-install-exec-local: install-libLTLIBRARIES install-exec-clean
-install-exec-clean:
-       case "@host_os@" in \
-         aix*) ;; \
-         *) rm -f $(DESTDIR)$(libdir)/libgettextlib.a ;; \
-       esac
-
 Include:
 
 License: