forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2375 lines (1910 loc) · 76.4 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2018-2019 Google LLC
# Copyright (c) 2014-2018 Nest Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description:
# This file is the GNU autoconf input source file for the
# Connected Home over IP package.
#
#
# Declare autoconf version requirements
#
AC_PREREQ([2.68])
#
# Initialize autoconf for the package
#
AC_INIT([Chip],
m4_esyscmd([third_party/nlbuild-autotools/repo/scripts/mkversion -b `cat .default-version` .]),
[chip.support@zigbee.com],
[chip],
[https://zigbee.com/])
# Tell the rest of the build system the absolute path where the
# nlbuild-autotools repository is rooted at.
AC_SUBST(nlbuild_autotools_stem,[third_party/nlbuild-autotools/repo])
AC_SUBST(abs_top_nlbuild_autotools_dir,[\${abs_top_srcdir}/\${nlbuild_autotools_stem}])
#
# CHIP interface current, revision, and age versions.
#
# NOTE: At present, the CHIP SDK makes NO ABI compatibility
# commitments. Consequently, these simply serve as documentation
# for how the interfaces have evolved.
#
# Maintainters: Please manage these fields as follows:
#
# Interfaces removed: CURRENT++, AGE = 0, REVISION = 0
# Interfaces added: CURRENT++, AGE++, REVISION = 0
# No interfaces changed: REVISION++
#
#
AC_SUBST(LIBCHIP_VERSION_CURRENT, [1])
AC_SUBST(LIBCHIP_VERSION_AGE, [0])
AC_SUBST(LIBCHIP_VERSION_REVISION, [0])
AC_SUBST(LIBCHIP_VERSION_INFO, [${LIBCHIP_VERSION_CURRENT}:${LIBCHIP_VERSION_REVISION}:${LIBCHIP_VERSION_AGE}])
#
# Check the sanity of the source directory by checking for the
# presence of a key watch file
#
AC_CONFIG_SRCDIR([src/lib/core/CHIPConfig.h])
#
# Tell autoconf where to find auxilliary build tools (e.g. config.guess,
# install-sh, missing, etc.)
#
AC_CONFIG_AUX_DIR([build/autoconf])
#
# Tell autoconf where to find auxilliary M4 macros
# Note that nlbuild-autotools has macros in two subdirs, for local vs third-party scripts
#
AC_CONFIG_MACRO_DIRS([build/autoconf/m4 autoconf/m4 third_party/nlbuild-autotools/repo/third_party/autoconf/m4 third_party/nlbuild-autotools/repo/autoconf/m4])
#
# Tell autoconf what file the package is using to aggregate C preprocessor
# defines.
#
AC_CONFIG_HEADERS([src/include/BuildConfig.h])
#
# Guards against multiple inclusion of the BuildConfig.h
#
AH_TOP([#ifndef CHIP_BUILD_CONFIG_H
#define CHIP_BUILD_CONFIG_H])
AH_BOTTOM([#endif // CHIP_BUILD_CONFIG_H])
#
# Figure out what the canonical build, host and target tuples are.
#
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
#
# Mac OS X / Darwin ends up putting some versioning cruft on the end of its
# tuple that we don't care about in this script. Create "clean" variables
# devoid of it.
#
NL_FILTERED_CANONICAL_BUILD
NL_FILTERED_CANONICAL_HOST
NL_FILTERED_CANONICAL_TARGET
#
# Configure automake with the desired options, indicating that this is not
# a native GNU package, that we want "silent" build rules, and that we want
# objects built in the same subdirectory as their source rather than collapsed
# together at the top-level directory.
#
# Disable silent build rules by either passing --disable-silent-rules to
# configure or passing V=1 to make
#
AM_INIT_AUTOMAKE([1.14 foreign silent-rules subdir-objects tar-pax no-define])
#
# Silent build rules requires at least automake-1.11. Employ
# techniques for not breaking earlier versions of automake.
#
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_SILENT_RULES([yes])
#
# Disable maintainer mode to enable the package to automatically rebuild
# configure, Makefile.in, etc. when the files on which they depend change (for
# example, configure.ac, Makefile.am, etc).
#
# For those that do not desire this behavior, run configure with
# `--enable-maintainer-mode` and run the top-level `bootstrap` script manually.
#
AM_MAINTAINER_MODE([disable])
#
# Check for the target style
#
CHIP_TARGET_STYLE=
CHIP_TARGET_STYLE_UNIX=0
CHIP_TARGET_STYLE_EMBEDDED=0
AC_MSG_CHECKING([for target style])
# The user may have attempted to explicitly specify the target
# style. Sanity check it or default to 'auto'.
AC_ARG_WITH(target-style,
[AS_HELP_STRING([--with-target-style=TARGET],
[Specify the target style from one of: auto, embedded or unix @<:@default=auto@:>@.])],
[
case "${with_target_style}" in
auto|embedded|unix)
;;
*)
AC_MSG_ERROR([Invalid value ${with_target_style} for --with-target-style])
;;
esac
],
[with_target_style=auto])
# At this point, the target style is one of the allowed
# values. If it's 'auto' we autodetect it.
if test "${with_target_style}" = "auto"; then
case ${target_os} in
*cygwin*|*darwin*|*linux*|*freebsd*|*netbsd*|*openbsd*)
with_target_style=unix
;;
*freertos*)
with_target_style=embedded
;;
*)
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Unsupported target OS ${target_os}])
;;
esac
fi
CHIP_TARGET_STYLE=${with_target_style}
case ${with_target_style} in
embedded)
CHIP_TARGET_STYLE_EMBEDDED=1
;;
unix)
CHIP_TARGET_STYLE_UNIX=1
;;
esac
AC_MSG_RESULT(${CHIP_TARGET_STYLE})
AC_SUBST(CHIP_TARGET_STYLE)
AC_DEFINE_UNQUOTED([CHIP_TARGET_STYLE],[${CHIP_TARGET_STYLE}],[CHIP target style])
AC_SUBST(CHIP_TARGET_STYLE_EMBEDDED)
AM_CONDITIONAL([CHIP_TARGET_STYLE_EMBEDDED], [test "${CHIP_TARGET_STYLE}" = "embedded"])
AC_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])
AC_SUBST(CHIP_TARGET_STYLE_UNIX)
AM_CONDITIONAL([CHIP_TARGET_STYLE_UNIX], [test "${CHIP_TARGET_STYLE}" = "unix"])
AC_DEFINE_UNQUOTED([CHIP_TARGET_STYLE_UNIX],[${CHIP_TARGET_STYLE_UNIX}],[Define to 1 if you want to use CHIP with a Unix-based system])
#
# Checks for build host programs
#
# If we are cross-compiling and we are on an embedded target that
# doesn't support independent, standalone executables, then all
# compiler tests that attempt to create an executable will fail. In
# such circumstances, set AC_NO_EXECUTABLES (see http://sourceware.org/
# ml/newlib/2006/msg00353.html).
AC_MSG_CHECKING([whether to disable executable checking])
if test "$cross_compiling" = yes -a "${CHIP_TARGET_STYLE}" = "embedded"; then
# AC_NO_EXECUTABLES
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
# Passing -Werror to GCC-based or -compatible compilers breaks some
# autoconf tests (see
# http://lists.gnu.org/archive/html/autoconf-patches/2008-09/msg00014.html).
#
# If -Werror has been passed transform it into -Wno-error. We'll
# transform it back later with NL_RESTORE_WERROR.
NL_SAVE_WERROR
# Check for compilers.
#
# These should be checked BEFORE we check for and, implicitly,
# initialize libtool such that libtool knows what languages it has to
# work with.
AC_PROG_CPP
AC_PROG_CPP_WERROR
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_CXXCPP
AC_PROG_CXX
AC_PROG_CXX_C_O
AC_PROG_OBJC
AC_PROG_OBJCXX
# Check for other compiler toolchain tools.
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib)
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(STRIP, strip)
# Check for other host tools.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROG(CLANG_FORMAT, clang-format)
AC_PATH_PROG(CMP, cmp)
AC_PATH_PROG(PERL, perl)
AC_PATH_PROG(VALGRIND, valgrind)
#
# Python
#
# At minimum, a Python interpreter is absolutely required to
# auto-generate a number of header files (e.g., ASN1OID.h).
# Additionally, Python support is used for one binding of the
# Device Manager as well as to run and orchestrate several
# unit and functional tests.
#
# In a normal "build-and-install on 'this' machine" context,
# placing Python packages in the normal pythondir and pyexecdir
# (typically
# lib/pythonPYTHON_VERSION/{dist,site}-packages/PACKAGE) makes
# sense.
#
# However, in our case, we're building and 'installing' for
# standalone distrubution to any number of machines for which we
# don't know the Python version. In those cases, override
# pythondir and pyexec dir.
case "${prefix}" in
/opt|/usr|/usr/local|NONE)
;;
*)
am_cv_python_pythondir="\${prefix}/lib/python"
am_cv_python_pyexecdir="\${exec_prefix}/lib/python"
;;
esac
# Check for Python
AM_PATH_PYTHON
# If a Python interpreter of any color cannot be found, error out.
if test "${PYTHON}" = ""; then
AC_MSG_ERROR([could not find python: python is required to build this package.])
fi
# Check for specific Python packages
AC_MSG_CHECKING([for Python setuptools package])
if ${PYTHON} -c 'import setuptools' >/dev/null 2>&1; then
have_python_package_setuptools=yes
else
have_python_package_setuptools=no
fi
AC_MSG_RESULT(${have_python_package_setuptools})
AC_MSG_CHECKING([for Python wheel package])
if ${PYTHON} -c 'import wheel' >/dev/null 2>&1; then
have_python_package_wheel=yes
else
have_python_package_wheel=no
fi
AC_MSG_RESULT(${have_python_package_wheel})
#
# Checks for specific compiler characteristics
#
#
# Common compiler flags we would like to have.
#
# -Wall -Wshadow -Wframe-larger-than=9472 -Wtype-limits CC, CXX, OBJC, OBJCXX [unix, embedded]
# -fPIC CC, CXX, OBJC, OBJCXX [unix]
# -fno-stack-protector CC, CXX, OBJC, OBJCXX [unix]
# -fno-exceptions CXX, OBJCXX [unix]
# -fobjc-call-cxx-cdtors OBJC, OBJCXX [cocoa]
# -fobjc-arc OBJC, OBJCXX [cocoa]
#
#
PROSPECTIVE_CFLAGS="-Wall -Wshadow -Wframe-larger-than=9472 -Wtype-limits"
PROSPECTIVE_CXXFLAGS=""
PROSPECTIVE_OBJCFLAGS="-fobjc-call-cxx-cdtors -fobjc-arc"
PROSPECTIVE_OBJCXXFLAGS=""
# Suppress clang-specific warnings about -Wnonportable-include-path.
#
# -Wnonportable-include-path warns about include paths that can be
# problematic. This creates false positives for CHIP when compiling
# the CHIP Addressing and Routing Module (CHIPARM) in which source
# directories (e.g. src/warm/...) and public include directories
# (e.g. src/include/Warm/...) have identical, and consequently
# ambiguous, naming on case-insensitive file systems.
case "`basename ${CC}`" in
*clang)
AX_CHECK_COMPILER_OPTIONS([C], -Wno-nonportable-include-path)
;;
esac
case "`basename ${CXX}`" in
*clang++)
AX_CHECK_COMPILER_OPTIONS([C++], -Wno-nonportable-include-path)
;;
esac
# For the flags that are desired for the "unix" target style, add
# those to the set to be checked. For the "embedded" target style, the
# CHIP system integrator knows best as to what compiler flags should
# be added and will have passed them in.
if test "${CHIP_TARGET_STYLE}" = "unix"; then
PROSPECTIVE_CFLAGS="${PROSPECTIVE_CFLAGS} -fPIC -fno-stack-protector"
PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -fno-exceptions"
fi
# CHIP intentionally uses derived classes that do not use an explicit
# destructor and a virtual one at that. Consequently, do not emit
# compiler warnings or errors about it when deletion is performed on
# such objects.
PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -Wno-delete-non-virtual-dtor"
# Check whether the C++ compiler supports C++11 with GNU
# extensions. If it is supported, enable it. Otherwise, proceed
# without error or warning. While the CHIP code itself does not rely
# on the GNU extensions, Android build targets crash when the standard
# is set to strict C++11
AX_CXX_COMPILE_STDCXX_11(noext, optional)
AM_CONDITIONAL([HAVE_CXX11], [test "x${HAVE_CXX11}" == "x1"])
if test "x${HAVE_CXX11}" == "x1"; then
PROSPECTIVE_CXXFLAGS="${PROSPECTIVE_CXXFLAGS} -std=gnu++11"
fi
AX_CHECK_COMPILER_OPTIONS([C], ${PROSPECTIVE_CFLAGS})
AX_CHECK_COMPILER_OPTIONS([C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS})
# Check for and initialize libtool
LT_INIT
#
# Android support
#
with_android=no
AC_MSG_CHECKING([for an Android target])
case "${target}" in
*android*)
with_android=yes
;;
*)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
#if !defined(__ANDROID__) || !__ANDROID__
#error "We are not compiling with Android."
#endif
]])],
[with_android=yes],
[with_android=no])
;;
esac
AC_MSG_RESULT(${with_android})
AM_CONDITIONAL([CHIP_WITH_ANDROID], [test "${with_android}" = "yes"])
AC_SUBST(CROSS_SYSROOT, [$lt_sysroot])
#
# CHIP package-specific build customization options
#
#
# Check for logging style
#
CHIP_LOGGING_STYLE=
CHIP_LOGGING_STYLE_ANDROID=0
CHIP_LOGGING_STYLE_EXTERNAL=0
CHIP_LOGGING_STYLE_STDIO=0
CHIP_LOGGING_STYLE_STDIO_WEAK=0
AC_MSG_CHECKING([for logging style])
AC_ARG_WITH(logging-style,
[AS_HELP_STRING([--with-logging-style=STYLE],
[Specify the logging style from one of: auto, android, stdio, stdio-weak, or external @<:@default=auto@:>@.])],
[
case "${with_logging_style}" in
android|auto|external|stdio|stdio-weak)
;;
*)
AC_MSG_ERROR([Invalid value ${with_logging_style} for --with-logging-style])
;;
esac
],
[with_logging_style=auto])
# At this point, the logging style is one of the allowed values. If
# it's 'auto' we autodetect it. Otherwise, sanity check the specified
# value.
if test "${with_logging_style}" = "auto"; then
if test "${with_android}" = "yes"; then
with_logging_style=android
elif test "${with_target_style}" = "unix"; then
with_logging_style=stdio
else
with_logging_style=external
fi
else
if test "${with_android}" != "yes"; then
if test "${with_logging_style}" = "android"; then
AC_MSG_ERROR([Android-style logging may only be specified when building for Android.])
fi
fi
fi
CHIP_LOGGING_STYLE=${with_logging_style}
case ${with_logging_style} in
android)
CHIP_LOGGING_STYLE_ANDROID=1
;;
external)
CHIP_LOGGING_STYLE_EXTERNAL=1
;;
stdio)
CHIP_LOGGING_STYLE_STDIO=1
;;
stdio-weak)
CHIP_LOGGING_STYLE_STDIO_WEAK=1
;;
esac
AC_MSG_RESULT(${CHIP_LOGGING_STYLE})
AC_SUBST(CHIP_LOGGING_STYLE)
AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE],[${CHIP_LOGGING_STYLE}],[CHIP logging style])
AC_SUBST(CHIP_LOGGING_STYLE_ANDROID)
AM_CONDITIONAL([CHIP_LOGGING_STYLE_ANDROID], [test "${CHIP_LOGGING_STYLE}" = "android"])
AC_DEFINE_UNQUOTED([CHIP_LOGGING_STYLE_ANDROID],[${CHIP_LOGGING_STYLE_ANDROID}],[Define to 1 if you want to use CHIP with the Android logging system])
AC_SUBST(CHIP_LOGGING_STYLE_EXTERNAL)
AM_CONDITIONAL([CHIP_LOGGING_STYLE_EXTERNAL], [test "${CHIP_LOGGING_STYLE}" = "external"])
AC_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])
AC_SUBST(CHIP_LOGGING_STYLE_STDIO)
AM_CONDITIONAL([CHIP_LOGGING_STYLE_STDIO], [test "${CHIP_LOGGING_STYLE}" = "stdio"])
AC_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])
AC_SUBST(CHIP_LOGGING_STYLE_STDIO_WEAK)
AM_CONDITIONAL([CHIP_LOGGING_STYLE_STDIO_WEAK], [test "${CHIP_LOGGING_STYLE}" = "stdio-weak"])
AC_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])
#
# If C Standard I/O logging is used, prepending timestamps before log
# lines may be enabled to support test automation and other debugging
# activities.
#
CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS=0
AC_MSG_CHECKING([whether to enable stdio logging timestamps])
AC_ARG_ENABLE(stdio-logging-timestamps,
[AS_HELP_STRING([--enable-stdio-logging-timestamps],[Enable timestamps in stdio- or stdio-weak- style log output @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
if test "${enableval}" = "yes"; then
if test "${CHIP_LOGGING_STYLE}" != "stdio"; then
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.])
else
CHIP_LOGGING_STYLE_STDIO_WITH_TIMESTAMPS=1
fi
fi
enable_stdio_logging_timestamps=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-stdio-logging-timestamps])
;;
esac
],
[enable_stdio_logging_timestamps=no])
AC_MSG_RESULT(${enable_stdio_logging_timestamps})
AC_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])
#
# Cocoa support
#
AC_MSG_CHECKING([whether to build Cocoa support])
AC_ARG_ENABLE(cocoa,
[AS_HELP_STRING([--enable-cocoa],[Enable Cocoa support, required for the iOS device manager @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_cocoa=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-cocoa])
;;
esac
],
[enable_cocoa=no])
AC_MSG_RESULT(${enable_cocoa})
AM_CONDITIONAL([CHIP_WITH_COCOA], [test "${enable_cocoa}" = "yes"])
if test "${enable_cocoa}" = "yes" ; then
# Check if the Objective C and Objective C++ compilers support
# some overall options we want for those sources.
AX_CHECK_COMPILER_OPTIONS([Objective C], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_OBJCFLAGS})
AX_CHECK_COMPILER_OPTIONS([Objective C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS} ${PROSPECTIVE_OBJCFLAGS} ${PROSPECTIVE_OBJCXXFLAGS})
AC_LANG_PUSH([Objective C++])
# Check for required Cocoa headers.
AC_CHECK_HEADERS([Foundation/Foundation.h],
[],
[
AC_MSG_ERROR(The Cocoa header "$ac_header" is required but cannot be found.)
])
AC_LANG_POP([Objective C++])
fi
#
# Java support
#
# Influential external variables for Java support
AC_ARG_VAR(JAVA_HOME, [Java SDK root directory])
AC_ARG_VAR(JNI_CPPFLAGS, [Java Native Interface (JNI) C preprocessor flags])
AC_ARG_VAR(JAVAC, [Java class compiler command])
AC_ARG_VAR(JAR, [Java archiver command])
AC_MSG_CHECKING([whether to build Java support])
AC_ARG_ENABLE(java,
[AS_HELP_STRING([--disable-java],[Disable Java support, otherwise required for the Android device manager and CHIP service support @<:@default=auto@:>@.])],
[
case "${enableval}" in
auto|no|yes)
enable_java=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-java])
;;
esac
],
[enable_java=auto])
if test "${enable_java}" = "auto"; then
if test "x${JAVA_HOME}" != "x"; then
enable_java=yes
else
enable_java=no
fi
fi
AC_MSG_RESULT(${enable_java})
# If Java support has been requested, then check for the relevant Java
# headers and tools.
if test "${enable_java}" = "yes" ; then
# Check for Java
# If a specific set of JNI_INCLUDE_DIRS has *not* been given, attempt
# to locate the JNI include dirs from JAVA_HOME or the location of
# javac.
if test "x${JNI_INCLUDE_DIRS}" = "x" ; then
AC_JNI_INCLUDE_DIR
fi
if test "x${JNI_INCLUDE_DIRS}" != "x" ; then
for dir in ${JNI_INCLUDE_DIRS} ; do
JNI_CPPFLAGS="${JNI_CPPFLAGS} -I${dir}"
done
AC_SUBST(JNI_CPPFLAGS)
fi
AC_PATH_PROG([JAVAC], [javac], [], [${JAVA_HOME:+${JAVA_HOME}/bin}${PATH_SEPARATOR}${PATH}])
AC_PATH_PROG([JAR], [jar], [], [${JAVA_HOME:+${JAVA_HOME}/bin}${PATH_SEPARATOR}${PATH}])
fi
AM_CONDITIONAL([CHIP_WITH_JAVA], [test "${enable_java}" = "yes"])
#
# Debug and profile instances
#
AC_MSG_NOTICE([checking whether to build debug and profile instances])
# Debug
NL_ENABLE_DEBUG([no])
AM_CONDITIONAL([CHIP_BUILD_DEBUG], [test "${nl_cv_build_debug}" = "yes"])
# Profile
AC_MSG_CHECKING([whether to build profile instances of programs and libraries])
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--disable-profile],[Disable the generation of profile instances @<:@default=yes@:>@.])],
[
case "${enableval}" in
no|yes)
build_profile=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-profile])
;;
esac
],
[build_profile=no])
AC_MSG_RESULT(${build_profile})
AM_CONDITIONAL([CHIP_BUILD_PROFILE], [test "${build_profile}" = "yes"])
#
# Code coverage and compiler optimization
#
# Coverage
NL_ENABLE_COVERAGE([no])
AM_CONDITIONAL([CHIP_BUILD_COVERAGE], [test "${nl_cv_build_coverage}" = "yes"])
NL_ENABLE_COVERAGE_REPORTS([auto])
AM_CONDITIONAL([CHIP_BUILD_COVERAGE_REPORTS], [test "${nl_cv_build_coverage_reports}" = "yes"])
# Optimization
NL_ENABLE_OPTIMIZATION([yes])
AM_CONDITIONAL([CHIP_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = "yes"])
#
# Treat Compiler Warnings as Errors
#
NL_ENABLE_WERROR([no])
#
# Tests and tools
#
AC_MSG_NOTICE([checking whether to build tools and tests])
# Tests
NL_ENABLE_TESTS([yes])
AM_CONDITIONAL([CHIP_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
# Tools
AC_MSG_CHECKING([whether to build tools])
AC_ARG_ENABLE(tools,
[AS_HELP_STRING([--disable-tools],[Disable building of tools @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
build_tools=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-tools])
;;
esac
],
[build_tools=yes])
AC_MSG_RESULT(${build_tools})
AM_CONDITIONAL([CHIP_BUILD_TOOLS], [test "${build_tools}" = "yes"])
# Happy
AC_MSG_CHECKING([checking whether to run functional tests with Happy])
AC_ARG_WITH(happy,
[AS_HELP_STRING([--with-happy=HAPPY],
[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].])],
[
case "${with_happy}" in
no|yes)
;;
*)
configure_happy_path=${with_happy}
happy_path="${with_happy}/lib/python${am_cv_python_version}/site-packages/"
with_happy=yes
;;
esac
],
[with_happy=auto])
if test "${nl_cv_build_tests}" != "yes"; then
with_happy=no
happy_path="-"
else
if test -n ${happy_path}; then
grep "Nest Labs" ${configure_happy_path}/setup.py &> /dev/null
if test $? = 0; then
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."])
fi
if ! test -d ${happy_path}; then
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."])
fi
fi
fi
if test "${with_happy}" != "no"; then
PYTHONPATH=${happy_path}:${PYTHONPATH} python -c 'import happy' 2> /dev/null
if test $? != 0; then
if test "${with_happy}" = "yes"; then
if test -z ${happy_path}; then
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>'."])
else
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}."])
fi
else
with_happy=no
happy_path="-"
fi
else
with_happy=yes
fi
fi
if test "${with_happy}" = "yes"; then
HAPPY_MINIMUM_VERSION="1.1.36"
happy_version=`PYTHONPATH=${happy_path}:${PYTHONPATH} ${PYTHON} -c 'import happy; print happy.__version__ if "__version__" in dir(happy) else "0.0.0"'`
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}."])],[])
fi
AC_MSG_RESULT(${with_happy})
AM_CONDITIONAL([WEAVE_RUN_HAPPY], [test "${with_happy}" = "yes"])
AC_SUBST(HAPPY_PATH,[${happy_path}])
#
# CHIPoBLE Control Path and Throughput Test (CHIPoBLE Test)
#
AC_MSG_CHECKING([whether to build CHIPoBLE Test])
AC_ARG_ENABLE(chipoble-test,
[AS_HELP_STRING([--enable-chipoble-test],[Enable CHIPoBLE Test @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_chipoble_test=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-chipoble-test])
;;
esac
],
[enable_chipoble_test=no])
AC_MSG_RESULT(${enable_chipoble_test})
AM_CONDITIONAL([CHIP_ENABLE_CHIPOBLE_TEST], [test "${enable_chipoble_test}" = "yes"])
if test "${enable_chipoble_test}" = "yes"; then
CHIP_ENABLE_CHIPOBLE_TEST=1
else
CHIP_ENABLE_CHIPOBLE_TEST=0
fi
AC_DEFINE_UNQUOTED([CHIP_ENABLE_CHIPOBLE_TEST],[${CHIP_ENABLE_CHIPOBLE_TEST}],[Define to 1 if you want to enable CHIPoBle Control Path and Throughput Test.])
#
# Documentation
#
# Determine whether or not documentation (via Doxygen) should be built
# or not, with 'auto' as the default and establish a default support
# value for GraphViz 'dot' support.
NL_ENABLE_DOCS([auto],[NO])
AM_CONDITIONAL(CHIP_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
#
# OpenThread
#
NL_WITH_OPTIONAL_INTERNAL_PACKAGE(
[OpenThread],
[OPENTHREAD],
[openthread],
[],
[
AC_MSG_NOTICE([No internal OpenThread support yet!])
with_openthread=no
],
[
# Check for required OpenThread headers.
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],
[],
[
AC_MSG_ERROR(The nlio header "$ac_header" is required but cannot be found.)
])
]
)
AM_CONDITIONAL([CHIP_ENABLE_OPENTHREAD], [test "${with_openthread}" != "no"])
if test "${with_openthread}" != "no"; then
CHIP_ENABLE_OPENTHREAD=1
else
CHIP_ENABLE_OPENTHREAD=0
fi
AC_DEFINE_UNQUOTED([CHIP_ENABLE_OPENTHREAD],[${CHIP_ENABLE_OPENTHREAD}],[Define to 1 if you want to enable OpenThread.])
#
# Network Technology Layer
#
AC_MSG_CHECKING([network layer])
AC_ARG_WITH(network-layer,
[AS_HELP_STRING([--with-network-layer=LAYER],
[Specify the target network layers from one of: ble, inet, or all @<:@default=all@:>@.])],
[
case "${with_network_layer}" in
ble|inet|all)
;;
*)
AC_MSG_ERROR([Invalid value ${with_network_layer} for --with-network-layer])
;;
esac
],
[with_network_layer=all])
AC_MSG_RESULT(${with_network_layer})
case "${with_network_layer}" in
ble)
CONFIG_NETWORK_LAYER_BLE=1
CONFIG_NETWORK_LAYER_INET=0
;;
inet)
CONFIG_NETWORK_LAYER_BLE=0
CONFIG_NETWORK_LAYER_INET=1
;;
all)
CONFIG_NETWORK_LAYER_BLE=1
CONFIG_NETWORK_LAYER_INET=1
;;
esac
# NOTE WELL: The following logic is a transitional patch (BLE layer is currently dependent on INET layer)
if test ${CONFIG_NETWORK_LAYER_INET} = 0 && test ${CONFIG_NETWORK_LAYER_BLE} = 1; then
with_network_layer=all
CONFIG_NETWORK_LAYER_INET=1
AC_MSG_NOTICE([NOTE WELL: the BLE layer currently requires the INET layer.])
fi
AC_SUBST(CONFIG_NETWORK_LAYER_BLE)
AM_CONDITIONAL([CONFIG_NETWORK_LAYER_BLE], [test "${CONFIG_NETWORK_LAYER_BLE}" = 1])
AC_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.])
AC_SUBST(CONFIG_NETWORK_LAYER_INET)
AM_CONDITIONAL([CONFIG_NETWORK_LAYER_INET], [test "${CONFIG_NETWORK_LAYER_INET}" = 1])
AC_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.])
#
# CHIP Device Layer
#
AC_MSG_CHECKING([device layer])
AC_ARG_WITH(device-layer,
[AS_HELP_STRING([--with-device-layer=LAYER],
[Specify the target environment for the CHIP Device Layer. Choose one of: darwin, efr32, esp32, nrf5, linux, or none @<:@default=none@:>@.])],
[