generator: _c_accessor_get_length: remove buggy special case
[free-sw/xcb/libxcb] / m4 / xcb.m4
1 dnl Detection and configuration of the visibility feature of gcc
2 dnl Vincent Torri 2006-02-11
3 dnl
4 dnl XCB_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
5 dnl Check the visibility feature of gcc
6 dnl
7 AC_DEFUN([XCB_CHECK_VISIBILITY],
8 [
9 AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
10
11 save_CFLAGS=${CFLAGS}
12 CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
13 AC_COMPILE_IFELSE(
14    [AC_LANG_PROGRAM(
15       [[
16 #pragma GCC visibility push(hidden)
17 extern 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
31 CFLAGS=${save_CFLAGS}
32 ])
33
34 dnl Detection and configuration of the visibility feature of gcc
35 dnl Vincent Torri 2006-02-11
36 dnl
37 dnl XCB_EXTENSION(name, default)
38 dnl set the X extension
39 dnl
40 AC_DEFUN([XCB_EXTENSION],
41 [dnl
42 pushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
43 pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
44 dnl
45 m4_if([$2], [yes], [m4_define([xcb_defopt], [yes])],
46       [$2], [no],  [m4_define([xcb_defopt], [no])],
47       m4_define([xcb_defopt], [auto]))dnl
48
49 AC_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])
54 dnl
55 m4_if(xcb_defopt, [auto], [
56 # This extension has a default value of "auto" and depends on the value of $2
57 if test "x$BUILD_[]UP" = "xauto" ; then
58     BUILD_[]UP=$2
59 fi
60 if 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
64 fi])
65
66 m4_undefine([xcb_defopt])dnl
67 AM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
68 ])
69
70 dnl End of acinclude.m4