# 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
# 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
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
# 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}
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