/
configure.ac
2149 lines (1919 loc) · 67.4 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl **************************************************************
dnl
dnl PVFS2 AUTOCONF SCRIPT
dnl
dnl Process this file with autoconf to produce a configure script.
dnl You may need to use autoheader as well if changing any DEFINEs
dnl sanity checks, output header, location of scripts used here
AC_INIT
AC_CONFIG_SRCDIR([include/pvfs2-types.h])
dnl As time progresses our old autotools files and m4 macros
dnl get out-of-date. Autotools responds with pages of warnings
dnl about obsolete macros. I ran autoupdate on our configure.ac
dnl and the m4 files in maint/config, plus a little hand editing
dnl where required. I was afraid that my updates
dnl might introduce warnings or failures on older machines, so I
dnl tested across a range of autotools generations on 2.6.32-754.el6
dnl and 5.17.11-300.fc36.
dnl 2.6.32-754.el6 has autoconf-2.63 which came out in 2008.
dnl 5.17.11-300.fc36 has autoconf-2.71.
AC_PREREQ([2.63])
AC_CONFIG_AUX_DIR(maint/config)
dnl
dnl for test builds, insert the build date and time information into
dnl into the version; for official releases, clear the PVFS2_PRE line
dnl
dnl PVFS2 versioning information.
dnl An @ in the date string can confuse e.g. scp and 'make kmod'
CONFIGURE_TIME=`date -u +"%Y-%m-%d-%H%M%S"`
PVFS2_VERSION_MAJOR=2
PVFS2_VERSION_MINOR=10
PVFS2_VERSION_SUB=0
PVFS2_VERSION_RELEASE="orangefs"
#PVFS2_PRE=""
PVFS2_VERSION_PRE="-DEVEL-$CONFIGURE_TIME"
PVFS2_VERSION=$PVFS2_VERSION_MAJOR.$PVFS2_VERSION_MINOR.$PVFS2_VERSION_SUB-$PVFS2_VERSION_RELEASE$PVFS2_VERSION_PRE
AC_SUBST(PVFS2_VERSION)
AC_DEFINE_UNQUOTED(PVFS2_VERSION_MAJOR, $PVFS2_VERSION_MAJOR, major version number)
AC_DEFINE_UNQUOTED(PVFS2_VERSION_MINOR, $PVFS2_VERSION_MINOR, minor version number)
AC_DEFINE_UNQUOTED(PVFS2_VERSION_SUB, $PVFS2_VERSION_SUB, sub version number)
#AC_DEFINE_UNQUOTED(PVFS2_VERSION_RELEASE, $PVFS2_VERSION_RELEASE, release version number)
AC_SUBST(PVFS2_VERSION_MAJOR)
AC_SUBST(PVFS2_VERSION_MINOR)
AC_SUBST(PVFS2_VERSION_SUB)
#AC_SUBST(PVFS2_VERSION_RELEASE)
dnl BMI_ONLY_TAG
dnl Checks for host type
dnl Ensures we can compile on this OS
AC_CANONICAL_HOST
USR_CFLAGS=$CFLAGS
if test "x$USR_CFLAGS" = "x"; then
USR_CFLAGS_SET=no
fi
dnl if we use headers that might not be on every platform, add them here
AC_CONFIG_HEADERS([pvfs2-config.h])
AC_CHECK_HEADER([pwd.h],
[AC_DEFINE(HAVE_PWD_H, 1, Define if pwd.h exists)])
AC_CHECK_HEADER([features.h],
[AC_DEFINE(HAVE_FEATURES_H, 1, Define if features.h exists)])
AC_CHECK_HEADER([fstab.h],
[AC_DEFINE(HAVE_FSTAB_H, 1, Define if fstab.h exists)])
AC_CHECK_HEADER([malloc.h],
[AC_DEFINE(HAVE_MALLOC_H, 1, Define if malloc.h exists)])
AC_CHECK_HEADER([memory.h],
[AC_DEFINE(HAVE_MEMORY_H, 1, Define if memory.h exists)])
AC_CHECK_HEADER([mntent.h],
[AC_DEFINE(HAVE_MNTENT_H, 1, Define if mntent.h exists)])
AC_CHECK_HEADER([netdb.h],
[AC_DEFINE(HAVE_NETDB_H, 1, Define if netdb.h exists)])
AC_CHECK_HEADER([stdarg.h],
[AC_DEFINE(HAVE_STDARG_H, 1, Define if stdarg.h exists)])
AC_CHECK_HEADER([stdint.h],
[AC_DEFINE(HAVE_STDINT_H, 1, Define if stdint.h exists)])
AC_CHECK_HEADER([stdlib.h],
[AC_DEFINE(HAVE_STDLIB_H, 1, Define if stdlib.h exists)])
AC_CHECK_HEADER([stdio.h],
[AC_DEFINE(HAVE_STDIO_H, 1, Define if stdio.h exists)])
AC_CHECK_HEADER([fcntl.h],
[AC_DEFINE(HAVE_FCNTL_H, 1, Define if fcntl.h exists)])
AC_CHECK_HEADER([utime.h],
[AC_DEFINE(HAVE_UTIME_H, 1, Define if utime.h exists)])
AC_CHECK_HEADER([string.h],
[AC_DEFINE(HAVE_STRING_H, 1, Define if string.h exists)])
AC_CHECK_HEADER([strings.h],
[AC_DEFINE(HAVE_STRINGS_H, 1, Define if strings.h exists)])
AC_CHECK_HEADER([assert.h],
[AC_DEFINE(HAVE_ASSERT_H, 1, Define if assert.h exists)])
AC_CHECK_HEADER([libgen.h],
[AC_DEFINE(HAVE_LIBGEN_H, 1, Define if libgen.h exists)])
AC_CHECK_HEADER([dirent.h],
[AC_DEFINE(HAVE_DIRENT_H, 1, Define if dirent.h exists)])
AC_CHECK_HEADER([time.h],
[AC_DEFINE(HAVE_TIME_H, 1, Define if time.h exists)])
AC_CHECK_HEADER([dlfcn.h],
[AC_DEFINE(HAVE_DLFCN_H, 1, Define if dlfcn.h exists)])
AC_CHECK_HEADER([linux/types.h],
[AC_DEFINE(HAVE_LINUX_TYPES_H, 1, Define if linux/types.h exists)])
AC_CHECK_HEADER([linux/malloc.h],
[AC_DEFINE(HAVE_LINUX_MALLOC_H, 1, Define if linux/malloc.h exists)])
AC_CHECK_HEADER([selinux/selinux.h],
[AC_DEFINE(HAVE_SELINUX_H, 1, Define if selinux/selinux.h exists)])
dnl Kernel Headers checked in maint/kernel.m4
AC_CHECK_HEADER([sys/vfs.h],
[AC_DEFINE(HAVE_SYS_VFS_H, 1, Define if sys/vfs.h exists)])
AC_CHECK_HEADER([sys/mount.h],
[AC_DEFINE(HAVE_SYS_MOUNT_H, 1, Define if sys/mount.h exists)])
AC_CHECK_HEADER([sys/stat.h],
[AC_DEFINE(HAVE_SYS_STAT_H, 1, Define if sys/stat.h exists)])
AC_CHECK_HEADER([sys/types.h],
[AC_DEFINE(HAVE_SYS_TYPES_H, 1, Define if sys/types.h exists)])
AC_CHECK_HEADER([sys/socket.h],
[AC_DEFINE(HAVE_SYS_SOCKET_H, 1, Define if sys/socket.h exists)])
AC_CHECK_HEADER([sys/sendfile.h],
[AC_DEFINE(HAVE_SYS_SENDFILE_H, 1, Define if sys/sendfile.h exists)])
AC_CHECK_HEADER([sys/xattr.h],
[AC_DEFINE(HAVE_SYS_XATTR_H, 1, Define if sys/xattr.h exists)])
AC_CHECK_HEADER([sys/statvfs.h],
[AC_DEFINE(HAVE_SYS_STATVFS_H, 1, Define if sys/statvfs.h exists)])
AC_CHECK_HEADER([sys/uio.h],
[AC_DEFINE(HAVE_SYS_UIO_H, 1, Define if sys/uio.h exists)])
AC_CHECK_HEADER([sys/mman.h],
[AC_DEFINE(HAVE_SYS_MMAN_H, 1, Define if sys/mman.h exists)])
AC_CHECK_HEADER([sys/time.h],
[AC_DEFINE(HAVE_SYS_TIME_H, 1, Define if sys/time.h exists)])
AC_CHECK_HEADER([arpa/inet.h],
[AC_DEFINE(HAVE_ARPA_INET_H, 1, Define if arpa/inet.h exists)])
AC_CHECK_HEADER([attr/xattr.h],
[AC_DEFINE(HAVE_ATTR_XATTR_H, 1, Define if attr/xattr.h exists)])
AC_CHECK_SIZEOF([long int])
dnl Check for utilities that we need during the build process
AC_PROG_INSTALL
AC_PROG_CC
AC_MSG_CHECKING([for required gcc])
if test "x$GCC" = "x"; then
AC_MSG_ERROR(no)
fi
CFLAGS=$USR_CFLAGS
AC_PROG_CPP
AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
if test $HAVE_PERL = "no"; then
AC_MSG_ERROR("perl required in PATH to complete build")
fi
AC_CHECK_PROG(HAVE_FIND, find, yes, no)
if test $HAVE_FIND = "no"; then
AC_MSG_ERROR("find required in PATH complete build")
fi
AC_CHECK_PROG(HAVE_BISON, bison, yes, no)
if test $HAVE_BISON = "no"; then
AC_MSG_ERROR("bison required in PATH to complete build")
fi
AC_CHECK_PROG(HAVE_FLEX, flex, yes, no)
if test $HAVE_FLEX = "no"; then
AC_MSG_ERROR("flex required in PATH to complete build")
fi
AC_MSG_CHECKING([for required Math::BigInt perl module])
perl -e "use Math::BigInt" 2>&1 > /dev/null
if test $? != 0; then
AC_MSG_ERROR(no)
else
AC_MSG_RESULT(yes)
fi
if test $host != $build; then
AC_CHECK_PROGS(BUILD_CC, gcc cc)
else
BUILD_CC=$CC
BUILD_CFLAGS=$BUILD_CFLAGS
BUILD_LDFLAGS=$BUILD_LDFLAGS
fi
AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(BUILD_LDFLAGS)
#
# Threading options.
#
# Client - thread-safe or not
# --disable-thread-safety : chooses null or posix locking mechanism
# For applications that know they are not multi-threaded, or choose
# to handle locking themselves, this configure option can be used to
# slightly decrease library-induced latency by removing the locking.
#
# Client - job threading
# libpvfs2-threaded.{so,a} with __PVFS2_JOB_THREADED__
# This option causes the client library to spawn an extra thread
# to handle network communications. In this way, it is possible
# that the library can handle new and completed requests from
# the application while also interacting with the network.
#
# These separate libraries can not be built using the existing
# configure mechanism. They are only built if required by the
# kernel module helper.
#
# Server - three options:
# trove
# (hack Makefile.in)
# job
# (hack Makefile.in)
# aio
# --disable-aio-threaded-callbacks
#
# Trove (storage) and job threading in the server are implemented
# using #defines, but not exported through the configure mechanism.
# AIO threaded callbacks are a separate thread used in conjunction
# with trove, and can be disabled through a configure option as
# AIO has been found to be buggy on many systems.
#
#
# Kernel module helper - job threading
# --enable-threaded-kmod-helper
#
# This is a special client that "helps" applications that access PVFS
# through the kernel using normal VFS calls (e.g. "ls"). This
# configure options builds it using __PVFS2_JOB_THREADED__ as described
# above. That enables a thread for the network layer and a thread
# for the kernel interface. This has the potential to increase the
# rate at which concurrent operations are processed, but has the potential
# drawback of somewhat higher overhead for a single operation and lack
# of testing.
#
# Enabling this options causes one of libpvfs2-threaded.{so,a} to be
# built, depending on --enable-shared and --enable-static. If both are
# enabled, the shared library takes precedence.
#
dnl a mechanism to turn off threads in the client library
AC_MSG_CHECKING([for client library thread safety support])
AC_ARG_ENABLE(thread-safety,
[ --disable-thread-safety Disables thread safety in the client library],
[if test "x$enableval" = "xno" ; then
LIBCFLAGS="$LIBCFLAGS -D__GEN_NULL_LOCKING__"
THREAD_LIB=""
AC_MSG_RESULT(no)
fi],
[ LIBCFLAGS="$LIBCFLAGS -D__GEN_POSIX_LOCKING__"
THREAD_LIB="-lpthread"
AC_MSG_RESULT(yes) ])
AC_SUBST(LIBCFLAGS)
AC_SUBST(THREAD_LIB)
dnl a mechanism to disable building the PVFS2 server
AC_ARG_ENABLE(server,
[ --disable-server Disables building of PVFS2 server],
[if test "x$enableval" = "xyes" ; then
BUILD_SERVER=1
else
BUILD_SERVER=""
fi],
BUILD_SERVER=1)
AC_SUBST(BUILD_SERVER)
AC_ARG_WITH(db-backend,
[ --with-db-backend Use specified database (bdb or lmdb).],
if test "${withval}" = "bdb"
then
DATABASE_BACKEND=bdb
NEED_BERKELEY_DB=yes
elif test "${withval}" = "lmdb"
then
DATABASE_BACKEND=lmdb
NEED_LMDB=yes
else
AC_MSG_ERROR(database backend ${withval} invalid)
fi
AC_SUBST(DATABASE_BACKEND)
AC_SUBST(NEED_BERKELEY_DB)
AC_SUBST(NEED_LMDB),
DATABASE_BACKEND=bdb
NEED_BERKELEY_DB=yes
AC_SUBST(DATABASE_BACKEND)
AC_SUBST(NEED_BERKELEY_DB)
AC_SUBST(NEED_LMDB))
AC_ARG_ENABLE(external-lmdb,
[ --enable-external-lmdb Enable linking against an external LMDB library.],
WANT_INTERNAL_LMDB=no,
WANT_INTERNAL_LMDB=yes)
AC_SUBST(WANT_INTERNAL_LMDB)
dnl locate OpenSSL libraries
AX_OPENSSL
dnl check to see if the "fast" getgrouplist function is available
AX_GETGROUPLIST
dnl check for key-based security
AC_ARG_ENABLE(security-key,
[ --enable-security-key Enables key-based security],
[if test "x$enableval" = "xyes" ; then
ENABLE_SECURITY_KEY=1
AC_DEFINE(ENABLE_SECURITY_KEY, 1, Define if key-based security is enabled)
else
ENABLE_SECURITY_KEY=
fi],
[ENABLE_SECURITY_KEY=]
)
AC_SUBST(ENABLE_SECURITY_KEY)
dnl check for cert-based-security
AC_ARG_ENABLE(security-cert,
[ --enable-security-cert Enables certificate-based security],
[if test "x$enableval" = "xyes" ; then
ENABLE_SECURITY_CERT=1
AC_DEFINE(ENABLE_SECURITY_CERT, 1, Define if certificate-based security is enabled)
else
ENABLE_SECURITY_CERT=
fi],
[ENABLE_SECURITY_CERT=]
)
AC_SUBST(ENABLE_SECURITY_CERT)
dnl check for capability cache
AC_ARG_ENABLE(capcache,
[ --disable-capcache Disables server capability cache],
[if test "x$enableval" = "xyes" ; then
ENABLE_CAPCACHE=1
AC_DEFINE(ENABLE_CAPCACHE, 1, Define if capability cache is enabled)
else
ENABLE_CAPCACHE=
fi],
[if test "x$ENABLE_SECURITY_KEY" = "x1" -o "x$ENABLE_SECURITY_CERT" = "x1"; then
ENABLE_CAPCACHE=1
AC_DEFINE(ENABLE_CAPCACHE, 1, Define if capability cache is enabled)
else
ENABLE_CAPCACHE=
fi]
)
AC_SUBST(ENABLE_CAPCACHE)
dnl check for credential cache
AC_ARG_ENABLE(credcache,
[ --disable-credcache Disables server credential cache],
[if test "x$enableval" = "xyes" ; then
ENABLE_CREDCACHE=1
AC_DEFINE(ENABLE_CREDCACHE, 1, Define if credential cache is enabled)
else
ENABLE_CREDCACHE=
fi],
[if test "x$ENABLE_SECURITY_KEY" = "x1" -o "x$ENABLE_SECURITY_CERT" = "x1"; then
ENABLE_CREDCACHE=1
AC_DEFINE(ENABLE_CREDCACHE, 1, Define if credential cache is enabled)
else
ENABLE_CREDCACHE=
fi]
)
AC_SUBST(ENABLE_CREDCACHE)
dnl check for certificate cache
AC_ARG_ENABLE(certcache,
[ --disable-certcache Disables server certificate cache],
[if test "x$enableval" = "xyes" ; then
ENABLE_CERTCACHE=1
AC_DEFINE(ENABLE_CERTCACHE, 1, Define if certificate cache is enabled)
else
ENABLE_CERTCACHE=
fi],
[if test "x$ENABLE_SECURITY_CERT" = "x1"; then
ENABLE_CERTCACHE=1
AC_DEFINE(ENABLE_CERTCACHE, 1, Define if certificate cache is enabled)
else
ENABLE_CERTCACHE=
fi]
)
AC_SUBST(ENABLE_CERTCACHE)
if test "x$ENABLE_SECURITY_KEY" = "x1" -a "x$ENABLE_SECURITY_CERT" = "x1"; then
AC_MSG_ERROR([only one of --enable-security-key and --enable-security-cert may be used])
fi
dnl OpenSSL is required for robust security
if test \( "x$ENABLE_SECURITY_KEY" = "x1" -o "x$ENABLE_SECURITY_CERT" = "x1" \) -a "x$OPENSSL_CPPFLAGS" = "x"; then
AC_MSG_ERROR([OpenSSL required for robust security (use --with-ssl)])
fi
dnl credential cache only valid in security modes
if test "x$ENABLE_CREDCACHE" = "x1" -a "x$ENABLE_SECURITY_KEY" = "x" -a "x$ENABLE_SECURITY_CERT" = "x"; then
AC_MSG_ERROR([credential cache can only be used in key- or certificate-based security mode])
fi
dnl certificate cache only valid in certificate-based security mode
if test "x$ENABLE_CERTCACHE" = "x1" -a "x$ENABLE_SECURITY_CERT" = "x"; then
AC_MSG_ERROR([certificate cache can only be used in certificate-based security mode])
fi
dnl locate LDAP libraries
AX_LDAP
dnl certificate security requires LDAP
if test "x$ENABLE_SECURITY_CERT" = "x1" -a "x$LDAP_LIB" = "x"; then
AC_MSG_ERROR([OpenLDAP required for certificate-based security (use --with-ldap)])
fi
dnl enable profiling
AC_ARG_ENABLE(profiling,
[ --enable-profiling Enables simple profiling],
[if test "x$enableval" = "xyes" ; then
ENABLE_PROFILING=1
AC_DEFINE(ENABLE_PROFILING, 1, Define if profiling is enabled)
else
ENABLE_PROFILING=
fi],
)
AC_SUBST(ENABLE_PROFILING)
dnl a mechanism to turn off memory usage statistics in karma (may be
dnl confusing for some classes of users)
AC_ARG_ENABLE(karma-mem-usage-stats,
[ --disable-karma-mem-usage-stats
Disables memory usage stats in karma],
[if test "x$enableval" = "xno" ; then
CFLAGS="$CFLAGS -D__KARMA_DISABLE_MEM_USAGE__"
fi]
,)
dnl build only the bmi library
AC_ARG_ENABLE(bmi-only,
[ --enable-bmi-only Build only the BMI library],
[if test "x$enableval" = "xyes" ; then
BUILD_BMI_ONLY=1
fi]
,)
AC_SUBST(BUILD_BMI_ONLY)
dnl if we're only building the BMI lib, disable checks for server and DB.
if test "x$BUILD_BMI_ONLY" = "x1"; then
BUILD_SERVER=""
AC_SUBST(BUILD_SERVER)
fi
dnl a mechanism to turn off perf counters
AC_ARG_ENABLE(perf-counters,
[ --disable-perf-counters Disables pvfs2-server performance counters],
[if test "x$enableval" = "xno" ; then
CFLAGS="$CFLAGS -D__PVFS2_DISABLE_PERF_COUNTERS__"
fi]
,)
dnl a mechanism to turn on readahead caching (for kernel interface)
RA_CACHE=""
AC_ARG_ENABLE(racache,
[ --enable-racache Enables readahead in the Client Core ],
[if test "x$enableval" = "xyes" ; then
RA_CACHE="-DUSE_RA_CACHE"
fi]
,)
AC_SUBST(RA_CACHE)
dnl a mechanism that resets the file position pointer when an error occurs whether
dnl or not any bytes were written (kernel interface only).
RESET_FILE_POS=""
AC_ARG_ENABLE(reset-file-pos,
[ --enable-reset-file-pos Resets file position pointer in kernel interface upon error],
[if test "x$enableval" = "xyes" ; then
RESET_FILE_POS="-DRESET_FILE_POS"
fi
]
,)
AC_SUBST(RESET_FILE_POS)
dnl See if the --enable-trusted-connections option was given to configure
AC_ARG_ENABLE(trusted-connections,
[ --enable-trusted-connections
**EXPERIMENTAL** Enables connects only
from trusted hosts/ports ],
[if test "x$enableval" = "xyes"; then
TRUSTED_CONNECTIONS="-DUSE_TRUSTED"
fi],
)
AC_SUBST(TRUSTED_CONNECTIONS)
dnl a function to check if we have the required gtk stuff for the
dnl karma gui
test_for_karma()
{
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
if test "x$HAVE_PKGCONFIG" = "xyes" ; then
AC_MSG_CHECKING([for gtk2.0 (for karma gui)])
if `pkg-config --exists gtk+-2.0` ; then
AC_MSG_RESULT(yes)
GTKLIBS=`pkg-config --libs gtk+-2.0`
GTKCFLAGS=`pkg-config --cflags gtk+-2.0`
AC_SUBST(GTKLIBS)
AC_SUBST(GTKCFLAGS)
BUILD_KARMA="1"
AC_SUBST(BUILD_KARMA)
else
AC_MSG_RESULT(no)
fi
fi
}
dnl optionally disable building the karma gui
dnl AC_ARG_ENABLE(karma,
dnl [ --disable-karma Disables optional gui. (Enabled by default)],
dnl [ if test "x$enableval" = "xyes" ; then
dnl test_for_karma
dnl fi
dnl ],
dnl [test_for_karma]
dnl )
AC_ARG_ENABLE(karma,
[ --enable-karma Enables optional gui. (Disabled by default)],
[ if test "x$enableval" = "xyes" ; then
test_for_karma
fi
])
dnl shared or static client library (see --enable-shared below)
AC_ARG_ENABLE(static,
[ --disable-static Do not build static client library],
[build_static=$enableval], [build_static=yes])
AC_SUBST(build_static)
dnl NOTE: removing the linux-gnu host check for now; we may want to put it back
dnl before releaseing any code, though... -Phil
dnl
dnl AC_MSG_CHECKING(whether we know how to compile for this OS)
dnl if test x$host_os != xlinux-gnu; then AC_MSG_ERROR($host_os not supported.)
dnl else AC_MSG_RESULT(yes)
dnl fi
dnl some redhat 2.4 kernels have a lot of 2.6 features, so we need to take
dnl special measures to accomodate those hacked kernels. However, we do not
dnl need to take these workarounds if someone is building a stock kernel.org
dnl kernel.
dnl was the configure option passed in?
set_redhat24=0
dnl what was the configure option set to?
use_redhat24=0
AC_ARG_ENABLE([redhat24],
[ --enable-redhat24 Enables workaround for RedHat 2.4 kernel],
set_redhat24=1
if test "$enableval" = no ; then
use_redhat24=0
else
use_redhat24=1
fi
)
dnl some systems (ie, RedHat EL 3 prior to Update 2) have buggy NPTL/Pthread
dnl implementations. We accomodate this with a server stub script hack that
dnl attempts to disable NPTL and fall back to old fashioned Linux Threads.
dnl was the configure option passed in?
set_nptl_workaround=0
dnl what was the configure option set to?
use_nptl_workaround=0
AC_ARG_ENABLE([nptl-workaround],
[ --enable-nptl-workaround
Enables workaround for buggy NPTL/Pthread libraries],
set_nptl_workaround=1
if test "$enableval" = no ; then
use_nptl_workaround=0
else
use_nptl_workaround=1
fi
)
dnl We check for the following redhat tags, as they all have similarly
dnl modified 2.4.x kernels
dnl
RHTAG1="Red Hat Linux release 9"
RHTAG2="Red Hat Enterprise Linux WS release 3"
RHTAG3="Red Hat Enterprise Linux AS release 3"
RHTAG4="Red Hat Enterprise Linux ES release 3"
RHTAG5="Red Hat Linux Advanced Server release 2.1AS"
RHTAG6="Fedora Core release 1 (Yarrow)"
dnl we won't be able to catch all cases, but see if we can
dnl get the majority of platforms where we might need to work around
dnl backported features. Basically we give up if running on these redhat
dnl versions
REDHAT_RELEASE=""
if test -f /etc/redhat-release; then
AC_MSG_CHECKING(for tagged Redhat releases (must patch))
REDHAT_REL=`cat /etc/redhat-release`
if test "x`echo $REDHAT_REL | cut -b 1-23`" = "x$RHTAG1" ||
test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG2" ||
test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG3" ||
test "x`echo $REDHAT_REL | cut -b 1-37`" = "x$RHTAG4" ||
test "x`echo $REDHAT_REL | cut -b 1-43`" = "x$RHTAG5" ||
test "x`echo $REDHAT_REL | cut -b 1-30`" = "x$RHTAG6" ; then
AC_MSG_RESULT(yes)
if test "$set_redhat24" = 0 || test "$set_nptl_workaround" = 0 ; then
AC_MSG_ERROR([
You appear to be configuring PVFS2 on a RedHat distribution that
likely ships with a heavily modified kernel and c library. You must
specify two configure arguments to provide necessary information before
proceeding. First pick one of these two options:
=============================
--enable-redhat24 (if you are using a redhat provided 2.4 kernel)
--disable-redhat24 (if you are using a stock kernel.org kernel)
=============================
Also pick one of the next two options. You should probably enable the
workaround if you are using RedHat EL 3 prior to update 2. Otherwise it
is probably safer (and higher performance) to disable it:
=============================
--enable-nptl-workaround (to work around buggy glibc pthread library)
--disable-nptl-workaround (if you trust your glibc pthread library)
============================= ])
fi
else
AC_MSG_RESULT(no)
fi
fi
dnl some non-redhat kernels (like whitebox linux and centos) rebuild
dnl rhel and give the distribution a different name, so if the user sets
dnl "enable-redhat24", then use it no matter what /etc/redhat-release might say
if test "$use_redhat24" = 1 ; then
REDHAT_RELEASE="-DREDHAT_RELEASE_9"
fi
AC_SUBST(REDHAT_RELEASE)
if test "$use_nptl_workaround" = 1 ; then
NPTL_WORKAROUND="1"
fi
AC_SUBST(NPTL_WORKAROUND)
use_aio_thcb=1
AC_ARG_ENABLE([aio-threaded-callbacks],
[ --disable-aio-threaded-callbacks
**EXPERIMENTAL** Disable use of AIO
threaded callbacks],
if test "$enableval" = no ; then use_aio_thcb=0 ; fi)
dnl there used to be a big hairy test in here, back when glibc-2.3.0 and
dnl glibc-2.3.1 had buggy aio callbacks. That test was broken because it
dnl assumed just linux, and could not handle glibc-2.4.x (or newer). Rely on
dnl aio-threaded-callbacks, perhaps with a blacklist of distros that have the
dnl broken glibc.
MISC_TROVE_FLAGS=""
if test $use_aio_thcb = 1 ; then
MISC_TROVE_FLAGS="-D__PVFS2_TROVE_AIO_THREADED__"
fi
AC_SUBST(MISC_TROVE_FLAGS)
dnl Check for AIO's aiocb->__error_code field (linux has it, OS X doesn't)
AC_MSG_CHECKING([for __error_code field in aiocb struct])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <aio.h>
]], [[
struct aiocb aiocb;
aiocb.__error_code = 0;
]])],[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AIOCB_ERROR_CODE, 1, Define if aiocb->__error_code exists)
],[AC_MSG_RESULT(no)
])
dnl Check for AIO's aiocb->__return_value field (linux has it, OS X doesn't)
AC_MSG_CHECKING([for __return_value field in aiocb struct])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <aio.h>
]], [[
struct aiocb aiocb;
aiocb.__return_value = 0;
]])],[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AIOCB_RETURN_VALUE, 1, Define if aiocb->__return_value exists)
],[AC_MSG_RESULT(no)
])
dnl Check for updated selinux so it won't break usrint
AC_MSG_CHECKING([for const security_context_t in setfilecon])
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <selinux/selinux.h>
int setfilecon(const char *path, const char *con)
{
return 0;
}
]], [[
const char *sc_t = NULL;
setfilecon("somepath", sc_t);
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONST_SECURITY_CONTEXT, 1, Define if setfilecon uses a const security_context_t)
],[AC_MSG_RESULT(no)
])
CFLAGS="$old_cflags"
dnl Check byte ordering
AC_C_BIGENDIAN
dnl Check size of pointer type; needed by id-generator
AC_CHECK_SIZEOF(void *)
dnl Options for debugging
dnl This particular one enables tracing of memory allocation and
dnl freeing with the mtrace tool
AC_ARG_WITH(mtrace,
[ --with-mtrace Use mtrace (must set MALLOC_TRACE to output file)],
CFLAGS="$CFLAGS -include mcheck.h"
AC_DEFINE(WITH_MTRACE, 1, Define if mtrace memory leak detection was enabled)
)
TAU_INCS=
BUILD_TAU=
dnl use the tau trace library
AC_ARG_WITH(tau,
[ --with-tau=path Use TAU trace library installed in "path"],
if test "x$withval" = "xyes" ; then
AC_MSG_ERROR(--with-tau must be given a pathname)
else
TAU_INCS="-I$withval/include"
CFLAGS="$CFLAGS $TAU_INCS -D__PVFS2_ENABLE_EVENT__"
LDFLAGS="$LDFLAGS -L$withval/$(uname -m)/lib"
tau_mkfile=$withval/$(uname -m)/lib/Makefile.*-profile-trace
if test ! -f $tau_mkfile; then
AC_MSG_ERROR(TAU not compiled with profiling and tracing support)
fi
tau_config=$(echo $tau_mkfile | sed -e "s|.*Makefile.tau-||")
LIBS="$LIBS -lTAU_tf -lTAU_traceinput-$tau_config -ltau-$tau_config -lpthread -lstdc++"
AC_DEFINE(HAVE_TAU, 1, [Define if TAU library is used])
BUILD_TAU=1
fi
)
AC_SUBST(TAU_INCS)
AC_SUBST(BUILD_TAU)
BUILD_KERNEL=
dnl
dnl Enables the kernel module to build if the appropriate
dnl linux-2.6.x path is specified
dnl Make sure this is a usable kernel source tree too.
dnl version.h moved with kernel 3.7, so check for it in the
dnl new place too.
dnl
AC_ARG_WITH(kernel,
[ --with-kernel=srcpath Build pvfs2 kernel module against 2.6.x src],
if test "x$withval" = "xyes" -o "x$withval" = "x" ; then
AC_MSG_ERROR(--with-kernel must be given the path to your kernel source.)
fi
if ! test -d $withval ; then
AC_MSG_ERROR(The --with-kernel path $withval is not a directory.)
fi
if ! test -r $withval/include/linux/version.h && ! test -r $withval/include/generated/uapi/linux/version.h; then
AC_MSG_ERROR(The kernel source tree must not have been configured.)
fi
if test -r $withval/include/linux/version.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/linux/version.h ; then
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/version.h`
elif test -r $withval/include/linux/utsrelease.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/linux/utsrelease.h; then
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/utsrelease.h`
elif test -r $withval/include/generated/utsrelease.h && grep -q UTS_RELEASE..2\\.6\\. $withval/include/generated/utsrelease.h; then
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/generated/utsrelease.h`
elif test -r $withval/include/generated/utsrelease.h && grep -qE UTS_RELEASE..3\\. $withval/include/generated/utsrelease.h; then
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/generated/utsrelease.h`
elif test -r $withval/include/generated/utsrelease.h && grep -qE UTS_RELEASE..4\\. $withval/include/generated/utsrelease.h; then
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/generated/utsrelease.h`
else
AC_MSG_ERROR(The kernel source tree does not appear to be 2.6 or 3.X or 4.X)
fi
# At least up through 2.6.3 needed to write .__modpost.cmd; this changed
# sometime between then and 2.6.10. Now anybody can compile out-of-tree
# modules against a configured kernel tree
LINUX_KERNEL_SRC="$withval"
BUILD_KERNEL=1
, LINUX_KERNEL_SRC=""
)
dnl
dnl Enables the kernel module to build if the appropriate
dnl linux-2.4.x path is specified
dnl Make sure this is a usable kernel source tree too.
dnl
AC_ARG_WITH(kernel24,
[ --with-kernel24=srcpath Build pvfs2 kernel module against 2.4.x src],
if test "x$withval" = "xyes" -o "x$withval" = "x" ; then
AC_MSG_ERROR(--with-kernel24 must be given the path to your kernel 2.4.x source.)
fi
if ! test -d $withval ; then
AC_MSG_ERROR(The --with-kernel path $withval is not a directory.)
fi
if ! test -r $withval/include/linux/version.h ; then
AC_MSG_ERROR(The kernel source tree must have been configured.)
fi
vers=`sed -n '/UTS_RELEASE/{; s/.*"\([0-9]\.[0-9]\).*".*/\1/; p; }' $withval/include/linux/version.h`
if ! grep -q UTS_RELEASE..2\\.4\\. $withval/include/linux/version.h ; then
AC_MSG_ERROR(The kernel source tree does not appear to be 2.4)
fi
k24_minor_ver=`echo $vers | cut -b 26- | sed -n 's/\"//p' | head -n 1`
tmp_k24_minor_ver=`echo $k24_minor_ver | grep \-`
if ! test "x$tmp_k24_minor_ver" = "x"; then
tmp_k24_minor_ver=`echo $k24_minor_ver | cut -d- -f1`
k24_minor_ver=$tmp_k24_minor_ver
fi
LINUX24_KERNEL_SRC="$withval" LINUX24_KERNEL_MINOR_VER="`echo $k24_minor_ver| cut -d'.' -f 1`"
BUILD_KERNEL=1
, LINUX24_KERNEL_SRC="" LINUX24_KERNEL_MINOR_VER="")
AC_SUBST(BUILD_KERNEL)
dnl now that we have the path to kernel source we can feature-test kernels.
oldcflags=$CFLAGS
if test -z "${LINUX_KERNEL_SRC}" ; then
lk_src=${LINUX24_KERNEL_SRC}
elif test -z "${LINUX24_KERNEL_SRC}" ; then
lk_src=${LINUX_KERNEL_SRC}
fi
dnl some kernels (SLES9 2.6.5-7.191, for one) will pass the test for ki_dtor
dnl but the resulting pvfs2.ko module will be built with internal
dnl symbols (mmgrab and flush_icache_range).
dnl
dnl if option not given, carry out the test. Only certain kernels (like SLES
dnl 9) will need --disable-kernel-aio
AC_ARG_ENABLE(kernel-aio,
[ --disable-kernel-aio Forcibly disable kernel aio],
[ enable_kernel_aio=$enableval ],
[ enable_kernel_aio=yes ]
)
AC_ARG_ENABLE(kernel-sendfile,
[ --enable-kernel-sendfile
**EXPERIMENTAL** Forcibly enables kernel sendfile],
[ enable_kernel_sendfile=$enableval ],
[ enable_kernel_sendfile=no ]
)
if test -n "$lk_src" ; then
AX_KERNEL_FEATURES
AC_DEFINE(WITH_LINUX_KMOD, 1, [Define to build for linux kernel module userspace helper.])
fi
dnl
dnl Enabling this option links pvfs2-client-core against libpvfs2-threaded.so.
dnl Note that even without this option, pvfs2-client-core always requires
dnl pthreads to run its remount thread.
dnl
AC_ARG_ENABLE([threaded-kmod-helper],
[ --enable-threaded-kmod-helper
**EXPERIMENTAL** Use threads in the kernel
helper application],
[ if test "x$enableval" = "xyes" ; then
THREADED_KMOD_HELPER=yes
fi
])
AC_SUBST(THREADED_KMOD_HELPER)
dnl PAV configuration needs absolute location of source and build.
dnl Linux-2.6 module needs absolute location of source, and uses the
dnl relative location for soft links for out-of-tree builds.
BUILD_ABSOLUTE_TOP=`pwd`
SRC_RELATIVE_TOP=`echo $0 | sed -e "s|configure$||"`
SRC_ABSOLUTE_TOP=`cd $SRC_RELATIVE_TOP ; pwd`
AC_SUBST(LINUX_KERNEL_SRC)
AC_SUBST(LINUX24_KERNEL_SRC)
AC_SUBST(LINUX24_KERNEL_MINOR_VER)
AC_SUBST(BUILD_ABSOLUTE_TOP)
AC_SUBST(SRC_RELATIVE_TOP)
AC_SUBST(SRC_ABSOLUTE_TOP)
dnl Optimized code, but never override CFLAGS from command line or environment.
AC_ARG_ENABLE(fast,
[ --enable-fast Disables optional debugging, enables optimization],
[
if test "x$USR_CFLAGS_SET" = "xno"; then
CFLAGS="$CFLAGS -DNDEBUG -O3 -DGOSSIP_DISABLE_DEBUG"
fi
])
dnl Disable compiler optimization
AC_ARG_ENABLE(opt,
[ --disable-opt Disables compiler optimization],
[if test "x$enableval" = "xyes" ; then
CC_OPT=-O2
else
CC_OPT=-O0
fi],
CC_OPT=-O2)
AC_SUBST(CC_OPT)
dnl
dnl a function to check for FUSE
dnl
test_for_fuse()
{
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
if test "x$HAVE_PKGCONFIG" = "xyes" ; then
AC_MSG_CHECKING([for FUSE library])
if `pkg-config --exists fuse` ; then
AC_MSG_RESULT(yes)
FUSE_LDFLAGS=`pkg-config --libs fuse`
FUSE_CFLAGS=`pkg-config --cflags fuse`
AC_SUBST(FUSE_LDFLAGS)
AC_SUBST(FUSE_CFLAGS)
BUILD_FUSE="1"
AC_SUBST(BUILD_FUSE)
else
AC_MSG_ERROR([FUSE: FUSE library not found. Check LD_LIBRARY_PATH.])
fi
else
AC_MSG_ERROR(FUSE: pkg-config not available. Please install pkg-config.)
fi
}
dnl FUSE component
AC_ARG_ENABLE(fuse,
[ --enable-fuse **EXPERIMENTAL** Enables FUSE component],
[
if test "x$enableval" = "xyes" ; then
test_for_fuse
CFLAGS="$CFLAGS -D__PVFS2_ENABLE_FUSE__"
fi
],
)
# default CFLAGS is -g -O2, unless user set CFLAGS or asked for --enable-fast
if test "x$USR_CFLAGS_SET" = "xno" && test "x$enable_fast" != "xyes"; then
CFLAGS="$CFLAGS -g $CC_OPT"
fi
dnl Options that are not yet working
dnl --------------------------------
dnl AC_ARG_ENABLE(profiling,
dnl [ --enable-profiling Enables profiling (using gprof). *** not yet working ***],
dnl CFLAGS="$CFLAGS -pg -fprofile-arcs",
dnl )
dnl
dnl AC_ARG_ENABLE(coverage,
dnl [ --enable-coverage Enables coverage analysis (disables optimizations). *** not yet working ***],
dnl [ CFLAGS="$CFLAGS -g -pg -ftest-coverage -O0"
dnl ENABLE_COVERAGE=1 ],
dnl )
AC_SUBST(ENABLE_COVERAGE)
STRICT_CFLAGS=
AC_ARG_ENABLE(strict,
[ --enable-strict Turn on strict compiler warnings],
STRICT_CFLAGS=1)
AC_SUBST(STRICT_CFLAGS)
dnl Check if user actually wants to see all our build output (compiles, links, etc.).
AC_ARG_ENABLE(verbose-build,
[ --enable-verbose-build Enables full output during build process],
QUIET_COMPILE=0,
QUIET_COMPILE=1)
AC_SUBST(QUIET_COMPILE)
dnl
dnl a function to check for epoll capabilities
dnl
test_for_epoll()
{
AC_CHECK_HEADERS(sys/epoll.h)
AC_MSG_CHECKING(for epoll functions)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[
int fd;