summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac16
-rw-r--r--examples/client/Makefile.am3
-rw-r--r--examples/client/stream-tubes/Makefile.am3
-rw-r--r--examples/cm/callable/Makefile.am3
-rw-r--r--examples/cm/channelspecific/Makefile.am3
-rw-r--r--examples/cm/echo-message-parts/Makefile.am3
-rw-r--r--examples/cm/extended/Makefile.am3
-rw-r--r--examples/cm/no-protocols/Makefile.am3
-rw-r--r--examples/extensions/Makefile.am3
-rw-r--r--examples/future/call-cm/Makefile.am3
-rw-r--r--extensions/Makefile.am3
-rw-r--r--m4/tp-compiler-flag.m47
-rw-r--r--m4/tp-linker-flag.m444
-rw-r--r--telepathy-glib/Makefile.am3
-rw-r--r--telepathy-glib/abi.am1
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/dbus/Makefile.am3
-rw-r--r--tests/lib/Makefile.am3
18 files changed, 110 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2ea0b8f48..016badf47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,6 +94,22 @@ TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$official_release" = xno],
unused-parameter])
AC_SUBST([ERROR_CFLAGS])
+# these aren't really error flags but they serve a similar purpose for us -
+# making the toolchain stricter
+if test "x$official_release" = xno; then
+ TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-copy-dt-needed-entries])
+
+ # --no-copy-dt-needed-entries is the new name for --no-add-needed which
+ # is much more widely supported
+ case "$ERROR_LDFLAGS" in
+ (*-Wl,--no-copy-dt-needed-entries*)
+ ;;
+ (*)
+ TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-add-needed])
+ ;;
+ esac
+fi
+
AM_CONDITIONAL([OFFICIAL_RELEASE], [test "x$official_release" = xyes])
AC_ARG_ENABLE(debug,
diff --git a/examples/client/Makefile.am b/examples/client/Makefile.am
index bc282bb8c..c4525994f 100644
--- a/examples/client/Makefile.am
+++ b/examples/client/Makefile.am
@@ -59,3 +59,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/client/stream-tubes/Makefile.am b/examples/client/stream-tubes/Makefile.am
index eaecbe4ce..1f687f360 100644
--- a/examples/client/stream-tubes/Makefile.am
+++ b/examples/client/stream-tubes/Makefile.am
@@ -18,3 +18,6 @@ AM_CFLAGS = \
@DBUS_CFLAGS@ \
@GLIB_CFLAGS@ \
@TP_GLIB_CFLAGS@
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/cm/callable/Makefile.am b/examples/cm/callable/Makefile.am
index 21342ab50..0a04041ec 100644
--- a/examples/cm/callable/Makefile.am
+++ b/examples/cm/callable/Makefile.am
@@ -66,3 +66,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/cm/channelspecific/Makefile.am b/examples/cm/channelspecific/Makefile.am
index ba853cc1d..d0c5a6a8a 100644
--- a/examples/cm/channelspecific/Makefile.am
+++ b/examples/cm/channelspecific/Makefile.am
@@ -65,3 +65,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/cm/echo-message-parts/Makefile.am b/examples/cm/echo-message-parts/Makefile.am
index 84f420dcc..609a18514 100644
--- a/examples/cm/echo-message-parts/Makefile.am
+++ b/examples/cm/echo-message-parts/Makefile.am
@@ -61,3 +61,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/cm/extended/Makefile.am b/examples/cm/extended/Makefile.am
index 6f33246d4..437e5614a 100644
--- a/examples/cm/extended/Makefile.am
+++ b/examples/cm/extended/Makefile.am
@@ -50,3 +50,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/cm/no-protocols/Makefile.am b/examples/cm/no-protocols/Makefile.am
index b0d850e9d..f12c374db 100644
--- a/examples/cm/no-protocols/Makefile.am
+++ b/examples/cm/no-protocols/Makefile.am
@@ -45,3 +45,6 @@ AM_CPPFLAGS = \
$(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
diff --git a/examples/extensions/Makefile.am b/examples/extensions/Makefile.am
index ba59776cd..636a82575 100644
--- a/examples/extensions/Makefile.am
+++ b/examples/extensions/Makefile.am
@@ -14,6 +14,9 @@ AM_CFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(TP_GLIB_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
EXTRA_DIST = \
all.xml \
diff --git a/examples/future/call-cm/Makefile.am b/examples/future/call-cm/Makefile.am
index 0193afe2e..9df367c54 100644
--- a/examples/future/call-cm/Makefile.am
+++ b/examples/future/call-cm/Makefile.am
@@ -67,6 +67,9 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(NULL)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 0cf7813ed..3333eff9a 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -9,6 +9,9 @@ AM_CFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(TP_GLIB_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
EXTRA_DIST = \
all.xml \
diff --git a/m4/tp-compiler-flag.m4 b/m4/tp-compiler-flag.m4
index fc05e9e17..06deaba05 100644
--- a/m4/tp-compiler-flag.m4
+++ b/m4/tp-compiler-flag.m4
@@ -34,3 +34,10 @@ AC_DEFUN([TP_COMPILER_FLAG],
fi
AC_MSG_RESULT([$flag_ok])
])
+
+dnl TP_ADD_COMPILER_FLAG(VARIABLE, CFLAGS)
+dnl Append CFLAGS to VARIABLE if the compiler supports them.
+AC_DEFUN([TP_ADD_COMPILER_FLAG],
+[
+ TP_COMPILER_FLAG([$2], [$1="[$]$1 $2"])
+])
diff --git a/m4/tp-linker-flag.m4 b/m4/tp-linker-flag.m4
new file mode 100644
index 000000000..23eb41ad9
--- /dev/null
+++ b/m4/tp-linker-flag.m4
@@ -0,0 +1,44 @@
+dnl A version of AS_COMPILER_FLAG that supports linker flags
+dnl Based on:
+
+dnl as-compiler-flag.m4 0.1.0
+dnl autostars m4 macro for detection of compiler flags
+dnl David Schleef <ds@schleef.org>
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
+
+dnl TP_LINKER_FLAG(LDFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given LDFLAGS.
+dnl
+dnl Runs ACTION-IF-ACCEPTED if the compiler/linker for the currently selected
+dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise.
+dnl
+dnl Note that LDFLAGS are passed to the linker via the compiler, so you
+dnl should check for -Wl,--no-add-needed rather than --no-add-needed.
+
+AC_DEFUN([TP_LINKER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler/linker understand $1])
+
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], []), [flag_ok=yes], [flag_ok=no])
+
+ LDFLAGS="$save_LDFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ $2
+ true
+ else
+ $3
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+dnl TP_ADD_LINKER_FLAG(VARIABLE, LDFLAGS)
+dnl Append LDFLAGS to VARIABLE if the linker supports them.
+AC_DEFUN([TP_ADD_LINKER_FLAG],
+[
+ TP_LINKER_FLAG([$2], [$1="[$]$1 $2"])
+])
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am
index 8d2aacb9f..54a42b859 100644
--- a/telepathy-glib/Makefile.am
+++ b/telepathy-glib/Makefile.am
@@ -249,6 +249,9 @@ AM_CFLAGS = \
@GLIB_CFLAGS@ \
-I$(top_builddir) \
-I$(top_srcdir)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
ALL_LIBS = \
@DBUS_LIBS@ \
diff --git a/telepathy-glib/abi.am b/telepathy-glib/abi.am
index 1396d5e98..2ee0b16ac 100644
--- a/telepathy-glib/abi.am
+++ b/telepathy-glib/abi.am
@@ -72,6 +72,7 @@ ABI_LISTS = \
# that vim quickfix mode (:make) doesn't interpret the libtool --mode=link
# command as an error message in a bizarrely named file
libtelepathy_glib_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
-version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)"
libtelepathy_glib_la_LIBADD = libtelepathy-glib-internal.la
nodist_libtelepathy_glib_la_SOURCES =
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8f211a466..9f6caff3b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -129,6 +129,9 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(NULL)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
AM_CXXFLAGS = $(ERROR_CXXFLAGS)
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 93df1ced7..274b1d20e 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -218,6 +218,9 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
$(NULL)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
AM_CFLAGS = $(ERROR_CFLAGS)
diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am
index a27c6926f..803d8d39b 100644
--- a/tests/lib/Makefile.am
+++ b/tests/lib/Makefile.am
@@ -57,6 +57,9 @@ AM_CFLAGS = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(TP_GLIB_CFLAGS)
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
libtp_glib_tests_la_LIBADD = \
$(DBUS_LIBS) \