forked from Seagate/cortx-motr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1246 lines (1062 loc) · 41.5 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
# Motr version
m4_define([M0_VERSION_MAJOR],[2])
m4_define([M0_VERSION_MINOR],[0])
m4_define([M0_VERSION_PATCH],[0])
m4_define([M0_VERSION],[M0_VERSION_MAJOR.M0_VERSION_MINOR.M0_VERSION_PATCH])
#
# Autoconf/Automake/Libtool configuration --------------------------------- {{{1
#
AC_PREREQ(2.63)
AC_INIT([cortx-motr],[M0_VERSION],[info@seagate.com])
# The AC_PROG_CC macro sets CFLAGS to '-g -O2' by default if CFLAGS is not
# initialized by the user, we don't need this because we use a separate
# M0_CFLAGS variable to control compiler's options while allowing user to
# override it via CFLAGS from command-line.
CFLAGS=${CFLAGS:=""}
AM_INIT_AUTOMAKE([-Wall -Werror nostdinc foreign subdir-objects silent-rules])
AM_SILENT_RULES([yes])
LT_INIT([disable-static])
AC_CONFIG_SRCDIR([motr/init.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
#
# Global variables -------------------------------------------------------- {{{1
#
# PACKAGE_VERSION is a default autoconf variable, generated by AC_INIT from
# it's "version" argument
AC_SUBST([LT_RELEASE], [$PACKAGE_VERSION])
# The value passed to libtool's `-version-info` parameter.
#
# [https://autotools.io/libtool/version.html#idm46422828083360]
# |
# | To set the version of the library, libtool provides the `-version-info`
# | parameter, which accepts three numbers, separated by colons, that are
# | called respectively, _current_, _revision_ and _age_. Both their name
# | and their behaviour, nowadays, have to be considered fully arbitrary,
# | as the explanation provided in the official documentation is confusing
# | to say the least, and can be, in some cases, considered completely wrong.
# |
# | *Warning*
# |
# | A common mistake is to assume that the three values passed to
# | `-version-info` map directly into the three numbers at the end of
# | the library name. This is not the case, and indeed, current,
# | revision and age are applied differently depending on the operating
# | system that one is using.
#
# E.g., LT_VERSION=1:1:0 results in motr/.libs/libmotr.so.1.0.1 file.
#
# See also
# https://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
AC_SUBST([LT_VERSION], [M0_VERSION_MAJOR:M0_VERSION_MINOR:0])
# the following variables are only for internal use within this configure script
# external scripts should use collection of variables, which is automatically
# provided by autoconf:
#
# @srcdir@
# @top_srcdir@
# @abs_top_srcdir@
# @builddir@
# @top_builddir@
# @abs_top_builddir@
#
SRCDIR="$srcdir"
ABS_SRCDIR="$(cd $srcdir; pwd)"
ABS_BUILDDIR="$(pwd)"
AC_SUBST([ABS_BUILDDIR])
AC_SUBST([M0_VERSION_CODE],
["$(( (M0_VERSION_MAJOR << 24) + (M0_VERSION_MINOR << 16) + (M0_VERSION_PATCH << 8) ))U"]
)
# we need GIT_* variables to be evaluated during creation of configure script
# and not be changed afterwards, so they are kind of "built-in" into configure
# script; this allows us to still have information about git revision even when
# we are building from dist archive which is obviously not under git (for
# example when building rpm package)
m4_define([GIT_REV_ID_SHORT_BUILTIN],
[m4_esyscmd([git rev-parse > /dev/null 2>&1 && git rev-parse --short HEAD])])
m4_define([GIT_REV_ID_FULL_BUILTIN],
[m4_esyscmd([git rev-parse > /dev/null 2>&1 && git rev-parse HEAD])])
m4_define([GIT_REV_ID_RPM_BUILTIN],
m4_if(GIT_REV_ID_SHORT_BUILTIN,[],[],[git]GIT_REV_ID_SHORT_BUILTIN))
m4_define([GIT_BRANCH_BUILTIN],
[m4_esyscmd([git rev-parse > /dev/null 2>&1 && git rev-parse --abbrev-ref HEAD])])
m4_define([GIT_DESCRIBE_BUILTIN],
[m4_esyscmd([git rev-parse > /dev/null 2>&1 && git describe --dirty --always])])
AC_SUBST([GIT_REV_ID_SHORT],[GIT_REV_ID_SHORT_BUILTIN])
AC_SUBST([GIT_REV_ID_FULL],[$(echo ${GIT_REV_ID_FULL:-GIT_REV_ID_FULL_BUILTIN})])
AC_SUBST([GIT_REV_ID_RPM],[GIT_REV_ID_RPM_BUILTIN])
AC_SUBST([GIT_BRANCH],[GIT_BRANCH_BUILTIN])
AC_SUBST([GIT_DESCRIBE],[GIT_DESCRIBE_BUILTIN])
BUILD_HOST=$(hostname)
AC_SUBST([BUILD_HOST])
AC_SUBST([BUILD_USER],["$(whoami)"])
AC_SUBST([BUILD_TIME],["$(date -u)"])
AC_SUBST([BUILD_GCC],["$(gcc -v 2>&1 | grep '^gcc version' | sed -e 's/(GCC)//')"])
#
# Checking for OS support ------------------------------------------------- {{{1
#
AC_MSG_CHECKING([for operating system])
AC_MSG_RESULT([$host_os])
AS_CASE([$host_os],
# supported operating systems:
[linux*], [],
# default action for unsupported OS is to abort with error
[AC_MSG_ERROR([Unsupported platform detected!])]
)
#
# Checking for Platform support -------------------------------------------{{{1
#
ARCH=
AC_CANONICAL_HOST
AS_CASE([$host_cpu],
[aarch64], [ARCH=aarch64],
[x86_64], [ARCH=x86_64],
[AC_MSG_ERROR("Only X86_64 and aarch64 platforms are supported")]
)
# Check for X86_64 platform -------------{{{2
AS_IF([test x$ARCH = xx86_64],
[
AC_DEFINE([CONFIG_X86_64])
]
)
# Check for AARCH64 platform ------------{{{2
AS_IF([test x$ARCH = xaarch64],
[
AC_DEFINE([CONFIG_AARCH64])
]
)
AC_SUBST([ARCH])
#
# Configuration options --------------------------------------------------- {{{1
#
# variables ------------------------------------------- {{{2
AC_ARG_VAR([KCFLAGS], [kernel-space CFLAGS])
AC_ARG_VAR([CXXXML], [gccxml/castxml command])
# define macros --------------------------------------- {{{2
#
# Add include guards to config.h
#
AH_TOP([
#pragma once
#ifndef __MOTR_CONFIG_H__
#define __MOTR_CONFIG_H__
])
AH_TEMPLATE([MOTR_IDX_STORE_CASS], [Use Cassandra as KVS backend.])
AH_TEMPLATE([IDX_CASS_DRV_V22], [Cassandra driver version >= 2.2.])
AH_TEMPLATE([ENABLE_LUSTRE], [Enable LNet network stack from Lustre.])
AH_TEMPLATE([ENABLE_LIBFAB], [Enable Libfabric network stack.])
AH_TEMPLATE([ENABLE_GCCXML], [Use deprecated GCC-XML instead of CastXML])
AH_TEMPLATE([ENABLE_DIST_MODE], [Enable distribution mode (only for package building).])
AH_TEMPLATE([ENABLE_DEV_MODE], [Enable developer mode.])
AH_TEMPLATE([ENABLE_RELEASE], [Enable release mode (this has the same effect as --disable-dev-mode).])
AH_TEMPLATE([ENABLE_DEBUG], [Enable debug info and disable optimizations.])
AH_TEMPLATE([ENABLE_PROFILER], [Enable profile samples gathering.])
AH_TEMPLATE([ENABLE_FRAME_POINTERS], [Enable frame pointers (for better stack traces).])
AH_TEMPLATE([ENABLE_FAULT_INJECTION], [Enable fault injection.])
AH_TEMPLATE([ENABLE_IMMEDIATE_TRACE], [Enable immediate tracing.])
AH_TEMPLATE([ENABLE_EXPENSIVE_CHECKS],[Enable expensive checks.])
AH_TEMPLATE([ENABLE_BALLOC_DUMP], [Enable balloc dumps in trace log.])
AH_TEMPLATE([ENABLE_SYNC_ATOMIC], [Enable gcc built-in atomic functions])
AH_TEMPLATE([ENABLE_DATA_INTEGRITY], [Enable data integrity.])
AH_TEMPLATE([ENABLE_FREE_POISON], [Poison freed memory for debugging.])
AH_TEMPLATE([ENABLE_DETAILED_BACKTRACE],[Enable detailed backtraces on crash using gdb.])
AH_TEMPLATE([ENABLE_SOCK_MOCK_LNET], [Enable LNet simulation in net/sock. Forces sock to pretend to be lnet. With this option end-points prefixed with "lnet:" are interpreted by sock.])
AH_TEMPLATE([M0_NDEBUG], [Disable M0_ASSERT.])
AH_TEMPLATE([ENABLE_DTM0], [Enable DTM0 mode.])
AH_TEMPLATE([M0_BE_SEGMENT_SIZE], [BE segment size in MiB.])
AH_TEMPLATE([M0_TRACE_KBUF_SIZE], [Kernel space trace buffer size in MiB.])
AH_TEMPLATE([M0_TRACE_UBUF_SIZE], [User space trace buffer size in MiB.])
AH_TEMPLATE([ENABLE_RESTRICTED_TRACE_MODE],[Enable restricted trace mode, when only some trace records get logged.])
AH_TEMPLATE([M0_TRACE_HIGHEST_ALLOWED_LEVEL],[Highest trace level that is allowed to be logged.])
AH_TEMPLATE([M0_DEFAULT_NETWORK], [Default network transport type.])
AH_TEMPLATE([M0_LUSTRE_VERSION], [Autodetected Lustre version represented as integer])
AH_TEMPLATE([ENABLE_USER_MODE_ONLY], [Enabling user mode shall avoid kernel deps])
AH_TEMPLATE([HAVE_JOURNAL_ABORT], [Have journal_abort() function])
AH_TEMPLATE([HAVE_FILE_READV], [Have fops->readv function])
AH_TEMPLATE([HAVE_FILE_AIO_READ], [Have fops->aio_read function])
AH_TEMPLATE([HAVE_INODE_BLKSIZE], [Have inode->i_blksize field])
AH_TEMPLATE([HAVE_WRITE_BEGIN_END], [Have .begin_write/end_write])
AH_TEMPLATE([HAVE_SENDFILE], [Have .sendfile])
AH_TEMPLATE([HAVE_MALLINFO], [Have mallinfo() function])
AH_TEMPLATE([HAVE_MALLOC_SIZE], [Have malloc_size() function])
AH_TEMPLATE([HAVE_BACKTRACE], [Have backtrace(3) function])
AH_TEMPLATE([HAVE_SYSTEMD], [Have systemd available])
AH_TEMPLATE([CONFIG_X86_64], [Support for X86_64 platform])
AH_TEMPLATE([CONFIG_AARCH64], [Support for AARCH64 platform])
AH_BOTTOM([
#endif /* __MOTR_CONFIG_H__ */
])
# enable/disable options ------------------------------ {{{2
# dist-mode {{{3
AC_ARG_ENABLE([dist-mode],
[AS_HELP_STRING([--enable-dist-mode],
[enable dististribution mode (only for package building)])],
[], [enable_dist_mode=no]
)
# dev-mode {{{3
AC_ARG_ENABLE([dev-mode],
[AS_HELP_STRING([--disable-dev-mode],
[disable developer mode (additional checks and tests)])],
[], [enable_dev_mode=yes]
)
# release {{{3
AC_ARG_ENABLE([release],
[AS_HELP_STRING([--enable-release],
[enable release mode (it has the same effect as --disable-dev-mode)])],
[AS_IF([test x$enable_release = xyes],
[enable_dev_mode=no],[enable_dev_mode=yes])]
)
AS_IF([test x$enable_dev_mode = xyes],
AC_DEFINE([ENABLE_DEV_MODE]))
# debug {{{3
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug information and disable optimizations])],
[], [enable_debug=no]
)
AM_CONDITIONAL([ENABLE_DEBUG],
[test "x$enable_debug" = xyes])
# profiler {{{3
AC_ARG_ENABLE([profiler],
[AS_HELP_STRING([--enable-profiler],
[enable gperftools profiling information])],
[], [enable_profiler=no]
)
# data-integrity {{{3
AC_ARG_ENABLE([data_integrity],
[AS_HELP_STRING([--enable-data-integrity],
[enable data integrity])],
[], [enable_data_integrity=no]
)
AS_IF([test x$enable_data_integrity = xyes],
AC_DEFINE([ENABLE_DATA_INTEGRITY]))
# be-alloc-zones {{{3
AC_ARG_ENABLE([be_alloc_zones],
[AS_HELP_STRING([--enable-be-alloc-zones],
[enable BE Allocator zones])],
[], [enable_be_alloc_zones=no]
)
# free-poison {{{3
AC_ARG_ENABLE([free_poison],
[AS_HELP_STRING([--enable-free-poison],
[enable free poison])],
[], [enable_free_poison=$enable_dev_mode]
)
AS_IF([test x$enable_free_poison = xyes],
AC_DEFINE([ENABLE_FREE_POISON]))
# frame-pointers {{{3
AC_ARG_ENABLE([frame_pointers],
AS_HELP_STRING([--disable-frame-pointers],[disable frame pointers]),
[],
[enable_frame_pointers=yes]
)
AS_IF([test x$enable_frame_pointers = xyes],
AC_DEFINE([ENABLE_FRAME_POINTERS]))
# coverage {{{3
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage], [build for test coverage analysis])],
[], [enable_coverage=no]
)
AC_SUBST([ENABLE_COVERAGE], [$enable_coverage])
# finject {{{3
AC_ARG_ENABLE([finject],
AS_HELP_STRING([--disable-finject],[disable fault injection support]),
[],
[enable_finject=$enable_dev_mode]
)
AS_IF([test x$enable_finject = xyes],
AC_DEFINE([ENABLE_FAULT_INJECTION]))
# balloc-dump {{{3
AC_ARG_ENABLE([balloc_dump],
AS_HELP_STRING([--disable-balloc-dump], [disable balloc dumps in trace]),
[], [enable_balloc_dump=$enable_dev_mode]
)
AS_IF([test x$enable_balloc_dump = xyes],
AC_DEFINE([ENABLE_BALLOC_DUMP], 1),
AC_DEFINE([ENABLE_BALLOC_DUMP], 0))
# immediate-trace {{{3
AC_ARG_ENABLE([immediate-trace],
AC_HELP_STRING([--disable-immediate-trace], [disable immediate tracing]),
[],
[enable_immediate_trace=$enable_dev_mode]
)
AS_IF([test x$enable_immediate_trace = xyes],
AC_DEFINE([ENABLE_IMMEDIATE_TRACE]))
# detailed-backtrace {{{3
AC_ARG_ENABLE([detailed-backtrace],
AC_HELP_STRING([--enable-detailed-backtrace],
[enable detailed backtrace on crash using gdb]),
[],
[enable_detailed_backtrace=no]
)
AS_IF([test x$enable_detailed_backtrace = xyes],
AC_DEFINE([ENABLE_DETAILED_BACKTRACE]))
# sock-mock-lnet {{{3
AC_ARG_ENABLE([sock-mock-lnet],
AC_HELP_STRING([--enable-sock-mock-lnet],
[enable lnet emulation in sock/net]),
[],
[enable_sock_mock_lnet=no]
)
AS_IF([test x$enable_sock_mock_lnet = xyes],
AC_DEFINE([ENABLE_SOCK_MOCK_LNET]))
# sync-atomic {{{3
AC_ARG_ENABLE([sync-atomic],
AS_HELP_STRING([--enable-sync-atomic],
[enable gcc built-in __sync_atomic functions]),
[], [enable_sync_atomic=no]
)
AS_IF([test x$enable_sync_atomic = xyes],
AC_DEFINE([ENABLE_SYNC_ATOMIC]))
# mcheck {{{3
AC_ARG_ENABLE([mcheck],
[AS_HELP_STRING([--enable-mcheck], [enable glibc malloc check])],
[],
[enable_mcheck=no]
)
# m0-asserts {{{3
AC_ARG_ENABLE([m0_asserts],
AS_HELP_STRING([--disable-m0-asserts],[disable M0_ASSERT]),
[], [enable_m0_asserts=yes]
)
AS_IF([test x$enable_m0_asserts = xno],
AC_DEFINE([M0_NDEBUG]))
# dtm0 {{{3
AC_ARG_ENABLE([dtm0],
AS_HELP_STRING([--enable-dtm0],[enable DTM0 mode]),
[BUILD_DEPEND_DTM="--enable-dtm0"], [enable_dtm0=no]
)
AS_IF([test x$enable_dtm0 = xyes],
AC_DEFINE([ENABLE_DTM0], [1]),
AC_DEFINE([ENABLE_DTM0], [0]))
# expensive-checks {{{3
AC_ARG_ENABLE([expensive_checks],
AS_HELP_STRING([--disable-expensive-checks],[disable expensive checks]),
[],
[enable_expensive_checks=$enable_dev_mode]
)
AS_IF([test x$enable_expensive_checks = xyes],
AC_DEFINE([ENABLE_EXPENSIVE_CHECKS]))
# altogether-mode {{{3
AC_ARG_ENABLE([altogether-mode],
[AS_HELP_STRING([--disable-altogether-mode],[disable altogether build mode])],
[], [enable_altogether_mode=yes]
)
AM_CONDITIONAL([ENABLE_MOTR_ALTOGETHER],
[test "x$enable_altogether_mode" = xyes])
# system-libs {{{3
AC_ARG_ENABLE([system-libs],
[AS_HELP_STRING([--disable-system-libs],[use bundled libraries instead of system wide ones])],
[], [enable_system_libs=yes]
)
# unit-tests {{{3
AC_ARG_ENABLE([unit-tests],
[AS_HELP_STRING([--disable-unit-tests], [disable unit tests])],
[], [enable_unit_tests=yes]
)
AM_CONDITIONAL([ENABLE_UNIT_TESTS],
[test "x$enable_unit_tests" = xyes])
AS_IF([test x$enable_unit_tests = xyes],
AC_SUBST([ENABLE_KERNEL_UNIT_TESTS], [m]))
# ivt-tests {{{3
AC_ARG_ENABLE([ivt-tests],
[AS_HELP_STRING([--disable-ivt-tests], [disable ivt tests])],
[], [enable_ivt_tests=yes]
)
AM_CONDITIONAL([ENABLE_IVT_TESTS],
[test "x$enable_ivt_tests" = xyes])
AS_IF([test x$enable_ivt_tests = xyes],
AC_SUBST([ENABLE_KERNEL_IVT_TESTS], [m]))
# systemd {{{3
AC_ARG_ENABLE([systemd],
[AS_HELP_STRING([--disable-systemd],
[disable integration with systemd])],
[], [enable_systemd=yes]
)
# GCC-XML {{{3
AC_ARG_ENABLE([gccxml],
[AS_HELP_STRING([--enable-gccxml],
[use deprecated GCC-XML instead of CastXML])],
[], [enable_gccxml=no]
)
# argument options ------------------------------------ {{{2
# trace-kbuf-size {{{3
AC_ARG_WITH([trace-kbuf-size],
[AS_HELP_STRING([--with-trace-kbuf-size=number],
[set kernel space trace buffer size in MiB, default is 4MiB])],
[TRACE_KBUF_SIZE=$with_trace_kbuf_size],
[TRACE_KBUF_SIZE=4]
)
AS_IF([test -z "$TRACE_KBUF_SIZE" || test "x$TRACE_KBUF_SIZE" = xyes ||
test "x$TRACE_KBUF_SIZE" = xno],
[AC_MSG_ERROR([Kernel space trace buffer size must be set with --with-trace-kbuf-size option.])]
)
AC_DEFINE_UNQUOTED([M0_TRACE_KBUF_SIZE], [($TRACE_KBUF_SIZE * 1024 * 1024UL)])
# trace-ubuf-size {{{3
AC_ARG_WITH([trace-ubuf-size],
[AS_HELP_STRING([--with-trace-ubuf-size=number],
[set user space trace buffer size in MiB, default is 16MiB])],
[TRACE_UBUF_SIZE=$with_trace_ubuf_size],
[TRACE_UBUF_SIZE=16]
)
AS_IF([test -z "$TRACE_UBUF_SIZE" || test "x$TRACE_UBUF_SIZE" = xyes ||
test "x$TRACE_UBUF_SIZE" = xno],
[AC_MSG_ERROR([User space trace buffer size must be set with --with-trace-ubuf-size option.])]
)
AC_DEFINE_UNQUOTED([M0_TRACE_UBUF_SIZE], [($TRACE_UBUF_SIZE * 1024 * 1024UL)])
# trace-max-level {{{3
AC_ARG_WITH([trace-max-level],
[AS_HELP_STRING([--with-trace-max-level=<M0_ALWAYS|M0_FATAL|M0_ERROR|M0_WARN|M0_NOTICE|M0_INFO|M0_DEBUG>],
[set highest trace level that will be enabled, all levels with verbosity above that will not be logged])]
)
AS_IF([test -n "$with_trace_max_level" && test "x$enable_release" = xyes],
[AC_MSG_ERROR([Option --with-trace-max-level is incompatible with --enable-release option.])]
)
AS_IF([test -n "$with_trace_max_level"],
[
AS_IF([case "$with_trace_max_level" in (M0_DEBUG|M0_INFO|M0_NOTICE|M0_WARN|M0_ERROR|M0_FATAL|M0_ALWAYS) true ;; (*) false ;; esac],
[
AC_DEFINE([ENABLE_RESTRICTED_TRACE_MODE])
AC_DEFINE_UNQUOTED([M0_TRACE_HIGHEST_ALLOWED_LEVEL], [$with_trace_max_level])
],[
AC_MSG_ERROR([Invalid argument for --with-trace-max-level option ($with_trace_max_level),
allowed values are: M0_DEBUG, M0_INFO, M0_NOTICE, M0_WARN, M0_ERROR, M0_FATAL, M0_ALWAYS])
]
)
]
)
# default-network {{{3
AC_ARG_WITH([default-network],
[AS_HELP_STRING([--with-default-network=<SOCK|LNET|LF|MEMBULK>],
[selects the network transport used by default, i.e., to interpret end-points not starting with the transport prefix. The default default is LNET for now])]
)
AS_IF([test -n "$with_default_network"],
[
AS_IF([case "$with_default_network" in (SOCK|LNET|LF|MEMBULK) true ;; (*) false ;; esac],
[
AC_DEFINE_UNQUOTED([M0_DEFAULT_NETWORK], ["$with_default_network"])
],[
AC_MSG_ERROR([Invalid argument for --with-default-network option ($with_default_network),
allowed values are: SOCK, LNET, MEMBULK and LF])
]
)
],
[
AC_DEFINE_UNQUOTED([M0_DEFAULT_NETWORK], ["LNET"])
]
)
# cassandra {{{3
AC_ARG_WITH([cassandra],
[AS_HELP_STRING([--with-cassandra],
[set Cassandra as KVS backend])],
[CASS_DRV_VERSION=$with_cassandra;
CASS_IDX=yes;
case "${CASS_DRV_VERSION}" in
2.2) CASS_DRV_VERSION=2.2;;
*) CASS_DRV_VERSION=2.1;;
esac],
[CASS_IDX=no]
)
AS_IF([test "x$CASS_IDX" = xyes],
[AC_DEFINE([MOTR_IDX_STORE_CASS])])
AS_VERSION_COMPARE(${CASS_DRV_VERSION}, "2.2", [CASS_DRV_V22=0], [CASS_DRV_V22=1], [CASS_DRV_V22=1])
AS_IF([test "$CASS_DRV_V22" = 1],
AC_DEFINE([IDX_CASS_DRV_V22]))
# user-mode {{{3
AC_ARG_WITH([user-mode-only],
[AS_HELP_STRING([--with-user-mode-only],
[Build motr with user space only])],
[with_user_mode_only=yes;
with_lustre=no;
with_default_transport=LF],
[with_user_mode_only=no]
)
AS_IF([test "x$with_user_mode_only" = xyes],
[AC_DEFINE([ENABLE_USER_MODE_ONLY])])
# linux {{{3
AC_ARG_WITH([linux],
[AS_HELP_STRING([--with-linux=path],
[set path to Linux kernel dir, default is /lib/modules/`uname -r`/build])],
[LINUX=$with_linux; LINUX_OBJ=$LINUX],
[LINUX=/lib/modules/`uname -r`; LINUX_OBJ=$LINUX/build]
)
AS_IF([test x$with_lustre = xno || test x$with_user_mode_only = xyes],[
LINUX_OBJ=
BUILD_KERNEL=not-relevant
],[
BUILD_KERNEL=$(basename $LINUX)
])
AC_SUBST([LINUX_OBJ])
AC_SUBST([BUILD_KERNEL])
#
# Skip all checks in distribution mode
AS_IF([test x$enable_dist_mode = xno],[
#
# Checking Lustre sources ------------------------------------------------- {{{1
#
AC_ARG_WITH([lustre],
[AS_HELP_STRING([--with-lustre=path],
[set path to lustre headers or built sources dir, default is /usr/src/lustre-*])],
[LUSTRE=$with_lustre],
[LUSTRE=`ls -td /usr/src/lustre-* 2>/dev/null | head -1`]
)
AS_IF([test -z "$LUSTRE" || test "x$with_lustre" != "xno" && ! test -d "$LUSTRE/"],
[AC_MSG_ERROR([Lustre headers not found! Please, install lustre-devel \
package or provide the path to a directory with built Lustre sources, \
using --with-lustre option.])]
)
AS_IF([test x$with_lustre = xno || test x$with_user_mode_only = xyes],[
LUSTRE=none
LUSTRE_INCLUDES=
LUSTRE_VERSION_STR=none
LUSTRE_VERSION_NUM=0
],[
LUSTRE_INCLUDES="-I$LUSTRE/libcfs/include -I$LUSTRE/lnet/include -I$LUSTRE/lnet/include/uapi/linux -I$LUSTRE/lustre/include -I$LUSTRE/lustre/include/uapi/linux -I$LUSTRE/lustre/include/uapi"
# if Lustre version cannot be deduced from the $LUSTRE directory name, which
# conforms to 'lustre-client-1.22.3' format for all Intel releases, assume
# old Seagate Lustre is used and set version to 2.7.0
LUSTRE_VERSION_STR=`echo $LUSTRE | grep -Po '(?<=-)\d+\.\d+(?:\.\d)?' || echo 2.7.0`
# convert extracted Lustre version to a number with at most 4 digits
LUSTRE_VERSION_NUM=`echo $LUSTRE_VERSION_STR | tr -d . | cut -c 1-4`
AC_DEFINE([ENABLE_LUSTRE])
])
AC_SUBST([LUSTRE])
AC_SUBST([LUSTRE_VERSION_STR])
AC_DEFINE_UNQUOTED([M0_LUSTRE_VERSION], [$LUSTRE_VERSION_NUM])
AM_CONDITIONAL([ENABLE_LUSTRE],
[test x$with_lustre != xno])
#
# Checking required programs ---------------------------------------------- {{{1
#
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_SED
AC_PROG_LN_S
AC_PROG_INSTALL
AC_CHECK_PROG(cxxxml_name, castxml, castxml, gccxml)
AS_IF([test x$enable_gccxml = xyes],
[cxxxml_name=gccxml]
)
AS_IF([test x$cxxxml_name = xgccxml],
AC_DEFINE([ENABLE_GCCXML]))
AM_CONDITIONAL([ENABLE_GCCXML],
[test x$cxxxml_name = xgccxml])
# castxml is required by xcode/m0gccxml2xcode script
AC_PATH_PROG(CXXXML, $cxxxml_name,, [/usr/bin$PATH_SEPARATOR$PATH])
AS_IF([test -z "$CXXXML"],
AC_MSG_ERROR([$cxxxml_name is not found: it can be installed from $cxxxml_name \
package on Red Hat based systems])
)
# c++ compiler is required by gccxml/castxml
AC_CHECK_PROG(CXX, g++, g++)
AS_IF([test -z "$CXX"],
AC_MSG_ERROR([g++ is not found: it can be installed from gcc-c++ package \
on Red Hat based systems])
)
# perl-modules for xcode/m0gccxml2xcode script
AX_PROG_PERL_MODULES([XML::LibXML], ,
AC_MSG_ERROR([No XML::LibXML Perl module found: it can be installed \
from perl-XML-LibXML package on Red Hat based systems])
)
AX_PROG_PERL_MODULES([List::MoreUtils], ,
AC_MSG_ERROR([No List::MoreUtils Perl module found: it can be \
installed from perl-List-MoreUtils package on Red Hat based systems])
)
# perl-modules for xcode/proto script
AX_PROG_PERL_MODULES([YAML::XS], ,
AC_MSG_ERROR([No YAML::XS Perl module found: it can be installed \
from perl-YAML-LibYAML package on Red Hat based systems])
)
# perl-modules for scripts/build/check-sources script
AX_PROG_PERL_MODULES([File::Find::Rule], ,
AC_MSG_ERROR([No File::Find::Rule Perl module found: it can be \
installed from perl-File-Find-Rule package on Red Hat based systems])
)
AX_PROG_PERL_MODULES([IO::All], ,
AC_MSG_ERROR([No IO::All Perl module found: it can be installed from \
perl-IO-All package on Red Hat based systems])
)
AX_PROG_PERL_MODULES([File::Slurp], ,
AC_MSG_ERROR([No File::Slurp Perl module found: it can be installed from \
perl-File-Slurp package on Red Hat based systems])
)
# `ply' module is required by utils/m0confgen and utils/m0hagen.
# It is provided by `python36-ply' package on Red Hat based systems.
AX_PYTHON_MODULE([ply], die_if_absent)
AC_CHECK_PROG(POD2MAN, pod2man, pod2man)
AS_IF([test -z "$POD2MAN"],
AC_MSG_ERROR([pod2man is not found please install perl])
)
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, doxygen)
AC_CHECK_PROG(A2X, a2x, a2x)
AS_IF([test -z "$A2X"],
AC_MSG_ERROR([a2x is not found please install asciidoc])
)
# BASH variable is already set by configure to /bin/sh, so we need to unset it
# first to prevent AC_CHECK_PROG from using cached value
unset BASH
# bash shell is required by Makefile.am to build kernel modules
# see 'build-kernel-modules' make target for more details
AC_CHECK_PROG(BASH, bash, bash)
AS_IF([test -z "$BASH"],
AC_MSG_ERROR([bash is not found: it can be installed from bash package on \
Red Hat based systems])
)
#
# Checking required libraries --------------------------------------------- {{{1
#
# sqrt() requires m library
MOTR_SEARCH_LIBS([sqrt], [c m], [MATH_LIBS],
[sqrt cannot be found! Try to install libc-devel.]
)
AC_SUBST([MATH_LIBS])
# pthread library is required for a subset of pthread_XXX funcs
MOTR_SEARCH_LIBS([pthread_create], [c pthread], [PTHREAD_LIBS],
[pthread_create cannot be found! Try to install libc-devel or libpthread-devel.]
)
AC_SUBST([PTHREAD_LIBS])
MOTR_SEARCH_LIBS([MD5_Init], [c crypto], [OPENSSL_LIBS],
[MD5_Init cannot be found! Try to install openssl.]
)
AC_SUBST([OPENSSL_LIBS])
# check for aio library (io_submit(3) & co.)
MOTR_SEARCH_LIBS([io_getevents], [aio c], [AIO_LIBS],
[io_getevents cannot be found! Try to install libaio-devel.]
)
AC_SUBST([AIO_LIBS])
# check for libedit library
MOTR_SEARCH_LIBS([readline], [c edit], [LIBEDIT_LIBS],
[libedit cannot be found! Try to install libedit-devel.]
)
AC_SUBST([LIBEDIT_LIBS])
# rt library is required for: aio_read(3), aio_write(3), timer_create(2)
MOTR_SEARCH_LIBS([aio_read], [rt aio c], [RT_LIBS],
[aio_read cannot be found! Try to install librt-devel or libaio-devel.]
)
AC_SUBST([RT_LIBS])
MOTR_SEARCH_LIBS([dlopen], [c dl], [DL_LIBS],
[dlopen cannot be found! Try to install libdl.]
)
AC_SUBST([DL_LIBS])
MOTR_SEARCH_LIBS([uuid_generate], [uuid c], [UUID_LIBS],
[uuid_generate cannot be found! Try to install libuuid and libuuid-devel.])
AC_SUBST([UUID_LIBS])
#
# Checking for required header files
#
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h memory.h netdb.h \
netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h \
sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADERS([pthread.h], [], [AC_MSG_ERROR([pthread.h cannot be found!])])
AC_CHECK_HEADERS([openssl/md5.h], [], [AC_MSG_ERROR([md5.h cannot be found!])])
AC_HEADER_STDBOOL
#
# Checking required types ------------------------------------------------- {{{1
#
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([pthread_barrier_t], [], [], [[#include <pthread.h>]])
#
# Checking compiler characteristics --------------------------------------- {{{1
#
AC_CHECK_SIZEOF([long])
AC_MSG_CHECKING([whether target platform is a 64-bit one])
AS_IF([test $ac_cv_sizeof_long -eq 8],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([Only 64bit platforms are supported!])
]
)
AC_C_INLINE
MOTR_COMPILER_OPTION_CHECK([-Wno-unused-but-set-variable],
[M0_KCFLAGS="-Wno-unused-but-set-variable $M0_KCFLAGS"],
[M0_KCFLAGS="$M0_KCFLAGS"])
#
# Checking required library functions ------------------------------------- {{{1
#
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([dup2 getcwd getpagesize gettimeofday memmove memset mkdir \
munmap setenv sqrt strcasecmp strchr strdup strerror strrchr \
strstr strtol strtoul strtoull])
AC_CHECK_DECL([mallinfo], [AC_DEFINE([HAVE_MALLINFO])], [], [[#include <malloc.h>]])
AC_CHECK_DECL([malloc_size], [AC_DEFINE([HAVE_MALLOC_SIZE])], [], [[#include <malloc/malloc.h>]])
AC_CHECK_DECL([backtrace], [AC_DEFINE([HAVE_BACKTRACE])], [], [[#include <execinfo.h>]])
#
# Checking systemd availability ------------------------------------------- {{{1
#
AS_IF([test x$enable_systemd = xyes],
[
AC_CHECK_HEADERS([systemd/sd-daemon.h], [],
[AC_MSG_ERROR([systemd/sd-daemon.h cannot be found! please, install systemd-devel package])])
AC_CHECK_DECL([sd_notify], [], [AC_MSG_ERROR([sd_notify() not found])],
[[#include <systemd/sd-daemon.h>]])
MOTR_SEARCH_LIBS([sd_notify], [systemd-daemon systemd], [SYSTEMD_LIBS],
[sd_notify() cannot be found! Try to install systemd-devel.]
)
AC_SUBST([SYSTEMD_LIBS])
AC_DEFINE([HAVE_SYSTEMD])
AM_CONDITIONAL([HAVE_SYSTEMD], [true])
],[
AM_CONDITIONAL([HAVE_SYSTEMD], [false])
]
)
#
# Checking cassandra availability ------------------------------------------- {{{1
#
AS_IF([test x$CASS_IDX = xyes],
[
AC_CHECK_HEADERS([cassandra.h], [],
[AC_MSG_ERROR([cassandra.h cannot be found! \
try to install cassandra-cpp-driver-devel])])
AC_CHECK_HEADERS([uv.h], [],
[AC_MSG_ERROR([uv.h cannot be found! \
try to install libuv-devel])])
MOTR_SEARCH_LIBS([cass_cluster_new], [cassandra c], [CASSANDRA_LIBS],
[cass_cluster_new cannot be found! Try to install cppdriver.]
)
AC_SUBST([CASSANDRA_LIBS])
MOTR_SEARCH_LIBS([uv_loop_new], [uv c], [UV_LIBS],
[uv_loop_new cannot be found! Try to install libuv.]
)
AC_SUBST([UV_LIBS])
AM_CONDITIONAL([MOTR_IDX_STORE_CASS], [true])
],[
AM_CONDITIONAL([MOTR_IDX_STORE_CASS], [false])
]
)
#
# Checking user-mode availability ------------------------------------------- {{{1
#
AS_IF([test x$with_user_mode_only = xyes],
[AM_CONDITIONAL([ENABLE_USER_MODE_ONLY], [true])],
[AM_CONDITIONAL([ENABLE_USER_MODE_ONLY], [false])]
)
#
# Checking required linux kernel API -------------------------------------- {{{1
#
AS_IF([test x$with_lustre != xno],[
# Prepare linux configuration checks facility.
# Should be done before any *_LINUX_* checks.
MOTR_LINUX_INIT_CONFIG
MOTR_LINUX_CHECK_SYMBOL([journal_abort], [AC_DEFINE([HAVE_JOURNAL_ABORT])])
MOTR_LINUX_INODE_BLKSIZE
MOTR_LINUX_FILE_READV
MOTR_LINUX_FILE_AIO_READ
MOTR_LINUX_WRITE_BEGIN_END
MOTR_LINUX_SENDFILE
])
#
# Checking Intel ISA library --------------------------------------------------------- {{{1
#
MOTR_SEARCH_LIBS([ec_encode_data], [c isal], [ISAL_LIBS],
[ec_encode_data cannot be found! Try to install Intel ISA library package.]
)
AC_SUBST([ISAL_LIBS])
AC_CHECK_HEADERS([isa-l.h],
[AC_MSG_NOTICE([INTEL ISA-L Headers Available])],
[AC_MSG_ERROR([No INTEL ISA-L Headers])]
)
#
# Checking libfabric library----------------------------------------------- {{{1
#
AC_ARG_ENABLE([libfab],
[AS_HELP_STRING([--enable-libfab],
[Use libfabric transport])],
[],[enable_libfab=no]
)
AC_ARG_WITH([libfab],
[AS_HELP_STRING([--with-libfab=path],
[set path to user installed libfabric headers and library])],
[LIBFABRIC=$with_libfab],
[LIBFABRIC=""]
)
AS_IF([! test -z "$with_libfab"],
[
LIB_FAB_INCLUDES="-I$LIBFABRIC/include"
LIBFAB_LIBS="-L$LIBFABRIC/lib -lfabric"
M0_CPPFLAGS="-DENABLE_LIBFAB $M0_CPPFLAGS $LIB_FAB_INCLUDES"
BUILD_DEPEND_LIBFAB=""
],
)
AS_IF([test x$enable_libfab = xyes || test "x$with_default_network" = "xLF" ],
[
MOTR_SEARCH_LIBS([fi_fabric], [fabric], [LIBFAB_LIBS],
[fi_fabric cannot be found! Try to install libfabric package]
)
AC_CHECK_HEADERS([rdma/fabric.h], [],
AC_MSG_ERROR([rdma/fabric.h is not found. Try to install libfabric package])
)
M0_CPPFLAGS="-DENABLE_LIBFAB $M0_CPPFLAGS"
]
)
AS_IF([ test -z "$with_libfab" && test x$enable_libfab = xno],
[
AC_CHECK_HEADERS([rdma/fabric.h],
[
# Check for libfabric library
MOTR_SEARCH_LIBS([fi_fabric], [fabric], [LIBFAB_LIBS],
[fi_fabric cannot be found! Try to install libfabric package.]
)
AS_IF([! test -z LIBFAB_LIBS],
[
M0_CPPFLAGS="-DENABLE_LIBFAB $M0_CPPFLAGS"
enable_libfab=yes
AC_DEFINE_UNQUOTED([M0_DEFAULT_NETWORK], ["LF"])
BUILD_DEPEND_LIBFAB="BuildRequires: libfabric-devel"
]
)
], []
)
]
)
AC_SUBST([LIBFAB_LIBS])
AC_SUBST([BUILD_DEPEND_LIBFAB])
AC_SUBST([BUILD_DEPEND_DTM])
AM_CONDITIONAL([ENABLE_LIBFAB],
[test "x$enable_libfab" = xyes || ! test -z "$with_libfab"])
AC_MSG_CHECKING([for motr/config.h])
MOTR_CONFIG="motr/config.h"
AS_IF([! test -e "ABS_BUILDDIR/$MOTR_CONFIG"],
[
AC_MSG_NOTICE([$MOTR_CONFIG not found! Creating the symlink.])
(cd "$ABS_BUILDDIR/motr" && $LN_S "../config.h" "config.h")
]
)
#
# Checking Lustre --------------------------------------------------------- {{{1
#
AS_IF([test x$with_lustre = xno],
[
AC_SUBST([LUSTRE_CONFIG_LINK], [])
],[
AC_MSG_CHECKING([for LNet header dir])
AS_IF([! test -d $LUSTRE/lnet/include],
[AC_MSG_ERROR([lnet/include not found in '$LUSTRE', please provide a \
correct path to Lustre headers using --with-lustre option])]
)
AC_MSG_RESULT([$LUSTRE/lnet/include])
AC_MSG_CHECKING([for Lustre config.h])
LUSTRE_CONFIG="$LUSTRE/config.h"