changeset 393:ffbb5e3f2551

Add missing linking with zlib and libpthread/librt The uncompress and sem_* functions are used by various parts of the code but the files built from that code were not linked with zlib/pthread/rt. This fixes building with the --no-add-needed linker option. Fixes: https://bugs.debian.org/604796
author Paul Wise <pabs3@bonedaddy.net>
date Mon, 23 Dec 2019 12:23:22 +0800
parents 54465fca8b9e
children 3cbda103e0ef
files configure.ac src/Makefile.am
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Dec 23 12:23:22 2019 +0800
+++ b/configure.ac	Mon Dec 23 12:23:22 2019 +0800
@@ -173,7 +173,10 @@
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h inttypes.h limits.h regex.h semaphore.h signal.h stdarg.h stdint.h stdio.h stdlib.h string.h sys/param.h sys/shm.h sys/stat.h sys/types.h time.h unistd.h wchar.h])
-AC_SEARCH_LIBS([sem_init],[pthread rt])
+save_libs="$LIBS" ; LIBS=""
+AC_SEARCH_LIBS([sem_init], [pthread rt], [SEM_LIBS="$LIBS"], [AC_MSG_ERROR([sem_init missing])])
+AC_SUBST([SEM_LIBS])
+LIBS="$save_libs"
 
 
 # Checks for typedefs, structures, and compiler characteristics.
--- a/src/Makefile.am	Mon Dec 23 12:23:22 2019 +0800
+++ b/src/Makefile.am	Mon Dec 23 12:23:22 2019 +0800
@@ -12,7 +12,7 @@
 
 
 if STATIC_TOOLS
-    PSTLIB = @PST_OBJDIR@/libpst.a
+    PSTLIB = @PST_OBJDIR@/libpst.a @ZLIB_LIBS@ $(SEM_LIBS)
 else
     PSTLIB = libpst.la
 endif
@@ -80,7 +80,7 @@
 endif
 
 libpst_la_SOURCES     = $(common_source) $(common_header)
-libpst_la_LIBADD      = $(LTLIBICONV)
+libpst_la_LIBADD      = $(LTLIBICONV) @ZLIB_LIBS@ $(SEM_LIBS)
 
 EXTRA_DIST =
 if !NEED_XGETOPT
@@ -92,7 +92,7 @@
 
 # the library search path.
 lspst_LDADD       = $(all_libraries) $(PSTLIB) $(LTLIBICONV) @ZLIB_LIBS@
-readpst_LDADD     = $(all_libraries) $(PSTLIB) $(LTLIBICONV) $(REGEXLIB) $(GSF_LIBS) @ZLIB_LIBS@
+readpst_LDADD     = $(all_libraries) $(PSTLIB) $(LTLIBICONV) $(REGEXLIB) $(GSF_LIBS) @ZLIB_LIBS@ $(SEM_LIBS)
 pst2ldif_LDADD    = $(all_libraries) $(PSTLIB) $(LTLIBICONV) @ZLIB_LIBS@
 pst2dii_LDADD     = $(all_libraries) $(PSTLIB) $(LTLIBICONV) -lgd @ZLIB_LIBS@
 deltasearch_LDADD = $(all_libraries) $(PSTLIB) $(LTLIBICONV) @ZLIB_LIBS@