Sttaically link gallium modules with libstdc++/libgcc/libgcc_eh if --enable-static-libstdc++ is passed to ./configure:
--- configure.ac | 38 +++++++++++++++++++++++++++++++++++++ src/gallium/Automake.inc | 1 + src/gallium/targets/dri/Makefile.am | 1 + 3 files changed, 40 insertions(+) diff --git a/configure.ac b/configure.ac index 90c7737..f10ed66 100644 --- a/configure.ac +++ b/configure.ac @@ -705,6 +705,43 @@ AC_ARG_ENABLE([dri], [enable_dri="$enableval"], [enable_dri=yes]) +AC_ARG_ENABLE([static-libstdc++], + [AS_HELP_STRING([--enable-static-libstdc++], + [Statically link libstdc++/libgcc @<:@default=disabled@:>@])], + [enable_static_libstdc__="$enableval"], + [enable_static_libstdc__=no]) + +dnl Strip out unnecessary dynamic linking in of libstdc++ and libgcc_s for +dnl DRI modules: they cause problems when loaded by games linked against +dnl a steam runtime with a different libgcc or libstdc++ version: +if test x$enable_static_libstdc__ != xno; +then + if test x$enable_dri != xno; + then +AC_MSG_NOTICE([Cleanup libtool C++ postdeps: $postdeps_CXX (enable_dri=$enable_dri)]) + tmppdcxx=; + for x in ${postdeps_CXX}; + do + case $x in + -lstdc++) true; ;; + -lgcc_s) true; ;; + *) tmppdcxx=${tmppdcxx}${tmppdcxx:+ }$x; ;; + esac; + done; + postdeps_CXX="${tmppdcxx}"; +AC_MSG_NOTICE([Cleaned libtool C++ postdeps: $postdeps_CXX]) + fi; + STATIC_STDCPP_LIBS="-l:libgcc.a -l:libgcc_eh.a -l:libstdc++.a"; + STATIC_STDCPP_LDFLAGS="-static-libgcc -static-libstdc++ \ + -l:libgcc.a -l:libstdc++.a \ + -Wl,--exclude-libs -Wl,libgcc.a:libstdc++.a"; +else + STATIC_STDCPP_LIBS=""; + STATIC_STDCPP_LDFLAGS=""; +fi +AC_SUBST([STATIC_STDCPP_LDFLAGS]) +AC_SUBST([STATIC_STDCPP_LIBS]) + case "$host_os" in linux*) dri3_default=yes @@ -2450,6 +2487,7 @@ echo " prefix: $prefix" echo " exec_prefix: $exec_prefix" echo " libdir: $libdir" echo " includedir: $includedir" +echo " postdeps_CXX: $postdeps_CXX" dnl API info echo "" diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc index 95aae50..3e13cc7 100644 --- a/src/gallium/Automake.inc +++ b/src/gallium/Automake.inc @@ -46,6 +46,7 @@ GALLIUM_TARGET_CFLAGS = \ GALLIUM_COMMON_LIB_DEPS = \ -lm \ + $(STATIC_STDCPP_LIBS) \ $(CLOCK_LIB) \ $(PTHREAD_LIBS) \ $(DLOPEN_LIBS) diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index aaeb950..6bc5458 100644 --- a/src/gallium/targets/dri/Makefile.am +++ b/src/gallium/targets/dri/Makefile.am @@ -27,6 +27,7 @@ gallium_dri_la_LDFLAGS = \ -shrext .so \ -module \ -avoid-version \ + $(STATIC_STDCPP_LDFLAGS) \ $(GC_SECTIONS) if HAVE_LD_VERSION_SCRIPT -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev