automake: check if the linker supports --dynamic-list
authorJonathan Gray <jsg@jsg.id.au>
Mon, 1 Sep 2014 16:08:00 +0000 (02:08 +1000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 5 Sep 2014 13:20:42 +0000 (14:20 +0100)
As older versions of gnu ld did not support --dynamic-list check to see
if it is supported before using it.  Non gnu linkers such the apple one
likely lack this option as well.

Fixes the build on OpenBSD which has binutils 2.15 and 2.17.
The --dynamic-list option seems to been have introduced sometime after
binutils 2.17 was released as it is present in 2.18.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
src/gallium/targets/dri/Makefile.am
src/gallium/targets/vdpau/Makefile.am

index 9d2ddb4ab00164282ba6ed7b8b3bfc6d95c714bd..f7525fe77a4c2be1c23b46421b772958c5cec36d 100644 (file)
@@ -357,6 +357,24 @@ AC_LINK_IFELSE(
 LDFLAGS=$save_LDFLAGS
 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
 
+dnl
+dnl Check if linker supports dynamic list files
+dnl
+AC_MSG_CHECKING([if the linker supports --dynamic-list])
+save_LDFLAGS=$LDFLAGS
+LDFLAGS="$LDFLAGS -Wl,--dynamic-list=conftest.dyn"
+cat > conftest.dyn <<EOF
+{
+       radeon_drm_winsys_create;
+};
+EOF
+AC_LINK_IFELSE(
+    [AC_LANG_SOURCE([int main() { return 0;}])],
+    [have_ld_dynamic_list=yes;AC_MSG_RESULT(yes)],
+    [have_ld_dynamic_list=no; AC_MSG_RESULT(no)])
+LDFLAGS=$save_LDFLAGS
+AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
+
 dnl
 dnl compatibility symlinks
 dnl
index 70b19b8d5e20ca42bc2d7ad63ce35139c4043ce8..1c33a91dff0c08f2632fe8ce3c1ab752fab06ffe 100644 (file)
@@ -26,7 +26,6 @@ gallium_dri_la_LDFLAGS = \
        -shrext .so \
        -module \
        -avoid-version \
-       -Wl,--dynamic-list=$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn \
        $(GC_SECTIONS)
 
 if HAVE_LD_VERSION_SCRIPT
@@ -34,6 +33,11 @@ gallium_dri_la_LDFLAGS += \
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym
 endif # HAVE_LD_VERSION_SCRIPT
 
+if HAVE_LD_DYNAMIC_LIST
+gallium_dri_la_LDFLAGS += \
+       -Wl,--dynamic-list=$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
+endif # HAVE_LD_DYNAMIC_LIST
+
 gallium_dri_la_LIBADD = \
        $(top_builddir)/src/mesa/libmesagallium.la \
        $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
index 6c92cd8603a43b5a6958c7403acf27d3815ec554..440cf2243a40334c3713f4e7756dff06d76a9c3e 100644 (file)
@@ -15,7 +15,6 @@ libvdpau_gallium_la_LDFLAGS = \
        -module \
        -no-undefined \
        -version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-       -Wl,--dynamic-list=$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
@@ -24,6 +23,11 @@ libvdpau_gallium_la_LDFLAGS += \
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau/vdpau.sym
 endif # HAVE_LD_VERSION_SCRIPT
 
+if HAVE_LD_DYNAMIC_LIST
+libvdpau_gallium_la_LDFLAGS += \
+       -Wl,--dynamic-list=$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
+endif # HAVE_LD_DYNAMIC_LIST
+
 libvdpau_gallium_la_LIBADD = \
        $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \