1dnl Detection and configuration of the visibility feature of gcc
2dnl Vincent Torri 2006-02-11
3dnl
4dnl XCB_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
5dnl Check the visibility feature of gcc
6dnl
7AC_DEFUN([XCB_CHECK_VISIBILITY],
8[
9AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
10
11save_CFLAGS=${CFLAGS}
12CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
13AC_COMPILE_IFELSE(
14   [AC_LANG_PROGRAM(
15      [[
16#pragma GCC visibility push(hidden)
17extern void f(int);
18#pragma GCC visibility pop
19      ]],
20      [[]]
21    )],
22   [AC_DEFINE(
23       GCC_HAS_VISIBILITY,
24       [],
25       [Defined if GCC supports the visibility feature])
26    m4_if([$1], [], [:], [$1])
27    AC_MSG_RESULT(yes)],
28   [m4_if([$2], [], [:], [$2])
29    AC_MSG_RESULT(no)])
30
31CFLAGS=${save_CFLAGS}
32])
33
34dnl Detection and configuration of the visibility feature of gcc
35dnl Vincent Torri 2006-02-11
36dnl
37dnl XCB_EXTENSION(name, default)
38dnl set the X extension
39dnl
40AC_DEFUN([XCB_EXTENSION],
41[dnl
42pushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
43pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
44dnl
45m4_if([$2], [yes], [m4_define([xcb_defopt], [yes])],
46      [$2], [no],  [m4_define([xcb_defopt], [no])],
47      m4_define([xcb_defopt], [auto]))dnl
48
49AC_ARG_ENABLE(DOWN,
50    [AS_HELP_STRING([--enable-[]DOWN],
51                    [Build XCB $1 Extension (default: ]xcb_defopt[)])],
52    [BUILD_[]UP=$enableval],
53    [BUILD_[]UP=xcb_defopt])
54dnl
55m4_if(xcb_defopt, [auto], [
56# This extension has a default value of "auto" and depends on the value of $2
57if test "x$BUILD_[]UP" = "xauto" ; then
58    BUILD_[]UP=$2
59fi
60if test "x$BUILD_[]UP" = "xyes" ; then
61    if test "x$2" = "xno" ; then
62      AC_MSG_ERROR([Extension []UP requested, but dependencies are not met])
63    fi
64fi])
65
66m4_undefine([xcb_defopt])dnl
67AM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
68])
69
70dnl End of acinclude.m4
71