blob: ce9221a016bac6582f33f8e8362ea630d9bc19bb [file] [log] [blame]
Martin Turonba1a0282020-03-10 19:25:02 -07001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4#
Grant Erickson8e583362020-03-31 10:40:56 -07005# Copyright (c) 2020 Project CHIP Authors
Rob Walkere812e672020-03-31 17:51:57 -07006# Copyright (c) 2018-2019 Google LLC
7# Copyright (c) 2014-2018 Nest Labs, Inc.
Martin Turonba1a0282020-03-10 19:25:02 -07008#
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20#
21
22#
23# Description:
24# This file is the GNU autoconf input source file for the
25# Connected Home over IP package.
26#
27
28#
29# Declare autoconf version requirements
30#
31AC_PREREQ([2.68])
32
33#
34# Initialize autoconf for the package
35#
36AC_INIT([Chip],
37 m4_esyscmd([third_party/nlbuild-autotools/repo/scripts/mkversion -b `cat .default-version` .]),
38 [chip.support@zigbee.com],
39 [chip],
40 [https://zigbee.com/])
41
42# Tell the rest of the build system the absolute path where the
43# nlbuild-autotools repository is rooted at.
44
45AC_SUBST(nlbuild_autotools_stem,[third_party/nlbuild-autotools/repo])
46AC_SUBST(abs_top_nlbuild_autotools_dir,[\${abs_top_srcdir}/\${nlbuild_autotools_stem}])
47
48#
49# CHIP interface current, revision, and age versions.
50#
51# NOTE: At present, the CHIP SDK makes NO ABI compatibility
52# commitments. Consequently, these simply serve as documentation
53# for how the interfaces have evolved.
54#
55# Maintainters: Please manage these fields as follows:
56#
57# Interfaces removed: CURRENT++, AGE = 0, REVISION = 0
58# Interfaces added: CURRENT++, AGE++, REVISION = 0
59# No interfaces changed: REVISION++
60#
61#
62AC_SUBST(LIBCHIP_VERSION_CURRENT, [1])
63AC_SUBST(LIBCHIP_VERSION_AGE, [0])
64AC_SUBST(LIBCHIP_VERSION_REVISION, [0])
65AC_SUBST(LIBCHIP_VERSION_INFO, [${LIBCHIP_VERSION_CURRENT}:${LIBCHIP_VERSION_REVISION}:${LIBCHIP_VERSION_AGE}])
66
67#
68# Check the sanity of the source directory by checking for the
69# presence of a key watch file
70#
71AC_CONFIG_SRCDIR([src/lib/core/CHIPConfig.h])
72
73#
74# Tell autoconf where to find auxilliary build tools (e.g. config.guess,
75# install-sh, missing, etc.)
76#
77AC_CONFIG_AUX_DIR([build/autoconf])
78
79#
80# Tell autoconf where to find auxilliary M4 macros
81# Note that nlbuild-autotools has macros in two subdirs, for local vs third-party scripts
82#
Rob Walkeraeec6c52020-04-20 10:05:18 -070083AC_CONFIG_MACRO_DIRS([build/autoconf/m4 autoconf/m4 third_party/nlbuild-autotools/repo/third_party/autoconf/m4 third_party/nlbuild-autotools/repo/autoconf/m4])
Martin Turonba1a0282020-03-10 19:25:02 -070084
85#
86# Tell autoconf what file the package is using to aggregate C preprocessor
87# defines.
88#
89AC_CONFIG_HEADERS([src/include/BuildConfig.h])
90
91#
92# Guards against multiple inclusion of the BuildConfig.h
93#
94
95AH_TOP([#ifndef CHIP_BUILD_CONFIG_H
96#define CHIP_BUILD_CONFIG_H])
97
98AH_BOTTOM([#endif // CHIP_BUILD_CONFIG_H])
99
100#
101# Figure out what the canonical build, host and target tuples are.
102#
103AC_CANONICAL_BUILD
104AC_CANONICAL_HOST
105AC_CANONICAL_TARGET
106
107#
108# Mac OS X / Darwin ends up putting some versioning cruft on the end of its
109# tuple that we don't care about in this script. Create "clean" variables
110# devoid of it.
111#
112
113NL_FILTERED_CANONICAL_BUILD
114NL_FILTERED_CANONICAL_HOST
115NL_FILTERED_CANONICAL_TARGET
116
117#
118# Configure automake with the desired options, indicating that this is not
119# a native GNU package, that we want "silent" build rules, and that we want
120# objects built in the same subdirectory as their source rather than collapsed
121# together at the top-level directory.
122#
123# Disable silent build rules by either passing --disable-silent-rules to
124# configure or passing V=1 to make
125#
126AM_INIT_AUTOMAKE([1.14 foreign silent-rules subdir-objects tar-pax no-define])
127
128#
129# Silent build rules requires at least automake-1.11. Employ
130# techniques for not breaking earlier versions of automake.
131#
132m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
133AM_SILENT_RULES([yes])
134
135#
Zang MingJiee9196fd2020-06-20 00:37:35 +0800136# Disable maintainer mode to enable the package to automatically rebuild
137# configure, Makefile.in, etc. when the files on which they depend change (for
138# example, configure.ac, Makefile.am, etc).
Martin Turonba1a0282020-03-10 19:25:02 -0700139#
Zang MingJiee9196fd2020-06-20 00:37:35 +0800140# For those that do not desire this behavior, run configure with
141# `--enable-maintainer-mode` and run the top-level `bootstrap` script manually.
Martin Turonba1a0282020-03-10 19:25:02 -0700142#
Zang MingJiee9196fd2020-06-20 00:37:35 +0800143AM_MAINTAINER_MODE([disable])
Martin Turonba1a0282020-03-10 19:25:02 -0700144
145#
146# Check for the target style
147#
148CHIP_TARGET_STYLE=
149CHIP_TARGET_STYLE_UNIX=0
150CHIP_TARGET_STYLE_EMBEDDED=0
151
152AC_MSG_CHECKING([for target style])
153
154# The user may have attempted to explicitly specify the target
155# style. Sanity check it or default to 'auto'.
156
157AC_ARG_WITH(target-style,
158 [AS_HELP_STRING([--with-target-style=TARGET],
159 [Specify the target style from one of: auto, embedded or unix @<:@default=auto@:>@.])],
160 [
161 case "${with_target_style}" in
162
163 auto|embedded|unix)
164 ;;
165
166 *)
167 AC_MSG_ERROR([Invalid value ${with_target_style} for --with-target-style])
168 ;;
169
170 esac
171 ],
172 [with_target_style=auto])
173
174# At this point, the target style is one of the allowed
175# values. If it's 'auto' we autodetect it.
176
177if test "${with_target_style}" = "auto"; then
178 case ${target_os} in
179
180 *cygwin*|*darwin*|*linux*|*freebsd*|*netbsd*|*openbsd*)
181 with_target_style=unix
182 ;;
183
184 *freertos*)
185 with_target_style=embedded
186 ;;
187
188 *)
189 AC_MSG_RESULT([unknown])
190 AC_MSG_ERROR([Unsupported target OS ${target_os}])
191 ;;
192
193 esac
194fi
195
196CHIP_TARGET_STYLE=${with_target_style}
197
198case ${with_target_style} in
199
200 embedded)
201 CHIP_TARGET_STYLE_EMBEDDED=1
202 ;;
203
204 unix)
205 CHIP_TARGET_STYLE_UNIX=1
206 ;;
207
208esac
209
210AC_MSG_RESULT(${CHIP_TARGET_STYLE})
211
212AC_SUBST(CHIP_TARGET_STYLE)
213AC_DEFINE_UNQUOTED([CHIP_TARGET_STYLE],[${CHIP_TARGET_STYLE}],[CHIP target style])
214
215AC_SUBST(CHIP_TARGET_STYLE_EMBEDDED)
216AM_CONDITIONAL([CHIP_TARGET_STYLE_EMBEDDED], [test "${CHIP_TARGET_STYLE}" = "embedded"])
217AC_DEFINE_UNQUOTED([CHIP_TARGET_STYLE_EMBEDDED],[${CHIP_TARGET_STYLE_EMBEDDED}],[Define to 1 if you want to use CHIP with an embedded (i.e. non-Unix-based) system])
218
219AC_SUBST(CHIP_TARGET_STYLE_UNIX)
220AM_CONDITIONAL([CHIP_TARGET_STYLE_UNIX], [test "${CHIP_TARGET_STYLE}" = "unix"])
221AC_DEFINE_UNQUOTED([CHIP_TARGET_STYLE_UNIX],[${CHIP_TARGET_STYLE_UNIX}],[Define to 1 if you want to use CHIP with a Unix-based system])
222
223#
224# Checks for build host programs
225#
226
227# If we are cross-compiling and we are on an embedded target that
228# doesn't support independent, standalone executables, then all
229# compiler tests that attempt to create an executable will fail. In
230# such circumstances, set AC_NO_EXECUTABLES (see http://sourceware.org/
231# ml/newlib/2006/msg00353.html).
232
233AC_MSG_CHECKING([whether to disable executable checking])
234if test "$cross_compiling" = yes -a "${CHIP_TARGET_STYLE}" = "embedded"; then
235# AC_NO_EXECUTABLES
236 AC_MSG_RESULT([yes])
237else
238 AC_MSG_RESULT([no])
239fi
240
241# Passing -Werror to GCC-based or -compatible compilers breaks some
242# autoconf tests (see
243# http://lists.gnu.org/archive/html/autoconf-patches/2008-09/msg00014.html).
244#
245# If -Werror has been passed transform it into -Wno-error. We'll
246# transform it back later with NL_RESTORE_WERROR.
247
248NL_SAVE_WERROR
249
250# Check for compilers.
251#
252# These should be checked BEFORE we check for and, implicitly,
253# initialize libtool such that libtool knows what languages it has to
254# work with.
255
256AC_PROG_CPP
257AC_PROG_CPP_WERROR
258
259AC_PROG_CC
260AC_PROG_CC_C_O
261
262AC_PROG_CXXCPP
263
264AC_PROG_CXX
265AC_PROG_CXX_C_O
266
267AC_PROG_OBJC
268AC_PROG_OBJCXX
269
270# Check for other compiler toolchain tools.
271
272AC_CHECK_TOOL(AR, ar)
273AC_CHECK_TOOL(RANLIB, ranlib)
274AC_CHECK_TOOL(OBJCOPY, objcopy)
275AC_CHECK_TOOL(STRIP, strip)
276
277# Check for other host tools.
278
279AC_PROG_INSTALL
280AC_PROG_LN_S
281
282AC_PATH_PROG(CLANG_FORMAT, clang-format)
283AC_PATH_PROG(CMP, cmp)
284AC_PATH_PROG(PERL, perl)
285AC_PATH_PROG(VALGRIND, valgrind)
286
287#
288# Python
289#
290# At minimum, a Python interpreter is absolutely required to
291# auto-generate a number of header files (e.g., ASN1OID.h).
292# Additionally, Python support is used for one binding of the
293# Device Manager as well as to run and orchestrate several
294# unit and functional tests.
295#
296
297# In a normal "build-and-install on 'this' machine" context,
298# placing Python packages in the normal pythondir and pyexecdir
299# (typically
300# lib/pythonPYTHON_VERSION/{dist,site}-packages/PACKAGE) makes
301# sense.
302#
303# However, in our case, we're building and 'installing' for
304# standalone distrubution to any number of machines for which we
305# don't know the Python version. In those cases, override
306# pythondir and pyexec dir.
307
308case "${prefix}" in
309
310 /opt|/usr|/usr/local|NONE)
311 ;;
312
313 *)
314 am_cv_python_pythondir="\${prefix}/lib/python"
315 am_cv_python_pyexecdir="\${exec_prefix}/lib/python"
316 ;;
317
318esac
319
320# Check for Python
321
322AM_PATH_PYTHON
323
324# If a Python interpreter of any color cannot be found, error out.
325
326if test "${PYTHON}" = ""; then
327 AC_MSG_ERROR([could not find python: python is required to build this package.])
328fi
329
330# Check for specific Python packages
331
332AC_MSG_CHECKING([for Python setuptools package])
333if ${PYTHON} -c 'import setuptools' >/dev/null 2>&1; then
334 have_python_package_setuptools=yes
335else
336 have_python_package_setuptools=no
337fi
338AC_MSG_RESULT(${have_python_package_setuptools})
339
340AC_MSG_CHECKING([for Python wheel package])
341if ${PYTHON} -c 'import wheel' >/dev/null 2>&1; then
342 have_python_package_wheel=yes
343else
344 have_python_package_wheel=no
345fi
346AC_MSG_RESULT(${have_python_package_wheel})
347
348
349#
350# Checks for specific compiler characteristics
351#
352
353#
354# Common compiler flags we would like to have.
355#
356# -Wall -Wshadow -Wframe-larger-than=9472 -Wtype-limits CC, CXX, OBJC, OBJCXX [unix, embedded]
357# -fPIC CC, CXX, OBJC, OBJCXX [unix]
358# -fno-stack-protector CC, CXX, OBJC, OBJCXX [unix]
359# -fno-exceptions CXX, OBJCXX [unix]
360# -fobjc-call-cxx-cdtors OBJC, OBJCXX [cocoa]
361# -fobjc-arc OBJC, OBJCXX [cocoa]
362#
363#
364
365PROSPECTIVE_CFLAGS="-Wall -Wshadow -Wframe-larger-than=9472 -Wtype-limits"
366PROSPECTIVE_CXXFLAGS=""
367PROSPECTIVE_OBJCFLAGS="-fobjc-call-cxx-cdtors -fobjc-arc"
368PROSPECTIVE_OBJCXXFLAGS=""
369
370# Suppress clang-specific warnings about -Wnonportable-include-path.
371#
372# -Wnonportable-include-path warns about include paths that can be
373# problematic. This creates false positives for CHIP when compiling
374# the CHIP Addressing and Routing Module (CHIPARM) in which source
375# directories (e.g. src/warm/...) and public include directories
376# (e.g. src/include/Warm/...) have identical, and consequently
377# ambiguous, naming on case-insensitive file systems.
378
379case "`basename ${CC}`" in
380
381 *clang)
382 AX_CHECK_COMPILER_OPTIONS([C], -Wno-nonportable-include-path)
383 ;;
384
385esac
386
387case "`basename ${CXX}`" in
388
389 *clang++)
390 AX_CHECK_COMPILER_OPTIONS([C++], -Wno-nonportable-include-path)
391 ;;
392
393esac
394
395# For the flags that are desired for the "unix" target style, add
396# those to the set to be checked. For the "embedded" target style, the
397# CHIP system integrator knows best as to what compiler flags should
398# be added and will have passed them in.
399
400if test "${CHIP_TARGET_STYLE}" = "unix"; then
401 PROSPECTIVE_CFLAGS="${PROSPECTIVE_CFLAGS} -fPIC -fno-stack-protector"
402 PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -fno-exceptions"
403fi
404
405# CHIP intentionally uses derived classes that do not use an explicit
406# destructor and a virtual one at that. Consequently, do not emit
407# compiler warnings or errors about it when deletion is performed on
408# such objects.
409
410PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -Wno-delete-non-virtual-dtor"
411
412# Check whether the C++ compiler supports C++11 with GNU
413# extensions. If it is supported, enable it. Otherwise, proceed
414# without error or warning. While the CHIP code itself does not rely
415# on the GNU extensions, Android build targets crash when the standard
416# is set to strict C++11
417
418AX_CXX_COMPILE_STDCXX_11(noext, optional)
419
420AM_CONDITIONAL([HAVE_CXX11], [test "x${HAVE_CXX11}" == "x1"])
421
422if test "x${HAVE_CXX11}" == "x1"; then
423PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -std=gnu++11"
424fi
425
426AX_CHECK_COMPILER_OPTIONS([C], ${PROSPECTIVE_CFLAGS})
427AX_CHECK_COMPILER_OPTIONS([C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS})
428
429# Check for and initialize libtool
430
431LT_INIT
432
433#
434# Android support
435#
436with_android=no
437
438AC_MSG_CHECKING([for an Android target])
439
440 case "${target}" in
441
442 *android*)
443 with_android=yes
444 ;;
445
446 *)
447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
448 #if !defined(__ANDROID__) || !__ANDROID__
449 #error "We are not compiling with Android."
450 #endif
451 ]])],
452 [with_android=yes],
453 [with_android=no])
454 ;;
455
456 esac
457
458AC_MSG_RESULT(${with_android})
459
460AM_CONDITIONAL([CHIP_WITH_ANDROID], [test "${with_android}" = "yes"])
461
462AC_SUBST(CROSS_SYSROOT, [$lt_sysroot])
463#
464# CHIP package-specific build customization options
465#
466
467#
468# Check for logging style
469#
470
471CHIP_LOGGING_STYLE=
472CHIP_LOGGING_STYLE_ANDROID=0
473CHIP_LOGGING_STYLE_EXTERNAL=0
474CHIP_LOGGING_STYLE_STDIO=0
475CHIP_LOGGING_STYLE_STDIO_WEAK=0
476
477AC_MSG_CHECKING([for logging style])
478
479AC_ARG_WITH(logging-style,
480 [AS_HELP_STRING([--with-logging-style=STYLE],
481 [Specify the logging style from one of: auto, android, stdio, stdio-weak, or external @<:@default=auto@:>@.])],
482 [
483 case "${with_logging_style}" in
484
485 android|auto|external|stdio|stdio-weak)
486 ;;
487
488 *)
489 AC_MSG_ERROR([Invalid value ${with_logging_style} for --with-logging-style])
490 ;;
491
492 esac
493 ],
494 [with_logging_style=auto])
495
496# At this point, the logging style is one of the allowed values. If
497# it's 'auto' we autodetect it. Otherwise, sanity check the specified
498# value.
499
500if test "${with_logging_style}" = "auto"; then
501
502 if test "${with_android}" = "yes"; then
503 with_logging_style=android
504
505 elif test "${with_target_style}" = "unix"; then
506 with_logging_style=stdio
507
508 else
509 with_logging_style=external
510
511 fi
512
513else
514 if test "${with_android}" != "yes"; then
515 if test "${with_logging_style}" = "android"; then
516 AC_MSG_ERROR([Android-style logging may only be specified when building for Android.])
517 fi
518 fi
519fi
520
521CHIP_LOGGING_STYLE=${with_logging_style}
522
523case ${with_logging_style} in
524
525 android)
526 CHIP_LOGGING_STYLE_ANDROID=1
527 ;;
528
529 external)
530 CHIP_LOGGING_STYLE_EXTERNAL=1
531 ;;
532
533 stdio)
534 CHIP_LOGGING_STYLE_STDIO=1
535 ;;
536
537 stdio-weak)
538 CHIP_LOGGING_STYLE_STDIO_WEAK=1
539 ;;
540
541esac
542
543AC_MSG_RESULT(${CHIP_LOGGING_STYLE})
544
545AC_SUBST(CHIP_LOGGING_STYLE)
546AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE],[${CHIP_LOGGING_STYLE}],[CHIP logging style])
547
548AC_SUBST(CHIP_LOGGING_STYLE_ANDROID)
549AM_CONDITIONAL([CHIP_LOGGING_STYLE_ANDROID], [test "${CHIP_LOGGING_STYLE}" = "android"])
550AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_ANDROID],[${CHIP_LOGGING_STYLE_ANDROID}],[Define to 1 if you want to use CHIP with the Android logging system])
551
552AC_SUBST(CHIP_LOGGING_STYLE_EXTERNAL)
553AM_CONDITIONAL([CHIP_LOGGING_STYLE_EXTERNAL], [test "${CHIP_LOGGING_STYLE}" = "external"])
554AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_EXTERNAL],[${CHIP_LOGGING_STYLE_EXTERNAL}],[Define to 1 if you want to use CHIP with an external (i.e. platform- and integrator-defined) logging system])
555
556AC_SUBST(CHIP_LOGGING_STYLE_STDIO)
557AM_CONDITIONAL([CHIP_LOGGING_STYLE_STDIO], [test "${CHIP_LOGGING_STYLE}" = "stdio"])
558AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_STDIO],[${CHIP_LOGGING_STYLE_STDIO}],[Define to 1 if you want to use CHIP with a C Standard I/O Library-based logging system])
559
560AC_SUBST(CHIP_LOGGING_STYLE_STDIO_WEAK)
561AM_CONDITIONAL([CHIP_LOGGING_STYLE_STDIO_WEAK], [test "${CHIP_LOGGING_STYLE}" = "stdio-weak"])
562AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_STDIO_WEAK],[${CHIP_LOGGING_STYLE_STDIO_WEAK}],[Define to 1 if you want to use CHIP with a C Standard I/O Library-based logging system,but override, at link-time an external (i.e. platform- and integrator-defined) logging system])
563
564#
565# If C Standard I/O logging is used, prepending timestamps before log
566# lines may be enabled to support test automation and other debugging
567# activities.
568#
569
570CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS=0
571
572AC_MSG_CHECKING([whether to enable stdio logging timestamps])
573AC_ARG_ENABLE(stdio-logging-timestamps,
574 [AS_HELP_STRING([--enable-stdio-logging-timestamps],[Enable timestamps in stdio- or stdio-weak- style log output @<:@default=no@:>@.])],
575 [
576 case "${enableval}" in
577
578 no|yes)
579 if test "${enableval}" = "yes"; then
580 if test "${CHIP_LOGGING_STYLE}" != "stdio"; then
581 AC_MSG_ERROR([The CHIP logging style must be 'stdio' to use logging timestamps. Use --with-logging-style=stdio Use --with-logging-style=stdio-weak to enable this logging style.])
582 else
583 CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS=1
584 fi
585 fi
586
587 enable_stdio_logging_timestamps=${enableval}
588 ;;
589
590 *)
591 AC_MSG_ERROR([Invalid value ${enableval} for --enable-stdio-logging-timestamps])
592 ;;
593
594 esac
595 ],
596 [enable_stdio_logging_timestamps=no])
597AC_MSG_RESULT(${enable_stdio_logging_timestamps})
598
599AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS],[${CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS}],[Define to 1 if you want to use CHIP with a C Standard I/O Library-based logging system with timestamped log entries])
600
601#
602# Cocoa support
603#
604AC_MSG_CHECKING([whether to build Cocoa support])
605AC_ARG_ENABLE(cocoa,
606 [AS_HELP_STRING([--enable-cocoa],[Enable Cocoa support, required for the iOS device manager @<:@default=no@:>@.])],
607 [
608 case "${enableval}" in
609
610 no|yes)
611 enable_cocoa=${enableval}
612 ;;
613
614 *)
615 AC_MSG_ERROR([Invalid value ${enableval} for --enable-cocoa])
616 ;;
617
618 esac
619 ],
620 [enable_cocoa=no])
621AC_MSG_RESULT(${enable_cocoa})
622
623AM_CONDITIONAL([CHIP_WITH_COCOA], [test "${enable_cocoa}" = "yes"])
624
625if test "${enable_cocoa}" = "yes" ; then
626
627 # Check if the Objective C and Objective C++ compilers support
628 # some overall options we want for those sources.
629
630 AX_CHECK_COMPILER_OPTIONS([Objective C], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_OBJCFLAGS})
631 AX_CHECK_COMPILER_OPTIONS([Objective C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS} ${PROSPECTIVE_OBJCFLAGS} ${PROSPECTIVE_OBJCXXFLAGS})
632
633 AC_LANG_PUSH([Objective C++])
634
635 # Check for required Cocoa headers.
636
637 AC_CHECK_HEADERS([Foundation/Foundation.h],
638 [],
639 [
640 AC_MSG_ERROR(The Cocoa header "$ac_header" is required but cannot be found.)
641 ])
642
643 AC_LANG_POP([Objective C++])
644fi
645
646#
647# Java support
648#
649
650# Influential external variables for Java support
651
652AC_ARG_VAR(JAVA_HOME, [Java SDK root directory])
653AC_ARG_VAR(JNI_CPPFLAGS, [Java Native Interface (JNI) C preprocessor flags])
654AC_ARG_VAR(JAVAC, [Java class compiler command])
655AC_ARG_VAR(JAR, [Java archiver command])
656
657AC_MSG_CHECKING([whether to build Java support])
658AC_ARG_ENABLE(java,
659 [AS_HELP_STRING([--disable-java],[Disable Java support, otherwise required for the Android device manager and CHIP service support @<:@default=auto@:>@.])],
660 [
661 case "${enableval}" in
662
663 auto|no|yes)
664 enable_java=${enableval}
665 ;;
666
667 *)
668 AC_MSG_ERROR([Invalid value ${enableval} for --enable-java])
669 ;;
670
671 esac
672 ],
673 [enable_java=auto])
674
675if test "${enable_java}" = "auto"; then
676 if test "x${JAVA_HOME}" != "x"; then
677 enable_java=yes
678 else
679 enable_java=no
680 fi
681fi
682
683AC_MSG_RESULT(${enable_java})
684
685# If Java support has been requested, then check for the relevant Java
686# headers and tools.
687
688if test "${enable_java}" = "yes" ; then
689 # Check for Java
690
691 # If a specific set of JNI_INCLUDE_DIRS has *not* been given, attempt
692 # to locate the JNI include dirs from JAVA_HOME or the location of
693 # javac.
694 if test "x${JNI_INCLUDE_DIRS}" = "x" ; then
695 AC_JNI_INCLUDE_DIR
696 fi
Sagar Dhawanba5eacf2020-03-23 13:49:10 -0700697
Martin Turonba1a0282020-03-10 19:25:02 -0700698 if test "x${JNI_INCLUDE_DIRS}" != "x" ; then
699 for dir in ${JNI_INCLUDE_DIRS} ; do
700 JNI_CPPFLAGS="${JNI_CPPFLAGS} -I${dir}"
701 done
702
703 AC_SUBST(JNI_CPPFLAGS)
704 fi
705
706 AC_PATH_PROG([JAVAC], [javac], [], [${JAVA_HOME:+${JAVA_HOME}/bin}${PATH_SEPARATOR}${PATH}])
707 AC_PATH_PROG([JAR], [jar], [], [${JAVA_HOME:+${JAVA_HOME}/bin}${PATH_SEPARATOR}${PATH}])
708fi
709
710AM_CONDITIONAL([CHIP_WITH_JAVA], [test "${enable_java}" = "yes"])
711
712#
713# Debug and profile instances
714#
715AC_MSG_NOTICE([checking whether to build debug and profile instances])
716
717# Debug
718
719NL_ENABLE_DEBUG([no])
720
721AM_CONDITIONAL([CHIP_BUILD_DEBUG], [test "${nl_cv_build_debug}" = "yes"])
722
723# Profile
724
725AC_MSG_CHECKING([whether to build profile instances of programs and libraries])
726AC_ARG_ENABLE(profile,
727 [AS_HELP_STRING([--disable-profile],[Disable the generation of profile instances @<:@default=yes@:>@.])],
728 [
Sagar Dhawanba5eacf2020-03-23 13:49:10 -0700729 case "${enableval}" in
Martin Turonba1a0282020-03-10 19:25:02 -0700730
731 no|yes)
732 build_profile=${enableval}
733 ;;
734
735 *)
736 AC_MSG_ERROR([Invalid value ${enableval} for --enable-profile])
737 ;;
738
739 esac
740 ],
741 [build_profile=no])
742AC_MSG_RESULT(${build_profile})
743AM_CONDITIONAL([CHIP_BUILD_PROFILE], [test "${build_profile}" = "yes"])
744
745#
746# Code coverage and compiler optimization
747#
748
749# Coverage
750
751NL_ENABLE_COVERAGE([no])
752
753AM_CONDITIONAL([CHIP_BUILD_COVERAGE], [test "${nl_cv_build_coverage}" = "yes"])
754
755NL_ENABLE_COVERAGE_REPORTS([auto])
756
757AM_CONDITIONAL([CHIP_BUILD_COVERAGE_REPORTS], [test "${nl_cv_build_coverage_reports}" = "yes"])
758
759# Optimization
760
761NL_ENABLE_OPTIMIZATION([yes])
762
763AM_CONDITIONAL([CHIP_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = "yes"])
764
765#
766# Treat Compiler Warnings as Errors
767#
768NL_ENABLE_WERROR([no])
769
770#
771# Tests and tools
772#
773AC_MSG_NOTICE([checking whether to build tools and tests])
774
775# Tests
776
777NL_ENABLE_TESTS([yes])
778
779AM_CONDITIONAL([CHIP_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
780
781# Tools
782
783AC_MSG_CHECKING([whether to build tools])
784AC_ARG_ENABLE(tools,
785 [AS_HELP_STRING([--disable-tools],[Disable building of tools @<:@default=no@:>@.])],
786 [
Sagar Dhawanba5eacf2020-03-23 13:49:10 -0700787 case "${enableval}" in
Martin Turonba1a0282020-03-10 19:25:02 -0700788
789 no|yes)
790 build_tools=${enableval}
791 ;;
792
793 *)
794 AC_MSG_ERROR([Invalid value ${enableval} for --enable-tools])
795 ;;
796
797 esac
798 ],
799 [build_tools=yes])
800AC_MSG_RESULT(${build_tools})
801AM_CONDITIONAL([CHIP_BUILD_TOOLS], [test "${build_tools}" = "yes"])
802
Grant Erickson6d7428b2020-05-11 16:31:38 -0700803# Happy
804
805AC_MSG_CHECKING([checking whether to run functional tests with Happy])
806AC_ARG_WITH(happy,
807 [AS_HELP_STRING([--with-happy=HAPPY],
808 [Run CHIP functional tests using the Happy network functional test framework: yes, no, auto, or a path to the Happy network functional test framework [default=auto].])],
809 [
810 case "${with_happy}" in
811
812 no|yes)
813 ;;
814
815 *)
816 configure_happy_path=${with_happy}
817 happy_path="${with_happy}/lib/python${am_cv_python_version}/site-packages/"
818 with_happy=yes
819 ;;
820 esac
821 ],
822 [with_happy=auto])
823
824if test "${nl_cv_build_tests}" != "yes"; then
825 with_happy=no
826 happy_path="-"
827else
828 if test -n ${happy_path}; then
829 grep "Nest Labs" ${configure_happy_path}/setup.py &> /dev/null
830 if test $? = 0; then
831 AC_MSG_ERROR(["You have specified a valid path, ${configure_happy_path} to a Nest Labs network functional test framework (Happy) source directory; however, it does not appear to be built and installed. Please build and install Happy from the specified path, ${configure_happy_path}, and then try again."])
832 fi
833 if ! test -d ${happy_path}; then
834 AC_MSG_ERROR(["No Nest Labs network functional test framework (Happy) installation could be found at ${configure_happy_path}. Please provide a path to a valid Happy installation."])
835 fi
836 fi
837fi
838
839if test "${with_happy}" != "no"; then
840 PYTHONPATH=${happy_path}:${PYTHONPATH} python -c 'import happy' 2> /dev/null
841 if test $? != 0; then
842 if test "${with_happy}" = "yes"; then
843 if test -z ${happy_path}; then
844 AC_MSG_ERROR(["The Happy network functional test framework was configured with the defaults; however, Happy could not be found in the Python default package locations. Please either install Happy in a default location or invoke 'configure' with an explicit path using '--with-happy=<path to happy>'."])
845 else
846 AC_MSG_ERROR(["The Happy network functional test framework was configured with the path ${happy_path}; however, Happy could neither be found in the Python default package locations and nor at ${happy_path}."])
847 fi
848 else
849 with_happy=no
850 happy_path="-"
851 fi
852 else
853 with_happy=yes
854 fi
855fi
856
857if test "${with_happy}" = "yes"; then
858 HAPPY_MINIMUM_VERSION="1.1.36"
859 happy_version=`PYTHONPATH=${happy_path}:${PYTHONPATH} ${PYTHON} -c 'import happy; print happy.__version__ if "__version__" in dir(happy) else "0.0.0"'`
860 AX_COMPARE_VERSION([${HAPPY_MINIMUM_VERSION}],[gt],[${happy_version}],[AC_MSG_ERROR(["The Happy network functional test framework is installed with version ${happy_version}; however, Weave test apps require at least version ${HAPPY_MINIMUM_VERSION}."])],[])
861fi
862
863AC_MSG_RESULT(${with_happy})
864AM_CONDITIONAL([WEAVE_RUN_HAPPY], [test "${with_happy}" = "yes"])
865AC_SUBST(HAPPY_PATH,[${happy_path}])
Martin Turonba1a0282020-03-10 19:25:02 -0700866#
867# CHIPoBLE Control Path and Throughput Test (CHIPoBLE Test)
868#
869
870AC_MSG_CHECKING([whether to build CHIPoBLE Test])
871AC_ARG_ENABLE(chipoble-test,
872 [AS_HELP_STRING([--enable-chipoble-test],[Enable CHIPoBLE Test @<:@default=no@:>@.])],
873 [
Sagar Dhawanba5eacf2020-03-23 13:49:10 -0700874 case "${enableval}" in
Martin Turonba1a0282020-03-10 19:25:02 -0700875
876 no|yes)
877 enable_chipoble_test=${enableval}
878 ;;
879
880 *)
881 AC_MSG_ERROR([Invalid value ${enableval} for --enable-chipoble-test])
882 ;;
883
884 esac
885 ],
886 [enable_chipoble_test=no])
887AC_MSG_RESULT(${enable_chipoble_test})
Martin Turon7a8a93f2020-04-15 17:38:24 -0700888AM_CONDITIONAL([CHIP_ENABLE_CHIPOBLE_TEST], [test "${enable_chipoble_test}" = "yes"])
Martin Turonba1a0282020-03-10 19:25:02 -0700889if test "${enable_chipoble_test}" = "yes"; then
Martin Turon7a8a93f2020-04-15 17:38:24 -0700890 CHIP_ENABLE_CHIPOBLE_TEST=1
Martin Turonba1a0282020-03-10 19:25:02 -0700891else
Martin Turon7a8a93f2020-04-15 17:38:24 -0700892 CHIP_ENABLE_CHIPOBLE_TEST=0
Martin Turonba1a0282020-03-10 19:25:02 -0700893fi
Martin Turon7a8a93f2020-04-15 17:38:24 -0700894AC_DEFINE_UNQUOTED([CHIP_ENABLE_CHIPOBLE_TEST],[${CHIP_ENABLE_CHIPOBLE_TEST}],[Define to 1 if you want to enable CHIPoBle Control Path and Throughput Test.])
Martin Turonba1a0282020-03-10 19:25:02 -0700895#
896# Documentation
897#
898
899# Determine whether or not documentation (via Doxygen) should be built
900# or not, with 'auto' as the default and establish a default support
901# value for GraphViz 'dot' support.
902
903NL_ENABLE_DOCS([auto],[NO])
904
905AM_CONDITIONAL(CHIP_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
906
907#
908# Network Technology Layer
909#
910AC_MSG_CHECKING([network layer])
911AC_ARG_WITH(network-layer,
912 [AS_HELP_STRING([--with-network-layer=LAYER],
913 [Specify the target network layers from one of: ble, inet, or all @<:@default=all@:>@.])],
914 [
915 case "${with_network_layer}" in
916
917 ble|inet|all)
918 ;;
919
920 *)
921 AC_MSG_ERROR([Invalid value ${with_network_layer} for --with-network-layer])
922 ;;
923
924 esac
925 ],
926 [with_network_layer=all])
927AC_MSG_RESULT(${with_network_layer})
928
929case "${with_network_layer}" in
930
931ble)
932 CONFIG_NETWORK_LAYER_BLE=1
933 CONFIG_NETWORK_LAYER_INET=0
934 ;;
935
936inet)
937 CONFIG_NETWORK_LAYER_BLE=0
938 CONFIG_NETWORK_LAYER_INET=1
939 ;;
940
941all)
942 CONFIG_NETWORK_LAYER_BLE=1
943 CONFIG_NETWORK_LAYER_INET=1
944 ;;
945
946esac
947
948# NOTE WELL: The following logic is a transitional patch (BLE layer is currently dependent on INET layer)
949if test ${CONFIG_NETWORK_LAYER_INET} = 0 && test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
950 with_network_layer=all
951 CONFIG_NETWORK_LAYER_INET=1
952 AC_MSG_NOTICE([NOTE WELL: the BLE layer currently requires the INET layer.])
953fi
954
955AC_SUBST(CONFIG_NETWORK_LAYER_BLE)
956AM_CONDITIONAL([CONFIG_NETWORK_LAYER_BLE], [test "${CONFIG_NETWORK_LAYER_BLE}" = 1])
957AC_DEFINE_UNQUOTED([CONFIG_NETWORK_LAYER_BLE],[${CONFIG_NETWORK_LAYER_BLE}],[Define to 1 if you want to use CHIP with the Bluetooth Low Energy network stack.])
958
959AC_SUBST(CONFIG_NETWORK_LAYER_INET)
960AM_CONDITIONAL([CONFIG_NETWORK_LAYER_INET], [test "${CONFIG_NETWORK_LAYER_INET}" = 1])
961AC_DEFINE_UNQUOTED([CONFIG_NETWORK_LAYER_INET],[${CONFIG_NETWORK_LAYER_INET}],[Define to 1 if you want to use CHIP with the Internet Protocol network stack.])
962
963#
964# CHIP Device Layer
965#
966AC_MSG_CHECKING([device layer])
967AC_ARG_WITH(device-layer,
968 [AS_HELP_STRING([--with-device-layer=LAYER],
Damian Królik34a4a932020-07-20 20:07:50 +0200969 [Specify the target environment for the CHIP Device Layer. Choose one of: auto, darwin, efr32, esp32, nrf5, nrfconnect, linux, or none @<:@default=auto@:>@.])],
Martin Turonba1a0282020-03-10 19:25:02 -0700970 [
971 case "${with_device_layer}" in
972
Damian Królik34a4a932020-07-20 20:07:50 +0200973 auto|darwin|efr32|esp32|nrf5|nrfconnect|linux|none)
Martin Turonba1a0282020-03-10 19:25:02 -0700974 ;;
975
976 *)
977 AC_MSG_ERROR([Invalid value ${with_device_layer} for --with-device-layer])
978 ;;
979
980 esac
981 ],
Vivien Nicolas694f20d2020-07-16 22:48:40 +0200982 [with_device_layer=auto])
Martin Turonba1a0282020-03-10 19:25:02 -0700983AC_MSG_RESULT(${with_device_layer})
984
Martin Turon0c03fa82020-05-26 15:43:11 -0700985# Disable all device layer targets by default
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +0200986CHIP_DEVICE_LAYER_TARGET_DARWIN=0
987CHIP_DEVICE_LAYER_TARGET_EFR32=0
Martin Turon0c03fa82020-05-26 15:43:11 -0700988CHIP_DEVICE_LAYER_TARGET_ESP32=0
989CHIP_DEVICE_LAYER_TARGET_NRF5=0
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +0200990CHIP_DEVICE_LAYER_TARGET_LINUX=0
Damian Królik34a4a932020-07-20 20:07:50 +0200991CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=0
Martin Turon0c03fa82020-05-26 15:43:11 -0700992
Vivien Nicolas694f20d2020-07-16 22:48:40 +0200993if test "${with_device_layer}" = "auto"; then
994 case ${target_os} in
995
996 *darwin*)
997 with_device_layer=darwin
998 ;;
999
1000 *linux*)
1001 with_device_layer=linux
1002 ;;
1003
1004 *)
1005 with_device_layer=none
1006 ;;
1007
1008 esac
1009fi
1010
Martin Turonba1a0282020-03-10 19:25:02 -07001011case "${with_device_layer}" in
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001012
1013darwin)
Martin Turon0c03fa82020-05-26 15:43:11 -07001014 CONFIG_DEVICE_LAYER=1
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001015 CHIP_DEVICE_LAYER_TARGET=Darwin
1016 CHIP_DEVICE_LAYER_TARGET_DARWIN=1
1017 ;;
1018
1019efr32)
1020 CONFIG_DEVICE_LAYER=1
1021 CHIP_DEVICE_LAYER_TARGET=EFR32
1022 CHIP_DEVICE_LAYER_TARGET_EFR32=1
Martin Turon0c03fa82020-05-26 15:43:11 -07001023 ;;
1024
Martin Turonba1a0282020-03-10 19:25:02 -07001025esp32)
1026 CONFIG_DEVICE_LAYER=1
1027 CHIP_DEVICE_LAYER_TARGET=ESP32
1028 CHIP_DEVICE_LAYER_TARGET_ESP32=1
Martin Turonba1a0282020-03-10 19:25:02 -07001029 ;;
1030
1031nrf5)
1032 CONFIG_DEVICE_LAYER=1
1033 CHIP_DEVICE_LAYER_TARGET=nRF5
1034 CHIP_DEVICE_LAYER_TARGET_NRF5=1
Yakun Xu47f325f2020-07-15 00:10:33 +08001035 CFLAGS="${CFLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs"
1036 CXXFLAGS="${CXXFLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs"
Martin Turonba1a0282020-03-10 19:25:02 -07001037 ;;
1038
Damian Królik34a4a932020-07-20 20:07:50 +02001039nrfconnect)
1040 CONFIG_DEVICE_LAYER=1
1041 CHIP_DEVICE_LAYER_TARGET=nrfconnect
1042 CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=1
1043 ;;
1044
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001045linux)
Martin Turonba1a0282020-03-10 19:25:02 -07001046 CONFIG_DEVICE_LAYER=1
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001047 CHIP_DEVICE_LAYER_TARGET=Linux
1048 CHIP_DEVICE_LAYER_TARGET_LINUX=1
Martin Turonba1a0282020-03-10 19:25:02 -07001049 ;;
1050
1051none)
1052 CONFIG_DEVICE_LAYER=0
1053 CHIP_DEVICE_LAYER_TARGET=NONE
Martin Turonba1a0282020-03-10 19:25:02 -07001054 ;;
Martin Turonba1a0282020-03-10 19:25:02 -07001055esac
1056
1057AC_SUBST(CONFIG_DEVICE_LAYER)
1058AM_CONDITIONAL([CONFIG_DEVICE_LAYER], [test "${CONFIG_DEVICE_LAYER}" = 1])
1059AC_DEFINE_UNQUOTED([CONFIG_DEVICE_LAYER],[${CONFIG_DEVICE_LAYER}],[Define to 1 if you want to use the CHIP Device Layer.])
1060
1061AC_SUBST(CHIP_DEVICE_LAYER_TARGET)
1062AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET],[${CHIP_DEVICE_LAYER_TARGET}],[Target platform name for CHIP Device Layer.])
1063
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001064AC_SUBST(CHIP_DEVICE_LAYER_TARGET_DARWIN)
1065AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_DARWIN], [test "${CHIP_DEVICE_LAYER_TARGET_DARWIN}" = 1])
1066AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_DARWIN],[${CHIP_DEVICE_LAYER_TARGET_DARWIN}],[Define to 1 if you want to build the CHIP Device Layer for Darwin platforms.])
1067
Martin Turonba1a0282020-03-10 19:25:02 -07001068AC_SUBST(CHIP_DEVICE_LAYER_TARGET_EFR32)
1069AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_EFR32], [test "${CHIP_DEVICE_LAYER_TARGET_EFR32}" = 1])
1070AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_EFR32],[${CHIP_DEVICE_LAYER_TARGET_EFR32}],[Define to 1 if you want to build the CHIP Device Layer for Silicon Labs EFR32 platforms.])
1071
1072AC_SUBST(CHIP_DEVICE_LAYER_TARGET_ESP32)
1073AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_ESP32], [test "${CHIP_DEVICE_LAYER_TARGET_ESP32}" = 1])
1074AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_ESP32],[${CHIP_DEVICE_LAYER_TARGET_ESP32}],[Define to 1 if you want to build the CHIP Device Layer for the Espressif ESP32.])
1075
1076AC_SUBST(CHIP_DEVICE_LAYER_TARGET_NRF5)
1077AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_NRF5], [test "${CHIP_DEVICE_LAYER_TARGET_NRF5}" = 1])
1078AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_NRF5],[${CHIP_DEVICE_LAYER_TARGET_NRF5}],[Define to 1 if you want to build the CHIP Device Layer for Nordic nRF5* platforms.])
1079
Damian Królik34a4a932020-07-20 20:07:50 +02001080AC_SUBST(CHIP_DEVICE_LAYER_TARGET_NRFCONNECT)
1081AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_NRFCONNECT], [test "${CHIP_DEVICE_LAYER_TARGET_NRFCONNECT}" = 1])
1082AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_NRFCONNECT],[${CHIP_DEVICE_LAYER_TARGET_NRFCONNECT}],[Define to 1 if you want to build the CHIP Device Layer for Nordic nRF Connect platforms.])
1083
Martin Turon0c03fa82020-05-26 15:43:11 -07001084AC_SUBST(CHIP_DEVICE_LAYER_TARGET_LINUX)
1085AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_LINUX], [test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1])
1086AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_LINUX],[${CHIP_DEVICE_LAYER_TARGET_LINUX}],[Define to 1 if you want to build the CHIP Device Layer for Linux platforms.])
1087
Martin Turonba1a0282020-03-10 19:25:02 -07001088if test "${CONFIG_DEVICE_LAYER}" = 1; then
1089 AC_DEFINE_UNQUOTED([BLE_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001090 [<platform/${CHIP_DEVICE_LAYER_TARGET}/BlePlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001091 [Path to BLE platform config header file])
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001092 AC_DEFINE_UNQUOTED([INET_PLATFORM_CONFIG_INCLUDE],
1093 [<platform/${CHIP_DEVICE_LAYER_TARGET}/InetPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001094 [Path to Inet Layer platform config header file])
1095 AC_DEFINE_UNQUOTED([SYSTEM_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001096 [<platform/${CHIP_DEVICE_LAYER_TARGET}/SystemPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001097 [Path to System Layer platform config header file])
1098 AC_DEFINE_UNQUOTED([WARM_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001099 [<platform/${CHIP_DEVICE_LAYER_TARGET}/WarmPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001100 [Path to WARM platform config header file])
1101 AC_DEFINE_UNQUOTED([CHIP_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001102 [<platform/${CHIP_DEVICE_LAYER_TARGET}/CHIPPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001103 [Path to CHIP platform config header file])
1104 AC_DEFINE_UNQUOTED([CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001105 [<platform/${CHIP_DEVICE_LAYER_TARGET}/CHIPDevicePlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001106 [Path to CHIP Device Layer platform config header file])
1107fi
1108
Vivien Nicolasb1e52b22020-07-22 00:14:00 +02001109if test ${CHIP_DEVICE_LAYER_TARGET_DARWIN} = 1 && test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
1110 AC_CHECK_HEADER([CoreBluetooth/CoreBluetooth.h])
1111 LDFLAGS="${LDFLAGS} -framework Foundation -framework CoreBluetooth"
1112fi
1113
Martin Turonba1a0282020-03-10 19:25:02 -07001114#
1115# CHIP target network stack(s)
1116#
1117CONFIG_TARGET_NETWORKS=sockets
1118
1119AC_MSG_CHECKING([target network])
1120AC_ARG_WITH(target-network,
1121 [AS_HELP_STRING([--with-target-network=NETWORK],
Vivien Nicolas79625962020-06-19 00:28:26 +02001122 [Specify the target network stack from one or more of, separated by commas: sockets, lwip or Network.framework @<:@default=sockets@:>@.])],
Martin Turonba1a0282020-03-10 19:25:02 -07001123 [
1124 CONFIG_TARGET_NETWORKS=`echo ${with_target_network} | sed -e 's/,/ /g'`
1125
1126 for target_network in ${CONFIG_TARGET_NETWORKS}; do
1127 case "${target_network}" in
1128
Vivien Nicolas79625962020-06-19 00:28:26 +02001129 lwip|sockets|Network.framework)
Martin Turonba1a0282020-03-10 19:25:02 -07001130 ;;
1131
1132 *)
1133 AC_MSG_ERROR([Invalid value ${with_target_network} for --with-target-network])
1134 ;;
1135
1136 esac
1137 done
1138 ],
1139 [with_target_network=${CONFIG_TARGET_NETWORKS}])
1140AC_MSG_RESULT(${with_target_network})
1141AC_SUBST(CONFIG_TARGET_NETWORKS)
1142AC_DEFINE_UNQUOTED([CONFIG_TARGET_NETWORKS], "${CONFIG_TARGET_NETWORKS}", [CHIP target network stack(s)])
1143
1144CHIP_SYSTEM_CONFIG_USE_LWIP=0
1145CHIP_SYSTEM_CONFIG_USE_SOCKETS=0
Vivien Nicolas79625962020-06-19 00:28:26 +02001146CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK=0
Martin Turonba1a0282020-03-10 19:25:02 -07001147
1148for target_network in ${CONFIG_TARGET_NETWORKS}; do
1149 case ${target_network} in
1150
1151 lwip)
1152 CHIP_SYSTEM_CONFIG_USE_LWIP=1
1153 ;;
1154
1155 sockets)
1156 CHIP_SYSTEM_CONFIG_USE_SOCKETS=1
1157 ;;
1158
Vivien Nicolas79625962020-06-19 00:28:26 +02001159 Network.framework)
1160 CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK=1
1161 ;;
1162
Martin Turonba1a0282020-03-10 19:25:02 -07001163 esac
1164done
1165
1166AC_SUBST(CHIP_SYSTEM_CONFIG_USE_LWIP)
1167AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_LWIP], [test "${CHIP_SYSTEM_CONFIG_USE_LWIP}" = 1])
1168AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_LWIP], [${CHIP_SYSTEM_CONFIG_USE_LWIP}],
1169 [Define to 1 if you want to use LwIP with CHIP System Layer.])
1170
1171AC_SUBST(CHIP_SYSTEM_CONFIG_USE_SOCKETS)
1172AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_SOCKETS], [test "${CHIP_SYSTEM_CONFIG_USE_SOCKETS}" = 1])
1173AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_SOCKETS], [${CHIP_SYSTEM_CONFIG_USE_SOCKETS}],
1174 [Define to 1 if you want to use BSD sockets with CHIP System Layer.])
1175
Vivien Nicolas79625962020-06-19 00:28:26 +02001176AC_SUBST(CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK)
1177AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK], [test "${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}" = 1])
1178AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK], [${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}],
1179 [Define to 1 if you want to use Network.framework with CHIP System Layer.])
1180
1181#
Martin Turonba1a0282020-03-10 19:25:02 -07001182#
1183# Internet Protocol Network Endpoints
1184#
1185if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
1186 AC_MSG_CHECKING([IPv4 enabled])
1187 AC_ARG_ENABLE(ipv4,
1188 [AS_HELP_STRING([--disable-ipv4],[Disable the inclusion of IPv4 networking @<:@default=yes@:>@.])],
1189 [
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001190 case "${enableval}" in
Martin Turonba1a0282020-03-10 19:25:02 -07001191
1192 no|yes)
1193 enable_ivp4=${enableval}
1194 ;;
1195
1196 *)
1197 AC_MSG_ERROR([Invalid value ${enableval} for --enable-ivp4])
1198 ;;
1199
1200 esac
1201 ],
1202 [enable_ivp4=yes])
1203 AC_MSG_RESULT(${enable_ivp4})
1204
1205 INET_WANT_IPV4=1
1206
1207 if test "${enable_ipv4}" = no; then
1208 INET_WANT_IPV4=0
1209 fi
1210
1211 AM_CONDITIONAL([INET_WANT_IPV4], [test "${INET_WANT_IPV4}" = 1])
1212 AC_DEFINE_UNQUOTED([INET_WANT_IPV4],[${INET_WANT_IPV4}], [Define to 1 if you want to use CHIP with IPv4.])
1213
1214 if test "${INET_WANT_IPV4}" = 1; then
1215 AC_DEFINE(INET_CONFIG_ENABLE_IPV4, 1, [Define to 1 for enabling IPv4])
1216 fi
1217
1218 AC_MSG_CHECKING([inet network endpoint])
1219 AC_ARG_WITH(inet-endpoint,
1220 [AS_HELP_STRING([--with-inet-endpoint=ENDPOINT],
1221 [Specify the inet network endpoint from one or more of: raw, tcp, tun, udp @<:@default=all@:>@.])],
1222 [
1223 INET_ENDPOINTS=`echo ${with_inet_endpoint} | sed -e 's/,/ /g'`
1224
1225 for inet_endpoint in ${INET_ENDPOINTS}; do
1226
1227 case "${inet_endpoint}" in
1228
1229 dns|raw|tcp|tun|udp|all)
1230 ;;
1231
1232 *)
1233 AC_MSG_ERROR([Invalid value ${with_inet_endpoint} for --with-inet-endpoint])
1234 ;;
1235
1236 esac
1237
1238 done
1239 ],
1240 [INET_ENDPOINTS=all])
1241 AC_MSG_RESULT(${with_inet_endpoint})
1242
1243 AC_SUBST(INET_ENDPOINTS)
1244 AC_DEFINE_UNQUOTED([INET_ENDPOINTS], "${INET_ENDPOINTS}", [CHIP target inet network endpoint(s)])
1245
1246 INET_WANT_ENDPOINT_DNS=0
1247 INET_WANT_ENDPOINT_RAW=0
1248 INET_WANT_ENDPOINT_TCP=0
1249 INET_WANT_ENDPOINT_TUN=0
1250 INET_WANT_ENDPOINT_UDP=0
1251
1252 for wanted_endpoint in ${INET_ENDPOINTS}; do
1253
1254 case "${wanted_endpoint}" in
1255
1256 dns)
1257 INET_WANT_ENDPOINT_DNS=1
1258 ;;
1259
1260 raw)
1261 INET_WANT_ENDPOINT_RAW=1
1262 ;;
1263
1264 tcp)
1265 INET_WANT_ENDPOINT_TCP=1
1266 ;;
1267
1268 tun)
1269 INET_WANT_ENDPOINT_TUN=1
1270 ;;
1271
1272 udp)
1273 INET_WANT_ENDPOINT_UDP=1
1274 ;;
1275
1276 all)
1277 INET_WANT_ENDPOINT_DNS=1
1278 INET_WANT_ENDPOINT_RAW=1
1279 INET_WANT_ENDPOINT_TCP=1
1280 INET_WANT_ENDPOINT_TUN=1
1281 INET_WANT_ENDPOINT_UDP=1
1282 ;;
1283 esac
1284
1285 done
1286
1287 if test "${INET_WANT_ENDPOINT_TUN}" = 1; then
1288 AC_CHECK_HEADERS(linux/if_tun.h,[AC_SUBST(HAVE_LINUX_IF_TUN_H, [1])], [], [])
1289 AC_CHECK_TYPE(struct rtentry, , AC_CHECK_HEADERS(linux/route.h, [AC_SUBST(HAVE_LINUX_ROUTE_H, [1])], [], []), [[#include <net/route.h>]])
1290 AC_CHECK_TYPE(struct in6_rtmsg, , AC_CHECK_HEADERS(linux/ipv6_route.h, [AC_SUBST(HAVE_LINUX_IPV6_ROUTE_H, [1])], [], []), [[#include <net/route.h>]])
1291 # Check whether linux/if_tun.h defines TUNGETIFF.
1292 AC_MSG_CHECKING([whether linux/if_tun.h declares TUNGETIFF])
1293 AC_COMPILE_IFELSE([
1294 AC_LANG_PROGRAM(
1295 [[
1296 #if HAVE_LINUX_IF_TUN_H
1297 # include <linux/if_tun.h>
1298 #endif
1299 ]],
1300 [[
1301 #if !defined(TUNGETIFF)
1302 #error "TUNGETIFF is not defined"
1303 #endif
1304 ]])],
1305 [
1306 AC_MSG_RESULT([yes])
1307 AC_DEFINE(HAVE_TUNGETIFF, 1, [Define to 1 if <linux/if_tun.h> header file defines the TUNGETIFF ioctl command.])
1308 ],
1309 [
1310 AC_MSG_RESULT([no])
1311 ])
1312 AC_CHECK_TYPES(struct in6_rtmsg, [AC_SUBST(HAVE_IN6_RTMSG, [1])],[],[#include<net/route.h>])
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001313 if [[[ "${CHIP_SYSTEM_CONFIG_USE_LWIP}" -eq 0 ]]] &&
Martin Turonba1a0282020-03-10 19:25:02 -07001314 [[[ "${HAVE_LINUX_IF_TUN_H}" -eq 0 || "${HAVE_IN6_RTMSG}" -eq 0 ]]]; then
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001315 AC_MSG_NOTICE([Tun EndPoint cannot be enabled for current target
Martin Turonba1a0282020-03-10 19:25:02 -07001316 CHIP_SYSTEM_CONFIG_USE_LWIP=$CHIP_SYSTEM_CONFIG_USE_LWIP, HAVE_LINUX_IF_TUN_H=$HAVE_LINUX_IF_TUN_H,
1317 HAVE_IN6_RTMSG=$HAVE_IN6_RTMSG])
1318 INET_WANT_ENDPOINT_TUN=0
1319 fi
1320 fi
1321
1322 AM_CONDITIONAL([INET_WANT_ENDPOINT_DNS], [test "${INET_WANT_ENDPOINT_DNS}" = 1])
1323 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_DNS],[${INET_WANT_ENDPOINT_DNS}],
1324 [Define to 1 if you want to use CHIP with the inet dns resolver.])
1325
1326 AM_CONDITIONAL([INET_WANT_ENDPOINT_RAW], [test "${INET_WANT_ENDPOINT_RAW}" = 1])
1327 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_RAW],[${INET_WANT_ENDPOINT_RAW}],
1328 [Define to 1 if you want to use CHIP with the inet raw endpoint.])
1329
1330 AM_CONDITIONAL([INET_WANT_ENDPOINT_TCP], [test "${INET_WANT_ENDPOINT_TCP}" = 1])
1331 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_TCP],[${INET_WANT_ENDPOINT_TCP}],
1332 [Define to 1 if you want to use CHIP with the inet tcp endpoint.])
1333
1334 AM_CONDITIONAL([INET_WANT_ENDPOINT_TUN], [test "${INET_WANT_ENDPOINT_TUN}" = 1])
1335 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_TUN],[${INET_WANT_ENDPOINT_TUN}],
1336 [Define to 1 if you want to use CHIP with the inet tun endpoint.])
1337
1338 AM_CONDITIONAL([INET_WANT_ENDPOINT_UDP], [test "${INET_WANT_ENDPOINT_UDP}" = 1])
1339 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_UDP],[${INET_WANT_ENDPOINT_UDP}],
1340 [Define to 1 if you want to use CHIP with the inet udp endpoint.])
1341
1342 if test "${INET_WANT_ENDPOINT_DNS}" = 1; then
1343 AC_DEFINE(INET_CONFIG_ENABLE_DNS_RESOLVER, 1, [Define to 1 for enabling DNS Resolver])
1344 fi
1345
1346 if test "${INET_WANT_ENDPOINT_RAW}" = 1; then
1347 AC_DEFINE(INET_CONFIG_ENABLE_RAW_ENDPOINT, 1, [Define to 1 for enabling Raw Endpoint])
1348 fi
1349
1350 if test "${INET_WANT_ENDPOINT_TCP}" = 1; then
1351 AC_DEFINE(INET_CONFIG_ENABLE_TCP_ENDPOINT, 1, [Define to 1 for enabling TCP Endpoint])
1352 fi
1353
1354 if test "${INET_WANT_ENDPOINT_TUN}" = 1; then
1355 AC_DEFINE(INET_CONFIG_ENABLE_TUN_ENDPOINT, 1, [Define to 1 for enabling TUN Endpoint (only for LWIP and Linux w/ support)])
1356 fi
1357
1358 if test "${INET_WANT_ENDPOINT_UDP}" = 1; then
1359 AC_DEFINE(INET_CONFIG_ENABLE_UDP_ENDPOINT, 1, [Define to 1 for enabling UDP Endpoint])
1360 fi
1361fi
1362
1363# Asynchronous DNS
1364AC_MSG_CHECKING([whether to build with asynchronous DNS resolution support])
1365AC_ARG_ENABLE(adns,
1366 [AS_HELP_STRING([--disable-adns],[Disable building of adns @<:@default=no@:>@.])],
1367 [
1368 case "${enableval}" in
1369
1370 no|yes)
1371 build_adns=${enableval}
1372 ;;
1373
1374 *)
1375 AC_MSG_ERROR([Invalid value ${enableval} for --disable-adns])
1376 ;;
1377
1378 esac
1379 ],
1380 [build_adns=yes])
1381AC_MSG_RESULT(${build_adns})
1382
1383AM_CONDITIONAL([INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS], [test "${build_adns}" = "yes"])
1384
1385if test ${build_adns} = "yes" && test ${INET_WANT_ENDPOINT_DNS} = 1 && test ${CHIP_SYSTEM_CONFIG_USE_SOCKETS} = 1; then
1386 AC_DEFINE(INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS, 1, [Define to 1 for enabling ASYNC DNS])
1387else
1388 AC_DEFINE(INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS, 0, [Define to 0 for disabling ASYNC DNS])
1389fi
1390
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001391#
1392# Options for the user to specify project-specific configuration files
1393# for various CHIP components.
1394#
1395
1396AC_LANG_PUSH([C++])
1397
1398# SystemLayer
1399
Rob Walkeraeec6c52020-04-20 10:05:18 -07001400CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-system-project-includes, SYSTEM_PROJECT_CONFIG_INCLUDE, SystemProjectConfig.h, CHIP System Layer, ${ac_abs_confdir}/config/standalone)
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001401
1402# BleLayer
1403
1404if test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
Rob Walkeraeec6c52020-04-20 10:05:18 -07001405 CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-ble-project-includes, BLE_PROJECT_CONFIG_INCLUDE, BleProjectConfig.h, CHIP BLE Layer, ${ac_abs_confdir}/config/standalone)
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001406fi
1407
1408# InetLayer
1409
1410if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
Rob Walkeraeec6c52020-04-20 10:05:18 -07001411 CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-inet-project-includes, INET_PROJECT_CONFIG_INCLUDE, InetProjectConfig.h, CHIP Inet Layer, ${ac_abs_confdir}/config/standalone)
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001412fi
1413
1414# Core
1415
Rob Walkeraeec6c52020-04-20 10:05:18 -07001416CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-project-includes, CHIP_PROJECT_CONFIG_INCLUDE, CHIPProjectConfig.h, CHIP Core, ${ac_abs_confdir}/config/standalone)
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001417
1418# Device Layer
1419
Rob Walkerae3a9002020-04-15 13:48:47 -07001420if test "${CONFIG_DEVICE_LAYER}" = 1; then
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001421 CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-device-project-includes, CHIP_DEVICE_PROJECT_CONFIG_INCLUDE, CHIPDeviceProjectConfig.h, CHIP Device Layer,)
1422fi
1423
1424AC_LANG_POP([C++])
Martin Turonba1a0282020-03-10 19:25:02 -07001425
1426#
Pankaj Garg5daed722020-04-20 16:55:31 -07001427# Check for crypto implementation
1428#
1429CHIP_CRYPTO=
1430CHIP_CRYPTO_MBEDTLS=0
1431CHIP_CRYPTO_OPENSSL=0
1432
1433AC_MSG_CHECKING([for crypto implementation])
1434
1435# The user may have attempted to explicitly specify the crypto
1436# implementation. Sanity check it or default to 'auto'.
1437
1438AC_ARG_WITH(crypto,
1439 [AS_HELP_STRING([--with-crypto=CRYPTO],
1440 [Specify the crypto implementation from one of: auto, mbedtls, or openssl @<:@default=auto@:>@.])],
1441 [
1442 case "${with_crypto}" in
1443 auto|mbedtls|openssl)
1444 ;;
1445 *)
1446 AC_MSG_ERROR([Invalid value ${with_crypto} for --with-crypto])
1447 ;;
1448 esac
1449 ],
1450 [with_crypto=auto])
1451
1452# At this point, the crypto implementation is one of the allowed
1453# values. If it's 'auto' we autodetect it.
1454
1455if test "${with_crypto}" = "auto"; then
1456 case ${target_os} in
1457
1458 *cygwin*|*darwin*|*linux*|*freebsd*|*netbsd*|*openbsd*)
1459 with_crypto=openssl
1460 ;;
1461
1462 *freertos*)
1463 with_crypto=mbedtls
1464 ;;
1465
1466 *)
1467 AC_MSG_RESULT([unknown])
1468 AC_MSG_ERROR([Unsupported target OS ${target_os}])
1469 ;;
1470
1471 esac
1472fi
1473
1474CHIP_CRYPTO=${with_crypto}
1475
1476case ${with_crypto} in
1477
1478 mbedtls)
1479 CHIP_CRYPTO_MBEDTLS=1
1480 ;;
1481
1482 openssl)
1483 CHIP_CRYPTO_OPENSSL=1
1484 ;;
1485
1486esac
1487
1488AC_MSG_RESULT(${CHIP_CRYPTO})
1489
1490AC_SUBST(CHIP_CRYPTO)
1491AC_DEFINE_UNQUOTED([CHIP_CRYPTO],[${CHIP_CRYPTO}],[CHIP crypto implementation])
1492
1493AC_SUBST(CHIP_CRYPTO_MBEDTLS)
1494AM_CONDITIONAL([CHIP_CRYPTO_MBEDTLS], [test "${CHIP_CRYPTO}" = "mbedtls"])
1495AC_DEFINE_UNQUOTED([CHIP_CRYPTO_MBEDTLS],[${CHIP_CRYPTO_MBEDTLS}],[Define to 1 if you want to use CHIP with a mbedTLS crypto implementation])
1496
1497AC_SUBST(CHIP_CRYPTO_OPENSSL)
1498AM_CONDITIONAL([CHIP_CRYPTO_OPENSSL], [test "${CHIP_CRYPTO}" = "openssl"])
1499AC_DEFINE_UNQUOTED([CHIP_CRYPTO_OPENSSL],[${CHIP_CRYPTO_OPENSSL}],[Define to 1 if you want to use CHIP with an OpenSSL crypto implementation])
1500
1501#
Martin Turonba1a0282020-03-10 19:25:02 -07001502# Checks for libraries and packages.
1503#
1504# At minimum, the following are required:
1505#
1506# * nlassert
1507# * nlio
1508#
1509# The following are optional, depending on configuration:
1510#
1511# * lwip
Pankaj Garg5daed722020-04-20 16:55:31 -07001512# * mbedtls
Martin Turonba1a0282020-03-10 19:25:02 -07001513# * nlunit-test
Martin Turonba1a0282020-03-10 19:25:02 -07001514# * nlfaultinjection
Pankaj Garg5daed722020-04-20 16:55:31 -07001515# * openssl
Martin Turonba1a0282020-03-10 19:25:02 -07001516#
1517# Most of these are supplied "in package"; however, they may be also
1518# supplied out of package.
1519#
1520AC_MSG_NOTICE([checking package dependencies])
1521
1522# Check if the build host has pkg-config
1523
1524AC_PATH_PROG([PKG_CONFIG],[pkg-config])
1525
1526#
yunhanw-googlee1d448c2020-07-21 11:57:53 -07001527# Chip over Ble over Bluez Peripheral support
1528#
1529
1530# Only a concern when the BLE layer is enabled.
1531
1532CONFIG_BLE_PLATFORM_BLUEZ=0
1533enable_chipoble_bluez="no"
1534
1535NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1536 [BlueZ],
1537 [BLUEZ],
1538 [bluez],
1539 [-lgdbus-internal -lshared-glib],
1540 [
1541 # actions if not external
1542 # At this time, enable this only for linux, and only if the tests are enabled
1543 if test "${nl_cv_build_tests}" = "yes" && test "${CONFIG_NETWORK_LAYER_BLE}" = 1 && test "${with_device_layer}" = "linux"; then
1544 case "${target}" in
1545
1546 *linux*)
1547 if test "x${HAVE_CXX11}" == "0"; then
1548 AC_MSG_ERROR([BlueZ support requires C++11 compiler])
1549 fi
1550 CONFIG_BLE_PLATFORM_BLUEZ=1
1551 enable_chipoble_bluez="yes"
1552 ;;
1553
1554 *)
1555 CONFIG_BLE_PLATFORM_BLUEZ=0
1556 enable_chipoble_bluez="no"
1557 ;;
1558
1559 esac
1560 fi
1561 ]
1562)
1563
1564# Depending on whether bluez has been configured for an internal
1565# location, its directory stem within this package needs to be set
1566# accordingly. In addition, if the location is internal, then we need
1567# to attempt to pull it down using the bootstrap makefile.
1568
1569if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
1570 maybe_bluez_dirstem="bluez/repo"
1571 bluez_dirstem="third_party/${maybe_bluez_dirstem}"
1572
1573 AC_MSG_NOTICE([attempting to create internal ${bluez_dirstem}])
1574
1575 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${bluez_dirstem}
1576
1577 if test $? -ne 0; then
1578 AC_MSG_ERROR([failed to create ${bluez_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1579 fi
1580
1581 echo " BOOTSTRAP ${bluez_dirstem}"
1582
1583 (cd ${srcdir}/${bluez_dirstem} && ./bootstrap)
1584
1585else
1586 maybe_bluez_dirstem=""
1587fi
1588
1589AC_SUBST(BLUEZ_SUBDIRS, [${maybe_bluez_dirstem}])
1590AM_CONDITIONAL([CHIP_WITH_BLUEZ_INTERNAL], [test "${nl_with_bluez}" = "internal"])
1591
1592AM_CONDITIONAL([CONFIG_BLE_PLATFORM_BLUEZ], [test "${enable_chipoble_bluez}" = "yes"])
1593AC_DEFINE_UNQUOTED([CONFIG_BLE_PLATFORM_BLUEZ],[${CONFIG_BLE_PLATFORM_BLUEZ}],[Define to 1 if you want to enable Chip over Ble over bluez.])
1594
1595if test "${enable_chipoble_bluez}" = "yes"; then
1596 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
1597 AC_MSG_ERROR(GLib >= 2.28 is required))
1598 AC_SUBST(GLIB_CFLAGS)
1599 AC_SUBST(GLIB_LIBS)
1600
1601 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
1602 AC_MSG_ERROR(D-Bus >= 1.6 is required))
1603 AC_SUBST(DBUS_CFLAGS)
1604 AC_SUBST(DBUS_LIBS)
1605
1606 AX_CHECK_COMPILER_OPTIONS([C], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1607 AX_CHECK_COMPILER_OPTIONS([C++], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1608fi
1609
1610#
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001611# OpenSSL
1612#
1613
Pankaj Garg5daed722020-04-20 16:55:31 -07001614if test "${with_crypto}" = "openssl"; then
1615 NL_WITH_REQUIRED_EXTERNAL_PACKAGE([OpenSSL],
1616 [OPENSSL],
1617 [openssl],
1618 [-lcrypto],
1619 [
1620 # Check for required OpenSSL headers.
1621 AC_CHECK_HEADERS([openssl/aes.h] [openssl/bn.h] [openssl/crypto.h] [openssl/ec.h] [openssl/err.h] [openssl/evp.h] [openssl/hmac.h] [openssl/kdf.h] [openssl/rand.h] [openssl/sha.h] [openssl/srp.h],
1622 [],
1623 [
1624 AC_MSG_ERROR(The OpenSSL header "$ac_header" is required but cannot be found.)
1625 ]
1626 )
1627 ]
1628 )
1629fi
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001630
1631AM_CONDITIONAL([CHIP_WITH_OPENSSL], [test "${nl_with_openssl}" != "no"])
1632
1633if test "${nl_with_openssl}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001634 AC_DEFINE([CHIP_WITH_OPENSSL], [0], [Define to 0 to build CHIP without OpenSSL])
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001635else
Pankaj Garg5daed722020-04-20 16:55:31 -07001636 AC_DEFINE([CHIP_WITH_OPENSSL], [1], [Define to 1 to build CHIP with OpenSSL])
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001637fi
1638
1639#
Pankaj Garg139d43b2020-04-15 19:04:57 -07001640# mbedTLS
1641#
Pankaj Garg5daed722020-04-20 16:55:31 -07001642
1643if test "${with_crypto}" = "mbedtls"; then
1644 NL_WITH_REQUIRED_INTERNAL_PACKAGE(
1645 [mbedTLS],
1646 [MBEDTLS],
1647 [mbedtls],
Pankaj Garge4a5eed2020-05-06 09:07:13 -07001648 [-lmbedtls],
Pankaj Garg5daed722020-04-20 16:55:31 -07001649 [
1650 # At this point, the internal mbedTLS package will be neither
1651 # configured nor built, so the normal checks we undertake for an
1652 # external package cannot be run here. Simply set the appropriate
1653 # variables and trust all will be well.
1654
1655 MBEDTLS_CPPFLAGS="-I\${abs_top_srcdir}/third_party/mbedtls/repo/include"
1656 MBEDTLS_LDFLAGS="-L${ac_pwd}/third_party/mbedtls"
1657 MBEDTLS_LIBS="-lmbedtls"
1658 ],
1659 [
1660 # Check for required mbedTLS headers.
1661 AC_CHECK_HEADERS([mbedtls/sha1.h] [mbedtls/sha256.h] [mbedtls/sha512.h] [mbedtls/md.h] [mbedtls/hkdf.h] [mbedtls/pkcs5.h] [mbedtls/chachapoly.h] [mbedtls/aes.h] [mbedtls/ecdh.h] [mbedtls/bignum.h],
1662 [],
1663 [
1664 AC_MSG_ERROR(The mbedTLS header "$ac_header" is required but cannot be found.)
Yakun Xu42f81cd2020-05-30 16:47:19 +08001665 ],
1666 [
1667// Undefine MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE to prevent
1668// including these files at configure stage. This is necessary because
1669// CPPFLAGS is shell expanded during configure stage, which is not
1670// compatible with the expansion of make.
1671#undef MBEDTLS_CONFIG_FILE
1672#undef MBEDTLS_USER_CONFIG_FILE
1673 ])
Pankaj Garg5daed722020-04-20 16:55:31 -07001674 ]
1675 )
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001676fi
Pankaj Garg139d43b2020-04-15 19:04:57 -07001677
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001678# Depending on whether mbedTLS has been configured for an internal
1679# location, its directory stem within this package needs to be set
1680# accordingly. In addition, if the location is internal, then we need
1681# to attempt to pull it down using the bootstrap makefile.
Pankaj Garg139d43b2020-04-15 19:04:57 -07001682
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001683if test "${nl_with_mbedtls}" = "internal"; then
1684 maybe_mbedtls_dirstem="mbedtls"
1685 mbedtls_dirstem="third_party/${maybe_mbedtls_dirstem}/repo"
1686
1687 AC_MSG_NOTICE([attempting to create internal ${mbedtls_dirstem}])
1688
1689 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${mbedtls_dirstem}
1690
1691 if test $? -ne 0; then
1692 AC_MSG_ERROR([failed to create ${mbedtls_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1693 fi
Pankaj Garg139d43b2020-04-15 19:04:57 -07001694else
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001695 maybe_mbedtls_dirstem=""
Pankaj Garg139d43b2020-04-15 19:04:57 -07001696fi
1697
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001698AC_SUBST(MBEDTLS_SUBDIRS, [${maybe_mbedtls_dirstem}])
1699AM_CONDITIONAL([CHIP_WITH_MBEDTLS_INTERNAL], [test "${nl_with_mbedtls}" = "internal"])
1700
Pankaj Garg5daed722020-04-20 16:55:31 -07001701AM_CONDITIONAL([CHIP_WITH_MBEDTLS], [test "${nl_with_mbedtls}" != "no"])
1702
1703if test "${nl_with_mbedtls}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001704 AC_DEFINE([CHIP_WITH_MBEDTLS], [0], [Define to 0 to build CHIP without mbedTLS])
Pankaj Garg5daed722020-04-20 16:55:31 -07001705else
1706 AC_DEFINE([CHIP_WITH_MBEDTLS], [1], [Define to 1 to build CHIP with mbedTLS])
1707fi
1708
Pankaj Garg139d43b2020-04-15 19:04:57 -07001709#
Yakun Xu47f325f2020-07-15 00:10:33 +08001710# OpenThread
1711#
1712
1713NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1714 [OpenThread],
1715 [OPENTHREAD],
1716 [openthread],
1717 [],
1718 [
1719 # use absolute path to support build out of source tree
1720 chip_srcdir="$(cd ${srcdir} && pwd)"
1721
1722 # bootstrap
1723 test -f ${chip_srcdir}/third_party/openthread/repo/configure || (cd ${chip_srcdir}/third_party/openthread/repo && ./bootstrap)
1724
1725 case "${with_device_layer}" in
1726 nrf5)
1727 OPENTHREAD_CPPFLAGS="-I\${abs_top_srcdir}/third_party/openthread/repo/include"
1728 OPENTHREAD_LDFLAGS="-L${ac_pwd}/third_party/openthread"
1729 OPENTHREAD_LIBS="-lopenthread-cli-ftd \
1730 -lopenthread-ftd \
1731 -lopenthread-platform-utils \
1732 -lopenthread-nrf52840-transport \
1733 -lopenthread-nrf52840-softdevice-sdk \
1734 -lnordicsemi-nrf52840-radio-driver-softdevice \
1735 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue.a \
1736 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue_cc310.a \
1737 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
1738 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_cc310_backend.a \
1739 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
1740 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a \
1741 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_tls_vanilla.a \
1742 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_x509_vanilla.a \
1743 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libnrf_cc310_platform_0.9.1.a"
1744
1745 # private definitions
1746 ot_cppflags="-Wno-expansion-to-defined \
1747 -I${chip_srcdir}/third_party/openthread/repo/examples/platforms/nrf528xx/nrf52840 \
1748 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/config \
1749 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include \
1750 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config \
1751 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/include \
1752 -I${chip_srcdir}/third_party/mbedtls/repo/include \
1753 -DMBEDTLS_CONFIG_FILE=\<nrf-config.h\> \
1754 -DMBEDTLS_USER_CONFIG_FILE=\<nrf52840-mbedtls-config.h\> \
1755 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\<openthread-core-nrf52840-config.h\> \
1756 -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\<openthread-core-nrf52840-config-check.h\> \
1757 -DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 \
1758 -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \
1759 -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 \
kangping70de84e2020-08-14 23:19:30 +08001760 -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 \
Yakun Xu47f325f2020-07-15 00:10:33 +08001761 -DUART_AS_SERIAL_TRANSPORT=1"
1762
1763 (mkdir -p ${ac_pwd}/third_party/openthread \
1764 && cd ${ac_pwd}/third_party/openthread \
1765 && CPPFLAGS="${ot_cppflags}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ${chip_srcdir}/third_party/openthread/repo/configure \
1766 --disable-builtin-mbedtls \
1767 --disable-docs \
1768 --disable-executable \
1769 --disable-tools \
1770 --enable-cli \
1771 --enable-ftd \
1772 --host=arm-none-eabi \
1773 --prefix=${prefix} \
1774 --exec-prefix=${exec_prefix} \
1775 --with-examples=nrf52840)
1776
1777 if test $? != 0; then
1778 AC_MSG_ERROR([Failed to configure OpenThread!])
1779 fi
1780
1781 maybe_openthread_dirstem="openthread"
1782 ;;
1783
1784 *)
1785 AC_MSG_NOTICE([No internal OpenThread support yet!])
1786 nl_with_openthread=no
1787 with_openthread=no
1788 ;;
1789 esac
1790 ],
1791 [
1792 # Check for required OpenThread headers.
1793 AC_CHECK_HEADERS([openthread/dataset.h] [openthread/dataset_ftd.h] [openthread/error.h] [openthread/icmp6.h] [openthread/instance.h] [openthread/ip6.h] [openthread/link.h] [openthread/message.h] [openthread/netdata.h] [openthread/tasklet.h] [openthread/thread.h],
1794 [],
1795 [
1796 AC_MSG_ERROR(The OpenThread header "$ac_header" is required but cannot be found.)
1797 ])
1798 maybe_openthread_dirstem=""
1799 ]
1800)
1801AC_SUBST(OPENTHREAD_SUBDIRS, [${maybe_openthread_dirstem}])
1802AM_CONDITIONAL([CHIP_ENABLE_OPENTHREAD], [test "${nl_with_openthread}" != "no"])
1803if test "${nl_with_openthread}" != "no"; then
1804 CHIP_ENABLE_OPENTHREAD=1
1805else
1806 CHIP_ENABLE_OPENTHREAD=0
1807fi
1808AC_DEFINE_UNQUOTED([CHIP_ENABLE_OPENTHREAD],[${CHIP_ENABLE_OPENTHREAD}],[Define to 1 if you want to enable OpenThread.])
1809
1810#
Martin Turonba1a0282020-03-10 19:25:02 -07001811# LwIP
1812#
1813
1814NL_WITH_LWIP(${CHIP_SYSTEM_CONFIG_USE_LWIP})
1815
1816#
1817# Nlio
1818#
1819
1820NL_WITH_PACKAGE(
1821 [Nlio],
1822 [NLIO],
1823 [nlio],
1824 [],
1825 [
1826 # At this point, the internal Nlio package will be neither
1827 # configured nor built, so the normal checks we undertake for an
1828 # external package cannot be run here. Simply set the appropriate
1829 # variables and trust all will be well.
1830
1831 NLIO_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlio/repo/include"
1832 NLIO_LDFLAGS=
1833 NLIO_LIBS=
1834 ],
1835 [
1836 # Check for required Nlio headers.
1837
1838 AC_CHECK_HEADERS([nlbyteorder.h],
1839 [],
1840 [
1841 AC_MSG_ERROR(The nlio header "$ac_header" is required but cannot be found.)
1842 ])
1843 ]
1844)
1845
1846# Depending on whether nlio has been configured for an internal
1847# location, its directory stem within this package needs to be set
1848# accordingly. In addition, if the location is internal, then we need
1849# to attempt to pull it down using the bootstrap makefile.
1850
1851if test "${nl_with_nlio}" = "internal"; then
1852 maybe_nlio_dirstem="nlio/repo"
1853 nlio_dirstem="third_party/${maybe_nlio_dirstem}"
1854
1855 AC_MSG_NOTICE([attempting to create internal ${nlio_dirstem}])
1856
1857 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlio_dirstem}
1858
1859 if test $? -ne 0; then
1860 AC_MSG_ERROR([failed to create ${nlio_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1861 fi
1862else
1863 maybe_nlio_dirstem=""
1864fi
1865
1866AC_SUBST(NLIO_SUBDIRS, [${maybe_nlio_dirstem}])
1867AM_CONDITIONAL([CHIP_WITH_NLIO_INTERNAL], [test "${nl_with_nlio}" = "internal"])
1868
1869#
1870# Nlassert
1871#
1872
1873NL_WITH_PACKAGE(
1874 [Nlassert],
1875 [NLASSERT],
1876 [nlassert],
1877 [],
1878 [
1879 # At this point, the internal Nlassert package will be neither
1880 # configured nor built, so the normal checks we undertake for an
1881 # external package cannot be run here. Simply set the appropriate
1882 # variables and trust all will be well.
1883
1884 NLASSERT_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlassert/repo/include"
1885 NLASSERT_LDFLAGS=
1886 NLASSERT_LIBS=
1887 ],
1888 [
1889 # Check for required Nlassert headers.
1890
1891 AC_CHECK_HEADERS([nlassert.h],
1892 [],
1893 [
1894 AC_MSG_ERROR(The nlassert header "$ac_header" is required but cannot be found.)
1895 ])
1896 ]
1897)
1898
1899# Depending on whether nlassert has been configured for an internal
1900# location, its directory stem within this package needs to be set
1901# accordingly. In addition, if the location is internal, then we need
1902# to attempt to pull it down using the bootstrap makefile.
1903
1904if test "${nl_with_nlassert}" = "internal"; then
1905 maybe_nlassert_dirstem="nlassert/repo"
1906 nlassert_dirstem="third_party/${maybe_nlassert_dirstem}"
1907
1908 AC_MSG_NOTICE([attempting to create internal ${nlassert_dirstem}])
1909
1910 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlassert_dirstem}
1911
1912 if test $? -ne 0; then
1913 AC_MSG_ERROR([failed to create ${nlassert_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1914 fi
1915else
1916 maybe_nlassert_dirstem=""
1917fi
1918
1919AC_SUBST(NLASSERT_SUBDIRS, [${maybe_nlassert_dirstem}])
1920AM_CONDITIONAL([CHIP_WITH_NLASSERT_INTERNAL], [test "${nl_with_nlassert}" = "internal"])
1921
1922#
Grant Erickson81bc5702020-03-18 10:26:28 -07001923# Nlfaultinjection
1924#
1925
1926NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1927 [Nlfaultinjection],
1928 [NLFAULTINJECTION],
1929 [nlfaultinjection],
1930 [-lnlfaultinjection],
1931 [
1932 # At this point, the internal nlfaultinjection package will be neither
1933 # configured nor built, so the normal checks we undertake for an
1934 # external package cannot be run here. Simply set the appropriate
1935 # variables and trust all will be well.
1936
1937 NLFAULTINJECTION_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlfaultinjection/repo/include"
1938 NLFAULTINJECTION_LDFLAGS="-L${ac_pwd}/third_party/nlfaultinjection/repo/src"
1939 NLFAULTINJECTION_LIBS="-lnlfaultinjection"
1940 ],
1941 [
1942 # Check for required nlfaultinjection headers.
1943
1944 AC_LANG_PUSH([C++])
1945 AC_CHECK_HEADERS([nlfaultinjection.hpp],
1946 [],
1947 [
1948 AC_MSG_ERROR(The nlfaultinjection header "$ac_header" is required but cannot be found.)
1949 ])
1950 AC_LANG_POP([C++])
1951 ]
1952)
1953
1954# Depending on whether nlfaultinjection has been configured for an internal
1955# location, its directory stem within this package needs to be set
1956# accordingly. In addition, if the location is internal, then we need
1957# to attempt to pull it down using the bootstrap makefile.
1958
1959if test "${nl_with_nlfaultinjection}" = "internal"; then
1960 maybe_nlfaultinjection_dirstem="nlfaultinjection/repo"
1961 nlfaultinjection_dirstem="third_party/${maybe_nlfaultinjection_dirstem}"
1962
1963 AC_MSG_NOTICE([attempting to create internal ${nlfaultinjection_dirstem}])
1964
1965 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlfaultinjection_dirstem}
1966
1967 if test $? -ne 0; then
1968 AC_MSG_ERROR([failed to create ${nlfaultinjection_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1969 fi
1970else
1971 maybe_nlfaultinjection_dirstem=""
1972fi
1973
1974AC_SUBST(NLFAULTINJECTION_SUBDIRS, [${maybe_nlfaultinjection_dirstem}])
1975AM_CONDITIONAL([CHIP_WITH_NLFAULTINJECTION], [test "${nl_with_nlfaultinjection}" != "no"])
1976AM_CONDITIONAL([CHIP_WITH_NLFAULTINJECTION_INTERNAL], [test "${nl_with_nlfaultinjection}" = "internal"])
1977
1978if test "${nl_with_nlfaultinjection}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001979 AC_DEFINE([CHIP_WITH_NLFAULTINJECTION], [0], [Define to 0 to build CHIP without nlFaultInjection features])
Grant Erickson81bc5702020-03-18 10:26:28 -07001980else
1981 AC_DEFINE([CHIP_WITH_NLFAULTINJECTION], [1], [Define to 1 to build CHIP with nlFaultInjection features])
1982fi
1983
1984if test "${nl_cv_build_tests}" = "yes"; then
1985 if test "${nl_with_nlfaultinjection}" = "no"; then
1986 AC_MSG_ERROR(CHIP tests require nlfaultinjection.)
1987 fi
1988fi
1989
Jiacheng Guo10be6f02020-07-08 13:46:03 +08001990#
1991# otbr-client
1992#
1993
1994NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1995 [ot_br_posix],
1996 [OT_BR_POSIX],
1997 [ot_br_posix],
1998 [-lot_br_client],
1999 [
2000 OT_BR_POSIX_CPPFLAGS="-I\${abs_top_srcdir}/third_party/ot-br-posix/repo/include/ -I\${abs_top_srcdir}/third_party/ot-br-posix/repo/src/"
2001 OT_BR_POSIX_LDFLAGS="-L${ac_pwd}/third_party/ot-br-posix/"
2002 OT_BR_POSIX_LIBS="-lot_br_client"
2003 ],
2004 [
2005 # Check for required nlfaultinjection headers.
2006 AC_LANG_PUSH([C++])
2007 AC_CHECK_HEADERS([dbus/client/thread_api_dbus.hpp],
2008 [],
2009 [
2010 AC_MSG_ERROR(The OpenThread border router header "$ac_header" is required but cannot be found.)
2011 ])
2012 AC_LANG_POP([C++])
2013 ]
2014)
2015
2016AC_MSG_NOTICE("nl_with_ot_br_posix=${nl_with_ot_br_posix}")
2017
2018if test "${nl_with_ot_br_posix}" = "internal" && test "${with_device_layer}" = "linux"; then
2019 maybe_ot_br_posix_dirstem="ot-br-posix"
2020 ot_br_posix_dirstem="third_party/${maybe_ot_br_posix_dirstem}/repo"
2021
2022 AC_MSG_NOTICE([attempting to create internal ${ot_br_posix_dirstem}])
2023
2024 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${ot_br_posix_dirstem}
2025
2026 if test $? -ne 0; then
2027 AC_MSG_ERROR([failed to create ${ot_br_posix_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
2028 fi
2029
2030 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4)
2031 AC_SUBST([DBUS_CFLAGS])
2032 AC_SUBST([DBUS_LIBS])
2033else
2034 maybe_ot_br_posix_dirstem=
2035fi
2036
2037AC_SUBST(OT_BR_POSIX_SUBDIRS, [${maybe_ot_br_posix_dirstem}])
2038AM_CONDITIONAL([CHIP_WITH_OT_BR_POSIX], [test "${nl_with_ot_br_posix}" != "no"])
Grant Erickson81bc5702020-03-18 10:26:28 -07002039
2040#
Martin Turonba1a0282020-03-10 19:25:02 -07002041# Nlunit-test
2042#
2043
2044if test "${nl_cv_build_tests}" = "yes"; then
2045 NL_WITH_PACKAGE(
2046 [Nlunit-test],
2047 [NLUNIT_TEST],
2048 [nlunit_test],
2049 [-lnlunit-test],
2050 [
2051 # At this point, the internal Nlunit-test package will be neither
2052 # configured nor built, so the normal checks we undertake for an
2053 # external package cannot be run here. Simply set the appropriate
2054 # variables and trust all will be well.
2055
2056 NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src"
2057 NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src"
2058 NLUNIT_TEST_LIBS="-lnlunit-test"
2059 ],
2060 [
2061 # Check for required nlunit-test headers.
2062
2063 AC_CHECK_HEADERS([nlunit-test.h],
2064 [],
2065 [
2066 AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.)
2067 ])
2068 ])
2069fi
2070
2071# Depending on whether nlunit-test has been configured for an internal
2072# location, its directory stem within this package needs to be set
2073# accordingly. In addition, if the location is internal, then we need
2074# to attempt to pull it down using the bootstrap makefile.
2075
2076if test "${nl_with_nlunit_test}" = "internal"; then
2077 maybe_nlunit_test_dirstem="nlunit-test/repo"
2078 nlunit_test_dirstem="third_party/${maybe_nlunit_test_dirstem}"
2079
2080 AC_MSG_NOTICE([attempting to create internal ${nlunit_test_dirstem}])
2081
2082 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlunit_test_dirstem}
2083
2084 if test $? -ne 0; then
2085 AC_MSG_ERROR([failed to create ${nlunit_test_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
2086 fi
2087else
2088 maybe_nlunit_test_dirstem=""
2089fi
2090
2091AC_SUBST(NLUNIT_TEST_SUBDIRS, [${maybe_nlunit_test_dirstem}])
2092AM_CONDITIONAL([CHIP_WITH_NLUNIT_TEST_INTERNAL], [test "${nl_with_nlunit_test}" = "internal"])
2093
2094#
Yufeng Wang92904f42020-06-15 13:46:29 -07002095#
2096# IniPP
2097#
2098
2099if test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1; then
2100 NL_WITH_PACKAGE(
2101 [IniPP],
2102 [INIPP],
2103 [],
2104 [],
2105 [
2106 INIPP_CPPFLAGS="-I\${abs_top_srcdir}/third_party/inipp/repo/inipp"
2107 ],
2108 [
2109 # Check for required IniPP headers.
2110
2111 AC_CHECK_HEADERS([inipp.h],
2112 [],
2113 [
2114 AC_MSG_ERROR(The IniPP header "inipp.h" is required but cannot be found.)
2115 ])
2116 ]
2117 )
2118fi
2119
2120#
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002121#
2122# GIO
2123#
2124
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002125CHIP_ENABLE_GIO=0
2126
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002127if test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1; then
2128 PKG_CHECK_MODULES([GIO], [gio-2.0])
2129
2130 # Check for GIO library is available.
2131 AC_CHECK_LIB([gio-2.0], [g_bus_get_sync],
2132 [
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002133 CHIP_ENABLE_GIO=1
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002134 AC_DEFINE([CHIP_WITH_GIO], [1], [Define to 1 to build CHIP with GIO])
2135 ],
2136 [
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002137 CHIP_ENABLE_GIO=0
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002138 AC_DEFINE([CHIP_WITH_GIO], [0], [Define to 0 to build CHIP without GIO])
2139 ]
2140 )
yunhanw-googlec0cde152020-07-29 06:33:50 -07002141
2142 PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0])
2143
2144 AC_CHECK_PROG(GDBUSCODEGEN, gdbus-codegen, gdbus-codegen)
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002145fi
2146
2147#
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002148#
2149# WPA
2150#
2151
2152CONFIG_WIFI_PLATFORM_WPA=0
2153enable_chipwifi_wpa="no"
2154
2155# At this time, enable this only for linux, and only if the GIO package are installed. Currently, WiFi and Thread
2156# are depending on the gdbus-internal configured by internal BLuez package.
2157# TODO: Refacrot BLuez to use common gdbus lib from GIO.
2158
2159if test "${with_device_layer}" = "linux" && test "${CHIP_ENABLE_GIO}" = 1 && test "${CONFIG_BLE_PLATFORM_BLUEZ}" = 1; then
2160case "${target}" in
2161 *linux*)
2162 CONFIG_WIFI_PLATFORM_WPA=1
2163 enable_chipwifi_wpa="yes"
2164 ;;
2165 *)
2166 CONFIG_WIFI_PLATFORM_WPA=0
2167 enable_chipwifi_wpa="no"
2168 ;;
2169 esac
2170fi
2171
2172AM_CONDITIONAL([CONFIG_WIFI_PLATFORM_WPA], [test "${enable_chipwifi_wpa}" = "yes"])
2173AC_DEFINE_UNQUOTED([CHIP_DEVICE_CONFIG_ENABLE_WPA],[${CONFIG_WIFI_PLATFORM_WPA}],[Define to 1 if you want to enable WPA support for wpa_supplicant.])
2174
2175#
Martin Turonba1a0282020-03-10 19:25:02 -07002176# Sockets
2177#
2178
2179# Influential external variables for BSD Sockets support
2180
2181AC_ARG_VAR(SOCKETS_CPPFLAGS, [BSD Sockets C preprocessor flags])
2182AC_ARG_VAR(SOCKETS_LDFLAGS, [BSD Sockets linker flags])
2183AC_ARG_VAR(SOCKETS_LIBS, [BSD Sockets linker libraries])
2184
2185
2186#
2187# Check for headers
2188#
2189AC_HEADER_STDBOOL
2190AC_HEADER_STDC
2191
2192AC_CHECK_HEADERS([ctype.h])
2193AC_CHECK_HEADERS([ifaddrs.h])
2194AC_CHECK_HEADERS([stdint.h])
2195AC_CHECK_HEADERS([stdlib.h])
2196AC_CHECK_HEADERS([string.h])
2197
2198# Check for netinet/icmp6.h for ICMP6_FILTER support. Both Android and
2199# Mac OS X fail to properly include both netinet/in.h and sys/types.h
2200# in netinet/icmp6.h, making the check fail unless it exists and these
2201# are both also included.
2202
2203AC_CHECK_HEADERS([netinet/in.h])
2204AC_CHECK_HEADERS([sys/types.h])
2205AC_CHECK_HEADERS([netinet/icmp6.h], [], [],
2206[
2207#if HAVE_SYS_TYPES_H
2208# include <sys/types.h>
2209#endif
2210#if HAVE_NETINET_IN_H
2211# include <netinet/in.h>
2212#endif
2213])
2214
2215# But, wait, this still isn't enough. Even with all of that, Android
2216# may still not have the ICMP6_FILTER socket option defined. Check for
2217# that too.
2218
2219AC_MSG_CHECKING([whether netinet/icmp6.h declares ICMP6_FILTER])
2220AC_COMPILE_IFELSE([
2221 AC_LANG_PROGRAM(
2222[[
2223#if HAVE_SYS_TYPES_H
2224# include <sys/types.h>
2225#endif
2226#if HAVE_NETINET_IN_H
2227# include <netinet/in.h>
2228#endif
2229#if HAVE_NETINET_ICMP6_H
2230# include <netinet/icmp6.h>
2231#endif
2232]],
2233[[
2234#if !defined(ICMP6_FILTER)
2235# error "ICMP6_FILTER is not defined"
2236#endif
2237]])],
2238[
2239AC_MSG_RESULT([yes])
2240AC_DEFINE(HAVE_ICMP6_FILTER, 1, [Define to 1 if your <netinet/icmp6.h> header file defines the ICMP6_FILTER socket option.])
2241],
2242[
2243AC_MSG_RESULT([no])
2244])
2245
2246# Check for sys/socket.h for SO_BINDTODEVICE support.
2247
2248AC_CHECK_HEADERS([sys/socket.h])
2249
2250AC_MSG_CHECKING([whether sys/socket.h declares SO_BINDTODEVICE])
2251AC_COMPILE_IFELSE([
2252 AC_LANG_PROGRAM(
2253[[
2254#if HAVE_SYS_SOCKET_H
2255# include <sys/socket.h>
2256#endif
2257]],
2258[[
2259#if !defined(SO_BINDTODEVICE)
2260# error "SO_BINDTODEVICE is not defined"
2261#endif
2262]])],
2263[
2264AC_MSG_RESULT([yes])
2265AC_DEFINE(HAVE_SO_BINDTODEVICE, 1, [Define to 1 if your <sys/socket.h> header file defines the SO_BINDTODEVICE socket option.])
2266],
2267[
2268AC_MSG_RESULT([no])
2269])
2270
2271# Check for sys/sockio.h
2272AC_CHECK_HEADERS([sys/sockio.h])
2273
2274#
2275# Check for types and structures
2276#
2277AC_TYPE_INT8_T
2278AC_TYPE_INT16_T
2279AC_TYPE_INT32_T
2280AC_TYPE_INT64_T
2281AC_TYPE_UINT8_T
2282AC_TYPE_UINT16_T
2283AC_TYPE_UINT32_T
2284AC_TYPE_UINT64_T
2285
2286#
2287# Checks for library functions
2288#
2289
2290CONFIG_HAVE_HEAP=0
2291
2292if test "${ac_no_link}" != "yes"; then
2293 # Check for stdlib memory management functions.
2294 AC_CHECK_FUNCS([malloc free realloc strdup], [CONFIG_HAVE_HEAP=1], [CONFIG_HAVE_HEAP=0])
2295 AC_CHECK_FUNCS([memchr memcmp memmove memset])
2296 AC_CHECK_FUNCS([strchr strcmp strlen])
2297 AC_CHECK_FUNCS([snprintf])
2298
2299 # Some versions of Android are missing getifaddrs and
2300 # freeifaddrs. Check to see if the target system is such a version.
2301
2302 AC_CHECK_FUNCS([getifaddrs freeifaddrs])
2303
2304 # Check for clock_gettime, gettimeofday, settimeofday and localtime.
2305 # In some target environments, clock_gettime exists in librt.
2306
2307 AC_SEARCH_LIBS([clock_gettime], [rt])
2308 AC_CHECK_FUNCS([clock_gettime gettimeofday localtime])
2309 AC_CHECK_HEADERS([time.h sys/time.h])
2310 AC_CHECK_TYPES([clockid_t], [], [], [[#include <time.h>]])
2311
2312 # Check for clock_settime. This function exists on iOS, however the compiler prevents
2313 # reference to it via the use of an "unavailable" attribute. Unfortunately, this goes
2314 # unnoticed by autoconf's AC_CHECK_FUNCS macro, hence the need for custom detection code.
2315
2316 AC_SEARCH_LIBS([clock_settime], [rt])
2317 AC_MSG_CHECKING([clock_settime])
2318 AC_LINK_IFELSE(
2319 [AC_LANG_SOURCE([[
2320 #include <stdlib.h>
2321 #include <time.h>
2322 int main(int argc, char *argv[])
2323 {
2324 clock_settime(CLOCK_REALTIME, NULL);
2325 return 0;
2326 }
2327 ]])],
2328 [AC_DEFINE([HAVE_CLOCK_SETTIME], [1], [Define to 1 if you have the `clock_settime' function.]) AC_MSG_RESULT([yes])],
2329 [AC_MSG_RESULT([no])]
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07002330 )
Martin Turonba1a0282020-03-10 19:25:02 -07002331
2332 # Note that different platforms have different APIs for monotonic timer with sleep time compensation.
2333 # CLOCK_BOOTTIME is available in later versions of linux and Android
2334
2335 AC_CHECK_DECLS([CLOCK_MONOTONIC, CLOCK_BOOTTIME], [], [], [[#include <time.h>]])
2336fi
2337
2338AC_SUBST(CONFIG_HAVE_HEAP)
2339AM_CONDITIONAL([CONFIG_HAVE_HEAP], [test "${CONFIG_HAVE_HEAP}" = "1"])
2340
2341#
2342# Check for POSIX thread (pthread) support
2343#
2344AX_PTHREAD([], [])
2345
2346AC_CHECK_DECL([PTHREAD_NULL], [], [AC_DEFINE([PTHREAD_NULL],[0], [Approximation of PTHREAD_NULL since pthread.h does not define one])],
2347 [[#include <pthread.h>]])
2348
2349#
Vivien Nicolas79625962020-06-19 00:28:26 +02002350# Check for Network.framework
2351#
2352if test "${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}" = "1"; then
2353 AC_CHECK_HEADER([Network/Network.h])
2354 LDFLAGS="${LDFLAGS} -lnetwork"
2355fi
2356
2357#
Martin Turonba1a0282020-03-10 19:25:02 -07002358# Check for <new>
2359#
2360AC_LANG_PUSH([C++])
2361
2362AC_CHECK_HEADERS([new])
2363
2364AC_LANG_POP([C++])
2365
2366
2367# Add test enabled macro
2368if test "${nl_cv_build_tests}" = "yes"; then
2369 CPPFLAGS="${CPPFLAGS} -DNL_CHIP_WITH_TESTS"
2370 CPPFLAGS="${CPPFLAGS} -DCHIP_CONFIG_TEST=1"
2371 CPPFLAGS="${CPPFLAGS} -DCHIP_SYSTEM_CONFIG_TEST=1"
2372 CPPFLAGS="${CPPFLAGS} -DCHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS=1"
2373 if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
2374 CPPFLAGS="${CPPFLAGS} -DINET_CONFIG_TEST=1"
2375 fi
2376fi
2377
Pankaj Garg5daed722020-04-20 16:55:31 -07002378# Add any crypto-implementation CPPFLAGS, LDFLAGS, and LIBS
Rob Walkerae3a9002020-04-15 13:48:47 -07002379
Pankaj Garg5daed722020-04-20 16:55:31 -07002380CRYPTO_CPPFLAGS="${CRYPTO_CPPFLAGS} ${MBEDTLS_CPPFLAGS} ${OPENSSL_CPPFLAGS}"
2381CRYPTO_LDFLAGS="${CRYPTO_LDFLAGS} ${MBEDTLS_LDFLAGS} ${OPENSSL_LDFLAGS}"
2382CRYPTO_LIBS="${CRYPTO_LIBS} ${MBEDTLS_LIBS} ${OPENSSL_LIBS}"
Martin Turonba1a0282020-03-10 19:25:02 -07002383
Pankaj Garg5daed722020-04-20 16:55:31 -07002384AC_SUBST(CRYPTO_CPPFLAGS)
2385AC_SUBST(CRYPTO_LDFLAGS)
2386AC_SUBST(CRYPTO_LIBS)
Martin Turonba1a0282020-03-10 19:25:02 -07002387
Yakun Xu47f325f2020-07-15 00:10:33 +08002388CPPFLAGS="${CPPFLAGS} ${CRYPTO_CPPFLAGS} ${OPENTHREAD_CPPFLAGS}"
2389LDFLAGS="${LDFLAGS} ${CRYPTO_LDFLAGS} ${OPENTHREAD_LDFLAGS}"
2390LIBS="${LIBS} ${CRYPTO_LIBS} ${OPENTHREAD_LIBS}"
Pankaj Garg139d43b2020-04-15 19:04:57 -07002391
Martin Turonba1a0282020-03-10 19:25:02 -07002392# Add any code coverage CPPFLAGS, LDFLAGS, and LIBS
2393
2394CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}"
2395LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}"
2396LIBS="${LIBS} ${NL_COVERAGE_LIBS}"
2397
2398# Fold in the warning-as-errors flag, unless it was already in effect.
2399
2400if test "${nl_had_CPPFLAGS_werror}" = "no"; then
2401 CPPFLAGS="${CPPFLAGS} ${NL_WERROR_CPPFLAGS}"
2402fi
2403
Rob Walkerae3a9002020-04-15 13:48:47 -07002404
Martin Turonba1a0282020-03-10 19:25:02 -07002405# At this point, we can restore the compiler flags to whatever the
2406# user passed in, now that we're clear of an -Werror issues by
2407# transforming -Wno-error back to -Werror.
2408
2409NL_RESTORE_WERROR
2410
2411#
2412# Code style
2413#
2414
Rob Walker1826e1d2020-04-23 13:55:34 -07002415AC_SUBST(PRETTY, ["\${abs_top_srcdir}/scripts/helpers/clang-format.sh"])
Martin Turonba1a0282020-03-10 19:25:02 -07002416AC_SUBST(PRETTY_ARGS, ["-style=file -i"])
Rob Walker1826e1d2020-04-23 13:55:34 -07002417AC_SUBST(PRETTY_CHECK, ["\${abs_top_srcdir}/scripts/helpers/clang-format-check.sh"])
Martin Turonba1a0282020-03-10 19:25:02 -07002418AC_SUBST(PRETTY_CHECK_ARGS, [""])
2419
2420# Configure any autotools-based subdirectories
2421if test "${nl_with_nlunit_test}" = "internal"; then
2422AC_CONFIG_SUBDIRS([third_party/nlunit-test/repo])
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002423AC_SUBST(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlunit-test/repo/src"])
Martin Turonba1a0282020-03-10 19:25:02 -07002424fi
2425
2426if test "${nl_with_nlio}" = "internal"; then
2427AC_CONFIG_SUBDIRS([third_party/nlio/repo])
2428fi
2429
2430if test "${nl_with_nlassert}" = "internal"; then
2431AC_CONFIG_SUBDIRS([third_party/nlassert/repo])
Pankaj Garg5f7b9522020-04-18 16:58:54 -07002432fi
2433
Grant Erickson81bc5702020-03-18 10:26:28 -07002434if test "${nl_with_nlfaultinjection}" = "internal"; then
2435AC_CONFIG_SUBDIRS([third_party/nlfaultinjection/repo])
Grant Erickson9299bd32020-05-13 10:08:01 -07002436AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo/src"])
Rob Walker1eef6cf2020-04-20 18:16:12 -07002437fi
2438
yunhanw-googlee1d448c2020-07-21 11:57:53 -07002439if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
2440AC_CONFIG_SUBDIRS([third_party/bluez/repo])
2441fi
2442
Rob Walker1eef6cf2020-04-20 18:16:12 -07002443if test "${nl_with_mbedtls}" = "internal"; then
2444AC_CONFIG_SUBDIRS([third_party/mbedtls/repo])
Grant Erickson81bc5702020-03-18 10:26:28 -07002445fi
2446
Grant Erickson9299bd32020-05-13 10:08:01 -07002447if test "${nl_with_lwip}" = "internal"; then
2448AC_SUBST(LWIP_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/src/lwip"])
2449fi
2450
Martin Turonba1a0282020-03-10 19:25:02 -07002451#
2452# Identify the various makefiles and auto-generated files for the package
2453#
2454AC_CONFIG_FILES([
2455Makefile
Martin Turone4c92e12020-05-13 10:36:33 -07002456docs/Makefile
Martin Turonef904ab2020-04-20 18:15:33 -07002457examples/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002458third_party/Makefile
2459third_party/lwip/Makefile
Grant Ericksona353a452020-04-24 08:39:46 -07002460third_party/mbedtls/Makefile
Jiacheng Guo10be6f02020-07-08 13:46:03 +08002461third_party/ot-br-posix/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002462src/Makefile
Grant Ericksondf2490952020-04-03 14:25:30 -07002463src/include/Makefile
Rob Walker06724df2020-05-26 11:09:01 -07002464src/app/Makefile
Boris Zbarsky4dd52302020-07-21 12:20:49 -04002465src/app/chip-zcl-zpro/Makefile
Boris Zbarsky3c021ad2020-08-07 14:15:22 -04002466src/app/clusters/Makefile
Boris Zbarsky3c021ad2020-08-07 14:15:22 -04002467src/app/util/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002468src/ble/Makefile
Grant Erickson5f1fe832020-04-03 10:56:51 -07002469src/ble/tests/Makefile
Vidhi Shah4a9410e2020-07-29 11:47:11 -07002470src/controller/java/Makefile
Bhaskar Sarma242d1712020-04-01 15:49:17 -07002471src/crypto/Makefile
2472src/crypto/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002473src/lwip/Makefile
2474src/lwip/tests/Makefile
2475src/system/Makefile
2476src/system/tests/Makefile
Martin Turon9389ebe2020-03-16 22:00:38 -07002477src/setup_payload/Makefile
Vidhi Shah92fda7c2020-07-07 07:47:51 -07002478src/setup_payload/java/Makefile
Martin Turon9389ebe2020-03-16 22:00:38 -07002479src/setup_payload/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002480src/inet/Makefile
Grant Erickson8e583362020-03-31 10:40:56 -07002481src/inet/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002482src/lib/Makefile
Grant Erickson5f1fe832020-04-03 10:56:51 -07002483src/lib/core/tests/Makefile
Martin Turon6f6c6d82020-06-10 10:10:10 -07002484src/lib/shell/Makefile
2485src/lib/shell/tests/Makefile
Grant Ericksond30c2302020-04-01 11:33:22 -07002486src/lib/support/Makefile
Grant Erickson9189b872020-04-02 10:49:27 -07002487src/lib/support/tests/Makefile
Pankaj Garg73f9cdc2020-03-23 15:47:39 -07002488src/platform/Makefile
Martin Turon0c03fa82020-05-26 15:43:11 -07002489src/platform/tests/Makefile
shana-appleab8ffd52020-05-20 18:25:29 +02002490src/qrcodetool/Makefile
Andrei Litvin343b5ad2020-05-27 16:29:50 -04002491src/transport/Makefile
2492src/transport/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002493])
2494
2495#
2496# Generate the auto-generated files for the package
2497#
2498AC_OUTPUT
2499
2500#
2501# Summarize the package configuration
2502#
2503
2504AC_MSG_NOTICE([
2505
2506 Configuration Summary
2507 ---------------------
2508 Package : ${PACKAGE_NAME}
2509 Version : ${PACKAGE_VERSION}
2510 Interface : ${LIBCHIP_VERSION_INFO//:/.}
2511 Build system : ${build}
2512 Host system : ${host}
2513 Target system : ${target}
2514 Target architecture : ${target_cpu}
2515 Target OS : ${target_os}
2516 Target style : ${CHIP_TARGET_STYLE}
Martin Turon0c03fa82020-05-26 15:43:11 -07002517 Device layer : ${CHIP_DEVICE_LAYER_TARGET}
Pankaj Garg5daed722020-04-20 16:55:31 -07002518 Cryptographic implementation : ${CHIP_CRYPTO}
Martin Turonba1a0282020-03-10 19:25:02 -07002519 Target network layer : ${with_network_layer}
2520 Target network system(s) : ${CONFIG_TARGET_NETWORKS}
2521 IPv4 enabled : ${enable_ipv4}
2522 Internet endpoint(s) : ${INET_ENDPOINTS}
2523 Printf enhancements : ${CHIP_ENHANCED_PRINTF}
2524 Android support : ${with_android}
2525 Logging style : ${CHIP_LOGGING_STYLE}
2526 Cross compiling : ${cross_compiling}
2527 Build shared libraries : ${enable_shared}
2528 Build static libraries : ${enable_static}
2529 Build debug libraries : ${nl_cv_build_debug}
2530 Build profile libraries : ${build_profile}
2531 Build optimized libraries : ${nl_cv_build_optimized}
2532 Build coverage libraries : ${nl_cv_build_coverage}
2533 Build coverage reports : ${nl_cv_build_coverage_reports}
2534 Lcov : ${LCOV:--}
2535 Genhtml : ${GENHTML:--}
Grant Erickson6d7428b2020-05-11 16:31:38 -07002536 Happy : ${with_happy}
2537 Happy Path : ${happy_path}
Martin Turonba1a0282020-03-10 19:25:02 -07002538 Treat warnings as errors : ${nl_cv_warnings_as_errors}
2539 Build tests : ${nl_cv_build_tests}
2540 Build long running tests : ${nl_cv_build_long_tests}
2541 Build tools : ${build_tools}
2542 Tunnel Failover support : ${build_tunnel_failover}
Martin Turonba1a0282020-03-10 19:25:02 -07002543 Prefix : ${prefix}
2544 Shadow directory program : ${LNDIR}
2545 Cocoa support : ${enable_cocoa}
2546 Java support : ${enable_java}
2547 Java home : ${JAVA_HOME:--}
2548 Java Compiler : ${JAVAC:--}
2549 Java Native Interface (JNI) compile flags : ${JNI_CPPFLAGS:--}
2550 Java Archiver : ${JAR:--}
2551 Python executable : ${PYTHON:--}
2552 Python version : ${PYTHON_VERSION:--}
2553 Python script directory : ${pythondir:--}
2554 Python extension directory : ${pyexecdir:--}
2555 Verhoeff support : ${enable_verhoeff}
2556 Pairing code decoding support : ${enable_pairing_code_decoding}
2557 Documentation support : ${nl_cv_build_docs}
2558 Clang-format : ${CLANG_FORMAT:--}
2559 Doxygen : ${DOXYGEN:--}
2560 GraphViz dot : ${DOT:--}
2561 PERL : ${PERL:--}
yunhanw-googlee1d448c2020-07-21 11:57:53 -07002562 CHIP over BlueZ support : ${enable_chipoble_bluez:--}
2563 BlueZ source : ${nl_with_bluez:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002564 Valgrind : ${VALGRIND:--}
2565 LwIP source : ${nl_with_lwip:--}
2566 LwIP compile flags : ${LWIP_CPPFLAGS:--}
2567 LwIP link flags : ${LWIP_LDFLAGS:--}
2568 LwIP link libraries : ${LWIP_LIBS:--}
Grant Erickson9299bd32020-05-13 10:08:01 -07002569 LwIP foreign subdirectory dependency : ${LWIP_FOREIGN_SUBDIR_DEPENDENCY:--}
Grant Ericksona353a452020-04-24 08:39:46 -07002570 mbedTLS source : ${nl_with_mbedtls:--}
Pankaj Garg139d43b2020-04-15 19:04:57 -07002571 mbedTLS compile flags : ${MBEDTLS_CPPFLAGS:--}
2572 mbedTLS link flags : ${MBEDTLS_LDFLAGS:--}
2573 mbedTLS link libraries : ${MBEDTLS_LIBS:--}
Yakun Xu47f325f2020-07-15 00:10:33 +08002574 OpenThread source : ${nl_with_openthread}
2575 OpenThread compile flags : ${OPENTHREAD_CPPFLAGS:--}
2576 OpenThread link flags : ${OPENTHREAD_LDFLAGS:--}
2577 OpenThread link libraries : ${OPENTHREAD_LIBS:--}
Pankaj Garg5daed722020-04-20 16:55:31 -07002578 OpenSSL source : ${nl_with_openssl}
2579 OpenSSL compile flags : ${OPENSSL_CPPFLAGS:--}
2580 OpenSSL link flags : ${OPENSSL_LDFLAGS:--}
2581 OpenSSL link libraries : ${OPENSSL_LIBS:--}
2582 Crypto implementation compile flags : ${CRYPTO_CPPFLAGS:--}
2583 Crypto implementation link flags : ${CRYPTO_LDFLAGS:--}
2584 Crypto implementation link libraries : ${CRYPTO_LIBS:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002585 Nlunit-test source : ${nl_with_nlunit_test:--}
2586 Nlunit-test compile flags : ${NLUNIT_TEST_CPPFLAGS:--}
2587 Nlunit-test link flags : ${NLUNIT_TEST_LDFLAGS:--}
2588 Nlunit-test link libraries : ${NLUNIT_TEST_LIBS:--}
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002589 Nlunit-test foreign subdirectory dependency : ${NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002590 Nlio source : ${nl_with_nlio:--}
2591 Nlio compile flags : ${NLIO_CPPFLAGS:--}
2592 Nlio link flags : ${NLIO_LDFLAGS:--}
2593 Nlio link libraries : ${NLIO_LIBS:--}
2594 Nlassert source : ${nl_with_nlassert:--}
2595 Nlassert compile flags : ${NLASSERT_CPPFLAGS:--}
2596 Nlassert link flags : ${NLASSERT_LDFLAGS:--}
2597 Nlassert link libraries : ${NLASSERT_LIBS:--}
2598 Nlfaultinjection source : ${nl_with_nlfaultinjection:--}
2599 Nlfaultinjection compile flags : ${NLFAULTINJECTION_CPPFLAGS:--}
2600 Nlfaultinjection link flags : ${NLFAULTINJECTION_LDFLAGS:--}
2601 Nlfaultinjection link libraries : ${NLFAULTINJECTION_LIBS:--}
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002602 Nlfaultinjection foreign subdirectory dependency : ${NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002603 Sockets compile flags : ${SOCKETS_CPPFLAGS:--}
2604 Sockets link flags : ${SOCKETS_LDFLAGS:--}
2605 Sockets link libraries : ${SOCKETS_LIBS:--}
2606 PThreads compile flags : ${PTHREAD_CFLAGS:--}
2607 PThreads link libraries : ${PTHREAD_LIBS:--}
Yufeng Wang92904f42020-06-15 13:46:29 -07002608 IniPP compile flags : ${INIPP_CPPFLAGS:--}
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002609 GIO compile flags : ${GIO_CFLAGS:--}
Vivien Nicolas03209202020-07-21 20:57:37 +02002610 GIO link flags : ${GIO_LIBS:--}
yunhanw-googlec0cde152020-07-29 06:33:50 -07002611 GIO UNIX compile flags : ${GIO_UNIX_CFLAGS:--}
2612 GIO UNIX link flags : ${GIO_UNIX_LIBS:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002613 C Preprocessor : ${CPP}
2614 C Compiler : ${CC}
2615 C++ Preprocessor : ${CXXCPP}
2616 C++ Compiler : ${CXX}
2617 Objective C Compiler : ${OBJC:--}
2618 Objective C++ Compiler : ${OBJCXX:--}
2619 Archiver : ${AR}
2620 Archive Indexer : ${RANLIB}
2621 Symbol Stripper : ${STRIP}
2622 Object Copier : ${OBJCOPY}
2623 C Preprocessor flags : ${CPPFLAGS:--}
2624 C Compile flags : ${CFLAGS:--}
2625 C++ Compile flags : ${CXXFLAGS:--}
2626 Objective C Compile flags : ${OBJCFLAGS:--}
2627 Objective C++ Compile flags : ${OBJCXXFLAGS:--}
2628 Symbol Visibility C Compile flags : ${VISIBILITY_CFLAGS:--}
2629 Symbol Visibility C++ Compile flags : ${VISIBILITY_CXXFLAGS:--}
2630 Symbol Visibility Objective C Compile flags : ${VISIBILITY_OBJCFLAGS:--}
2631 Symbol Visibility Objective C++ Compile flags : ${VISIBILITY_OBJCXXFLAGS:--}
2632 Link flags : ${LDFLAGS:--}
2633 Link libraries : ${LIBS}
2634 Fuzzing Enabled : ${enable_fuzzing}
Martin Turonba1a0282020-03-10 19:25:02 -07002635])