Fix build for darwin
authorJon TURNEY <jon.turney@dronecode.org.uk>
Sun, 11 May 2014 13:38:52 +0000 (14:38 +0100)
committerJon TURNEY <jon.turney@dronecode.org.uk>
Fri, 23 May 2014 14:24:01 +0000 (15:24 +0100)
Fix build for darwin, when ./configured --disable-driglx-direct

- darwin ld doesn't support -Bsymbolic or --version-script, so check if ld
supports those options before using them
- define GLX_ALIAS_UNSUPPORTED as config/darwin used to, as aliasing of non-weak
symbols isn't supported
- default to -with-dri-drivers=swrast

v2:
Use -Wl,-Bsymbolic, as before, not -Bsymbolic
Test that ld --version-script works, rather than just looking for it in ld --help
Don't use -Wl,--no-undefined on darwin, either

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
src/egl/main/Makefile.am
src/gallium/Automake.inc
src/gallium/targets/egl-static/Makefile.am
src/gallium/targets/gbm/Makefile.am
src/gallium/targets/opencl/Makefile.am
src/gallium/targets/pipe-loader/Makefile.am
src/glx/Makefile.am
src/mesa/drivers/dri/Makefile.am

index 76d13337f9eefa3ee38aaf280fa64e2fe75d57eb..675a4a67faa93ddeecb6ab6a6a09843c56cfb188 100644 (file)
@@ -315,6 +315,22 @@ if test "x$enable_debug" = xyes; then
     fi
 fi
 
+dnl
+dnl Check if linker supports -Bsymbolic
+dnl
+save_LDFLAGS=$LDFLAGS
+LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
+AC_MSG_CHECKING([if ld supports -Bsymbolic])
+AC_LINK_IFELSE(
+    [AC_LANG_SOURCE([int main() { return 0;}])],
+    [AC_MSG_RESULT([yes])
+        BSYMBOLIC="-Wl,-Bsymbolic";],
+    [AC_MSG_RESULT([no])
+        BSYMBOLIC="";])
+LDFLAGS=$save_LDFLAGS
+
+AC_SUBST([BSYMBOLIC])
+
 dnl
 dnl Check if linker supports garbage collection
 dnl
@@ -344,6 +360,28 @@ esac
 
 AC_SUBST([LD_NO_UNDEFINED])
 
+dnl
+dnl Check if linker supports version scripts
+dnl
+AC_MSG_CHECKING([if the linker supports version-scripts])
+save_LDFLAGS=$LDFLAGS
+LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+cat > conftest.map <<EOF
+VERSION_1 {
+     global:
+         main;
+
+     local:
+         *;
+};
+EOF
+AC_LINK_IFELSE(
+    [AC_LANG_SOURCE([int main() { return 0;}])],
+    [have_ld_version_script=yes;AC_MSG_RESULT(yes)],
+    [have_ld_version_script=no; AC_MSG_RESULT(no)])
+LDFLAGS=$save_LDFLAGS
+AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
+
 dnl
 dnl compatibility symlinks
 dnl
@@ -1043,6 +1081,12 @@ if test "x$enable_dri" = xyes; then
             with_dri_drivers="swrast"
         fi
         ;;
+    darwin*)
+        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DGLX_ALIAS_UNSUPPORTED"
+        if test "x$with_dri_drivers" = "xyes"; then
+            with_dri_drivers="swrast"
+        fi
+        ;;
     esac
 
     # default drivers
index 23207db8ae1aa7ab99019a2269dceaa1361c9106..38758a0abddaee77770609e38271dee460991499 100644 (file)
@@ -75,7 +75,7 @@ libEGL_la_LIBADD = \
 libEGL_la_LDFLAGS = \
        -no-undefined \
        -version-number 1:0 \
-       -Wl,-Bsymbolic \
+       $(BSYMBOLIC) \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index 4519c161c09f270d4c06202788288d3800a01ca9..70921ecd808dc0230dece438196a38f340865b73 100644 (file)
@@ -56,7 +56,9 @@ GALLIUM_DRI_LINKER_FLAGS = \
        -shrext .so \
        -module \
        -avoid-version \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym \
+endif
        $(GC_SECTIONS)
 
 GALLIUM_VDPAU_LINKER_FLAGS = \
@@ -64,7 +66,9 @@ GALLIUM_VDPAU_LINKER_FLAGS = \
        -module \
        -no-undefined \
        -version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
@@ -73,7 +77,9 @@ GALLIUM_XVMC_LINKER_FLAGS = \
        -module \
        -no-undefined \
        -version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
@@ -82,7 +88,9 @@ GALLIUM_OMX_LINKER_FLAGS = \
        -module \
        -no-undefined \
        -avoid-version \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index 7a2e5552205f422fd2319025659c7744429a63ee..bd18f9951617129b9b237b6b2978fddbf2e9dd1b 100644 (file)
@@ -48,7 +48,9 @@ AM_LDFLAGS = \
        -module \
        -no-undefined \
        -avoid-version \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/egl-static/egl.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index a8945a97f1ce24ee250e5fa777fc6112ebf4a5f2..bfc03073b3c6fa51af492fe9a9d7be2e7c57cef9 100644 (file)
@@ -67,7 +67,9 @@ gbm_gallium_drm_la_LDFLAGS = \
        -module \
        -no-undefined \
        -avoid-version \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/gbm/gbm.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index ba45aee81c1cbbb2c6526949cb3f4191a716268d..f8c591d62817b1fba242e8ddb71b1cabefb77cc1 100644 (file)
@@ -6,7 +6,9 @@ lib@OPENCL_LIBNAME@_la_LDFLAGS = \
        $(LLVM_LDFLAGS) \
        -no-undefined \
        -version-number 1:0 \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/opencl/opencl.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index 328069416d19cdeae1e4d4ed72ae4aba9308982d..93e497f9943f50eeca87ecc1bd94a7fc61e78417 100644 (file)
@@ -47,7 +47,9 @@ AM_LDFLAGS = \
        -module \
        -no-undefined \
        -avoid-version \
+if HAVE_LD_VERSION_SCRIPT
        -Wl,--version-script=$(top_srcdir)/src/gallium/targets/pipe-loader/pipe.sym \
+endif
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index 482d952302dee2368d9eabc295a599b2970125dd..0cf65e50732cf01369bf32ee4b569d2d93db4b8e 100644 (file)
@@ -111,7 +111,7 @@ GL_LIBS = \
 GL_LDFLAGS = \
        -no-undefined \
        -version-number 1:2 \
-       -Wl,-Bsymbolic \
+       $(BSYMBOLIC) \
        $(GC_SECTIONS) \
        $(LD_NO_UNDEFINED)
 
index e8076120d949b1de174d9308d048b5d9335939a3..70039f9ad82d262190993b96a4fe335717b7f47e 100644 (file)
@@ -52,7 +52,7 @@ nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
 mesa_dri_drivers_la_SOURCES =
 mesa_dri_drivers_la_LDFLAGS = \
         -module -avoid-version -shared -shrext .so \
-        -Wl,-Bsymbolic \
+        $(BSYMBOLIC) \
         $(GC_SECTIONS) \
         $()
 mesa_dri_drivers_la_LIBADD = \