summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:40 -0700
committerNoah Watkins <noahwatkins@gmail.com>2013-09-17 10:28:22 -0700
commitec828682bc7588c904100180fa799b0a23c65725 (patch)
tree85c52794b8ae8d521c52c8ffecb2d9e5d704609d
parent26b2f7f3974b112108c8f582a2c433ff3b6dd946 (diff)
downloadceph-ec828682bc7588c904100180fa799b0a23c65725.tar.gz
build: use flat namespace when linking on OSX
This a compatibility feature to avoid using OSX two-level namespacing. Ideally we can get rid of this, but it'll take some deeper understanding of the problem. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
-rw-r--r--configure.ac2
-rw-r--r--src/Makefile-env.am9
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 16c258baad8..b193c85d590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
case "${target_os}" in
darwin*)
AC_DEFINE([DARWIN], [1], [Define if darwin/osx])
+ darwin="yes"
;;
linux*)
linux="yes"
@@ -52,6 +53,7 @@ freebsd*)
freebsd="yes"
;;
esac
+AM_CONDITIONAL(DARWIN, test x"$darwin" = x"yes")
AM_CONDITIONAL(LINUX, test x"$linux" = x"yes")
AM_CONDITIONAL(FREEBSD, test x"$freebsd" = x"yes")
diff --git a/src/Makefile-env.am b/src/Makefile-env.am
index 389e3ef9fdd..8d076b781af 100644
--- a/src/Makefile-env.am
+++ b/src/Makefile-env.am
@@ -64,6 +64,11 @@ AM_CXXFLAGS = \
-Wno-invalid-offsetof \
-Wstrict-null-sentinel
+AM_LDFLAGS =
+if DARWIN
+AM_LDFLAGS += -undefined dynamic_lookup -flat_namespace
+endif
+
# note: this is position dependant, it affects the -l options that
# come after it on the command line. when you use ${AM_LDFLAGS} in
# later rules, take care where you place it. for more information, see
@@ -72,7 +77,9 @@ AM_CXXFLAGS = \
# http://www.gentoo.org/proj/en/qa/asneeded.xml
# http://gcc.gnu.org/ml/gcc-help/2010-12/msg00338.html
# http://sigquit.wordpress.com/2011/02/16/why-asneeded-doesnt-work-as-expected-for-your-libraries-on-your-autotools-project/
-AM_LDFLAGS = -Wl,--as-needed
+if !DARWIN
+AM_LDFLAGS += -Wl,--as-needed
+endif
if USE_BOOST_SPIRIT_OLD_HDR
AM_CXXFLAGS += -DUSE_BOOST_SPIRIT_OLD_HDR