Merge branch 'master' of git+ssh://git.freedesktop.org/git/xcb/libxcb
[free-sw/xcb/libxcb] / acinclude.m4
1 dnl Detection and configuration of the visibility feature of gcc
2 dnl Vincent Torri 2006-02-11
3 dnl
4 dnl GCC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
5 dnl Check the visibility feature of gcc
6 dnl
7 AC_DEFUN([GCC_CHECK_VISIBILITY],
8    [AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
9     save_CFLAGS=${CFLAGS}
10     CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
11     AC_COMPILE_IFELSE(
12        [AC_LANG_PROGRAM(
13           [[
14 #pragma GCC visibility push(hidden)
15 extern void f(int);
16 #pragma GCC visibility pop
17           ]],
18           [[]]
19         )],
20        [AC_DEFINE(
21            GCC_HAS_VISIBILITY,
22            [],
23            [Defined if GCC supports the visibility feature])
24         m4_if([$1], [], [:], [$1])
25         AC_MSG_RESULT(yes)],
26        [m4_if([$2], [], [:], [$2])
27         AC_MSG_RESULT(no)])
28     CFLAGS=${save_CFLAGS}
29    ])
30 dnl Configure script for doxygen
31 dnl Vincent Torri 2006-05-11
32 dnl
33 dnl AM_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
34 dnl Test for the doxygen program, and define BUILD_DOCS and DOXYGEN.
35 dnl
36 AC_DEFUN([AM_CHECK_DOXYGEN],
37    [
38     DOXYGEN="doxygen"
39     dnl
40     dnl Disable the build of the documentation
41     dnl
42     AC_ARG_ENABLE(
43        [build_docs],
44        AC_HELP_STRING(
45           [--disable-build-docs],
46           [Disable the build of the documentation]),
47        [if test x"$enableval" != x"yes" ; then
48            enable_build_docs="no"
49         else
50            enable_build_docs="yes"
51         fi],
52        [enable_build_docs="yes"])
53
54     if test "$enable_build_docs" = "no" ; then
55         BUILD_DOCS=no
56     else
57     dnl
58     dnl Get the prefix where doxygen is installed.
59     dnl
60     AC_ARG_WITH(
61        [doxygen],
62        AC_HELP_STRING(
63           [--with-doxygen=FILE],
64           [doxygen program to use (eg /usr/bin/doxygen)]),
65        dnl
66        dnl Check the given doxygen program.
67        dnl
68        [DOXYGEN=${withval}
69         AC_CHECK_PROG(
70            [BUILD_DOCS],
71            [${DOXYGEN}],
72            [yes],
73            [no])
74         if test $BUILD_DOCS = no; then
75            echo "WARNING:"
76            echo "The doxygen program you specified:"
77            echo "$DOXYGEN"
78            echo "was not found.  Please check the path and make sure "
79            echo "the program exists and is executable."
80            AC_MSG_WARN(
81               [Warning: no doxygen detected. Documentation will not be built])
82         fi],
83        [AC_CHECK_PROG(
84            [BUILD_DOCS],
85            [${DOXYGEN}],
86            [yes],
87            [no])
88         if test ${BUILD_DOCS} = no; then
89            echo "WARNING:"
90            echo "The doxygen program was not found in your execute"
91            echo "You may have doxygen installed somewhere not covered by your path."
92            echo ""
93            echo "If this is the case make sure you have the packages installed, AND"
94            echo "that the doxygen program is in your execute path (see your"
95            echo "shell's manual page on setting the \$PATH environment variable), OR"
96            echo "alternatively, specify the program to use with --with-doxygen."
97            AC_MSG_WARN(
98               [Warning: no doxygen detected. Documentation will not be built])
99         fi])
100     fi
101     AC_MSG_CHECKING([whether documentation is built])
102     AC_MSG_RESULT([${BUILD_DOCS}])
103     dnl
104     dnl Substitution
105     dnl
106     AC_SUBST([DOXYGEN])
107     AM_CONDITIONAL(BUILD_DOCS, test "x$BUILD_DOCS" = "xyes")
108    ])
109 dnl End of acinclude.m4