summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-02-08 18:31:51 +0000
committerColin Watson <cjwatson@debian.org>2022-02-08 18:31:51 +0000
commit545276705cb692aaa15134471f9c02222b7412bb (patch)
tree43d4d0832fd81dff11d071c1cf2f17148fda7ff5
parent1f807e372a8bb79d9af6ba4225be1369658b0625 (diff)
Fix building on Cygwin
Achim reported that 2.10.0 no longer builds on Cygwin, while 2.9.4 did. This was magnificently obscure, at least to this Unix-head. Initially it appeared to be an issue with inter-library linking between libman and libmandb, but 2.9.4 relied on that too, just slightly less so. The actual problem was that libman only exported `gl_get_setlocale_null_lock` and not all the other symbols it's supposed to export, which is because that was explicitly marked for export and no other symbols were. Building libman with `-Wl,--export-all-symbols` fixes this; libman is intended as an aggregation of various helper functions, including those from Gnulib, and it doesn't make sense to be especially selective since it's only installed as a private library anyway. (I'm still not exactly sure why 2.9.4 didn't do the same thing, but this seems to be a good enough fix.) * configure.ac: Set LIBMAN_EXPORT_LDFLAGS to '-Wl,--export-all-symbols' when linking with GNU ld on Windows platforms. * lib/Makefile.am (libman_la_LDFLAGS): Add $(LIBMAN_EXPORT_LDFLAGS). * src/Makefile.am (LIBMAN): Remove $(top_builddir)/gl/lib/libgnu.la; as a convenience library, this is already incorporated into libman.la, and specifying it again causes multiple-definition errors on Cygwin. * src/tests/Makefile.am (get_mtime_LDADD): Likewise. * NEWS.md: Document this.
-rw-r--r--NEWS.md1
-rw-r--r--configure.ac11
-rw-r--r--lib/Makefile.am1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/tests/Makefile.am4
5 files changed, 15 insertions, 5 deletions
diff --git a/NEWS.md b/NEWS.md
index 9bb61343..f39603b1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -7,6 +7,7 @@ Fixes:
* Fix inadvertent reliance on a GCC extension that caused build failures
with Clang.
* Fix building without `iconv`.
+ * Fix building on Cygwin.
man-db 2.10.0 (4 February 2022)
===============================
diff --git a/configure.ac b/configure.ac
index f3f47be5..7748edd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,17 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_AR
LT_INIT([disable-static])
+
+libman_export_ldflags=
+if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ cygwin*|mingw*|pw32*|cegcc*)
+ libman_export_ldflags='-Wl,--export-all-symbols'
+ ;;
+ esac
+fi
+AC_SUBST([LIBMAN_EXPORT_LDFLAGS], [$libman_export_ldflags])
+
AC_CHECK_PROGS([cat], [cat])
AC_DEFINE_UNQUOTED([PROG_CAT], ["$cat"], [Program to use as cat.])
MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 475fea04..49f7809f 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -70,4 +70,5 @@ libman_la_LIBADD = ../gl/lib/libgnu.la $(LTLIBOBJS) \
libman_la_LDFLAGS = \
-avoid-version -release $(VERSION) -rpath $(pkglibdir) \
-no-undefined \
+ $(LIBMAN_EXPORT_LDFLAGS) \
$(libseccomp_LIBS)
diff --git a/src/Makefile.am b/src/Makefile.am
index e55cdda2..7d4a398b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,8 +56,7 @@ AM_CFLAGS = \
$(WARN_CFLAGS) \
$(libpipeline_CFLAGS)
-LIBMAN = $(top_builddir)/lib/libman.la $(top_builddir)/gl/lib/libgnu.la \
- @LTLIBINTL@
+LIBMAN = $(top_builddir)/lib/libman.la @LTLIBINTL@
LIBMANDB = $(top_builddir)/libdb/libmandb.la $(LIBMAN) $(DBLIBS)
accessdb_LDADD = $(LIBMANDB)
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 35aa20f8..6491417b 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -74,8 +74,6 @@ fspause_LDADD = \
$(top_builddir)/gl/lib/libgnu.la \
$(LIB_NANOSLEEP)
get_mtime_SOURCES = get-mtime.c
-get_mtime_LDADD = \
- $(top_builddir)/lib/libman.la \
- $(top_builddir)/gl/lib/libgnu.la
+get_mtime_LDADD = $(top_builddir)/lib/libman.la
dist_check_SCRIPTS = testlib.sh $(ALL_TESTS)