summaryrefslogtreecommitdiff
path: root/m4/xcb.m4
blob: a43082a8e0a1b0078a693bb52a67337e3f587cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2006-02-11
dnl
dnl XCB_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Check the visibility feature of gcc
dnl
AC_DEFUN([XCB_CHECK_VISIBILITY],
[
AC_MSG_CHECKING([whether ${CC} supports symbol visibility])

save_CFLAGS=${CFLAGS}
CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
AC_COMPILE_IFELSE(
   [AC_LANG_PROGRAM(
      [[
#pragma GCC visibility push(hidden)
extern void f(int);
#pragma GCC visibility pop
      ]],
      [[]]
    )],
   [AC_DEFINE(
       GCC_HAS_VISIBILITY,
       [],
       [Defined if GCC supports the visibility feature])
    m4_if([$1], [], [:], [$1])
    AC_MSG_RESULT(yes)],
   [m4_if([$2], [], [:], [$2])
    AC_MSG_RESULT(no)])

CFLAGS=${save_CFLAGS}
])

dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2006-02-11
dnl
dnl XCB_EXTENSION(name, default)
dnl set the X extension
dnl
AC_DEFUN([XCB_EXTENSION],
[dnl
pushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
dnl
m4_if([$2], [yes], [m4_define([xcb_defopt], [yes])],
      [$2], [no],  [m4_define([xcb_defopt], [no])],
      m4_define([xcb_defopt], [auto]))dnl

AC_ARG_ENABLE(DOWN,
    [AS_HELP_STRING([--enable-[]DOWN],
                    [Build XCB $1 Extension (default: ]xcb_defopt[)])],
    [BUILD_[]UP=$enableval],
    [BUILD_[]UP=xcb_defopt])
dnl
m4_if(xcb_defopt, [auto], [
# This extension has a default value of "auto" and depends on the value of $2
if test "x$BUILD_[]UP" = "xauto" ; then
    BUILD_[]UP=$2
fi
if test "x$BUILD_[]UP" = "xyes" ; then
    if test "x$2" = "xno" ; then
      AC_MSG_ERROR([Extension []UP requested, but dependencies are not met])
    fi
fi])

m4_undefine([xcb_defopt])dnl
AM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
])

dnl End of acinclude.m4