Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlassert / repo / third_party / nlbuild-autotools / repo / autoconf / m4 / nl_enable_tests.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 #      --enable-tests configuration option to the package and controls
21 #      whether the package will be built with or without unit and
22 #      integration tests.
23 #
24
25 #
26 # NL_ENABLE_TESTS(default)
27 #
28 #   default - Whether the option should be enabled (yes) or disabled (no)
29 #             by default.
30 #
31 # Adds an --enable-tests configuration option to the package with a
32 # default value of 'default' (should be either 'no' or 'yes') and
33 # controls whether the package will be built with or without unit and
34 # integration tests.
35 #
36 # The value 'nl_cv_build_tests' will be set to the result.
37 #
38 #------------------------------------------------------------------------------
39
40 AC_DEFUN([NL_ENABLE_TESTS],
41 [
42     # Check whether or not a default value has been passed in.
43
44     m4_case([$1],
45         [yes],[],
46         [no],[],
47         [m4_fatal([$0: invalid default value '$1'; must be 'yes' or 'no'])])
48
49     AC_CACHE_CHECK([whether to build tests],
50         nl_cv_build_tests,
51         [
52             AC_ARG_ENABLE(tests,
53                 [AS_HELP_STRING([--enable-tests],[Enable building of tests @<:@default=$1@:>@.])],
54                 [
55                     case "${enableval}" in 
56
57                     no|yes)
58                         nl_cv_build_tests=${enableval}
59                         ;;
60
61                     *)
62                         AC_MSG_ERROR([Invalid value ${enableval} for --enable-tests])
63                         ;;
64
65                     esac
66                 ],
67                 [
68                     nl_cv_build_tests=$1
69                 ])
70     ])
71 ])