This repository has been archived by the owner on Nov 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
1339 lines (1087 loc) · 40 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) 2016-2018 Nest Labs Inc.
# All rights reserved.
#
# 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
# Nest Labs Embedded Runtime.
#
#
# Declare autoconf version requirements
#
AC_PREREQ([2.68])
#
# Initialize autoconf for the package
#
AC_INIT([NLER],
m4_esyscmd([third_party/nlbuild-autotools/repo/scripts/mkversion -b `cat .default-version` .]),
[nler-users@google.com],
[nler],
[https://github.com/nestlabs/nler/])
# 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}])
#
# NLER interface current, revision, and age versions.
#
# 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(LIBNLER_VERSION_CURRENT, [1])
AC_SUBST(LIBNLER_VERSION_AGE, [0])
AC_SUBST(LIBNLER_VERSION_REVISION, [0])
AC_SUBST(LIBNLER_VERSION_INFO, [${LIBNLER_VERSION_CURRENT}:${LIBNLER_VERSION_REVISION}:${LIBNLER_VERSION_AGE}])
#
# Check the sanity of the source directory by checking for the
# presence of a key watch file
#
AC_CONFIG_SRCDIR([include/nlercfg.h])
#
# Tell autoconf where to find auxilliary build tools (e.g. config.guess,
# install-sh, missing, etc.)
#
AC_CONFIG_AUX_DIR([third_party/nlbuild-autotools/repo/third_party/autoconf])
#
# Tell autoconf where to find auxilliary M4 macros
#
AC_CONFIG_MACRO_DIRS([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([include/nler-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])
#
# 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])
#
# Enable maintainer mode to prevent the package from constantly trying
# to rebuild configure, Makefile.in, etc. Rebuilding such files rarely,
# if ever, needs to be done "in the field".
#
# Use the included 'bootstrap' script instead when necessary.
#
AM_MAINTAINER_MODE
#
# Check for the target build platform
#
NLER_BUILD_PLATFORM=
NLER_BUILD_PLATFORM_FREERTOS=0
NLER_BUILD_PLATFORM_NSPR=0
NLER_BUILD_PLATFORM_PTHREADS=0
AC_MSG_CHECKING([for build platform])
# The user may have attempted to explicitly specify the build
# platform. Sanity check it or default to 'auto'.
AC_ARG_WITH(build-platform,
[AS_HELP_STRING([--with-build-platform=TARGET],
[Specify the build platform from one of: auto, freertos, nspr, or pthreads @<:@default=auto@:>@.])],
[
case "${with_build_platform}" in
auto|freertos|nspr|pthreads)
;;
*)
AC_MSG_ERROR([Invalid value ${with_build_platform} for --with-build-platform])
;;
esac
],
[with_build_platform=auto])
# At this point, the build platform is one of the allowed
# values. If it's 'auto' we autodetect it.
if test "${with_build_platform}" = "auto"; then
case ${target_os} in
*cygwin*|*darwin*|*linux*|*freebsd*|*netbsd*|*openbsd*)
with_build_platform=pthreads
;;
*freertos*)
with_build_platform=freertos
;;
*)
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Unsupported target OS ${target_os}])
;;
esac
fi
NLER_BUILD_PLATFORM=${with_build_platform}
case ${with_build_platform} in
freertos)
NLER_BUILD_PLATFORM_FREERTOS=1
;;
nspr)
NLER_BUILD_PLATFORM_NSPR=1
;;
pthreads)
NLER_BUILD_PLATFORM_PTHREADS=1
;;
esac
AC_MSG_RESULT(${NLER_BUILD_PLATFORM})
AC_SUBST(NLER_BUILD_PLATFORM)
AC_DEFINE_UNQUOTED([NLER_BUILD_PLATFORM],[${NLER_BUILD_PLATFORM}],[Embedded Runtime build platform])
AC_SUBST(NLER_BUILD_PLATFORM_FREERTOS)
AM_CONDITIONAL([NLER_BUILD_PLATFORM_FREERTOS], [test "${NLER_BUILD_PLATFORM}" = "freertos"])
AC_DEFINE_UNQUOTED([NLER_BUILD_PLATFORM_FREERTOS],[${NLER_BUILD_PLATFORM_FREERTOS}],[Define to 1 if you want to use Embedded Runtime with FreeRTOS])
AC_SUBST(NLER_BUILD_PLATFORM_NSPR)
AM_CONDITIONAL([NLER_BUILD_PLATFORM_NSPR], [test "${NLER_BUILD_PLATFORM}" = "nspr"])
AC_DEFINE_UNQUOTED([NLER_BUILD_PLATFORM_NSPR],[${NLER_BUILD_PLATFORM_NSPR}],[Define to 1 if you want to use Embedded Runtime with Netscape Portable Runtime (i.e., nspr)])
AC_SUBST(NLER_BUILD_PLATFORM_PTHREADS)
AM_CONDITIONAL([NLER_BUILD_PLATFORM_PTHREADS], [test "${NLER_BUILD_PLATFORM}" = "pthreads"])
AC_DEFINE_UNQUOTED([NLER_BUILD_PLATFORM_PTHREADS],[${NLER_BUILD_PLATFORM_PTHREADS}],[Define to 1 if you want to use Embedded Runtime with POSIX threads (i.e., pthreads)])
NLER_CPPFLAGS="-I\${abs_top_srcdir}/${NLER_BUILD_PLATFORM} ${NLER_CPPFLAGS}"
#
# Check for the target assembler ISA
#
AC_MSG_CHECKING([for target instruction set architecture])
AC_ARG_WITH(target-isa,
[AS_HELP_STRING([--with-target-isa=ARCH],
[Specify the build platform from one of: auto or generic @<:@default=auto@:>@.])],
[
case "${with_target_isa}" in
auto|generic)
;;
*)
AC_MSG_ERROR([Invalid or unsupported value ${with_target_isa} for --with-target-isa])
;;
esac
],
[with_target_isa=auto])
# At this point, the target ISA is one of the allowed
# values. If it's 'auto' we try to autodetect it.
if test "${with_target_isa}" = "auto"; then
case ${target_cpu} in
*)
with_target_isa="generic"
;;
esac
fi
# At this point, the target ISA is an explicitly-supported
# architecture or 'generic'.
NLER_ASM_ISA=${with_target_isa}
NLER_ASM_ISA_GENERIC=0
case ${NLER_ASM_ISA} in
generic)
NLER_ASM_ISA_GENERIC=1
;;
esac
AC_MSG_RESULT(${NLER_ASM_ISA})
AC_SUBST(NLER_ASM_ISA)
AC_SUBST(NLER_ASM_ISA_GENERIC)
AM_CONDITIONAL([NLER_ASM_ISA_GENERIC], [test "${NLER_ASM_ISA}" = "generic"])
AC_DEFINE_UNQUOTED([NLER_ASM_ISA],[${NLER_ASM_ISA}],[Embedded Runtime target CPU-specific instruction set architecture])
AC_DEFINE_UNQUOTED([NLER_ASM_ISA_GENERIC],[${NLER_ASM_ISA_GENERIC}],[Define to 1 if you want to use Embedded Runtime without target CPU-specific instruction set architecture (ISA) support])
#
# 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; 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.
AM_PROG_AS
AC_PROG_CPP
AC_PROG_CPP_WERROR
AC_PROG_CC
AC_PROG_CC_C_O
# 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(CMP, cmp)
AC_PATH_PROG(PERL, perl)
#
# Checks for specific compiler characteristics
#
#
# Common compiler flags we would like to have.
#
# -Wall CC
# -Wchar-subscripts CC
# -Wformat CC
# -Wimplicit CC
# -Wparentheses CC
# -Wreturn-type CC
# -Wsequence-point CC
# -Wunused CC
# -Wno-switch CC
#
PROSPECTIVE_CFLAGS="-Wall -Wchar-subscripts -Wformat -Wimplicit -Wparentheses -Wreturn-type -Wsequence-point -Wunused -Wno-switch"
AX_CHECK_COMPILER_OPTIONS([C], ${PROSPECTIVE_CFLAGS})
# Check for and initialize libtool
LT_INIT
# Check whether the current compiler supports atomic built-ins
#
# Because these are compiler built-in intrinsics, the standard
# AC_CHECK_FUNCS will not work.
AC_MSG_NOTICE([checking for compiler atomic built-ins])
# __sync_add_and_fetch
AC_CACHE_CHECK([whether the target supports __sync_add_and_fetch],
[nler_cv_have__sync_add_and_fetch],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_add_and_fetch(&val, 1);
]])],
[nler_cv_have__sync_add_and_fetch=yes],
[nler_cv_have__sync_add_and_fetch=no])
])
if test "x${nler_cv_have__sync_add_and_fetch}" != "xno"; then
AC_DEFINE(HAVE___SYNC_ADD_AND_FETCH, 1,
[Define this if your target compiler supports __sync_add_and_fetch])
fi
# __sync_fetch_and_and
AC_CACHE_CHECK([whether the target supports __sync_fetch_and_and],
[nler_cv_have__sync_fetch_and_and],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_fetch_and_and(&val, 1);
]])],
[nler_cv_have__sync_fetch_and_and=yes],
[nler_cv_have__sync_fetch_and_and=no])
])
if test "x${nler_cv_have__sync_fetch_and_and}" != "xno"; then
AC_DEFINE(HAVE___SYNC_FETCH_AND_AND, 1,
[Define this if your target compiler supports __sync_fetch_and_and])
fi
# __sync_fetch_and_or
AC_CACHE_CHECK([whether the target supports __sync_fetch_and_or],
[nler_cv_have__sync_fetch_and_or],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_fetch_and_or(&val, 1);
]])],
[nler_cv_have__sync_fetch_and_or=yes],
[nler_cv_have__sync_fetch_and_or=no])
])
if test "x${nler_cv_have__sync_fetch_and_or}" != "xno"; then
AC_DEFINE(HAVE___SYNC_FETCH_AND_OR, 1,
[Define this if your target compiler supports __sync_fetch_and_or])
fi
# __sync_sub_and_fetch
AC_CACHE_CHECK([whether the target supports __sync_sub_and_fetch],
[nler_cv_have__sync_sub_and_fetch],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_sub_and_fetch(&val, 1);
]])],
[nler_cv_have__sync_sub_and_fetch=yes],
[nler_cv_have__sync_sub_and_fetch=no])
])
if test "x${nler_cv_have__sync_sub_and_fetch}" != "xno"; then
AC_DEFINE(HAVE___SYNC_SUB_AND_FETCH, 1,
[Define this if your target compiler supports __sync_sub_and_fetch])
fi
# __sync_lock_test_and_set
AC_CACHE_CHECK([whether the target supports __sync_lock_test_and_set],
[nler_cv_have__sync_lock_test_and_set],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_lock_test_and_set(&val, 1);
]])],
[nler_cv_have__sync_lock_test_and_set=yes],
[nler_cv_have__sync_lock_test_and_set=no])
])
if test "x${nler_cv_have__sync_lock_test_and_set}" != "xno"; then
AC_DEFINE(HAVE___SYNC_LOCK_TEST_AND_SET, 1,
[Define this if your target compiler supports __sync_lock_test_and_set])
fi
# __sync_val_compare_and_swap
AC_CACHE_CHECK([whether the target supports __sync_val_compare_and_swap],
[nler_cv_have__sync_val_compare_and_swap],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
]],[[
volatile int val = 0;
return __sync_val_compare_and_swap(&val, 0, 1);
]])],
[nler_cv_have__sync_val_compare_and_swap=yes],
[nler_cv_have__sync_val_compare_and_swap=no])
])
if test "x${nler_cv_have__sync_val_compare_and_swap}" != "xno"; then
AC_DEFINE(HAVE___SYNC_VAL_COMPARE_AND_SWAP, 1,
[Define this if your target compiler supports __sync_val_compare_and_swap])
fi
NLER_HAVE_ATOMIC_BUILTINS=0
if test "${nler_cv_have__sync_add_and_fetch}" = "yes" && \
test "${nler_cv_have__sync_fetch_and_and}" = "yes" && \
test "${nler_cv_have__sync_fetch_and_or}" = "yes" && \
test "${nler_cv_have__sync_sub_and_fetch}" = "yes" && \
test "${nler_cv_have__sync_lock_test_and_set}" = "yes" && \
test "${nler_cv_have__sync_val_compare_and_swap}" = "yes"; then
NLER_HAVE_ATOMIC_BUILTINS=1
fi
AC_DEFINE_UNQUOTED([NLER_HAVE_ATOMIC_BUILTINS],
[${NLER_HAVE_ATOMIC_BUILTINS}],
[Define this if your target compiler supports the __sync* atomic built-in functions])
#
# Core build-specific features
#
# * Assertions
# * Default Logger
# * Event Timer
# * Flow Tracer
# * Log Tokenization
# * Simulateable Time
# * Stack Alignment
# * Task Local Storage
# * Timer Using Software-based Timer
# * Wake Timer
#
NLER_FEATURE_ASSERTS=0
NLER_FEATURE_DEFAULT_LOGGER=0
NLER_FEATURE_EVENT_TIMER=0
NLER_FEATURE_FLOW_TRACER=0
NLER_FEATURE_LOG_TOKENIZATION=0
NLER_FEATURE_SIMULATEABLE_TIME=0
NLER_FEATURE_STACK_ALIGNMENT=0
NLER_FEATURE_TASK_LOCAL_STORAGE=0
NLER_FEATURE_TIMER_USING_SWTIMER=0
NLER_FEATURE_WAKE_TIMER=0
#
# Assertions
#
AC_MSG_CHECKING([whether to build assertion support])
AC_ARG_ENABLE(asserts,
[AS_HELP_STRING([--enable-asserts],[Enable building of assertion support @<:@default=yes@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_asserts=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-asserts])
;;
esac
],
[nler_build_asserts=yes])
AC_MSG_RESULT(${nler_build_asserts})
AM_CONDITIONAL([NLER_BUILD_ASSERTS], [test "${nler_build_asserts}" = "yes"])
if test "${nler_build_asserts}" = "yes"; then
NLER_FEATURE_ASSERTS=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_ASSERTS=${NLER_FEATURE_ASSERTS}"
fi
#
# Default Logger
#
AC_MSG_CHECKING([whether to build default logger support])
AC_ARG_ENABLE(default-logger,
[AS_HELP_STRING([--enable-default-logger],[Enable building of default logger (vprintf) support @<:@default=yes@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_default_logger=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-default-logger])
;;
esac
],
[nler_build_default_logger=yes])
AC_MSG_RESULT(${nler_build_default_logger})
AM_CONDITIONAL([NLER_BUILD_DEFAULT_LOGGER], [test "${nler_build_default_logger}" = "yes"])
if test "${nler_build_default_logger}" = "yes"; then
NLER_FEATURE_DEFAULT_LOGGER=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_DEFAULT_LOGGER=${NLER_FEATURE_DEFAULT_LOGGER}"
fi
#
# Event Timer
#
AC_MSG_CHECKING([whether to build event timer support])
AC_ARG_ENABLE(event-timer,
[AS_HELP_STRING([--enable-event-timer],[Enable building of event timer support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_event_timer=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-event-timer])
;;
esac
],
[nler_build_event_timer=no])
AC_MSG_RESULT(${nler_build_event_timer})
AM_CONDITIONAL([NLER_BUILD_EVENT_TIMER], [test "${nler_build_event_timer}" = "yes"])
if test "${nler_build_event_timer}" = "yes"; then
NLER_FEATURE_EVENT_TIMER=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_EVENT_TIMER=${NLER_FEATURE_EVENT_TIMER}"
fi
#
# Flow Tracer
#
AC_MSG_CHECKING([whether to build flow tracer support])
AC_ARG_ENABLE(flow-tracer,
[AS_HELP_STRING([--enable-flow-tracer],[Enable building of flow tracer support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_flow_tracer=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-flow-tracer])
;;
esac
],
[nler_build_flow_tracer=no])
AC_MSG_RESULT(${nler_build_flow_tracer})
AM_CONDITIONAL([NLER_BUILD_FLOW_TRACER], [test "${nler_build_flow_tracer}" = "yes"])
if test "${nler_build_flow_tracer}" = "yes"; then
NLER_FEATURE_FLOW_TRACER=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_FLOW_TRACER=${NLER_FEATURE_FLOW_TRACER}"
fi
#
# Log Tokenization
#
AC_MSG_CHECKING([whether to build log tokenization support])
AC_ARG_ENABLE(log-tokenization,
[AS_HELP_STRING([--enable-log-tokenization],[Enable building of log tokenization support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_log_tokenization=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-log-tokenization])
;;
esac
],
[nler_build_log_tokenization=no])
AC_MSG_RESULT(${nler_build_log_tokenization})
AM_CONDITIONAL([NLER_BUILD_LOG_TOKENIZATION], [test "${nler_build_log_tokenization}" = "yes"])
if test "${nler_build_log_tokenization}" = "yes"; then
NLER_FEATURE_LOG_TOKENIZATION=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_LOG_TOKENIZATION=${NLER_FEATURE_LOG_TOKENIZATION}"
fi
#
# Simulateable Time
#
AC_MSG_CHECKING([whether to build simulateable time support])
AC_ARG_ENABLE(simulateable-time,
[AS_HELP_STRING([--enable-simulateable-time],[Enable building of simulateable time support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_simulateable_time=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-simulateable-time])
;;
esac
],
[nler_build_simulateable_time=no])
AC_MSG_RESULT(${nler_build_simulateable_time})
AM_CONDITIONAL([NLER_BUILD_SIMULATEABLE_TIME], [test "${nler_build_simulateable_time}" = "yes"])
if test "${nler_build_simulateable_time}" = "yes"; then
NLER_FEATURE_SIMULATEABLE_TIME=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_SIMULATEABLE_TIME=${NLER_FEATURE_SIMULATEABLE_TIME}"
fi
#
# Stack Alignment
#
AC_MSG_CHECKING([for required stack alignment])
AC_ARG_WITH(stack-alignment,
[AS_HELP_STRING([--with-stack-alignment=ALIGNMENT],[Specify the required staack alignment, in bytes @<:@default=none@:>@.])],
[
case "${with_stack_alignment}" in
*[!0-9]*|'')
AC_MSG_ERROR([Invalid value ${with_stack_alignment} for --with-stack-alignment])
;;
*)
nler_build_stack_alignment=${with_stack_alignment}
;;
esac
],
[nler_build_stack_alignment=none])
AC_MSG_RESULT(${nler_build_stack_alignment})
AM_CONDITIONAL([NLER_BUILD_STACK_ALIGNMENT], [test "${nler_build_stack_alignment}" != "none"])
if test "${nler_build_stack_alignment}" != "none"; then
NLER_FEATURE_STACK_ALIGNMENT=${nler_build_stack_alignment}
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_STACK_ALIGNMENT=${NLER_FEATURE_STACK_ALIGNMENT}"
fi
#
# Task Local Storage
#
AC_MSG_CHECKING([whether to build task local storage support])
AC_ARG_ENABLE(task-local-storage,
[AS_HELP_STRING([--enable-task-local-storage],[Enable building of task local storage support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_task_local_storage=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-task-local-storage])
;;
esac
],
[nler_build_task_local_storage=no])
AC_MSG_RESULT(${nler_build_task_local_storage})
AM_CONDITIONAL([NLER_BUILD_TASK_LOCAL_STORAGE], [test "${nler_build_task_local_storage}" = "yes"])
if test "${nler_build_task_local_storage}" = "yes"; then
NLER_FEATURE_TASK_LOCAL_STORAGE=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_TASK_LOCAL_STORAGE=${NLER_FEATURE_TASK_LOCAL_STORAGE}"
fi
#
# Timer Using Software-based Timers
#
AC_MSG_CHECKING([whether to build software-based timer support])
AC_ARG_ENABLE(software-timers,
[AS_HELP_STRING([--enable-software-timers],[Enable building of software-based timer support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_software_timers=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-task-local-storage])
;;
esac
],
[nler_build_software_timers=no])
AC_MSG_RESULT(${nler_build_software_timers})
AM_CONDITIONAL([NLER_BUILD_TIMER_USING_SWTIMER], [test "${nler_build_software_timers}" = "yes"])
if test "${nler_build_software_timers}" = "yes"; then
NLER_FEATURE_TIMER_USING_SWTIMER=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_TIMER_USING_SWTIMER=${NLER_FEATURE_TIMER_USING_SWTIMER}"
fi
#
# Wake Timer
#
AC_MSG_CHECKING([whether to build wake timer support])
AC_ARG_ENABLE(wake-timer,
[AS_HELP_STRING([--enable-wake-timer],[Enable building of wake timer support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_wake_timer=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-wake-timer])
;;
esac
],
[nler_build_wake_timer=no])
AC_MSG_RESULT(${nler_build_wake_timer})
AM_CONDITIONAL([NLER_BUILD_WAKE_TIMER], [test "${nler_build_wake_timer}" = "yes"])
if test "${nler_build_wake_timer}" = "yes"; then
NLER_FEATURE_WAKE_TIMER=1
NLER_CPPFLAGS="${NLER_CPPFLAGS} -DNLER_FEATURE_WAKE_TIMER=${NLER_FEATURE_WAKE_TIMER}"
fi
#
# Utilities
#
AC_MSG_CHECKING([whether to build utilities])
AC_ARG_ENABLE(utilities,
[AS_HELP_STRING([--enable-utilities],[Enable building of utilties @<:@default=yes@:>@.])],
[
case "${enableval}" in
no|yes)
nler_build_utilities=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-utilities])
;;
esac
],
[nler_build_utilities=yes])
AC_MSG_RESULT(${nler_build_utilities})
AM_CONDITIONAL([NLER_BUILD_UTILITIES], [test "${nler_build_utilities}" = "yes"])
#
# Debug instances
#
# Debug
NL_ENABLE_DEBUG([no])
AM_CONDITIONAL([NLER_BUILD_DEBUG], [test "${nl_cv_build_debug}" = "yes"])
#
# Code coverage and compiler optimization
#
# Coverage
NL_ENABLE_COVERAGE([no])
AM_CONDITIONAL([NLER_BUILD_COVERAGE], [test "${nl_cv_build_coverage}" = "yes"])
NL_ENABLE_COVERAGE_REPORTS([auto])
AM_CONDITIONAL([NLER_BUILD_COVERAGE_REPORTS], [test "${nl_cv_build_coverage_reports}" = "yes"])
# Optimization
NL_ENABLE_OPTIMIZATION([yes])
AM_CONDITIONAL([NLER_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = "yes"])
#
# Tests
#
AC_MSG_NOTICE([checking whether to build tests])
# Tests
NL_ENABLE_TESTS([yes])
AM_CONDITIONAL([NLER_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
#
# 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(NLER_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
# Check if the build host has pkg-config
AC_PATH_PROG([PKG_CONFIG],[pkg-config])
#
# Checks for libraries and packages.
#
# At minimum, the following packages are required:
#
# * nlcompiler
#
# At minimum, the following packages are optional, depending on
# configuration:
#
# * freertos
# * nlunit-test
# * nlutilities
# * nspr
#
AC_MSG_NOTICE([checking required and optional package dependencies])
#
# Nlcompiler
#
NL_WITH_PACKAGE(
[Nlcompiler],
[NLCOMPILER],
[nlcompiler],
[],
[
# At this point, the internal Nlcompiler package will be neither
# configured nor built, so the normal checks we undertake for an
# external package cannot be run here. Simply set the appropriate
# variables and trust all will be well.
NLCOMPILER_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlcompiler/repo"
NLCOMPILER_LDFLAGS=
NLCOMPILER_LIBS=
],
[
# Check for required Nlcompiler header.
AC_CHECK_HEADERS([nlcompiler.h],
[],
[
AC_MSG_ERROR(The nlcompiler header "$ac_header" is required but cannot be found.)
])
]
)
AM_CONDITIONAL([WEAVE_WITH_NLCOMPILER_INTERNAL], [test "${nl_with_nlcompiler}" = "internal"])
if test "${NLER_BUILD_PLATFORM}" == "freertos"; then
NL_WITH_OPTIONAL_EXTERNAL_PACKAGE([FreeRTOS],
[FREERTOS],
[freertos],
[-lcommon -lkernel],
[
# Check for required FreeRTOS headers
AC_CHECK_HEADERS([FreeRTOS.h],
[],
[
AC_MSG_NOTICE(The FreeRTOS header "$ac_header" is required but cannot be found.)
])
# The secondary FreeRTOS headers cannot be included without FreeRTOS.h
AC_CHECK_HEADERS([init.h queue.h semphr.h task.h],
[],
[
AC_MSG_NOTICE(The FreeRTOS header "$ac_header" is required but cannot be found.)
],
[
#ifdef HAVE_FREERTOS_H
#include <FreeRTOS.h>
#endif
])
]
)
fi
AM_CONDITIONAL([NLER_WITH_FREERTOS], [test "${nl_with_freertos}" != ""])
#
# Nlunit-test
#
if test "${nl_cv_build_tests}" = "yes" || test "${nler_build_event_timer}" = "yes"; then
NL_WITH_PACKAGE(
[Nlunit-test],
[NLUNIT_TEST],
[nlunit_test],
[-lnlunit-test],
[
# At this point, the internal Nlunit-test package will be neither
# configured nor built, so the normal checks we undertake for an
# external package cannot be run here. Simply set the appropriate
# variables and trust all will be well.
NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src"
NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src"
NLUNIT_TEST_LIBS="-lnlunit-test"
],
[
# Check for required nlunit-test headers.
AC_CHECK_HEADERS([nlunit-test.h],
[],
[
AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.)
])
])
fi
# Depending on whether nlunit-test has been configured for an internal
# location, its directory stem within this package needs to be set
# accordingly. In addition, if the location is internal, then we need
# to attempt to pull it down using the bootstrap makefile.
if test "${nl_with_nlunit_test}" = "internal"; then