summaryrefslogtreecommitdiff
path: root/m4/attributes.m4
diff options
context:
space:
mode:
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-19 02:40:09 +0100
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-19 02:40:09 +0100
commit164bbe5a9cf846903b166e37df087a4b9c8b363a (patch)
treeb1b14d7b834da919445e882abbf5a894bd2a8e84 /m4/attributes.m4
parentfde0f38a10e94f385870c021b27bcdd1891c3b7b (diff)
downloadxine-lib-164bbe5a9cf846903b166e37df087a4b9c8b363a.tar.gz
xine-lib-164bbe5a9cf846903b166e37df087a4b9c8b363a.tar.bz2
Create a new macro CC_NOUNDEFINED to check for the -z defs flag or
equivalent. I wanted this because I'm going to reuse attribute.m4 with that macro for a couple other projects. This also removes AC_TRY_LDFLAGS since it's not used any longer (replaced by CC_CHECK_LDFLAGS, which also caches results).
Diffstat (limited to 'm4/attributes.m4')
-rw-r--r--m4/attributes.m425
1 files changed, 25 insertions, 0 deletions
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 45ea789ad..e86456a46 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -99,6 +99,31 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
[$2], [$3])
])
+dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
+dnl the current linker to avoid undefined references in a shared object.
+AC_DEFUN([CC_NOUNDEFINED], [
+ dnl We check $host for which systems to enable this for.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ case $host in
+ dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
+ dnl are requested, as different implementations are present; to avoid problems
+ dnl use -Wl,-z,defs only for those platform not behaving this way.
+ *-freebsd*) ;;
+ *)
+ dnl First of all check for the --no-undefined variant of GNU ld. This allows
+ dnl for a much more readable commandline, so that people can understand what
+ dnl it does without going to look for what the heck -z defs does.
+ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
+ CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
+ break
+ done
+ ;;
+ esac
+
+ AC_SUBST([LDFLAGS_NOUNDEFINED])
+])
+
dnl Check for a -Werror flag or equivalent. -Werror is the GCC
dnl and ICC flag that tells the compiler to treat all the warnings
dnl as fatal. We usually need this option to make sure that some