Hi, Attached is a possible patch to enable compiling the XServer and modules with hidden symbols by default. Please comment :-)
The patch allows using the "--disable-visibility" option, and variants to disable compilation with hidden symbols (or one could go wild and change the xorg-server.pc :-) This patch probably is better then the one I had posted in the bugzilla some time ago, as this one doesn't require changes to modules, neither editing Makefile.am by Makefile.am to choose if want hidden or public symbols; if the X Server works with hidden symbols, so should the modules. I am also attaching a slightly modified version of the original script I used to search for undefined symbols. To test it, run % xorg-symbols.pl | less to use the default prefix of /usr and module path of /usr/lib/xorg/modules, or run it with the arguments -? or -h for the available options. Right now, I am running today's git master, compiling the XServer with the attached patch, and the recent patches I added. I am also using the vesa driver now; other modules requires more patches, not yet added to avoid too much changes at a time... Thanks, Paulo
diff --git a/configure.ac b/configure.ac
index ea3d0fa..9beeca1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -504,6 +504,9 @@ AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only
AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
[NULL_ROOT_CURSOR=$enableval],
[NULL_ROOT_CURSOR=no])
+AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
+ [SYMBOL_VISIBILITY=$enableval],
+ [SYMBOL_VISIBILITY=auto])
dnl GLX build options
AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
@@ -1229,6 +1232,46 @@ if test "x$XORG" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $SELINUX_LIB"
+ dnl ==================================================================
+ dnl symbol visibility
+ symbol_visibility=
+ have_visibility=disabled
+ if test x$SYMBOL_VISIBILITY != xno; then
+ AC_MSG_CHECKING(for symbol visibility support)
+ if test x$GCC = xyes; then
+ VISIBILITY_CFLAGS="-fvisibility=hidden"
+ else
+ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+ if test x$SUNCC = xyes; then
+ VISIBILITY_CFLAGS="-xldscope=hidden"
+ else
+ have_visibility=no
+ fi
+ fi
+ if test x$have_visibility != xno; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+ AC_TRY_COMPILE(
+ [#include <X11/Xfuncproto.h>
+ extern _X_HIDDEN int hidden_int;
+ extern _X_EXPORT int public_int;
+ extern _X_HIDDEN int hidden_int_func(void);
+ extern _X_EXPORT int public_int_func(void);],
+ [],
+ have_visibility=yes,
+ have_visibility=no)
+ CFLAGS=$save_CFLAGS
+ fi
+ AC_MSG_RESULT([$have_visibility])
+ if test x$have_visibility != xno; then
+ symbol_visibility=$VISIBILITY_CFLAGS
+ XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
+ fi
+ fi
+ dnl added to xorg-server.pc
+ AC_SUBST([symbol_visibility])
+ dnl ===================================================================
+
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
diff --git a/xorg-server.pc.in b/xorg-server.pc.in
index 139adf4..7547aa3 100644
--- a/xorg-server.pc.in
+++ b/xorg-server.pc.in
@@ -15,5 +15,5 @@ Name: xorg-server
Description: Modular X.Org X Server
Version: @PACKAGE_VERSION@
Requires: pixman-1 pciaccess
-Cflags: -I${sdkdir}
+Cflags: -I${sdkdir} @symbol_visibility@
Libs: -L${libdir}
xorg-symbols.pl
Description: Perl program
_______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
