summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-11-20 11:23:56 -0800
committerKeith Packard <keithp@keithp.com>2013-11-20 14:14:58 -0800
commitd4938bf5e57375b70c73831402fc8637996aad31 (patch)
tree3d4618aaec24d54ddf104c99452571e82655590b
parente390e3aaee3dace2a1e6cfe66efd884fc256b0f0 (diff)
downloadxorg-lib-libxshmfence-d4938bf5e57375b70c73831402fc8637996aad31.tar.gz
Set symbol visibility attribute to hide internal symbols
Expose only the official API. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--configure.ac43
-rw-r--r--src/xshmfence.h16
-rw-r--r--xshmfence.pc.in2
3 files changed, 53 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index eab0836..c592fd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,49 @@ AC_SUBST([PTHREAD_LIBS])
AM_CONDITIONAL([FUTEX], [test x"$FUTEX" = xyes])
AM_CONDITIONAL([PTHREAD], [test x"$PTHREAD" = xyes])
+PKG_CHECK_MODULES(XPROTO, xproto)
+
+AC_SUBST([XPROTO_CFLAGS])
+
+CFLAGS="$CFLAGS $XPROTO_CFLAGS"
+
+AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
+ [SYMBOL_VISIBILITY=$enableval],
+ [SYMBOL_VISIBILITY=auto])
+
+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
+ if test x$SUNCC = xyes; then
+ VISIBILITY_CFLAGS="-xldscope=hidden"
+ else
+ have_visibility=no
+ fi
+ fi
+ if test x$have_visibility != xno; then
+ 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)
+ fi
+ AC_MSG_RESULT([$have_visibility])
+ if test x$have_visibility != xno; then
+ symbol_visibility=$VISIBILITY_CFLAGS
+ CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+ fi
+fi
+
AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], [Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto)]),
[],
[with_shared_memory_dir=yes])
diff --git a/src/xshmfence.h b/src/xshmfence.h
index bbdbb53..27d1b82 100644
--- a/src/xshmfence.h
+++ b/src/xshmfence.h
@@ -23,29 +23,31 @@
#ifndef _XSHMFENCE_H_
#define _XSHMFENCE_H_
+#include <X11/Xfuncproto.h>
+
#define HAVE_STRUCT_XSHMFENCE 1
struct xshmfence;
-int
+_X_EXPORT int
xshmfence_trigger(struct xshmfence *f);
-int
+_X_EXPORT int
xshmfence_await(struct xshmfence *f);
-int
+_X_EXPORT int
xshmfence_query(struct xshmfence *f);
-void
+_X_EXPORT void
xshmfence_reset(struct xshmfence *f);
-int
+_X_EXPORT int
xshmfence_alloc_shm(void);
-struct xshmfence *
+_X_EXPORT struct xshmfence *
xshmfence_map_shm(int fd);
-void
+_X_EXPORT void
xshmfence_unmap_shm(struct xshmfence *f);
#endif /* _XSHMFENCE_H_ */
diff --git a/xshmfence.pc.in b/xshmfence.pc.in
index 579af0b..a139fab 100644
--- a/xshmfence.pc.in
+++ b/xshmfence.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: xshmfence
Description: The X Shared Memory Fence Library
Version: @PACKAGE_VERSION@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @XPROTO_CFLAGS@
Libs: -L${libdir} -lxshmfence
Libs.private: @PTHREAD_LIBS@