[Mesa-dev] [PATCH 1/3] Fix build for darwin
Jon TURNEY
jon.turney at dronecode.org.uk
Tue May 13 05:15:30 PDT 2014
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
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
configure.ac | 36 ++++++++++++++++++++++++++++++++++++
src/egl/main/Makefile.am | 2 +-
src/gallium/Automake.inc | 8 ++++++++
src/glx/Makefile.am | 2 +-
src/mesa/drivers/dri/Makefile.am | 2 +-
5 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 99a761a..f571af1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -316,6 +316,22 @@ if test "x$enable_debug" = xyes; then
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="-Bsymbolic";],
+ [AC_MSG_RESULT([no])
+ BSYMBOLIC="";])
+LDFLAGS=$save_LDFLAGS
+
+AC_SUBST([BSYMBOLIC])
+
+dnl
dnl Check if linker supports garbage collection
dnl
save_LDFLAGS=$LDFLAGS
@@ -332,6 +348,20 @@ LDFLAGS=$save_LDFLAGS
AC_SUBST([GC_SECTIONS])
dnl
+dnl Check if linker supports version scripts
+dnl
+AC_MSG_CHECKING([if libraries can be versioned])
+GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
+if test "$GLD"; then
+ have_ld_version_script=yes
+ AC_MSG_RESULT(yes)
+else
+ have_ld_version_script=no
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
+
+dnl
dnl compatibility symlinks
dnl
case "$host_os" in
@@ -1030,6 +1060,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
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 2858913..8b73c8b 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -75,7 +75,7 @@ libEGL_la_LIBADD = \
libEGL_la_LDFLAGS = \
-no-undefined \
-version-number 1:0 \
- -Wl,-Bsymbolic \
+ $(BSYMBOLIC) \
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 4519c16..70921ec 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -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)
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 482d952..0cf65e5 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -111,7 +111,7 @@ GL_LIBS = \
GL_LDFLAGS = \
-no-undefined \
-version-number 1:2 \
- -Wl,-Bsymbolic \
+ $(BSYMBOLIC) \
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index e807612..70039f9 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -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 = \
--
1.8.5.5
More information about the mesa-dev
mailing list