Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlfaultinjection / repo / third_party / nlbuild-autotools / repo / autoconf / m4 / nl_enable_docs.m4
1 #
2 #    Copyright 2015-2016 Nest Labs Inc. All Rights Reserved.
3 #
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
7 #
8 #    http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15 #
16
17 #
18 #    Description:
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.
22 #
23
24 #
25 # NL_ENABLE_DOCS(default, dot_default)
26 #
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)
30 #                 GraphViz dot.
31 #
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
35 # documentation.
36 #
37 # The value 'nl_cv_build_docs' will be set to the result. In addition:
38 #
39 #   DOXYGEN         - Will be set to the path of the Doxygen executable.
40 #   DOT             - Will be set to the path of the GraphViz dot
41 #                     executable.
42 #   DOXYGEN_USE_DOT - Will be set to 'NO' or 'YES' depending on whether
43 #                     GraphViz dot is available.
44 #
45 #------------------------------------------------------------------------------
46 AC_DEFUN([NL_ENABLE_DOCS],
47 [
48     # Check whether or not the 'default' value is sane.
49
50     m4_case([$1],
51         [auto],[],
52         [yes],[],
53         [no],[],
54         [m4_fatal([$0: invalid default value '$1'; must be 'auto', 'yes' or 'no'])])
55
56     # Check whether or not the 'dot_default' value is sane.
57
58     m4_case([$2],
59         [YES],[],
60         [NO],[],
61         [m4_fatal([$0: invalid default value '$2'; must be 'YES' or 'NO'])])
62
63     DOXYGEN_USE_DOT=$2
64
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])
67
68     AC_PATH_PROG(DOXYGEN, doxygen)
69     AC_PATH_PROG(DOT, dot)
70
71     AC_CACHE_CHECK([whether to build documentation],
72         nl_cv_build_docs,
73         [
74             AC_ARG_ENABLE(docs,
75                 [AS_HELP_STRING([--disable-docs],[Enable building documentation (requires Doxygen) @<:@default=$1@:>@.])],
76                 [
77                     case "${enableval}" in 
78
79                     auto|no|yes)
80                         nl_cv_build_docs=${enableval}
81                         ;;
82
83                     *)
84                         AC_MSG_ERROR([Invalid value ${enableval} for --disable-docs])
85                         ;;
86
87                     esac
88                 ],
89                 [nl_cv_build_docs=$1])
90
91             if test "x${DOXYGEN}" != "x"; then
92                 nl_cv_have_doxygen=yes
93             else
94                 nl_cv_have_doxygen=no
95             fi
96
97             if test "${nl_cv_build_docs}" = "auto"; then
98                 if test "${nl_cv_have_doxygen}" = "no"; then
99                     nl_cv_build_docs=no
100                 else
101                     nl_cv_build_docs=yes
102                 fi
103             fi
104
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
110                         DOXYGEN_USE_DOT=YES
111                     fi
112                 fi
113             fi
114     ])
115
116     AC_SUBST(DOXYGEN_USE_DOT)
117 ])