diff options
author | Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-11-19 02:40:09 +0100 |
---|---|---|
committer | Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-11-19 02:40:09 +0100 |
commit | 164bbe5a9cf846903b166e37df087a4b9c8b363a (patch) | |
tree | b1b14d7b834da919445e882abbf5a894bd2a8e84 | |
parent | fde0f38a10e94f385870c021b27bcdd1891c3b7b (diff) | |
download | xine-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).
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | m4/_xine.m4 | 15 | ||||
-rw-r--r-- | m4/attributes.m4 | 25 | ||||
-rw-r--r-- | misc/Makefile.common | 2 |
4 files changed, 27 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index f0e68fb1f..dd37376d3 100644 --- a/configure.ac +++ b/configure.ac @@ -2634,17 +2634,7 @@ CC_CHECK_CFLAGS_APPEND([-Wstrict-aliasing=2 -Wstrict-aliasing], [break;]) dnl This *has* to stay at the end as it can break some autoconf tests. CC_CHECK_CFLAGS_APPEND([-Werror=implicit-function-declaration -Werror-implicit-function-declaration], [break;]) -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*) ;; - *) - AC_TRY_LDFLAGS([-Wl,-z,defs], [NOUNDEF="-Wl,-z,defs"]) - ;; -esac -AC_SUBST([NOUNDEF]) - +CC_NOUNDEFINED dnl signal FreeBSD have also FreeBSD based kernel. dnl diff --git a/m4/_xine.m4 b/m4/_xine.m4 index 3ebbb028d..900b57da5 100644 --- a/m4/_xine.m4 +++ b/m4/_xine.m4 @@ -157,21 +157,6 @@ AC_DEFUN([AC_TRY_CFLAGS], ifelse([$3],[],[:],[$3]) fi]) -dnl AC_TRY_LDFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) -dnl check if $CC supports a given set of ldflags -AC_DEFUN([AC_TRY_LDFLAGS], - [AC_MSG_CHECKING([if $CC supports $1 flags]) - SAVE_LDFLAGS="$LDFLAGS" - LDFLAGS="$1" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no]) - LDFLAGS="$SAVE_LDFLAGS" - AC_MSG_RESULT([$ac_cv_try_ldflags_ok]) - if test x"$ac_cv_try_ldflags_ok" = x"yes"; then - ifelse([$2],[],[:],[$2]) - else - ifelse([$3],[],[:],[$3]) - fi]) - dnl AC_CHECK_GENERATE_INTTYPES_H (INCLUDE-DIRECTORY) dnl generate a default inttypes.h if the header file does not exist already AC_DEFUN([AC_CHECK_GENERATE_INTTYPES], 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 diff --git a/misc/Makefile.common b/misc/Makefile.common index a0617bbb4..4adab1527 100644 --- a/misc/Makefile.common +++ b/misc/Makefile.common @@ -3,7 +3,7 @@ XINE_LIB = $(top_builddir)/src/xine-engine/libxine.la xineincludedir = $(includedir)/xine xineplugdir = $(XINE_PLUGINDIR) -xineplug_ldflags = $(NOUNDEF) -avoid-version -module +xineplug_ldflags = $(LDFLAGS_NOUNDEFINED) -avoid-version -module xinepostdir = $(XINE_PLUGINDIR)/post vidixdir = $(XINE_PLUGINDIR)/vidix |