[patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable
David Bremner
david at tethera.net
Mon Jun 1 00:09:00 PDT 2015
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 | 4 +++-
bindings/ruby/extconf.rb | 5 +++--
configure | 13 +++++++++++++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index e0b0bf0..2ad0b86 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -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
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -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
diff --git a/configure b/configure
index 5a862b1..e3b4902 100755
--- a/configure
+++ b/configure
@@ -750,6 +750,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
@@ -954,6 +964,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}
--
2.1.4
More information about the notmuch
mailing list