xref: /freebsd/contrib/kyua/m4/doxygen.m4 (revision 3078531de10dcae44b253a35125c949ff4235284)
1dnl Copyright 2010 The Kyua Authors.
2dnl All rights reserved.
3dnl
4dnl Redistribution and use in source and binary forms, with or without
5dnl modification, are permitted provided that the following conditions are
6dnl met:
7dnl
8dnl * Redistributions of source code must retain the above copyright
9dnl   notice, this list of conditions and the following disclaimer.
10dnl * Redistributions in binary form must reproduce the above copyright
11dnl   notice, this list of conditions and the following disclaimer in the
12dnl   documentation and/or other materials provided with the distribution.
13dnl * Neither the name of Google Inc. nor the names of its contributors
14dnl   may be used to endorse or promote products derived from this software
15dnl   without specific prior written permission.
16dnl
17dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29dnl
30dnl KYUA_DOXYGEN
31dnl
32dnl Adds a --with-doxygen flag to the configure script and, when Doxygen support
33dnl is requested by the user, sets DOXYGEN to the path of the Doxygen binary and
34dnl enables the WITH_DOXYGEN Automake conditional.
35dnl
36AC_DEFUN([KYUA_DOXYGEN], [
37    AC_ARG_WITH([doxygen],
38                AS_HELP_STRING([--with-doxygen],
39                               [build documentation for internal APIs]),
40                [],
41                [with_doxygen=auto])
42
43    if test "${with_doxygen}" = yes; then
44        AC_PATH_PROG([DOXYGEN], [doxygen], [])
45        if test -z "${DOXYGEN}"; then
46            AC_MSG_ERROR([Doxygen explicitly requested but not found])
47        fi
48    elif test "${with_doxygen}" = auto; then
49        AC_PATH_PROG([DOXYGEN], [doxygen], [])
50    elif test "${with_doxygen}" = no; then
51        DOXYGEN=
52    else
53        AC_MSG_CHECKING([for doxygen])
54        DOXYGEN="${with_doxygen}"
55        AC_MSG_RESULT([${DOXYGEN}])
56        if test ! -x "${DOXYGEN}"; then
57            AC_MSG_ERROR([Doxygen binary ${DOXYGEN} is not executable])
58        fi
59    fi
60    AM_CONDITIONAL([WITH_DOXYGEN], [test -n "${DOXYGEN}"])
61    AC_SUBST([DOXYGEN])
62])
63