build: Use an export symbols file if there is no version script support We generate the symbol list from the version script to avoid repeating ourselves and potentially getting the lists out-of-sync. Proposed-by: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/.gitignore b/.gitignore
index affc47b..f3f1b27 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
ChangeLog
+*.sym
*.a
*.o
*.la
diff --git a/src/Makefile.am b/src/Makefile.am
index 62cba25..505843e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,9 +29,13 @@ libmd_la_LDFLAGS = \
if HAVE_LINKER_VERSION_SCRIPT
libmd_la_LDFLAGS += \
-Wl,--version-script=$(srcdir)/libmd.map
+else
+libmd_la_LDFLAGS += \
+ -export-symbols $(srcdir)/libmd.sym
endif
libmd_la_DEPENDENCIES = \
libmd.map \
+ libmd.sym \
helper.c \
$(nil)
libmd_la_SOURCES = \
@@ -58,6 +62,15 @@ CLEANFILES = \
$(libmd_la_helper_sources) \
$(nil)
+DISTCLEANFILES = \
+ libmd.sym \
+ $(nil)
+
+# Generate a simple libtool symbol export list to be used as a fallback if
+# there is no version script support.
+libmd.sym: libmd.map
+ $(AM_V_GEN) sed -ne 's/^[[:space:]]\+\([A-Za-z0-9]\+\);/\1/p' $< > $@
+
md2hl.c: helper.c
$(AM_V_GEN) sed -e 's/hashinc/md2.h/g' -e 's/HASH/MD2/g' $< > $@