Fixed evaluation of the disable-build-docs argument.
[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     dnl
54     dnl Get the prefix where doxygen is installed.
55     dnl
56     AC_ARG_WITH(
57        [doxygen],
58        AC_HELP_STRING(
59           [--with-doxygen=FILE],
60           [doxygen program to use (eg /usr/bin/doxygen)]),
61        dnl
62        dnl Check the given doxygen program.
63        dnl
64        [DOXYGEN=${withval}
65         AC_CHECK_PROG(
66            [BUILD_DOCS],
67            [${DOXYGEN}],
68            [yes],
69            [no])
70         if test $BUILD_DOCS = no; then
71            echo "WARNING:"
72            echo "The doxygen program you specified:"
73            echo "$DOXYGEN"
74            echo "was not found.  Please check the path and make sure "
75            echo "the program exists and is executable."
76            AC_MSG_WARN(
77               [Warning: no doxygen detected. Documentation will not be built])
78         fi],
79        [AC_CHECK_PROG(
80            [BUILD_DOCS],
81            [${DOXYGEN}],
82            [yes],
83            [no])
84         if test ${BUILD_DOCS} = no; then
85            echo "WARNING:"
86            echo "The doxygen program was not found in your execute"
87            echo "You may have doxygen installed somewhere not covered by your path."
88            echo ""
89            echo "If this is the case make sure you have the packages installed, AND"
90            echo "that the doxygen program is in your execute path (see your"
91            echo "shell's manual page on setting the \$PATH environment variable), OR"
92            echo "alternatively, specify the program to use with --with-doxygen."
93            AC_MSG_WARN(
94               [Warning: no doxygen detected. Documentation will not be built])
95         fi])
96     AC_MSG_CHECKING([whether documentation is built])
97     AC_MSG_RESULT([${BUILD_DOCS}])
98     dnl
99     dnl Substitution
100     dnl
101     AC_SUBST([DOXYGEN])
102     AM_CONDITIONAL(BUILD_DOCS, test "x$BUILD_DOCS" = "xyes")
103    ])
104 dnl End of acinclude.m4