-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1284 lines (1135 loc) · 38.2 KB
/
configure.in
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 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(include/pvfs2-types.h)
AC_PREREQ(2.59)
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=8
PVFS2_VERSION_SUB=2
#PVFS2_PRE=""
#PVFS2_VERSION_PRE="-pre1-$CONFIGURE_TIME"
PVFS2_VERSION=$PVFS2_VERSION_MAJOR.$PVFS2_VERSION_MINOR.$PVFS2_VERSION_SUB$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_SUBST(PVFS2_VERSION_MAJOR)
AC_SUBST(PVFS2_VERSION_MINOR)
AC_SUBST(PVFS2_VERSION_SUB)
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
AC_CONFIG_HEADER(pvfs2-config.h)
AC_CHECK_HEADER([pwd.h],
[AC_DEFINE(HAVE_GETPWUID, 1, Define if pwd.h exists)])
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_HEADERS([mntent.h, fstab.h])
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(attr/xattr.h)
AC_CHECK_HEADERS(sys/xattr.h)
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)
AC_CHECK_PROG(HAVE_FIND, find, yes, no)
AC_CHECK_PROG(HAVE_BISON, bison, yes, no)
AC_CHECK_PROG(HAVE_FLEX, flex, yes, no)
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
NEED_BERKELEY_DB=yes
else
BUILD_SERVER=""
fi],
BUILD_SERVER=1
NEED_BERKELEY_DB=yes)
AC_SUBST(BUILD_SERVER)
AC_ARG_WITH(openssl,
[ --with-openssl=<dir> Build with openssl (default=/usr)
--without-openssl Don't build with openssl.],
[AX_OPENSSL(${withval})],
[AX_OPENSSL_OPTIONAL])
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=""
NEED_BERKELEY_DB=no
AC_SUBST(BUILD_SERVER)
AC_SUBST(NEED_BERKELEY_DB)
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 mmap-readahead caching (for kernel interface)
MMAP_RA_CACHE=""
AC_ARG_ENABLE(mmap-racache,
[ --enable-mmap-racache **EXPERIMENTAL** Enables mmap-readahead in kernel
interface],
[if test "x$enableval" = "xyes" ; then
MMAP_RA_CACHE="-DUSE_MMAP_RA_CACHE"
fi]
,)
AC_SUBST(MMAP_RA_CACHE)
dnl See if the --enable-trusted-connections option was given to configure
AC_ARG_ENABLE(trusted-connections,
[ --enable-trusted-connections
**EXPERIMENTAL** Enable 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
AC_ARG_ENABLE(karma,
[ --disable-karma Disables optional gui. (Enabled by default)],
[ if test "x$enableval" = "xyes" ; then
test_for_karma
fi
],
[test_for_karma]
)
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 Enable 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
Enable 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_TRY_COMPILE(
[
#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_TRY_COMPILE(
[
#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 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)
)
dnl This particular one enables berkeley db to emit detected errors
AC_ARG_WITH(berkdb-debug,
[ --with-berkdb-debug Use berkeley db error reporting (if detected).],
AC_DEFINE(BERKDB_ERROR_REPORTING, 1, Define if berkeley db error reporting 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
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 ; 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\\.6\\. $withval/include/linux/version.h ; then
# 2.6.18 moves UTS_RELEASE into its own header
if ! grep -q UTS_RELEASE..2\\.6\\. $withval/include/linux/utsrelease.h ; then
AC_MSG_ERROR(The kernel source tree does not appear to be 2.6)
fi
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 enable 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 Disable optional debugging, enable optimizations.],
[
if test "x$USR_CFLAGS_SET" = "xno"; then
CFLAGS="$CFLAGS -DNDEBUG -O3 -DGOSSIP_DISABLE_DEBUG"
fi
])
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** Enable 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 -O2"
fi
dnl Options that are not yet working
dnl --------------------------------
dnl AC_ARG_ENABLE(profiling,
dnl [ --enable-profiling Enable profiling (using gprof). *** not yet working ***],
dnl CFLAGS="$CFLAGS -pg -fprofile-arcs",
dnl )
dnl
dnl AC_ARG_ENABLE(coverage,
dnl [ --enable-coverage Enable 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_TRY_LINK([#include <sys/epoll.h>], [
int fd;
fd = epoll_create(1);
close(fd);
],
AC_MSG_RESULT(yes)
BUILD_EPOLL=1
AC_SUBST(BUILD_EPOLL),
AC_MSG_RESULT(no)
)
}
dnl optionally enable use of epoll() on Linux instead of poll()
dnl optionally disable use of epoll() on Linux instead of poll()
AC_ARG_ENABLE(epoll,
[ --enable-epoll Enable use of epoll for TCP/IP polling
(epoll is enabled by default, this option
ensures no checking is done for x-compiling)
--disable-epoll Disable epoll, use poll instead],
[
if test "x$enableval" = "xyes"; then
BUILD_EPOLL=1
AC_SUBST(BUILD_EPOLL)
fi
],
[
test_for_epoll
])
dnl enables a hack to print back traces out of segfault signal handler
AC_ARG_ENABLE(segv-backtrace,
[ --disable-segv-backtrace
Disables back traces in segfault signal handler],,
AC_MSG_CHECKING(if segv backtrace capable)
AC_TRY_COMPILE([
#include <execinfo.h>
#define __USE_GNU
#include <ucontext.h>
#if !defined(REG_EIP) && !defined(REG_RIP)
choke me
#endif
], [],
AC_MSG_RESULT(yes)
PVFS2_SEGV_BACKTRACE=1,
AC_MSG_RESULT(no)
)
)
AC_SUBST(PVFS2_SEGV_BACKTRACE)
dnl shared or static client library
AC_ARG_ENABLE(shared,
[ --enable-shared Build shared client library],
[build_shared=$enableval], [build_shared=no])
AC_SUBST(build_shared)
dnl Bad things happen in the makefile if you happen to --disable-static
dnl but do not --enable-shared.
if test "x$build_shared" = "xno" -a "x$build_static" = "xno" ; then
AC_MSG_ERROR([Must do --enable-shared or --enable-static or both.])
fi
dnl See if CC is a GNU compiler. This may require a real test in future
dnl versions of autoconf. In 2.13 it is a side-effect of AC_PROG_CC. First
dnl check if it is an Intel compiler; those lie and claim to be gcc but are
dnl not argument compatible
INTELC=
GNUC=
AC_MSG_CHECKING(whether cc is an Intel compiler)
AC_TRY_COMPILE([
#ifndef __ICC
choke me
#endif
], [],
AC_MSG_RESULT(yes)
INTELC=1
,
AC_MSG_RESULT(no)
)
if test "x$INTELC" = "x" ; then
if test "x$GCC" = "xyes" ; then
GNUC=1
fi
fi
AC_SUBST(INTELC)
AC_SUBST(GNUC)
AC_ARG_WITH(efence,
[ --with-efence=<path> Use electric fence for malloc debugging.],
if test "x$withval" != "xyes" ; then
LDFLAGS="${LDFLAGS} -L$withval"
fi
AC_CHECK_LIB(efence,malloc)
)
dnl Use compiled-in valgrind annotations? Give the header path if
dnl is not in the usual location. It is common to install the header
dnl in a subdirectory, so look for that too. Leave the include path
dnl in CPPFLAGS if it is not a standard header.
AC_ARG_WITH(valgrind,
[ --with-valgrind[=<path>] Use valgrind annotations for debugging.], [
found=no
save_cppflags="$CPPFLAGS"
AC_MSG_CHECKING(for valgrind.h usability)
if test "x$withval" = xyes ; then
AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes)
if test x$found = xno ; then
CPPFLAGS="$CPPFLAGS -I/usr/include/valgrind"
AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
CPPFLAGS="$save_cppflags")
fi
else
for d in $withval $withval/include \
$withval/valgrind $withval/include/valgrind
do
CPPFLAGS="$CPPFLAGS -I$d"
AC_COMPILE_IFELSE([#include <valgrind.h>], found=yes,
CPPFLAGS="$save_cppflags")
if test x$found = xyes ; then
break
fi
done
fi
AC_MSG_RESULT($found)
if test x$found = xyes ; then
AC_DEFINE(HAVE_VALGRIND_H, 1, Define if include file valgrind.h exists)
fi
])
if test "x$NEED_BERKELEY_DB" = "xyes" ; then
dnl
dnl make sure that required db development package is installed
dnl and valid; path can be specified at configure time
dnl
AC_ARG_WITH(db,
[ --with-db=<dir> Location of installed DB package (default=/usr)],
[AX_BERKELEY_DB(${withval})],
[AX_BERKELEY_DB("")])
fi
dnl end of NEED_BERKELEY_DB section
if test "x$BUILD_SERVER" = "x1"; then
dnl check if -lrt is required
AX_CHECK_NEEDS_LIBRT
fi
case "$host_os" in
*darwin*)
AC_DEFINE([TARGET_OS_DARWIN], 1, Define if on darwin)
TARGET_OS_DARWIN=1
AC_SUBST(TARGET_OS_DARWIN)
;;
*linux*)
AC_DEFINE([TARGET_OS_LINUX], 1, Define if on linux)
TARGET_OS_LINUX=1
AC_SUBST(TARGET_OS_LINUX)
;;
esac
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(sys/socket.h)
dnl check for gethostbyname function
AC_MSG_CHECKING(for gethostbyname)
oldcflags="$CFLAGS"
CFLAGS="$USR_CFLAGS"
AC_TRY_COMPILE([
#include <netdb.h>
], [
gethostbyname("localhost");
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME, 1, Define if gethostbyname function exists),
AC_MSG_RESULT(no)
WARN_ABOUT_HOSTNAMES="yes")
AC_MSG_CHECKING(for gethostbyaddr)
AC_TRY_COMPILE([
#include <netdb.h>
], [
struct sockaddr_in peer;
gethostbyaddr((void *)&peer.sin_addr.s_addr, sizeof(struct in_addr), AF_INET);
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYADDR, 1, Define if gethostbyaddr function exists),
AC_MSG_RESULT(no) )
CFLAGS="$oldcflags"
dnl allow disabling TCP BMI method
BUILD_BMI_TCP=1
AC_ARG_WITH(bmi-tcp,
[ --without-bmi-tcp Disable BMI TCP method],
if test -z "$withval" -o "$withval" = yes ; then
:
elif test "$withval" = no ; then
BUILD_BMI_TCP=
else
AC_MSG_ERROR([Option --with-tcp requires yes/no argument.])
fi
)
AC_SUBST(BUILD_BMI_TCP)
dnl
dnl Configure bmi_gm, if --with-gm or a variant given.
dnl
AX_GM
dnl
dnl Configure bmi_mx, if --with-mx or a variant given.
dnl
AX_MX
dnl
dnl Configure bmi_ib, if --with-ib or a variant given.
dnl
AX_IB
dnl
dnl Configure bmi_portals, if --with-portals or a variant given.
dnl
AX_PORTALS
dnl
dnl check if fgetxattr takes extra arguments
AC_MSG_CHECKING([for fgetxattr extra arguments])
AC_TRY_COMPILE([
#include <sys/types.h>
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
],
[
fgetxattr(0, 0, 0, 0, 0, 0);
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FGETXATTR_EXTRA_ARGS, 1, Define if fgetxattr takes position and option arguments),
AC_MSG_RESULT(no)
)
dnl
dnl look for sysinfo header
AC_CHECK_HEADER(sys/sysinfo.h,
AC_DEFINE(HAVE_SYSINFO, 1, Define if sysinfo.h is present)
)
dnl for regular functions, add another AC_CHECK_FUNCS line
AC_CHECK_FUNCS(strnlen)
AC_CHECK_FUNCS(strtoull)
AC_CHECK_FUNCS(strstr)
AC_CHECK_FUNCS(fgetxattr)
AC_CHECK_FUNCS(fsetxattr)
dnl fgetxattr doesn't have a prototype on some systems
AC_MSG_CHECKING([for fgetxattr prototype])
AC_TRY_COMPILE([
#include <sys/types.h>
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
char * fgetxattr(char *foo);
], [],
AC_MSG_RESULT(no),
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FGETXATTR_PROTOTYPE, 1, Define if system provides fgtxattr prototype)
)
dnl
dnl check if fgetxattr takes extra arguments: old systems that do not have any
dnl sort of fgetxattr should fall back to our faked version.
AC_MSG_CHECKING([for fgetxattr extra arguments])
AC_TRY_COMPILE([
#include <sys/types.h>
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
#endif
],
[
#ifdef HAVE_FGETXATTR_PROTOTYPE
fgetxattr(0, 0, 0, 0, 0, 0);
#else
# error
#endif