xcb.m4 revision 1016ad83
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 Configure script for doxygen
35dnl Vincent Torri 2006-05-11
36dnl
37dnl XCB_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
38dnl Test for the doxygen program, and define BUILD_DOCS and DOXYGEN.
39dnl
40AC_DEFUN([XCB_CHECK_DOXYGEN],
41[
42DOXYGEN="doxygen"
43
44dnl
45dnl Disable the build of the documentation
46dnl
47AC_ARG_ENABLE(
48   [build_docs],
49   AC_HELP_STRING(
50      [--disable-build-docs],
51      [Disable the build of the documentation]),
52   [if test x"$enableval" != x"yes" ; then
53       enable_build_docs="no"
54    else
55       enable_build_docs="yes"
56    fi],
57   [enable_build_docs="yes"])
58
59if test "$enable_build_docs" = "no" ; then
60    BUILD_DOCS=no
61else
62dnl
63dnl Get the prefix where doxygen is installed.
64dnl
65AC_ARG_WITH(
66   [doxygen],
67   AC_HELP_STRING(
68      [--with-doxygen=FILE],
69      [doxygen program to use (eg /usr/bin/doxygen)]),
70   dnl
71   dnl Check the given doxygen program.
72   dnl
73   [DOXYGEN=${withval}
74    AC_CHECK_PROG(
75       [BUILD_DOCS],
76       [${DOXYGEN}],
77       [yes],
78       [no])
79    if test $BUILD_DOCS = no; then
80       echo "WARNING:"
81       echo "The doxygen program you specified:"
82       echo "$DOXYGEN"
83       echo "was not found.  Please check the path and make sure "
84       echo "the program exists and is executable."
85       AC_MSG_WARN(
86          [Warning: no doxygen detected. Documentation will not be built])
87    fi],
88   [AC_CHECK_PROG(
89       [BUILD_DOCS],
90       [${DOXYGEN}],
91       [yes],
92       [no])
93    if test ${BUILD_DOCS} = no; then
94       echo "WARNING:"
95       echo "The doxygen program was not found in your execute"
96       echo "You may have doxygen installed somewhere not covered by your path."
97       echo ""
98       echo "If this is the case make sure you have the packages installed, AND"
99       echo "that the doxygen program is in your execute path (see your"
100       echo "shell manual page on setting the \$PATH environment variable), OR"
101       echo "alternatively, specify the program to use with --with-doxygen."
102       AC_MSG_WARN(
103          [Warning: no doxygen detected. Documentation will not be built])
104    fi])
105    AC_PATH_PROG(DOT, dot, no)
106    if test "$DOT" = "no"; then
107        AC_MSG_WARN([Warning: no dot detected. Documentation will not be built])
108	BUILD_DOCS="no"
109    fi
110fi
111AC_MSG_CHECKING([whether documentation is built])
112AC_MSG_RESULT([${BUILD_DOCS}])
113
114dnl
115dnl Substitution
116dnl
117AC_SUBST([DOXYGEN])
118
119AM_CONDITIONAL(BUILD_DOCS, test "x$BUILD_DOCS" = "xyes")
120
121])
122
123dnl Detection and configuration of the visibility feature of gcc
124dnl Vincent Torri 2006-02-11
125dnl
126dnl XCB_EXTENSION(name, default)
127dnl set the X extension
128dnl
129AC_DEFUN([XCB_EXTENSION],
130[
131pushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
132pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
133
134AC_ARG_ENABLE(DOWN,
135    [AS_HELP_STRING([--enable-[]DOWN], [Build XCB $1 Extension (default: $2)])],
136    [BUILD_[]UP=$enableval],
137    [BUILD_[]UP=$2])
138
139AM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
140])
141
142dnl End of acinclude.m4
143