[kmscon-devel] [PATCH] Check for GNU ld

Florian Gilcher florian.gilcher at asquera.de
Mon Mar 24 11:52:50 PDT 2014


Some flags that are GNU ld-only are used. Deactivate them
if using a different linker.
---
 Makefile.am  | 10 ++++++++++
 configure.ac |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index a484292..76838b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,11 +70,16 @@ AM_CFLAGS = \
 AM_CPPFLAGS = \
 	-include $(top_builddir)/config.h \
 	-I $(srcdir)/src
+
+if BUILD_HAVE_GNU_LD
 AM_LDFLAGS = \
 	-Wl,--as-needed \
 	-Wl,--gc-sections \
 	-Wl,-z,relro \
 	-Wl,-z,now
+else
+AM_LDFLAGS =
+endif
 
 if BUILD_ENABLE_DEBUG
 AM_CFLAGS += -g
@@ -135,10 +140,15 @@ libtsm_test_la_LIBADD = libshl.la
 
 EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
 
+if BUILD_HAVE_GNU_LD
 libtsm_la_LDFLAGS = \
 	$(AM_LDFLAGS) \
 	-version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
 	-Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"
+else
+libtsm_la_LDFLAGS = $(AM_LDFLAGS)
+endif
+
 libtsm_test_la_LDFLAGS = \
 	$(AM_LDFLAGS)
 
diff --git a/configure.ac b/configure.ac
index 4373b92..fbada1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,13 @@ AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
                [test "x$enable_optimizations" = "xyes"])
 
 #
+# Check whether the linker we are linking with is GNU ld.
+#
+
+AM_CONDITIONAL([BUILD_HAVE_GNU_LD],
+               [test "x$with_gnu_ld" = "xyes"])
+
+#
 # Makefile vars
 # After everything is configured, we create all makefiles.
 #
-- 
1.8.5.2 (Apple Git-48)



More information about the kmscon-devel mailing list