]> git.notmuchmail.org Git - notmuch/commitdiff
lib, ruby: make use of -Wl,--no-undefined configurable
authorDavid Bremner <david@tethera.net>
Mon, 1 Jun 2015 07:09:00 +0000 (09:09 +0200)
committerDavid Bremner <david@tethera.net>
Sat, 13 Jun 2015 15:52:48 +0000 (17:52 +0200)
In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.

bindings/Makefile.local
bindings/ruby/extconf.rb
configure
lib/Makefile.local

index 16817f5ac4322771a0181d879d8a3a069c72491b..d236f014c1b048e6fdb5401c0730c7e980b366ca 100644 (file)
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be built
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-       cd $(dir)/ruby && ruby extconf.rb --vendor
+       cd $(dir)/ruby && \
+               EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+               ruby extconf.rb --vendor
        $(MAKE) -C $(dir)/ruby
 else
        @echo Missing dependency, skipping ruby bindings
index 6160db26e2ea10286fb16065c2c030ea90a0c07e..6d5607e168228bf7c12949fe9bb10d0800629d4d 100644 (file)
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
index 13a8dcabbff53e65d23deefa0bb94ccf22fad9e6..b967a4ed04294d76d855ee509c66337c6f21d00f 100755 (executable)
--- a/configure
+++ b/configure
@@ -751,6 +751,16 @@ else
     as_needed_ldflags=""
 fi
 
+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    no_undefined_ldflags="-Wl,--no-undefined"
+else
+    printf "No (nothing to worry about).\n"
+    no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}
 
index f9ecd50e7366f6afed8e5cd132e4ea83185d33cd..b58b4e8a425f8bbf0da01642fc44902268962899 100644 (file)
@@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so
 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
-LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
+LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
 ifeq ($(PLATFORM),OPENBSD)
 LIBRARY_LINK_FLAG += -lc
 endif