2 # Copyright 2015-2016 Nest Labs Inc. All Rights Reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 # This file defines a GNU autoconf M4-style macro that adds an
20 # --disable-docs configuration option to the package and controls
21 # whether the package will be built with or without documentation.
25 # NL_ENABLE_DOCS(default, dot_default)
27 # default - Whether the option should be automatic (auto), enabled
28 # (yes), disabled (no) by default.
29 # dot_default - Whether Doxygen should use (YES) or not use (NO)
32 # Adds an --disable-docs configuration option to the package with a
33 # default value of 'default' (should be 'auto', 'no' or 'yes') and
34 # controls whether the package will be built with or without Doxygen-based
37 # The value 'nl_cv_build_docs' will be set to the result. In addition:
39 # DOXYGEN - Will be set to the path of the Doxygen executable.
40 # DOT - Will be set to the path of the GraphViz dot
42 # DOXYGEN_USE_DOT - Will be set to 'NO' or 'YES' depending on whether
43 # GraphViz dot is available.
45 #------------------------------------------------------------------------------
46 AC_DEFUN([NL_ENABLE_DOCS],
48 # Check whether or not the 'default' value is sane.
54 [m4_fatal([$0: invalid default value '$1'; must be 'auto', 'yes' or 'no'])])
56 # Check whether or not the 'dot_default' value is sane.
61 [m4_fatal([$0: invalid default value '$2'; must be 'YES' or 'NO'])])
65 AC_ARG_VAR(DOXYGEN, [Doxygen executable])
66 AC_ARG_VAR(DOT, [GraphViz 'dot' executable, which may be used, when present, to generate Doxygen class graphs])
68 AC_PATH_PROG(DOXYGEN, doxygen)
69 AC_PATH_PROG(DOT, dot)
71 AC_CACHE_CHECK([whether to build documentation],
75 [AS_HELP_STRING([--disable-docs],[Enable building documentation (requires Doxygen) @<:@default=$1@:>@.])],
77 case "${enableval}" in
80 nl_cv_build_docs=${enableval}
84 AC_MSG_ERROR([Invalid value ${enableval} for --disable-docs])
89 [nl_cv_build_docs=$1])
91 if test "x${DOXYGEN}" != "x"; then
92 nl_cv_have_doxygen=yes
97 if test "${nl_cv_build_docs}" = "auto"; then
98 if test "${nl_cv_have_doxygen}" = "no"; then
105 if test "${nl_cv_build_docs}" = "yes"; then
106 if test "${nl_cv_have_doxygen}" = "no"; then
107 AC_MSG_ERROR([Building docs was explicitly requested but Doxygen cannot be found])
108 elif test "${nl_cv_have_doxygen}" = "yes"; then
109 if test "x${DOT}" != "x"; then
116 AC_SUBST(DOXYGEN_USE_DOT)