forked from Seagate/cortx-motr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1030 lines (869 loc) · 34.9 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],[1])
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],[[email protected]])
# 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:M0_VERSION_PATCH])
# 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!])]
)
#
# Configuration options --------------------------------------------------- {{{1
#
# variables ------------------------------------------- {{{2
AC_ARG_VAR([KCFLAGS], [kernel-space CFLAGS])
AC_ARG_VAR([CXXXML], [gccxml/castxml command])
# define macros --------------------------------------- {{{2
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_CASTXML], [Use CastXML instead of GCC-XML])
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_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([M0_NDEBUG], [Disable M0_ASSERT.])
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_LUSTRE_VERSION], [Autodetected Lustre version represented as integer])
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])
# 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]))
# 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]))
# 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]))
# 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]))
# systemd {{{3
AC_ARG_ENABLE([systemd],
[AS_HELP_STRING([--disable-systemd],
[disable integration with systemd])],
[], [enable_systemd=yes]
)
# CastXML {{{3
AC_ARG_ENABLE([castxml],
[AS_HELP_STRING([--enable-castxml],
[use CastXML instead of GCC-XML])],
[], [enable_castxml=no]
)
AS_IF([test x$enable_castxml = xyes],
AC_DEFINE([ENABLE_CASTXML]))
AM_CONDITIONAL([ENABLE_CASTXML],
[test x$enable_castxml = xyes])
# 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])
]
)
]
)
# 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]))
# 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],[
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=/usr/src/`ls /usr/src | grep lustre- | tail -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],[
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
AS_IF([test x$enable_castxml = xyes],
[cxxxml_name=castxml],
[cxxxml_name=gccxml]
)
# gccxml 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 gccxml \
package on Red Hat based systems])
)
# c++ compiler is required by gccxml
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])
# 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])
# 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_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 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 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"
AS_IF([! test -e $LUSTRE_CONFIG],
[ AC_MSG_RESULT([no])
AC_MSG_ERROR([$LUSTRE_CONFIG not found! Did you configure Lustre?])
],[
(cd $ABS_BUILDDIR; $LN_S $LUSTRE_CONFIG lustre_config.h)
]
)
AC_MSG_RESULT([$LUSTRE_CONFIG])
AC_SUBST([LUSTRE_CONFIG_LINK], [$ABS_BUILDDIR/lustre_config.h])
AC_MSG_CHECKING([for Lustre symbols file])
LUSTRE_SYMVERS="$LUSTRE/Module.symvers"
AS_IF([! test -e $LUSTRE_SYMVERS],
AC_MSG_RESULT([no])
AC_MSG_ERROR([$LUSTRE_SYMVERS not found! Did you build Lustre?])
)
AC_MSG_RESULT([$LUSTRE_SYMVERS])
AC_SUBST([LUSTRE_SYMVERS])
]) # --without-lustre, with_lustre=no
#
# Configure and build dependencies in external motr repositories ---------- {{{1
#
OLD_LIBS=$LIBS
OLD_CFLAGS=$CFLAGS
LIBS=""
CFLAGS=""
# Checking galois --------------------------------------------------------- {{{1
GALOIS_REL_PATH="extra-libs/galois"
GALOIS_SRC="$SRCDIR/$GALOIS_REL_PATH"
GALOIS_ABS_SRC="$ABS_SRCDIR/$GALOIS_REL_PATH"
GALOIS_INCLUDES="-I$GALOIS_ABS_SRC/include"
KGALOIS_INCLUDES="-I$GALOIS_ABS_SRC/include"
GALOIS_LIBS="$GALOIS_ABS_SRC/src/libgalois.la"
AC_SUBST([GALOIS_SYMVERS], [$GALOIS_ABS_SRC/src/linux_kernel/Module.symvers])
AS_IF([! test -x $GALOIS_SRC/configure],
[ test -x $GALOIS_SRC/autogen.sh && ( cd $GALOIS_SRC; ./autogen.sh ) ]
)
# Checking libyaml -------------------------------------------------------- {{{1
AS_IF([test x$enable_system_libs = xyes],
[
# Check for yaml
MOTR_SEARCH_LIBS([yaml_parser_initialize], [yaml], [YAML_LIBS],
[yaml_parser_initialize cannot be found! Try install yaml package]
)
AC_CHECK_HEADERS([yaml.h], [],
AC_MSG_ERROR([yaml.h is not found. Try to install libyaml-devel package])
)
],[
AC_MSG_ERROR([Motr doesn't come with a bundled libyaml any more, use system wide version instead.])
]
)
LIBS=$OLD_LIBS
CFLAGS=$OLD_CFLAGS
AC_SUBST([GALOIS_ABS_SRC])
AC_SUBST([GALOIS_LIBS])
AC_SUBST([YAML_LIBS])
#
# Handle configuration options -------------------------------------------- {{{1
#
AS_IF([test x$enable_debug = xyes],
[
M0_CPPFLAGS="-DDEBUG $M0_CPPFLAGS"
M0_KCPPFLAGS="-DDEBUG $M0_KCPPFLAGS"
M0_CFLAGS="-g -O0 $M0_CFLAGS"
M0_KCFLAGS="-g -O0 $M0_KCFLAGS"
AC_DEFINE([ENABLE_DEBUG])
],[
M0_CFLAGS="-g -O2 $M0_CFLAGS"
M0_KCFLAGS="-g -O2 $M0_KCFLAGS"
]
)
AS_IF([test x$enable_frame_pointers = xyes],
[
M0_CFLAGS="-fno-omit-frame-pointer $M0_CFLAGS"
M0_KCFLAGS="-fno-omit-frame-pointer $M0_KCFLAGS"
]
)
AS_IF([test x$enable_profiler = xyes],
[AC_DEFINE([ENABLE_PROFILER])
AC_CHECK_PROG(PPROF, pprof, pprof)
AS_IF([test -z $PPROF],
AC_MSG_ERROR([pprof not found. Try to 'yum install pprof'.]))
MOTR_SEARCH_LIBS([ProfilerStart], [c profiler], [PROFILER_LIBS],
[libprofiler not found. Try to \
'yum install gperftools-libs gperftools-devel gperf-debuginfo'.])
AC_SUBST([PROFILER_LIBS])],
[PROFILER_LIBS=" "])
AS_IF([test x$enable_coverage = xyes],
[
# Remove -O<digit> flag from $M0_CFLAGS
M0_CFLAGS="$(echo $M0_CFLAGS | sed 's/-O[[0-9]]//g') --coverage"
M0_LDFLAGS="-lgcov $M0_LDFLAGS"
]
)
AS_IF([test x$enable_mcheck = xyes],
[M0_LDFLAGS="-lmcheck $M0_LDFLAGS"]
)
#
# Set up build variables -------------------------------------------------- {{{1
#
M0_CPPFLAGS="$GALOIS_INCLUDES $YAML_INCLUDES $M0_CPPFLAGS $LUSTRE_INCLUDES"
# _GNU_SOURCE for asprintf(3), open(2) O_DIRECT flag
M0_CPPFLAGS="-D_REENTRANT -D_GNU_SOURCE -DM0_INTERNAL='' -DM0_EXTERN=extern \
-iquote'$ABS_BUILDDIR' -iquote'$SRCDIR' -include'config.h' \
-DM0_SRC_DIR='$ABS_SRCDIR' $M0_CPPFLAGS"
# contains only -D and -I/usr* entries from M0_CPPFLAGS, this is intended for
# pkg-config database provided within Motr rpm distribution
M0_CPPFLAGS_DIST=$(echo "$M0_CPPFLAGS" | grep -Po -e '-D\S+|-I/usr\S+' | xargs echo)
# -Wno-attributes is required to suppress warnings about unrecognized
# __attribute__, such as __attribute__((gccxml(...))). It's important because we
# use -Werror, which turns warnings into errors, but we still need to be able to
# use gccxml attributes.
M0_CFLAGS="-pipe -Wall -Werror -Wno-attributes -fno-strict-aliasing $M0_CFLAGS"
# Prevents gcc from introducing common symbols in object files. These symbols
# are avoided because they break the compilation toolchain that Parallel
# Scientific is using.
M0_CFLAGS="-fno-common $M0_CFLAGS"
M0_LDFLAGS="-rdynamic $M0_LDFLAGS"
M0_KCPPFLAGS="-DM0_INTERNAL='' -DM0_EXTERN=extern \
-include'$ABS_BUILDDIR/config.h' \
-iquote '$ABS_BUILDDIR' \
-iquote '$ABS_SRCDIR' \
$LUSTRE_INCLUDES $KGALOIS_INCLUDES $M0_KCPPFLAGS"
M0_KCFLAGS="-Wall -Werror -Wno-attributes $M0_KCFLAGS"
# trim spaces at the end of flags
M0_CPPFLAGS=$(echo $M0_CPPFLAGS | sed 's/[[[:blank:]]]*$//')
M0_CFLAGS=$(echo $M0_CFLAGS | sed 's/[[[:blank:]]]*$//')
M0_KCPPFLAGS=$(echo $M0_KCPPFLAGS | sed 's/[[[:blank:]]]*$//')
M0_KCFLAGS=$(echo $M0_KCFLAGS | sed 's/[[[:blank:]]]*$//')
M0_LDFLAGS=$(echo $M0_LDFLAGS | sed 's/[[[:blank:]]]*$//')
AC_SUBST([M0_CPPFLAGS])
AC_SUBST([M0_CPPFLAGS_DIST])
AC_SUBST([M0_CFLAGS])
AC_SUBST([M0_KCPPFLAGS])
AC_SUBST([M0_KCFLAGS])
AC_SUBST([M0_LDFLAGS])
AC_SUBST([BUILD_CONFIGURE_OPTS],["$ac_configure_args"])
AC_SUBST([BUILD_CFLAGS],["$M0_CPPFLAGS $M0_CFLAGS $CPPFLAGS $CFLAGS"])
AC_SUBST([BUILD_KCFLAGS],["$M0_KCPPFLAGS $M0_KCFLAGS $KCFLAGS"])
AC_SUBST([BUILD_LDFLAGS],["$M0_LDFLAGS"])
],[
AM_CONDITIONAL([HAVE_SYSTEMD], [true])
]) # enable_dist_mode
#
# Setup output files ------------------------------------------------------ {{{1
#
AC_CONFIG_FILES([
Makefile
Kbuild
])
AC_CONFIG_FILES([motr/version_macros.h])
AC_CONFIG_FILES([doc/man/asciidoc.conf])
AC_CONFIG_FILES([mdservice/ut/mdstore.h])
AC_CONFIG_FILES([cortx-motr.spec])
AC_CONFIG_FILES([motr.pc])
AC_CONFIG_FILES([scripts/install/usr/lib/pkgconfig/motr.pc])
AC_CONFIG_FILES([m0t1fs/linux_kernel/st/common.sh],
[chmod +x m0t1fs/linux_kernel/st/common.sh])
AC_CONFIG_FILES([net/test/m0nettest.sh], [chmod +x net/test/m0nettest.sh])
AC_CONFIG_FILES([net/test/m0nettestd.sh], [chmod +x net/test/m0nettestd.sh])
AC_CONFIG_FILES([net/test/test-user.sh], [chmod +x net/test/test-user.sh])
AC_CONFIG_FILES([net/test/st/st-config.sh], [chmod +x net/test/st/st-config.sh])
AC_CONFIG_FILES([net/test/demo/demo-config.sh], [chmod +x net/test/demo/demo-config.sh])
AC_CONFIG_FILES([utils/modload-all.sh], [chmod +x utils/modload-all.sh])
AC_CONFIG_FILES([scripts/systemtap/kem/Makefile])
AC_CONFIG_SUBDIRS([extra-libs/galois])
AC_OUTPUT
#
# Display resulting values of some important build variables -------------- {{{1
#
echo ""
AS_IF([test "x$CFLAGS" != x],
[echo "CFLAGS : \"$CFLAGS\""])
AS_IF([test "x$CPPFLAGS" != x],
[echo "CPPFLAGS : \"$CPPFLAGS\""])
AS_IF([test "x$KCFLAGS" != x],
[echo "KCFLAGS : \"$KCFLAGS\""])
AS_IF([test "x$KCPPFLAGS" != x],
[echo "KCPPFLAGS : \"$KCPPFLAGS\""])
AS_IF([test "x$LDFLAGS" != x],
[echo "LDFLAGS : \"$LDFLAGS\""])
AS_IF([test "x$LIBS" != x],
[echo "LIBS : \"$LIBS\""])
echo ""
echo "Motr version : $PACKAGE_VERSION"
echo ""
echo "CONFIGURE_OPTS: $BUILD_CONFIGURE_OPTS"
echo ""
echo "M0_CPPFLAGS : \"$M0_CPPFLAGS\""
echo "M0_CFLAGS : \"$M0_CFLAGS\""