blob: 05455658b6794439e874b5330707a0a135066c5f [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],
doru91edac1aa2020-08-20 04:28:05 +0300969 [Specify the target environment for the CHIP Device Layer. Choose one of: auto, darwin, efr32, esp32, nrf5, k32w, nrfconnect, linux, or none @<:@default=auto@:>@.])],
Martin Turonba1a0282020-03-10 19:25:02 -0700970 [
971 case "${with_device_layer}" in
972
doru91edac1aa2020-08-20 04:28:05 +0300973 auto|darwin|efr32|esp32|nrf5|k32w|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
doru91edac1aa2020-08-20 04:28:05 +0300990CHIP_DEVICE_LAYER_TARGET_K32W=0
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +0200991CHIP_DEVICE_LAYER_TARGET_LINUX=0
Damian Królik34a4a932020-07-20 20:07:50 +0200992CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=0
Martin Turon0c03fa82020-05-26 15:43:11 -0700993
Vivien Nicolas694f20d2020-07-16 22:48:40 +0200994if test "${with_device_layer}" = "auto"; then
995 case ${target_os} in
996
997 *darwin*)
998 with_device_layer=darwin
999 ;;
1000
1001 *linux*)
1002 with_device_layer=linux
1003 ;;
1004
1005 *)
1006 with_device_layer=none
1007 ;;
1008
1009 esac
1010fi
1011
Martin Turonba1a0282020-03-10 19:25:02 -07001012case "${with_device_layer}" in
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001013
1014darwin)
Martin Turon0c03fa82020-05-26 15:43:11 -07001015 CONFIG_DEVICE_LAYER=1
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001016 CHIP_DEVICE_LAYER_TARGET=Darwin
1017 CHIP_DEVICE_LAYER_TARGET_DARWIN=1
1018 ;;
1019
1020efr32)
1021 CONFIG_DEVICE_LAYER=1
1022 CHIP_DEVICE_LAYER_TARGET=EFR32
1023 CHIP_DEVICE_LAYER_TARGET_EFR32=1
Martin Turon0c03fa82020-05-26 15:43:11 -07001024 ;;
1025
Martin Turonba1a0282020-03-10 19:25:02 -07001026esp32)
1027 CONFIG_DEVICE_LAYER=1
1028 CHIP_DEVICE_LAYER_TARGET=ESP32
1029 CHIP_DEVICE_LAYER_TARGET_ESP32=1
Martin Turonba1a0282020-03-10 19:25:02 -07001030 ;;
1031
1032nrf5)
1033 CONFIG_DEVICE_LAYER=1
1034 CHIP_DEVICE_LAYER_TARGET=nRF5
1035 CHIP_DEVICE_LAYER_TARGET_NRF5=1
Yakun Xu47f325f2020-07-15 00:10:33 +08001036 CFLAGS="${CFLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs"
1037 CXXFLAGS="${CXXFLAGS} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs"
Martin Turonba1a0282020-03-10 19:25:02 -07001038 ;;
doru91edac1aa2020-08-20 04:28:05 +03001039
1040
1041k32w)
1042 CONFIG_DEVICE_LAYER=1
1043 CHIP_DEVICE_LAYER_TARGET=K32W
1044 CHIP_DEVICE_LAYER_TARGET_K32W=1
1045 ;;
Martin Turonba1a0282020-03-10 19:25:02 -07001046
Damian Królik34a4a932020-07-20 20:07:50 +02001047nrfconnect)
1048 CONFIG_DEVICE_LAYER=1
1049 CHIP_DEVICE_LAYER_TARGET=nrfconnect
1050 CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=1
1051 ;;
1052
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001053linux)
Martin Turonba1a0282020-03-10 19:25:02 -07001054 CONFIG_DEVICE_LAYER=1
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001055 CHIP_DEVICE_LAYER_TARGET=Linux
1056 CHIP_DEVICE_LAYER_TARGET_LINUX=1
Martin Turonba1a0282020-03-10 19:25:02 -07001057 ;;
1058
1059none)
1060 CONFIG_DEVICE_LAYER=0
1061 CHIP_DEVICE_LAYER_TARGET=NONE
Martin Turonba1a0282020-03-10 19:25:02 -07001062 ;;
Martin Turonba1a0282020-03-10 19:25:02 -07001063esac
1064
1065AC_SUBST(CONFIG_DEVICE_LAYER)
1066AM_CONDITIONAL([CONFIG_DEVICE_LAYER], [test "${CONFIG_DEVICE_LAYER}" = 1])
1067AC_DEFINE_UNQUOTED([CONFIG_DEVICE_LAYER],[${CONFIG_DEVICE_LAYER}],[Define to 1 if you want to use the CHIP Device Layer.])
1068
1069AC_SUBST(CHIP_DEVICE_LAYER_TARGET)
1070AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET],[${CHIP_DEVICE_LAYER_TARGET}],[Target platform name for CHIP Device Layer.])
1071
Vivien Nicolas6f8e28b2020-07-08 16:46:36 +02001072AC_SUBST(CHIP_DEVICE_LAYER_TARGET_DARWIN)
1073AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_DARWIN], [test "${CHIP_DEVICE_LAYER_TARGET_DARWIN}" = 1])
1074AC_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.])
1075
Martin Turonba1a0282020-03-10 19:25:02 -07001076AC_SUBST(CHIP_DEVICE_LAYER_TARGET_EFR32)
1077AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_EFR32], [test "${CHIP_DEVICE_LAYER_TARGET_EFR32}" = 1])
1078AC_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.])
1079
1080AC_SUBST(CHIP_DEVICE_LAYER_TARGET_ESP32)
1081AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_ESP32], [test "${CHIP_DEVICE_LAYER_TARGET_ESP32}" = 1])
1082AC_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.])
1083
1084AC_SUBST(CHIP_DEVICE_LAYER_TARGET_NRF5)
1085AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_NRF5], [test "${CHIP_DEVICE_LAYER_TARGET_NRF5}" = 1])
1086AC_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.])
1087
doru91edac1aa2020-08-20 04:28:05 +03001088AC_SUBST(CHIP_DEVICE_LAYER_TARGET_K32W)
1089AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_K32W], [test "${CHIP_DEVICE_LAYER_TARGET_K32W}" = 1])
1090AC_DEFINE_UNQUOTED([CHIP_DEVICE_LAYER_TARGET_K32W],[${CHIP_DEVICE_LAYER_TARGET_K32W}],[Define to 1 if you want to build the CHIP Device Layer for NXP K32W platforms.])
1091
Damian Królik34a4a932020-07-20 20:07:50 +02001092AC_SUBST(CHIP_DEVICE_LAYER_TARGET_NRFCONNECT)
1093AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_NRFCONNECT], [test "${CHIP_DEVICE_LAYER_TARGET_NRFCONNECT}" = 1])
1094AC_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.])
1095
Martin Turon0c03fa82020-05-26 15:43:11 -07001096AC_SUBST(CHIP_DEVICE_LAYER_TARGET_LINUX)
1097AM_CONDITIONAL([CHIP_DEVICE_LAYER_TARGET_LINUX], [test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1])
1098AC_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.])
1099
Martin Turonba1a0282020-03-10 19:25:02 -07001100if test "${CONFIG_DEVICE_LAYER}" = 1; then
1101 AC_DEFINE_UNQUOTED([BLE_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001102 [<platform/${CHIP_DEVICE_LAYER_TARGET}/BlePlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001103 [Path to BLE platform config header file])
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001104 AC_DEFINE_UNQUOTED([INET_PLATFORM_CONFIG_INCLUDE],
1105 [<platform/${CHIP_DEVICE_LAYER_TARGET}/InetPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001106 [Path to Inet Layer platform config header file])
1107 AC_DEFINE_UNQUOTED([SYSTEM_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001108 [<platform/${CHIP_DEVICE_LAYER_TARGET}/SystemPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001109 [Path to System Layer platform config header file])
1110 AC_DEFINE_UNQUOTED([WARM_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001111 [<platform/${CHIP_DEVICE_LAYER_TARGET}/WarmPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001112 [Path to WARM platform config header file])
1113 AC_DEFINE_UNQUOTED([CHIP_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001114 [<platform/${CHIP_DEVICE_LAYER_TARGET}/CHIPPlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001115 [Path to CHIP platform config header file])
1116 AC_DEFINE_UNQUOTED([CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE],
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001117 [<platform/${CHIP_DEVICE_LAYER_TARGET}/CHIPDevicePlatformConfig.h>],
Martin Turonba1a0282020-03-10 19:25:02 -07001118 [Path to CHIP Device Layer platform config header file])
1119fi
1120
Vivien Nicolasb1e52b22020-07-22 00:14:00 +02001121if test ${CHIP_DEVICE_LAYER_TARGET_DARWIN} = 1 && test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
1122 AC_CHECK_HEADER([CoreBluetooth/CoreBluetooth.h])
1123 LDFLAGS="${LDFLAGS} -framework Foundation -framework CoreBluetooth"
1124fi
1125
Martin Turonba1a0282020-03-10 19:25:02 -07001126#
1127# CHIP target network stack(s)
1128#
1129CONFIG_TARGET_NETWORKS=sockets
1130
1131AC_MSG_CHECKING([target network])
1132AC_ARG_WITH(target-network,
1133 [AS_HELP_STRING([--with-target-network=NETWORK],
Vivien Nicolas79625962020-06-19 00:28:26 +02001134 [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 -07001135 [
1136 CONFIG_TARGET_NETWORKS=`echo ${with_target_network} | sed -e 's/,/ /g'`
1137
1138 for target_network in ${CONFIG_TARGET_NETWORKS}; do
1139 case "${target_network}" in
1140
Vivien Nicolas79625962020-06-19 00:28:26 +02001141 lwip|sockets|Network.framework)
Martin Turonba1a0282020-03-10 19:25:02 -07001142 ;;
1143
1144 *)
1145 AC_MSG_ERROR([Invalid value ${with_target_network} for --with-target-network])
1146 ;;
1147
1148 esac
1149 done
1150 ],
1151 [with_target_network=${CONFIG_TARGET_NETWORKS}])
1152AC_MSG_RESULT(${with_target_network})
1153AC_SUBST(CONFIG_TARGET_NETWORKS)
1154AC_DEFINE_UNQUOTED([CONFIG_TARGET_NETWORKS], "${CONFIG_TARGET_NETWORKS}", [CHIP target network stack(s)])
1155
1156CHIP_SYSTEM_CONFIG_USE_LWIP=0
1157CHIP_SYSTEM_CONFIG_USE_SOCKETS=0
Vivien Nicolas79625962020-06-19 00:28:26 +02001158CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK=0
Martin Turonba1a0282020-03-10 19:25:02 -07001159
1160for target_network in ${CONFIG_TARGET_NETWORKS}; do
1161 case ${target_network} in
1162
1163 lwip)
1164 CHIP_SYSTEM_CONFIG_USE_LWIP=1
1165 ;;
1166
1167 sockets)
1168 CHIP_SYSTEM_CONFIG_USE_SOCKETS=1
1169 ;;
1170
Vivien Nicolas79625962020-06-19 00:28:26 +02001171 Network.framework)
1172 CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK=1
1173 ;;
1174
Martin Turonba1a0282020-03-10 19:25:02 -07001175 esac
1176done
1177
1178AC_SUBST(CHIP_SYSTEM_CONFIG_USE_LWIP)
1179AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_LWIP], [test "${CHIP_SYSTEM_CONFIG_USE_LWIP}" = 1])
1180AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_LWIP], [${CHIP_SYSTEM_CONFIG_USE_LWIP}],
1181 [Define to 1 if you want to use LwIP with CHIP System Layer.])
1182
1183AC_SUBST(CHIP_SYSTEM_CONFIG_USE_SOCKETS)
1184AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_SOCKETS], [test "${CHIP_SYSTEM_CONFIG_USE_SOCKETS}" = 1])
1185AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_SOCKETS], [${CHIP_SYSTEM_CONFIG_USE_SOCKETS}],
1186 [Define to 1 if you want to use BSD sockets with CHIP System Layer.])
1187
Vivien Nicolas79625962020-06-19 00:28:26 +02001188AC_SUBST(CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK)
1189AM_CONDITIONAL([CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK], [test "${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}" = 1])
1190AC_DEFINE_UNQUOTED([CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK], [${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}],
1191 [Define to 1 if you want to use Network.framework with CHIP System Layer.])
1192
1193#
Martin Turonba1a0282020-03-10 19:25:02 -07001194#
1195# Internet Protocol Network Endpoints
1196#
1197if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
1198 AC_MSG_CHECKING([IPv4 enabled])
1199 AC_ARG_ENABLE(ipv4,
1200 [AS_HELP_STRING([--disable-ipv4],[Disable the inclusion of IPv4 networking @<:@default=yes@:>@.])],
1201 [
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001202 case "${enableval}" in
Martin Turonba1a0282020-03-10 19:25:02 -07001203
1204 no|yes)
1205 enable_ivp4=${enableval}
1206 ;;
1207
1208 *)
1209 AC_MSG_ERROR([Invalid value ${enableval} for --enable-ivp4])
1210 ;;
1211
1212 esac
1213 ],
1214 [enable_ivp4=yes])
1215 AC_MSG_RESULT(${enable_ivp4})
1216
1217 INET_WANT_IPV4=1
1218
1219 if test "${enable_ipv4}" = no; then
1220 INET_WANT_IPV4=0
1221 fi
1222
1223 AM_CONDITIONAL([INET_WANT_IPV4], [test "${INET_WANT_IPV4}" = 1])
1224 AC_DEFINE_UNQUOTED([INET_WANT_IPV4],[${INET_WANT_IPV4}], [Define to 1 if you want to use CHIP with IPv4.])
1225
1226 if test "${INET_WANT_IPV4}" = 1; then
1227 AC_DEFINE(INET_CONFIG_ENABLE_IPV4, 1, [Define to 1 for enabling IPv4])
1228 fi
1229
1230 AC_MSG_CHECKING([inet network endpoint])
1231 AC_ARG_WITH(inet-endpoint,
1232 [AS_HELP_STRING([--with-inet-endpoint=ENDPOINT],
1233 [Specify the inet network endpoint from one or more of: raw, tcp, tun, udp @<:@default=all@:>@.])],
1234 [
1235 INET_ENDPOINTS=`echo ${with_inet_endpoint} | sed -e 's/,/ /g'`
1236
1237 for inet_endpoint in ${INET_ENDPOINTS}; do
1238
1239 case "${inet_endpoint}" in
1240
1241 dns|raw|tcp|tun|udp|all)
1242 ;;
1243
1244 *)
1245 AC_MSG_ERROR([Invalid value ${with_inet_endpoint} for --with-inet-endpoint])
1246 ;;
1247
1248 esac
1249
1250 done
1251 ],
1252 [INET_ENDPOINTS=all])
1253 AC_MSG_RESULT(${with_inet_endpoint})
1254
1255 AC_SUBST(INET_ENDPOINTS)
1256 AC_DEFINE_UNQUOTED([INET_ENDPOINTS], "${INET_ENDPOINTS}", [CHIP target inet network endpoint(s)])
1257
1258 INET_WANT_ENDPOINT_DNS=0
1259 INET_WANT_ENDPOINT_RAW=0
1260 INET_WANT_ENDPOINT_TCP=0
1261 INET_WANT_ENDPOINT_TUN=0
1262 INET_WANT_ENDPOINT_UDP=0
1263
1264 for wanted_endpoint in ${INET_ENDPOINTS}; do
1265
1266 case "${wanted_endpoint}" in
1267
1268 dns)
1269 INET_WANT_ENDPOINT_DNS=1
1270 ;;
1271
1272 raw)
1273 INET_WANT_ENDPOINT_RAW=1
1274 ;;
1275
1276 tcp)
1277 INET_WANT_ENDPOINT_TCP=1
1278 ;;
1279
1280 tun)
1281 INET_WANT_ENDPOINT_TUN=1
1282 ;;
1283
1284 udp)
1285 INET_WANT_ENDPOINT_UDP=1
1286 ;;
1287
1288 all)
1289 INET_WANT_ENDPOINT_DNS=1
1290 INET_WANT_ENDPOINT_RAW=1
1291 INET_WANT_ENDPOINT_TCP=1
1292 INET_WANT_ENDPOINT_TUN=1
1293 INET_WANT_ENDPOINT_UDP=1
1294 ;;
1295 esac
1296
1297 done
1298
1299 if test "${INET_WANT_ENDPOINT_TUN}" = 1; then
1300 AC_CHECK_HEADERS(linux/if_tun.h,[AC_SUBST(HAVE_LINUX_IF_TUN_H, [1])], [], [])
1301 AC_CHECK_TYPE(struct rtentry, , AC_CHECK_HEADERS(linux/route.h, [AC_SUBST(HAVE_LINUX_ROUTE_H, [1])], [], []), [[#include <net/route.h>]])
1302 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>]])
1303 # Check whether linux/if_tun.h defines TUNGETIFF.
1304 AC_MSG_CHECKING([whether linux/if_tun.h declares TUNGETIFF])
1305 AC_COMPILE_IFELSE([
1306 AC_LANG_PROGRAM(
1307 [[
1308 #if HAVE_LINUX_IF_TUN_H
1309 # include <linux/if_tun.h>
1310 #endif
1311 ]],
1312 [[
1313 #if !defined(TUNGETIFF)
1314 #error "TUNGETIFF is not defined"
1315 #endif
1316 ]])],
1317 [
1318 AC_MSG_RESULT([yes])
1319 AC_DEFINE(HAVE_TUNGETIFF, 1, [Define to 1 if <linux/if_tun.h> header file defines the TUNGETIFF ioctl command.])
1320 ],
1321 [
1322 AC_MSG_RESULT([no])
1323 ])
1324 AC_CHECK_TYPES(struct in6_rtmsg, [AC_SUBST(HAVE_IN6_RTMSG, [1])],[],[#include<net/route.h>])
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001325 if [[[ "${CHIP_SYSTEM_CONFIG_USE_LWIP}" -eq 0 ]]] &&
Martin Turonba1a0282020-03-10 19:25:02 -07001326 [[[ "${HAVE_LINUX_IF_TUN_H}" -eq 0 || "${HAVE_IN6_RTMSG}" -eq 0 ]]]; then
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07001327 AC_MSG_NOTICE([Tun EndPoint cannot be enabled for current target
Martin Turonba1a0282020-03-10 19:25:02 -07001328 CHIP_SYSTEM_CONFIG_USE_LWIP=$CHIP_SYSTEM_CONFIG_USE_LWIP, HAVE_LINUX_IF_TUN_H=$HAVE_LINUX_IF_TUN_H,
1329 HAVE_IN6_RTMSG=$HAVE_IN6_RTMSG])
1330 INET_WANT_ENDPOINT_TUN=0
1331 fi
1332 fi
1333
1334 AM_CONDITIONAL([INET_WANT_ENDPOINT_DNS], [test "${INET_WANT_ENDPOINT_DNS}" = 1])
1335 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_DNS],[${INET_WANT_ENDPOINT_DNS}],
1336 [Define to 1 if you want to use CHIP with the inet dns resolver.])
1337
1338 AM_CONDITIONAL([INET_WANT_ENDPOINT_RAW], [test "${INET_WANT_ENDPOINT_RAW}" = 1])
1339 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_RAW],[${INET_WANT_ENDPOINT_RAW}],
1340 [Define to 1 if you want to use CHIP with the inet raw endpoint.])
1341
1342 AM_CONDITIONAL([INET_WANT_ENDPOINT_TCP], [test "${INET_WANT_ENDPOINT_TCP}" = 1])
1343 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_TCP],[${INET_WANT_ENDPOINT_TCP}],
1344 [Define to 1 if you want to use CHIP with the inet tcp endpoint.])
1345
1346 AM_CONDITIONAL([INET_WANT_ENDPOINT_TUN], [test "${INET_WANT_ENDPOINT_TUN}" = 1])
1347 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_TUN],[${INET_WANT_ENDPOINT_TUN}],
1348 [Define to 1 if you want to use CHIP with the inet tun endpoint.])
1349
1350 AM_CONDITIONAL([INET_WANT_ENDPOINT_UDP], [test "${INET_WANT_ENDPOINT_UDP}" = 1])
1351 AC_DEFINE_UNQUOTED([INET_WANT_ENDPOINT_UDP],[${INET_WANT_ENDPOINT_UDP}],
1352 [Define to 1 if you want to use CHIP with the inet udp endpoint.])
1353
1354 if test "${INET_WANT_ENDPOINT_DNS}" = 1; then
1355 AC_DEFINE(INET_CONFIG_ENABLE_DNS_RESOLVER, 1, [Define to 1 for enabling DNS Resolver])
1356 fi
1357
1358 if test "${INET_WANT_ENDPOINT_RAW}" = 1; then
1359 AC_DEFINE(INET_CONFIG_ENABLE_RAW_ENDPOINT, 1, [Define to 1 for enabling Raw Endpoint])
1360 fi
1361
1362 if test "${INET_WANT_ENDPOINT_TCP}" = 1; then
1363 AC_DEFINE(INET_CONFIG_ENABLE_TCP_ENDPOINT, 1, [Define to 1 for enabling TCP Endpoint])
1364 fi
1365
1366 if test "${INET_WANT_ENDPOINT_TUN}" = 1; then
1367 AC_DEFINE(INET_CONFIG_ENABLE_TUN_ENDPOINT, 1, [Define to 1 for enabling TUN Endpoint (only for LWIP and Linux w/ support)])
1368 fi
1369
1370 if test "${INET_WANT_ENDPOINT_UDP}" = 1; then
1371 AC_DEFINE(INET_CONFIG_ENABLE_UDP_ENDPOINT, 1, [Define to 1 for enabling UDP Endpoint])
1372 fi
1373fi
1374
1375# Asynchronous DNS
1376AC_MSG_CHECKING([whether to build with asynchronous DNS resolution support])
1377AC_ARG_ENABLE(adns,
1378 [AS_HELP_STRING([--disable-adns],[Disable building of adns @<:@default=no@:>@.])],
1379 [
1380 case "${enableval}" in
1381
1382 no|yes)
1383 build_adns=${enableval}
1384 ;;
1385
1386 *)
1387 AC_MSG_ERROR([Invalid value ${enableval} for --disable-adns])
1388 ;;
1389
1390 esac
1391 ],
1392 [build_adns=yes])
1393AC_MSG_RESULT(${build_adns})
1394
1395AM_CONDITIONAL([INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS], [test "${build_adns}" = "yes"])
1396
1397if test ${build_adns} = "yes" && test ${INET_WANT_ENDPOINT_DNS} = 1 && test ${CHIP_SYSTEM_CONFIG_USE_SOCKETS} = 1; then
1398 AC_DEFINE(INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS, 1, [Define to 1 for enabling ASYNC DNS])
1399else
1400 AC_DEFINE(INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS, 0, [Define to 0 for disabling ASYNC DNS])
1401fi
1402
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001403#
1404# Options for the user to specify project-specific configuration files
1405# for various CHIP components.
1406#
1407
1408AC_LANG_PUSH([C++])
1409
1410# SystemLayer
1411
Rob Walkeraeec6c52020-04-20 10:05:18 -07001412CHIP_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 -07001413
1414# BleLayer
1415
1416if test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
Rob Walkeraeec6c52020-04-20 10:05:18 -07001417 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 -07001418fi
1419
1420# InetLayer
1421
1422if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
Rob Walkeraeec6c52020-04-20 10:05:18 -07001423 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 -07001424fi
1425
1426# Core
1427
Rob Walkeraeec6c52020-04-20 10:05:18 -07001428CHIP_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 -07001429
1430# Device Layer
1431
Rob Walkerae3a9002020-04-15 13:48:47 -07001432if test "${CONFIG_DEVICE_LAYER}" = 1; then
Grant Erickson7ada3ad2020-04-02 11:03:34 -07001433 CHIP_CHECK_PROJECT_CONFIG_INCLUDES(chip-device-project-includes, CHIP_DEVICE_PROJECT_CONFIG_INCLUDE, CHIPDeviceProjectConfig.h, CHIP Device Layer,)
1434fi
1435
1436AC_LANG_POP([C++])
Martin Turonba1a0282020-03-10 19:25:02 -07001437
1438#
Pankaj Garg5daed722020-04-20 16:55:31 -07001439# Check for crypto implementation
1440#
1441CHIP_CRYPTO=
1442CHIP_CRYPTO_MBEDTLS=0
1443CHIP_CRYPTO_OPENSSL=0
1444
1445AC_MSG_CHECKING([for crypto implementation])
1446
1447# The user may have attempted to explicitly specify the crypto
1448# implementation. Sanity check it or default to 'auto'.
1449
1450AC_ARG_WITH(crypto,
1451 [AS_HELP_STRING([--with-crypto=CRYPTO],
1452 [Specify the crypto implementation from one of: auto, mbedtls, or openssl @<:@default=auto@:>@.])],
1453 [
1454 case "${with_crypto}" in
1455 auto|mbedtls|openssl)
1456 ;;
1457 *)
1458 AC_MSG_ERROR([Invalid value ${with_crypto} for --with-crypto])
1459 ;;
1460 esac
1461 ],
1462 [with_crypto=auto])
1463
1464# At this point, the crypto implementation is one of the allowed
1465# values. If it's 'auto' we autodetect it.
1466
1467if test "${with_crypto}" = "auto"; then
1468 case ${target_os} in
1469
1470 *cygwin*|*darwin*|*linux*|*freebsd*|*netbsd*|*openbsd*)
1471 with_crypto=openssl
1472 ;;
1473
1474 *freertos*)
1475 with_crypto=mbedtls
1476 ;;
1477
1478 *)
1479 AC_MSG_RESULT([unknown])
1480 AC_MSG_ERROR([Unsupported target OS ${target_os}])
1481 ;;
1482
1483 esac
1484fi
1485
1486CHIP_CRYPTO=${with_crypto}
1487
1488case ${with_crypto} in
1489
1490 mbedtls)
1491 CHIP_CRYPTO_MBEDTLS=1
1492 ;;
1493
1494 openssl)
1495 CHIP_CRYPTO_OPENSSL=1
1496 ;;
1497
1498esac
1499
1500AC_MSG_RESULT(${CHIP_CRYPTO})
1501
1502AC_SUBST(CHIP_CRYPTO)
1503AC_DEFINE_UNQUOTED([CHIP_CRYPTO],[${CHIP_CRYPTO}],[CHIP crypto implementation])
1504
1505AC_SUBST(CHIP_CRYPTO_MBEDTLS)
1506AM_CONDITIONAL([CHIP_CRYPTO_MBEDTLS], [test "${CHIP_CRYPTO}" = "mbedtls"])
1507AC_DEFINE_UNQUOTED([CHIP_CRYPTO_MBEDTLS],[${CHIP_CRYPTO_MBEDTLS}],[Define to 1 if you want to use CHIP with a mbedTLS crypto implementation])
1508
1509AC_SUBST(CHIP_CRYPTO_OPENSSL)
1510AM_CONDITIONAL([CHIP_CRYPTO_OPENSSL], [test "${CHIP_CRYPTO}" = "openssl"])
1511AC_DEFINE_UNQUOTED([CHIP_CRYPTO_OPENSSL],[${CHIP_CRYPTO_OPENSSL}],[Define to 1 if you want to use CHIP with an OpenSSL crypto implementation])
1512
1513#
Martin Turonba1a0282020-03-10 19:25:02 -07001514# Checks for libraries and packages.
1515#
1516# At minimum, the following are required:
1517#
1518# * nlassert
1519# * nlio
1520#
1521# The following are optional, depending on configuration:
1522#
1523# * lwip
Pankaj Garg5daed722020-04-20 16:55:31 -07001524# * mbedtls
Martin Turonba1a0282020-03-10 19:25:02 -07001525# * nlunit-test
Martin Turonba1a0282020-03-10 19:25:02 -07001526# * nlfaultinjection
Pankaj Garg5daed722020-04-20 16:55:31 -07001527# * openssl
Martin Turonba1a0282020-03-10 19:25:02 -07001528#
1529# Most of these are supplied "in package"; however, they may be also
1530# supplied out of package.
1531#
1532AC_MSG_NOTICE([checking package dependencies])
1533
1534# Check if the build host has pkg-config
1535
1536AC_PATH_PROG([PKG_CONFIG],[pkg-config])
1537
1538#
yunhanw-googlee1d448c2020-07-21 11:57:53 -07001539# Chip over Ble over Bluez Peripheral support
1540#
1541
1542# Only a concern when the BLE layer is enabled.
1543
1544CONFIG_BLE_PLATFORM_BLUEZ=0
1545enable_chipoble_bluez="no"
1546
1547NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1548 [BlueZ],
1549 [BLUEZ],
1550 [bluez],
1551 [-lgdbus-internal -lshared-glib],
1552 [
1553 # actions if not external
1554 # At this time, enable this only for linux, and only if the tests are enabled
1555 if test "${nl_cv_build_tests}" = "yes" && test "${CONFIG_NETWORK_LAYER_BLE}" = 1 && test "${with_device_layer}" = "linux"; then
1556 case "${target}" in
1557
1558 *linux*)
1559 if test "x${HAVE_CXX11}" == "0"; then
1560 AC_MSG_ERROR([BlueZ support requires C++11 compiler])
1561 fi
1562 CONFIG_BLE_PLATFORM_BLUEZ=1
1563 enable_chipoble_bluez="yes"
1564 ;;
1565
1566 *)
1567 CONFIG_BLE_PLATFORM_BLUEZ=0
1568 enable_chipoble_bluez="no"
1569 ;;
1570
1571 esac
1572 fi
1573 ]
1574)
1575
1576# Depending on whether bluez has been configured for an internal
1577# location, its directory stem within this package needs to be set
1578# accordingly. In addition, if the location is internal, then we need
1579# to attempt to pull it down using the bootstrap makefile.
1580
1581if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
1582 maybe_bluez_dirstem="bluez/repo"
1583 bluez_dirstem="third_party/${maybe_bluez_dirstem}"
1584
1585 AC_MSG_NOTICE([attempting to create internal ${bluez_dirstem}])
1586
1587 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${bluez_dirstem}
1588
1589 if test $? -ne 0; then
1590 AC_MSG_ERROR([failed to create ${bluez_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1591 fi
1592
1593 echo " BOOTSTRAP ${bluez_dirstem}"
1594
1595 (cd ${srcdir}/${bluez_dirstem} && ./bootstrap)
1596
1597else
1598 maybe_bluez_dirstem=""
1599fi
1600
1601AC_SUBST(BLUEZ_SUBDIRS, [${maybe_bluez_dirstem}])
1602AM_CONDITIONAL([CHIP_WITH_BLUEZ_INTERNAL], [test "${nl_with_bluez}" = "internal"])
1603
1604AM_CONDITIONAL([CONFIG_BLE_PLATFORM_BLUEZ], [test "${enable_chipoble_bluez}" = "yes"])
1605AC_DEFINE_UNQUOTED([CONFIG_BLE_PLATFORM_BLUEZ],[${CONFIG_BLE_PLATFORM_BLUEZ}],[Define to 1 if you want to enable Chip over Ble over bluez.])
1606
1607if test "${enable_chipoble_bluez}" = "yes"; then
1608 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
1609 AC_MSG_ERROR(GLib >= 2.28 is required))
1610 AC_SUBST(GLIB_CFLAGS)
1611 AC_SUBST(GLIB_LIBS)
1612
1613 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.6, dummy=yes,
1614 AC_MSG_ERROR(D-Bus >= 1.6 is required))
1615 AC_SUBST(DBUS_CFLAGS)
1616 AC_SUBST(DBUS_LIBS)
1617
1618 AX_CHECK_COMPILER_OPTIONS([C], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1619 AX_CHECK_COMPILER_OPTIONS([C++], ${GLIB_CFLAGS} ${DBUS_CFLAGS})
1620fi
1621
1622#
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001623# OpenSSL
1624#
1625
Pankaj Garg5daed722020-04-20 16:55:31 -07001626if test "${with_crypto}" = "openssl"; then
1627 NL_WITH_REQUIRED_EXTERNAL_PACKAGE([OpenSSL],
1628 [OPENSSL],
1629 [openssl],
1630 [-lcrypto],
1631 [
1632 # Check for required OpenSSL headers.
1633 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],
1634 [],
1635 [
1636 AC_MSG_ERROR(The OpenSSL header "$ac_header" is required but cannot be found.)
1637 ]
1638 )
1639 ]
1640 )
1641fi
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001642
1643AM_CONDITIONAL([CHIP_WITH_OPENSSL], [test "${nl_with_openssl}" != "no"])
1644
1645if test "${nl_with_openssl}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001646 AC_DEFINE([CHIP_WITH_OPENSSL], [0], [Define to 0 to build CHIP without OpenSSL])
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001647else
Pankaj Garg5daed722020-04-20 16:55:31 -07001648 AC_DEFINE([CHIP_WITH_OPENSSL], [1], [Define to 1 to build CHIP with OpenSSL])
Grant Ericksoncb9d81f2020-04-02 15:47:40 -07001649fi
1650
1651#
Pankaj Garg139d43b2020-04-15 19:04:57 -07001652# mbedTLS
1653#
Pankaj Garg5daed722020-04-20 16:55:31 -07001654
1655if test "${with_crypto}" = "mbedtls"; then
1656 NL_WITH_REQUIRED_INTERNAL_PACKAGE(
1657 [mbedTLS],
1658 [MBEDTLS],
1659 [mbedtls],
Pankaj Garge4a5eed2020-05-06 09:07:13 -07001660 [-lmbedtls],
Pankaj Garg5daed722020-04-20 16:55:31 -07001661 [
1662 # At this point, the internal mbedTLS package will be neither
1663 # configured nor built, so the normal checks we undertake for an
1664 # external package cannot be run here. Simply set the appropriate
1665 # variables and trust all will be well.
1666
1667 MBEDTLS_CPPFLAGS="-I\${abs_top_srcdir}/third_party/mbedtls/repo/include"
1668 MBEDTLS_LDFLAGS="-L${ac_pwd}/third_party/mbedtls"
1669 MBEDTLS_LIBS="-lmbedtls"
1670 ],
1671 [
1672 # Check for required mbedTLS headers.
1673 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],
1674 [],
1675 [
1676 AC_MSG_ERROR(The mbedTLS header "$ac_header" is required but cannot be found.)
Yakun Xu42f81cd2020-05-30 16:47:19 +08001677 ],
1678 [
1679// Undefine MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE to prevent
1680// including these files at configure stage. This is necessary because
1681// CPPFLAGS is shell expanded during configure stage, which is not
1682// compatible with the expansion of make.
1683#undef MBEDTLS_CONFIG_FILE
1684#undef MBEDTLS_USER_CONFIG_FILE
1685 ])
Pankaj Garg5daed722020-04-20 16:55:31 -07001686 ]
1687 )
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001688fi
Pankaj Garg139d43b2020-04-15 19:04:57 -07001689
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001690# Depending on whether mbedTLS has been configured for an internal
1691# location, its directory stem within this package needs to be set
1692# accordingly. In addition, if the location is internal, then we need
1693# to attempt to pull it down using the bootstrap makefile.
Pankaj Garg139d43b2020-04-15 19:04:57 -07001694
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001695if test "${nl_with_mbedtls}" = "internal"; then
1696 maybe_mbedtls_dirstem="mbedtls"
1697 mbedtls_dirstem="third_party/${maybe_mbedtls_dirstem}/repo"
1698
1699 AC_MSG_NOTICE([attempting to create internal ${mbedtls_dirstem}])
1700
1701 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${mbedtls_dirstem}
1702
1703 if test $? -ne 0; then
1704 AC_MSG_ERROR([failed to create ${mbedtls_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1705 fi
Pankaj Garg139d43b2020-04-15 19:04:57 -07001706else
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001707 maybe_mbedtls_dirstem=""
Pankaj Garg139d43b2020-04-15 19:04:57 -07001708fi
1709
Pankaj Garg5f7b9522020-04-18 16:58:54 -07001710AC_SUBST(MBEDTLS_SUBDIRS, [${maybe_mbedtls_dirstem}])
1711AM_CONDITIONAL([CHIP_WITH_MBEDTLS_INTERNAL], [test "${nl_with_mbedtls}" = "internal"])
1712
Pankaj Garg5daed722020-04-20 16:55:31 -07001713AM_CONDITIONAL([CHIP_WITH_MBEDTLS], [test "${nl_with_mbedtls}" != "no"])
1714
1715if test "${nl_with_mbedtls}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001716 AC_DEFINE([CHIP_WITH_MBEDTLS], [0], [Define to 0 to build CHIP without mbedTLS])
Pankaj Garg5daed722020-04-20 16:55:31 -07001717else
1718 AC_DEFINE([CHIP_WITH_MBEDTLS], [1], [Define to 1 to build CHIP with mbedTLS])
1719fi
1720
Pankaj Garg139d43b2020-04-15 19:04:57 -07001721#
Yakun Xu47f325f2020-07-15 00:10:33 +08001722# OpenThread
1723#
1724
1725NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1726 [OpenThread],
1727 [OPENTHREAD],
1728 [openthread],
1729 [],
1730 [
1731 # use absolute path to support build out of source tree
1732 chip_srcdir="$(cd ${srcdir} && pwd)"
1733
1734 # bootstrap
1735 test -f ${chip_srcdir}/third_party/openthread/repo/configure || (cd ${chip_srcdir}/third_party/openthread/repo && ./bootstrap)
1736
1737 case "${with_device_layer}" in
1738 nrf5)
1739 OPENTHREAD_CPPFLAGS="-I\${abs_top_srcdir}/third_party/openthread/repo/include"
1740 OPENTHREAD_LDFLAGS="-L${ac_pwd}/third_party/openthread"
1741 OPENTHREAD_LIBS="-lopenthread-cli-ftd \
1742 -lopenthread-ftd \
1743 -lopenthread-platform-utils \
1744 -lopenthread-nrf52840-transport \
1745 -lopenthread-nrf52840-softdevice-sdk \
1746 -lnordicsemi-nrf52840-radio-driver-softdevice \
1747 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue.a \
1748 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue_cc310.a \
1749 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
1750 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_cc310_backend.a \
1751 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
1752 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a \
1753 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_tls_vanilla.a \
1754 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libmbedtls_x509_vanilla.a \
1755 \${NRF5_SDK_ROOT}/external/openthread/nrf_security/lib/libnrf_cc310_platform_0.9.1.a"
1756
1757 # private definitions
1758 ot_cppflags="-Wno-expansion-to-defined \
1759 -I${chip_srcdir}/third_party/openthread/repo/examples/platforms/nrf528xx/nrf52840 \
1760 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/config \
1761 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/include \
1762 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config \
1763 -I${chip_srcdir}/third_party/openthread/repo/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/include \
1764 -I${chip_srcdir}/third_party/mbedtls/repo/include \
1765 -DMBEDTLS_CONFIG_FILE=\<nrf-config.h\> \
1766 -DMBEDTLS_USER_CONFIG_FILE=\<nrf52840-mbedtls-config.h\> \
1767 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\<openthread-core-nrf52840-config.h\> \
1768 -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\<openthread-core-nrf52840-config-check.h\> \
1769 -DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 \
1770 -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 \
1771 -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 \
kangping70de84e2020-08-14 23:19:30 +08001772 -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 \
Yakun Xu47f325f2020-07-15 00:10:33 +08001773 -DUART_AS_SERIAL_TRANSPORT=1"
1774
1775 (mkdir -p ${ac_pwd}/third_party/openthread \
1776 && cd ${ac_pwd}/third_party/openthread \
1777 && CPPFLAGS="${ot_cppflags}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ${chip_srcdir}/third_party/openthread/repo/configure \
1778 --disable-builtin-mbedtls \
1779 --disable-docs \
1780 --disable-executable \
1781 --disable-tools \
1782 --enable-cli \
1783 --enable-ftd \
1784 --host=arm-none-eabi \
1785 --prefix=${prefix} \
1786 --exec-prefix=${exec_prefix} \
1787 --with-examples=nrf52840)
1788
1789 if test $? != 0; then
1790 AC_MSG_ERROR([Failed to configure OpenThread!])
1791 fi
1792
1793 maybe_openthread_dirstem="openthread"
1794 ;;
1795
1796 *)
1797 AC_MSG_NOTICE([No internal OpenThread support yet!])
1798 nl_with_openthread=no
1799 with_openthread=no
1800 ;;
1801 esac
1802 ],
1803 [
1804 # Check for required OpenThread headers.
1805 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],
1806 [],
1807 [
1808 AC_MSG_ERROR(The OpenThread header "$ac_header" is required but cannot be found.)
1809 ])
1810 maybe_openthread_dirstem=""
1811 ]
1812)
1813AC_SUBST(OPENTHREAD_SUBDIRS, [${maybe_openthread_dirstem}])
1814AM_CONDITIONAL([CHIP_ENABLE_OPENTHREAD], [test "${nl_with_openthread}" != "no"])
1815if test "${nl_with_openthread}" != "no"; then
1816 CHIP_ENABLE_OPENTHREAD=1
1817else
1818 CHIP_ENABLE_OPENTHREAD=0
1819fi
1820AC_DEFINE_UNQUOTED([CHIP_ENABLE_OPENTHREAD],[${CHIP_ENABLE_OPENTHREAD}],[Define to 1 if you want to enable OpenThread.])
1821
1822#
Martin Turonba1a0282020-03-10 19:25:02 -07001823# LwIP
1824#
1825
1826NL_WITH_LWIP(${CHIP_SYSTEM_CONFIG_USE_LWIP})
1827
1828#
1829# Nlio
1830#
1831
1832NL_WITH_PACKAGE(
1833 [Nlio],
1834 [NLIO],
1835 [nlio],
1836 [],
1837 [
1838 # At this point, the internal Nlio package will be neither
1839 # configured nor built, so the normal checks we undertake for an
1840 # external package cannot be run here. Simply set the appropriate
1841 # variables and trust all will be well.
1842
1843 NLIO_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlio/repo/include"
1844 NLIO_LDFLAGS=
1845 NLIO_LIBS=
1846 ],
1847 [
1848 # Check for required Nlio headers.
1849
1850 AC_CHECK_HEADERS([nlbyteorder.h],
1851 [],
1852 [
1853 AC_MSG_ERROR(The nlio header "$ac_header" is required but cannot be found.)
1854 ])
1855 ]
1856)
1857
1858# Depending on whether nlio has been configured for an internal
1859# location, its directory stem within this package needs to be set
1860# accordingly. In addition, if the location is internal, then we need
1861# to attempt to pull it down using the bootstrap makefile.
1862
1863if test "${nl_with_nlio}" = "internal"; then
1864 maybe_nlio_dirstem="nlio/repo"
1865 nlio_dirstem="third_party/${maybe_nlio_dirstem}"
1866
1867 AC_MSG_NOTICE([attempting to create internal ${nlio_dirstem}])
1868
1869 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlio_dirstem}
1870
1871 if test $? -ne 0; then
1872 AC_MSG_ERROR([failed to create ${nlio_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1873 fi
1874else
1875 maybe_nlio_dirstem=""
1876fi
1877
1878AC_SUBST(NLIO_SUBDIRS, [${maybe_nlio_dirstem}])
1879AM_CONDITIONAL([CHIP_WITH_NLIO_INTERNAL], [test "${nl_with_nlio}" = "internal"])
1880
1881#
1882# Nlassert
1883#
1884
1885NL_WITH_PACKAGE(
1886 [Nlassert],
1887 [NLASSERT],
1888 [nlassert],
1889 [],
1890 [
1891 # At this point, the internal Nlassert package will be neither
1892 # configured nor built, so the normal checks we undertake for an
1893 # external package cannot be run here. Simply set the appropriate
1894 # variables and trust all will be well.
1895
1896 NLASSERT_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlassert/repo/include"
1897 NLASSERT_LDFLAGS=
1898 NLASSERT_LIBS=
1899 ],
1900 [
1901 # Check for required Nlassert headers.
1902
1903 AC_CHECK_HEADERS([nlassert.h],
1904 [],
1905 [
1906 AC_MSG_ERROR(The nlassert header "$ac_header" is required but cannot be found.)
1907 ])
1908 ]
1909)
1910
1911# Depending on whether nlassert has been configured for an internal
1912# location, its directory stem within this package needs to be set
1913# accordingly. In addition, if the location is internal, then we need
1914# to attempt to pull it down using the bootstrap makefile.
1915
1916if test "${nl_with_nlassert}" = "internal"; then
1917 maybe_nlassert_dirstem="nlassert/repo"
1918 nlassert_dirstem="third_party/${maybe_nlassert_dirstem}"
1919
1920 AC_MSG_NOTICE([attempting to create internal ${nlassert_dirstem}])
1921
1922 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlassert_dirstem}
1923
1924 if test $? -ne 0; then
1925 AC_MSG_ERROR([failed to create ${nlassert_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1926 fi
1927else
1928 maybe_nlassert_dirstem=""
1929fi
1930
1931AC_SUBST(NLASSERT_SUBDIRS, [${maybe_nlassert_dirstem}])
1932AM_CONDITIONAL([CHIP_WITH_NLASSERT_INTERNAL], [test "${nl_with_nlassert}" = "internal"])
1933
1934#
Grant Erickson81bc5702020-03-18 10:26:28 -07001935# Nlfaultinjection
1936#
1937
1938NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
1939 [Nlfaultinjection],
1940 [NLFAULTINJECTION],
1941 [nlfaultinjection],
1942 [-lnlfaultinjection],
1943 [
1944 # At this point, the internal nlfaultinjection package will be neither
1945 # configured nor built, so the normal checks we undertake for an
1946 # external package cannot be run here. Simply set the appropriate
1947 # variables and trust all will be well.
1948
1949 NLFAULTINJECTION_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlfaultinjection/repo/include"
1950 NLFAULTINJECTION_LDFLAGS="-L${ac_pwd}/third_party/nlfaultinjection/repo/src"
1951 NLFAULTINJECTION_LIBS="-lnlfaultinjection"
1952 ],
1953 [
1954 # Check for required nlfaultinjection headers.
1955
1956 AC_LANG_PUSH([C++])
1957 AC_CHECK_HEADERS([nlfaultinjection.hpp],
1958 [],
1959 [
1960 AC_MSG_ERROR(The nlfaultinjection header "$ac_header" is required but cannot be found.)
1961 ])
1962 AC_LANG_POP([C++])
1963 ]
1964)
1965
1966# Depending on whether nlfaultinjection has been configured for an internal
1967# location, its directory stem within this package needs to be set
1968# accordingly. In addition, if the location is internal, then we need
1969# to attempt to pull it down using the bootstrap makefile.
1970
1971if test "${nl_with_nlfaultinjection}" = "internal"; then
1972 maybe_nlfaultinjection_dirstem="nlfaultinjection/repo"
1973 nlfaultinjection_dirstem="third_party/${maybe_nlfaultinjection_dirstem}"
1974
1975 AC_MSG_NOTICE([attempting to create internal ${nlfaultinjection_dirstem}])
1976
1977 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlfaultinjection_dirstem}
1978
1979 if test $? -ne 0; then
1980 AC_MSG_ERROR([failed to create ${nlfaultinjection_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
1981 fi
1982else
1983 maybe_nlfaultinjection_dirstem=""
1984fi
1985
1986AC_SUBST(NLFAULTINJECTION_SUBDIRS, [${maybe_nlfaultinjection_dirstem}])
1987AM_CONDITIONAL([CHIP_WITH_NLFAULTINJECTION], [test "${nl_with_nlfaultinjection}" != "no"])
1988AM_CONDITIONAL([CHIP_WITH_NLFAULTINJECTION_INTERNAL], [test "${nl_with_nlfaultinjection}" = "internal"])
1989
1990if test "${nl_with_nlfaultinjection}" = "no"; then
Yufeng Wangd3c22b92020-07-14 09:09:45 -07001991 AC_DEFINE([CHIP_WITH_NLFAULTINJECTION], [0], [Define to 0 to build CHIP without nlFaultInjection features])
Grant Erickson81bc5702020-03-18 10:26:28 -07001992else
1993 AC_DEFINE([CHIP_WITH_NLFAULTINJECTION], [1], [Define to 1 to build CHIP with nlFaultInjection features])
1994fi
1995
1996if test "${nl_cv_build_tests}" = "yes"; then
1997 if test "${nl_with_nlfaultinjection}" = "no"; then
1998 AC_MSG_ERROR(CHIP tests require nlfaultinjection.)
1999 fi
2000fi
2001
Jiacheng Guo10be6f02020-07-08 13:46:03 +08002002#
2003# otbr-client
2004#
2005
2006NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
2007 [ot_br_posix],
2008 [OT_BR_POSIX],
2009 [ot_br_posix],
2010 [-lot_br_client],
2011 [
2012 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/"
2013 OT_BR_POSIX_LDFLAGS="-L${ac_pwd}/third_party/ot-br-posix/"
2014 OT_BR_POSIX_LIBS="-lot_br_client"
2015 ],
2016 [
2017 # Check for required nlfaultinjection headers.
2018 AC_LANG_PUSH([C++])
2019 AC_CHECK_HEADERS([dbus/client/thread_api_dbus.hpp],
2020 [],
2021 [
2022 AC_MSG_ERROR(The OpenThread border router header "$ac_header" is required but cannot be found.)
2023 ])
2024 AC_LANG_POP([C++])
2025 ]
2026)
2027
2028AC_MSG_NOTICE("nl_with_ot_br_posix=${nl_with_ot_br_posix}")
2029
2030if test "${nl_with_ot_br_posix}" = "internal" && test "${with_device_layer}" = "linux"; then
2031 maybe_ot_br_posix_dirstem="ot-br-posix"
2032 ot_br_posix_dirstem="third_party/${maybe_ot_br_posix_dirstem}/repo"
2033
2034 AC_MSG_NOTICE([attempting to create internal ${ot_br_posix_dirstem}])
2035
2036 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${ot_br_posix_dirstem}
2037
2038 if test $? -ne 0; then
2039 AC_MSG_ERROR([failed to create ${ot_br_posix_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
2040 fi
2041
2042 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4)
2043 AC_SUBST([DBUS_CFLAGS])
2044 AC_SUBST([DBUS_LIBS])
2045else
2046 maybe_ot_br_posix_dirstem=
2047fi
2048
2049AC_SUBST(OT_BR_POSIX_SUBDIRS, [${maybe_ot_br_posix_dirstem}])
2050AM_CONDITIONAL([CHIP_WITH_OT_BR_POSIX], [test "${nl_with_ot_br_posix}" != "no"])
Grant Erickson81bc5702020-03-18 10:26:28 -07002051
2052#
Martin Turonba1a0282020-03-10 19:25:02 -07002053# Nlunit-test
2054#
2055
2056if test "${nl_cv_build_tests}" = "yes"; then
2057 NL_WITH_PACKAGE(
2058 [Nlunit-test],
2059 [NLUNIT_TEST],
2060 [nlunit_test],
2061 [-lnlunit-test],
2062 [
2063 # At this point, the internal Nlunit-test package will be neither
2064 # configured nor built, so the normal checks we undertake for an
2065 # external package cannot be run here. Simply set the appropriate
2066 # variables and trust all will be well.
2067
2068 NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src"
2069 NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src"
2070 NLUNIT_TEST_LIBS="-lnlunit-test"
2071 ],
2072 [
2073 # Check for required nlunit-test headers.
2074
2075 AC_CHECK_HEADERS([nlunit-test.h],
2076 [],
2077 [
2078 AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.)
2079 ])
2080 ])
2081fi
2082
2083# Depending on whether nlunit-test has been configured for an internal
2084# location, its directory stem within this package needs to be set
2085# accordingly. In addition, if the location is internal, then we need
2086# to attempt to pull it down using the bootstrap makefile.
2087
2088if test "${nl_with_nlunit_test}" = "internal"; then
2089 maybe_nlunit_test_dirstem="nlunit-test/repo"
2090 nlunit_test_dirstem="third_party/${maybe_nlunit_test_dirstem}"
2091
2092 AC_MSG_NOTICE([attempting to create internal ${nlunit_test_dirstem}])
2093
2094 ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlunit_test_dirstem}
2095
2096 if test $? -ne 0; then
2097 AC_MSG_ERROR([failed to create ${nlunit_test_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
2098 fi
2099else
2100 maybe_nlunit_test_dirstem=""
2101fi
2102
2103AC_SUBST(NLUNIT_TEST_SUBDIRS, [${maybe_nlunit_test_dirstem}])
2104AM_CONDITIONAL([CHIP_WITH_NLUNIT_TEST_INTERNAL], [test "${nl_with_nlunit_test}" = "internal"])
2105
2106#
Yufeng Wang92904f42020-06-15 13:46:29 -07002107#
2108# IniPP
2109#
2110
2111if test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1; then
2112 NL_WITH_PACKAGE(
2113 [IniPP],
2114 [INIPP],
2115 [],
2116 [],
2117 [
2118 INIPP_CPPFLAGS="-I\${abs_top_srcdir}/third_party/inipp/repo/inipp"
2119 ],
2120 [
2121 # Check for required IniPP headers.
2122
2123 AC_CHECK_HEADERS([inipp.h],
2124 [],
2125 [
2126 AC_MSG_ERROR(The IniPP header "inipp.h" is required but cannot be found.)
2127 ])
2128 ]
2129 )
2130fi
2131
2132#
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002133#
2134# GIO
2135#
2136
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002137CHIP_ENABLE_GIO=0
2138
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002139if test "${CHIP_DEVICE_LAYER_TARGET_LINUX}" = 1; then
2140 PKG_CHECK_MODULES([GIO], [gio-2.0])
2141
2142 # Check for GIO library is available.
2143 AC_CHECK_LIB([gio-2.0], [g_bus_get_sync],
2144 [
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002145 CHIP_ENABLE_GIO=1
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002146 AC_DEFINE([CHIP_WITH_GIO], [1], [Define to 1 to build CHIP with GIO])
2147 ],
2148 [
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002149 CHIP_ENABLE_GIO=0
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002150 AC_DEFINE([CHIP_WITH_GIO], [0], [Define to 0 to build CHIP without GIO])
2151 ]
2152 )
yunhanw-googlec0cde152020-07-29 06:33:50 -07002153
2154 PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0])
2155
2156 AC_CHECK_PROG(GDBUSCODEGEN, gdbus-codegen, gdbus-codegen)
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002157fi
2158
2159#
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002160#
2161# WPA
2162#
2163
2164CONFIG_WIFI_PLATFORM_WPA=0
2165enable_chipwifi_wpa="no"
2166
2167# At this time, enable this only for linux, and only if the GIO package are installed. Currently, WiFi and Thread
Rob Walkerb14e3e32020-08-20 13:59:22 -07002168# are depending on the gdbus-internal configured by internal BLuez package.
Yufeng Wangec3de6e2020-07-31 10:36:39 -07002169# TODO: Refacrot BLuez to use common gdbus lib from GIO.
2170
2171if test "${with_device_layer}" = "linux" && test "${CHIP_ENABLE_GIO}" = 1 && test "${CONFIG_BLE_PLATFORM_BLUEZ}" = 1; then
2172case "${target}" in
2173 *linux*)
2174 CONFIG_WIFI_PLATFORM_WPA=1
2175 enable_chipwifi_wpa="yes"
2176 ;;
2177 *)
2178 CONFIG_WIFI_PLATFORM_WPA=0
2179 enable_chipwifi_wpa="no"
2180 ;;
2181 esac
2182fi
2183
2184AM_CONDITIONAL([CONFIG_WIFI_PLATFORM_WPA], [test "${enable_chipwifi_wpa}" = "yes"])
2185AC_DEFINE_UNQUOTED([CHIP_DEVICE_CONFIG_ENABLE_WPA],[${CONFIG_WIFI_PLATFORM_WPA}],[Define to 1 if you want to enable WPA support for wpa_supplicant.])
2186
2187#
Martin Turonba1a0282020-03-10 19:25:02 -07002188# Sockets
2189#
2190
2191# Influential external variables for BSD Sockets support
2192
2193AC_ARG_VAR(SOCKETS_CPPFLAGS, [BSD Sockets C preprocessor flags])
2194AC_ARG_VAR(SOCKETS_LDFLAGS, [BSD Sockets linker flags])
2195AC_ARG_VAR(SOCKETS_LIBS, [BSD Sockets linker libraries])
2196
2197
2198#
2199# Check for headers
2200#
2201AC_HEADER_STDBOOL
2202AC_HEADER_STDC
2203
2204AC_CHECK_HEADERS([ctype.h])
2205AC_CHECK_HEADERS([ifaddrs.h])
2206AC_CHECK_HEADERS([stdint.h])
2207AC_CHECK_HEADERS([stdlib.h])
2208AC_CHECK_HEADERS([string.h])
2209
2210# Check for netinet/icmp6.h for ICMP6_FILTER support. Both Android and
2211# Mac OS X fail to properly include both netinet/in.h and sys/types.h
2212# in netinet/icmp6.h, making the check fail unless it exists and these
2213# are both also included.
2214
2215AC_CHECK_HEADERS([netinet/in.h])
2216AC_CHECK_HEADERS([sys/types.h])
2217AC_CHECK_HEADERS([netinet/icmp6.h], [], [],
2218[
2219#if HAVE_SYS_TYPES_H
2220# include <sys/types.h>
2221#endif
2222#if HAVE_NETINET_IN_H
2223# include <netinet/in.h>
2224#endif
2225])
2226
2227# But, wait, this still isn't enough. Even with all of that, Android
2228# may still not have the ICMP6_FILTER socket option defined. Check for
2229# that too.
2230
2231AC_MSG_CHECKING([whether netinet/icmp6.h declares ICMP6_FILTER])
2232AC_COMPILE_IFELSE([
2233 AC_LANG_PROGRAM(
2234[[
2235#if HAVE_SYS_TYPES_H
2236# include <sys/types.h>
2237#endif
2238#if HAVE_NETINET_IN_H
2239# include <netinet/in.h>
2240#endif
2241#if HAVE_NETINET_ICMP6_H
2242# include <netinet/icmp6.h>
2243#endif
2244]],
2245[[
2246#if !defined(ICMP6_FILTER)
2247# error "ICMP6_FILTER is not defined"
2248#endif
2249]])],
2250[
2251AC_MSG_RESULT([yes])
2252AC_DEFINE(HAVE_ICMP6_FILTER, 1, [Define to 1 if your <netinet/icmp6.h> header file defines the ICMP6_FILTER socket option.])
2253],
2254[
2255AC_MSG_RESULT([no])
2256])
2257
2258# Check for sys/socket.h for SO_BINDTODEVICE support.
2259
2260AC_CHECK_HEADERS([sys/socket.h])
2261
2262AC_MSG_CHECKING([whether sys/socket.h declares SO_BINDTODEVICE])
2263AC_COMPILE_IFELSE([
2264 AC_LANG_PROGRAM(
2265[[
2266#if HAVE_SYS_SOCKET_H
2267# include <sys/socket.h>
2268#endif
2269]],
2270[[
2271#if !defined(SO_BINDTODEVICE)
2272# error "SO_BINDTODEVICE is not defined"
2273#endif
2274]])],
2275[
2276AC_MSG_RESULT([yes])
2277AC_DEFINE(HAVE_SO_BINDTODEVICE, 1, [Define to 1 if your <sys/socket.h> header file defines the SO_BINDTODEVICE socket option.])
2278],
2279[
2280AC_MSG_RESULT([no])
2281])
2282
2283# Check for sys/sockio.h
2284AC_CHECK_HEADERS([sys/sockio.h])
2285
2286#
2287# Check for types and structures
2288#
2289AC_TYPE_INT8_T
2290AC_TYPE_INT16_T
2291AC_TYPE_INT32_T
2292AC_TYPE_INT64_T
2293AC_TYPE_UINT8_T
2294AC_TYPE_UINT16_T
2295AC_TYPE_UINT32_T
2296AC_TYPE_UINT64_T
2297
2298#
2299# Checks for library functions
2300#
2301
2302CONFIG_HAVE_HEAP=0
2303
2304if test "${ac_no_link}" != "yes"; then
2305 # Check for stdlib memory management functions.
2306 AC_CHECK_FUNCS([malloc free realloc strdup], [CONFIG_HAVE_HEAP=1], [CONFIG_HAVE_HEAP=0])
2307 AC_CHECK_FUNCS([memchr memcmp memmove memset])
2308 AC_CHECK_FUNCS([strchr strcmp strlen])
2309 AC_CHECK_FUNCS([snprintf])
2310
2311 # Some versions of Android are missing getifaddrs and
2312 # freeifaddrs. Check to see if the target system is such a version.
2313
2314 AC_CHECK_FUNCS([getifaddrs freeifaddrs])
2315
2316 # Check for clock_gettime, gettimeofday, settimeofday and localtime.
2317 # In some target environments, clock_gettime exists in librt.
2318
2319 AC_SEARCH_LIBS([clock_gettime], [rt])
2320 AC_CHECK_FUNCS([clock_gettime gettimeofday localtime])
2321 AC_CHECK_HEADERS([time.h sys/time.h])
2322 AC_CHECK_TYPES([clockid_t], [], [], [[#include <time.h>]])
2323
2324 # Check for clock_settime. This function exists on iOS, however the compiler prevents
2325 # reference to it via the use of an "unavailable" attribute. Unfortunately, this goes
2326 # unnoticed by autoconf's AC_CHECK_FUNCS macro, hence the need for custom detection code.
2327
2328 AC_SEARCH_LIBS([clock_settime], [rt])
2329 AC_MSG_CHECKING([clock_settime])
2330 AC_LINK_IFELSE(
2331 [AC_LANG_SOURCE([[
2332 #include <stdlib.h>
2333 #include <time.h>
2334 int main(int argc, char *argv[])
2335 {
2336 clock_settime(CLOCK_REALTIME, NULL);
2337 return 0;
2338 }
2339 ]])],
2340 [AC_DEFINE([HAVE_CLOCK_SETTIME], [1], [Define to 1 if you have the `clock_settime' function.]) AC_MSG_RESULT([yes])],
2341 [AC_MSG_RESULT([no])]
Sagar Dhawanba5eacf2020-03-23 13:49:10 -07002342 )
Martin Turonba1a0282020-03-10 19:25:02 -07002343
2344 # Note that different platforms have different APIs for monotonic timer with sleep time compensation.
2345 # CLOCK_BOOTTIME is available in later versions of linux and Android
2346
2347 AC_CHECK_DECLS([CLOCK_MONOTONIC, CLOCK_BOOTTIME], [], [], [[#include <time.h>]])
2348fi
2349
2350AC_SUBST(CONFIG_HAVE_HEAP)
2351AM_CONDITIONAL([CONFIG_HAVE_HEAP], [test "${CONFIG_HAVE_HEAP}" = "1"])
2352
2353#
2354# Check for POSIX thread (pthread) support
2355#
2356AX_PTHREAD([], [])
2357
2358AC_CHECK_DECL([PTHREAD_NULL], [], [AC_DEFINE([PTHREAD_NULL],[0], [Approximation of PTHREAD_NULL since pthread.h does not define one])],
2359 [[#include <pthread.h>]])
2360
2361#
Vivien Nicolas79625962020-06-19 00:28:26 +02002362# Check for Network.framework
2363#
2364if test "${CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK}" = "1"; then
2365 AC_CHECK_HEADER([Network/Network.h])
2366 LDFLAGS="${LDFLAGS} -lnetwork"
2367fi
2368
2369#
Martin Turonba1a0282020-03-10 19:25:02 -07002370# Check for <new>
2371#
2372AC_LANG_PUSH([C++])
2373
2374AC_CHECK_HEADERS([new])
2375
2376AC_LANG_POP([C++])
2377
2378
2379# Add test enabled macro
2380if test "${nl_cv_build_tests}" = "yes"; then
2381 CPPFLAGS="${CPPFLAGS} -DNL_CHIP_WITH_TESTS"
2382 CPPFLAGS="${CPPFLAGS} -DCHIP_CONFIG_TEST=1"
2383 CPPFLAGS="${CPPFLAGS} -DCHIP_SYSTEM_CONFIG_TEST=1"
2384 CPPFLAGS="${CPPFLAGS} -DCHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS=1"
2385 if test ${CONFIG_NETWORK_LAYER_INET} = 1; then
2386 CPPFLAGS="${CPPFLAGS} -DINET_CONFIG_TEST=1"
2387 fi
2388fi
2389
Pankaj Garg5daed722020-04-20 16:55:31 -07002390# Add any crypto-implementation CPPFLAGS, LDFLAGS, and LIBS
Rob Walkerae3a9002020-04-15 13:48:47 -07002391
Pankaj Garg5daed722020-04-20 16:55:31 -07002392CRYPTO_CPPFLAGS="${CRYPTO_CPPFLAGS} ${MBEDTLS_CPPFLAGS} ${OPENSSL_CPPFLAGS}"
2393CRYPTO_LDFLAGS="${CRYPTO_LDFLAGS} ${MBEDTLS_LDFLAGS} ${OPENSSL_LDFLAGS}"
2394CRYPTO_LIBS="${CRYPTO_LIBS} ${MBEDTLS_LIBS} ${OPENSSL_LIBS}"
Martin Turonba1a0282020-03-10 19:25:02 -07002395
Pankaj Garg5daed722020-04-20 16:55:31 -07002396AC_SUBST(CRYPTO_CPPFLAGS)
2397AC_SUBST(CRYPTO_LDFLAGS)
2398AC_SUBST(CRYPTO_LIBS)
Martin Turonba1a0282020-03-10 19:25:02 -07002399
Yakun Xu47f325f2020-07-15 00:10:33 +08002400CPPFLAGS="${CPPFLAGS} ${CRYPTO_CPPFLAGS} ${OPENTHREAD_CPPFLAGS}"
2401LDFLAGS="${LDFLAGS} ${CRYPTO_LDFLAGS} ${OPENTHREAD_LDFLAGS}"
2402LIBS="${LIBS} ${CRYPTO_LIBS} ${OPENTHREAD_LIBS}"
Pankaj Garg139d43b2020-04-15 19:04:57 -07002403
Martin Turonba1a0282020-03-10 19:25:02 -07002404# Add any code coverage CPPFLAGS, LDFLAGS, and LIBS
2405
2406CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}"
2407LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}"
2408LIBS="${LIBS} ${NL_COVERAGE_LIBS}"
2409
2410# Fold in the warning-as-errors flag, unless it was already in effect.
2411
2412if test "${nl_had_CPPFLAGS_werror}" = "no"; then
2413 CPPFLAGS="${CPPFLAGS} ${NL_WERROR_CPPFLAGS}"
2414fi
2415
Rob Walkerae3a9002020-04-15 13:48:47 -07002416
Martin Turonba1a0282020-03-10 19:25:02 -07002417# At this point, we can restore the compiler flags to whatever the
2418# user passed in, now that we're clear of an -Werror issues by
2419# transforming -Wno-error back to -Werror.
2420
2421NL_RESTORE_WERROR
2422
2423#
2424# Code style
2425#
2426
Rob Walker1826e1d2020-04-23 13:55:34 -07002427AC_SUBST(PRETTY, ["\${abs_top_srcdir}/scripts/helpers/clang-format.sh"])
Martin Turonba1a0282020-03-10 19:25:02 -07002428AC_SUBST(PRETTY_ARGS, ["-style=file -i"])
Rob Walker1826e1d2020-04-23 13:55:34 -07002429AC_SUBST(PRETTY_CHECK, ["\${abs_top_srcdir}/scripts/helpers/clang-format-check.sh"])
Martin Turonba1a0282020-03-10 19:25:02 -07002430AC_SUBST(PRETTY_CHECK_ARGS, [""])
2431
2432# Configure any autotools-based subdirectories
2433if test "${nl_with_nlunit_test}" = "internal"; then
2434AC_CONFIG_SUBDIRS([third_party/nlunit-test/repo])
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002435AC_SUBST(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlunit-test/repo/src"])
Martin Turonba1a0282020-03-10 19:25:02 -07002436fi
2437
2438if test "${nl_with_nlio}" = "internal"; then
2439AC_CONFIG_SUBDIRS([third_party/nlio/repo])
2440fi
2441
2442if test "${nl_with_nlassert}" = "internal"; then
2443AC_CONFIG_SUBDIRS([third_party/nlassert/repo])
Pankaj Garg5f7b9522020-04-18 16:58:54 -07002444fi
2445
Grant Erickson81bc5702020-03-18 10:26:28 -07002446if test "${nl_with_nlfaultinjection}" = "internal"; then
2447AC_CONFIG_SUBDIRS([third_party/nlfaultinjection/repo])
Grant Erickson9299bd32020-05-13 10:08:01 -07002448AC_SUBST(NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlfaultinjection/repo/src"])
Rob Walker1eef6cf2020-04-20 18:16:12 -07002449fi
2450
yunhanw-googlee1d448c2020-07-21 11:57:53 -07002451if test "${nl_with_bluez}" = "internal" && test "${enable_chipoble_bluez}" = "yes"; then
2452AC_CONFIG_SUBDIRS([third_party/bluez/repo])
2453fi
2454
Rob Walker1eef6cf2020-04-20 18:16:12 -07002455if test "${nl_with_mbedtls}" = "internal"; then
2456AC_CONFIG_SUBDIRS([third_party/mbedtls/repo])
Grant Erickson81bc5702020-03-18 10:26:28 -07002457fi
2458
Grant Erickson9299bd32020-05-13 10:08:01 -07002459if test "${nl_with_lwip}" = "internal"; then
2460AC_SUBST(LWIP_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/src/lwip"])
2461fi
2462
Martin Turonba1a0282020-03-10 19:25:02 -07002463#
2464# Identify the various makefiles and auto-generated files for the package
2465#
2466AC_CONFIG_FILES([
2467Makefile
Martin Turone4c92e12020-05-13 10:36:33 -07002468docs/Makefile
Martin Turonef904ab2020-04-20 18:15:33 -07002469examples/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002470third_party/Makefile
2471third_party/lwip/Makefile
Grant Ericksona353a452020-04-24 08:39:46 -07002472third_party/mbedtls/Makefile
Jiacheng Guo10be6f02020-07-08 13:46:03 +08002473third_party/ot-br-posix/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002474src/Makefile
Grant Ericksondf2490952020-04-03 14:25:30 -07002475src/include/Makefile
Rob Walker06724df2020-05-26 11:09:01 -07002476src/app/Makefile
Boris Zbarsky3c021ad2020-08-07 14:15:22 -04002477src/app/clusters/Makefile
Boris Zbarsky3c021ad2020-08-07 14:15:22 -04002478src/app/util/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002479src/ble/Makefile
Grant Erickson5f1fe832020-04-03 10:56:51 -07002480src/ble/tests/Makefile
Vidhi Shah4a9410e2020-07-29 11:47:11 -07002481src/controller/java/Makefile
Bhaskar Sarma242d1712020-04-01 15:49:17 -07002482src/crypto/Makefile
2483src/crypto/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002484src/lwip/Makefile
2485src/lwip/tests/Makefile
2486src/system/Makefile
2487src/system/tests/Makefile
Martin Turon9389ebe2020-03-16 22:00:38 -07002488src/setup_payload/Makefile
Vidhi Shah92fda7c2020-07-07 07:47:51 -07002489src/setup_payload/java/Makefile
Martin Turon9389ebe2020-03-16 22:00:38 -07002490src/setup_payload/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002491src/inet/Makefile
Grant Erickson8e583362020-03-31 10:40:56 -07002492src/inet/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002493src/lib/Makefile
Grant Erickson5f1fe832020-04-03 10:56:51 -07002494src/lib/core/tests/Makefile
Martin Turon6f6c6d82020-06-10 10:10:10 -07002495src/lib/shell/Makefile
2496src/lib/shell/tests/Makefile
Grant Ericksond30c2302020-04-01 11:33:22 -07002497src/lib/support/Makefile
Grant Erickson9189b872020-04-02 10:49:27 -07002498src/lib/support/tests/Makefile
Pankaj Garg73f9cdc2020-03-23 15:47:39 -07002499src/platform/Makefile
Martin Turon0c03fa82020-05-26 15:43:11 -07002500src/platform/tests/Makefile
shana-appleab8ffd52020-05-20 18:25:29 +02002501src/qrcodetool/Makefile
Andrei Litvin343b5ad2020-05-27 16:29:50 -04002502src/transport/Makefile
2503src/transport/tests/Makefile
Martin Turonba1a0282020-03-10 19:25:02 -07002504])
2505
2506#
2507# Generate the auto-generated files for the package
2508#
2509AC_OUTPUT
2510
2511#
2512# Summarize the package configuration
2513#
2514
2515AC_MSG_NOTICE([
2516
2517 Configuration Summary
2518 ---------------------
2519 Package : ${PACKAGE_NAME}
2520 Version : ${PACKAGE_VERSION}
2521 Interface : ${LIBCHIP_VERSION_INFO//:/.}
2522 Build system : ${build}
2523 Host system : ${host}
2524 Target system : ${target}
2525 Target architecture : ${target_cpu}
2526 Target OS : ${target_os}
2527 Target style : ${CHIP_TARGET_STYLE}
Martin Turon0c03fa82020-05-26 15:43:11 -07002528 Device layer : ${CHIP_DEVICE_LAYER_TARGET}
Pankaj Garg5daed722020-04-20 16:55:31 -07002529 Cryptographic implementation : ${CHIP_CRYPTO}
Martin Turonba1a0282020-03-10 19:25:02 -07002530 Target network layer : ${with_network_layer}
2531 Target network system(s) : ${CONFIG_TARGET_NETWORKS}
2532 IPv4 enabled : ${enable_ipv4}
2533 Internet endpoint(s) : ${INET_ENDPOINTS}
2534 Printf enhancements : ${CHIP_ENHANCED_PRINTF}
2535 Android support : ${with_android}
2536 Logging style : ${CHIP_LOGGING_STYLE}
2537 Cross compiling : ${cross_compiling}
2538 Build shared libraries : ${enable_shared}
2539 Build static libraries : ${enable_static}
2540 Build debug libraries : ${nl_cv_build_debug}
2541 Build profile libraries : ${build_profile}
2542 Build optimized libraries : ${nl_cv_build_optimized}
2543 Build coverage libraries : ${nl_cv_build_coverage}
2544 Build coverage reports : ${nl_cv_build_coverage_reports}
2545 Lcov : ${LCOV:--}
2546 Genhtml : ${GENHTML:--}
Grant Erickson6d7428b2020-05-11 16:31:38 -07002547 Happy : ${with_happy}
2548 Happy Path : ${happy_path}
Martin Turonba1a0282020-03-10 19:25:02 -07002549 Treat warnings as errors : ${nl_cv_warnings_as_errors}
2550 Build tests : ${nl_cv_build_tests}
2551 Build long running tests : ${nl_cv_build_long_tests}
2552 Build tools : ${build_tools}
2553 Tunnel Failover support : ${build_tunnel_failover}
Martin Turonba1a0282020-03-10 19:25:02 -07002554 Prefix : ${prefix}
2555 Shadow directory program : ${LNDIR}
2556 Cocoa support : ${enable_cocoa}
2557 Java support : ${enable_java}
2558 Java home : ${JAVA_HOME:--}
2559 Java Compiler : ${JAVAC:--}
2560 Java Native Interface (JNI) compile flags : ${JNI_CPPFLAGS:--}
2561 Java Archiver : ${JAR:--}
2562 Python executable : ${PYTHON:--}
2563 Python version : ${PYTHON_VERSION:--}
2564 Python script directory : ${pythondir:--}
2565 Python extension directory : ${pyexecdir:--}
2566 Verhoeff support : ${enable_verhoeff}
2567 Pairing code decoding support : ${enable_pairing_code_decoding}
2568 Documentation support : ${nl_cv_build_docs}
2569 Clang-format : ${CLANG_FORMAT:--}
2570 Doxygen : ${DOXYGEN:--}
2571 GraphViz dot : ${DOT:--}
2572 PERL : ${PERL:--}
yunhanw-googlee1d448c2020-07-21 11:57:53 -07002573 CHIP over BlueZ support : ${enable_chipoble_bluez:--}
2574 BlueZ source : ${nl_with_bluez:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002575 Valgrind : ${VALGRIND:--}
2576 LwIP source : ${nl_with_lwip:--}
2577 LwIP compile flags : ${LWIP_CPPFLAGS:--}
2578 LwIP link flags : ${LWIP_LDFLAGS:--}
2579 LwIP link libraries : ${LWIP_LIBS:--}
Grant Erickson9299bd32020-05-13 10:08:01 -07002580 LwIP foreign subdirectory dependency : ${LWIP_FOREIGN_SUBDIR_DEPENDENCY:--}
Grant Ericksona353a452020-04-24 08:39:46 -07002581 mbedTLS source : ${nl_with_mbedtls:--}
Pankaj Garg139d43b2020-04-15 19:04:57 -07002582 mbedTLS compile flags : ${MBEDTLS_CPPFLAGS:--}
2583 mbedTLS link flags : ${MBEDTLS_LDFLAGS:--}
2584 mbedTLS link libraries : ${MBEDTLS_LIBS:--}
Yakun Xu47f325f2020-07-15 00:10:33 +08002585 OpenThread source : ${nl_with_openthread}
2586 OpenThread compile flags : ${OPENTHREAD_CPPFLAGS:--}
2587 OpenThread link flags : ${OPENTHREAD_LDFLAGS:--}
2588 OpenThread link libraries : ${OPENTHREAD_LIBS:--}
Pankaj Garg5daed722020-04-20 16:55:31 -07002589 OpenSSL source : ${nl_with_openssl}
2590 OpenSSL compile flags : ${OPENSSL_CPPFLAGS:--}
2591 OpenSSL link flags : ${OPENSSL_LDFLAGS:--}
2592 OpenSSL link libraries : ${OPENSSL_LIBS:--}
2593 Crypto implementation compile flags : ${CRYPTO_CPPFLAGS:--}
2594 Crypto implementation link flags : ${CRYPTO_LDFLAGS:--}
2595 Crypto implementation link libraries : ${CRYPTO_LIBS:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002596 Nlunit-test source : ${nl_with_nlunit_test:--}
2597 Nlunit-test compile flags : ${NLUNIT_TEST_CPPFLAGS:--}
2598 Nlunit-test link flags : ${NLUNIT_TEST_LDFLAGS:--}
2599 Nlunit-test link libraries : ${NLUNIT_TEST_LIBS:--}
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002600 Nlunit-test foreign subdirectory dependency : ${NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002601 Nlio source : ${nl_with_nlio:--}
2602 Nlio compile flags : ${NLIO_CPPFLAGS:--}
2603 Nlio link flags : ${NLIO_LDFLAGS:--}
2604 Nlio link libraries : ${NLIO_LIBS:--}
2605 Nlassert source : ${nl_with_nlassert:--}
2606 Nlassert compile flags : ${NLASSERT_CPPFLAGS:--}
2607 Nlassert link flags : ${NLASSERT_LDFLAGS:--}
2608 Nlassert link libraries : ${NLASSERT_LIBS:--}
2609 Nlfaultinjection source : ${nl_with_nlfaultinjection:--}
2610 Nlfaultinjection compile flags : ${NLFAULTINJECTION_CPPFLAGS:--}
2611 Nlfaultinjection link flags : ${NLFAULTINJECTION_LDFLAGS:--}
2612 Nlfaultinjection link libraries : ${NLFAULTINJECTION_LIBS:--}
Grant Ericksonf48c08e2020-04-28 11:42:15 -07002613 Nlfaultinjection foreign subdirectory dependency : ${NLFAULTINJECTION_FOREIGN_SUBDIR_DEPENDENCY:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002614 Sockets compile flags : ${SOCKETS_CPPFLAGS:--}
2615 Sockets link flags : ${SOCKETS_LDFLAGS:--}
2616 Sockets link libraries : ${SOCKETS_LIBS:--}
2617 PThreads compile flags : ${PTHREAD_CFLAGS:--}
2618 PThreads link libraries : ${PTHREAD_LIBS:--}
Yufeng Wang92904f42020-06-15 13:46:29 -07002619 IniPP compile flags : ${INIPP_CPPFLAGS:--}
Yufeng Wangbca8b6e2020-07-15 07:01:51 -07002620 GIO compile flags : ${GIO_CFLAGS:--}
Vivien Nicolas03209202020-07-21 20:57:37 +02002621 GIO link flags : ${GIO_LIBS:--}
yunhanw-googlec0cde152020-07-29 06:33:50 -07002622 GIO UNIX compile flags : ${GIO_UNIX_CFLAGS:--}
2623 GIO UNIX link flags : ${GIO_UNIX_LIBS:--}
Martin Turonba1a0282020-03-10 19:25:02 -07002624 C Preprocessor : ${CPP}
2625 C Compiler : ${CC}
2626 C++ Preprocessor : ${CXXCPP}
2627 C++ Compiler : ${CXX}
2628 Objective C Compiler : ${OBJC:--}
2629 Objective C++ Compiler : ${OBJCXX:--}
2630 Archiver : ${AR}
2631 Archive Indexer : ${RANLIB}
2632 Symbol Stripper : ${STRIP}
2633 Object Copier : ${OBJCOPY}
2634 C Preprocessor flags : ${CPPFLAGS:--}
2635 C Compile flags : ${CFLAGS:--}
2636 C++ Compile flags : ${CXXFLAGS:--}
2637 Objective C Compile flags : ${OBJCFLAGS:--}
2638 Objective C++ Compile flags : ${OBJCXXFLAGS:--}
2639 Symbol Visibility C Compile flags : ${VISIBILITY_CFLAGS:--}
2640 Symbol Visibility C++ Compile flags : ${VISIBILITY_CXXFLAGS:--}
2641 Symbol Visibility Objective C Compile flags : ${VISIBILITY_OBJCFLAGS:--}
2642 Symbol Visibility Objective C++ Compile flags : ${VISIBILITY_OBJCXXFLAGS:--}
2643 Link flags : ${LDFLAGS:--}
2644 Link libraries : ${LIBS}
2645 Fuzzing Enabled : ${enable_fuzzing}
Martin Turonba1a0282020-03-10 19:25:02 -07002646])