-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.ac
1684 lines (1467 loc) · 45.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 Process this file with autoconf to produce a configure script.
AC_INIT([gfarm],[2.8.5])
AC_CONFIG_SRCDIR(RELNOTES)
AC_CONFIG_AUX_DIR(makes)
AC_CONFIG_HEADERS([include/gfarm/gfarm_config.h])
AC_CONFIG_MACRO_DIR([m4])
# Determine target system
# This is called "host" on autotools, because its terminology is following:
# build system - system which is used to build a tool
# host system - system which is used to run a tool
# target system - system which is used to run a program generated by a tool
AC_CANONICAL_HOST
# $host_os_nickname is used to select startup RC scripts, etc.
# currently GNU/Hurd and Debian/kFreeBSD are treated as Linux, because they
# are using Debian way, but not really tested.
case $host_os in
gnu*) host_os_nickname=linux;; # "gnu" (GNU/Hurd)
kfreebsd-gnu*) host_os_nickname=linux;; # (Debian/kFreeBSD)
linux-gnu*) host_os_nickname=linux;; # (Linux)
netbsdelf*) host_os_nickname=netbsd;; # "netbsdelf4.0"
osf*) host_os_nickname=osf1;; # "osf5.1b"
*) host_os_nickname=`echo $host_os | sed -e 's/[[0-9.]]*$//'`;;
# "netbsd6.1.4" -> "netbsd"
esac
######
###### Checks for programs.
######
AC_PROG_CC(cc gcc) # search cc before gcc
if test x"$GCC" = x"yes"; then # CFLAGS='-g -O2'
CFLAGS="${CFLAGS} -Wall"
else # CFLAGS='-g'
CFLAGS="-O" # don't use -g, but use -O
fi
AC_OPENMP
# Check whether gcc accepts '-rdynamic' option
# This check is performed for backtrace_symbols() function of glibc.
dynamic_ldflags=
if test x"$GCC" = x"yes"; then
AC_MSG_CHECKING([whether gcc accepts -rdynamic])
LDFLAGS_SAVE="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])],[
AC_MSG_RESULT([yes])
dynamic_ldflags="-rdynamic"
],[
AC_MSG_RESULT([no])
])
LDFLAGS="$LDFLAGS_SAVE"
fi
AC_SUBST(dynamic_ldflags)
if mkdir -p . 2>/dev/null; then
MKDIR_P='mkdir -p'
else
test -d ./-p && rmdir ./-p
MKDIR_P='$(top_srcdir)/makes/mkdirhier'
fi
AC_SUBST(MKDIR_P)
AC_PROG_YACC
AC_PROG_INSTALL
LT_INIT
AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
######
###### parsing command line options
######
###
### --with-pthread=PTHREAD_ROOT, or --without-pthread
###
AC_MSG_CHECKING([pthread])
AC_ARG_WITH(pthread,
[ --with-pthread=PTHREAD_ROOT pthread root directory
[[default=/usr]]
--without-pthread disable pthread support],
[with_pthread="${withval}"
])
ax_cv_have_pthread=no
if test x"${with_pthread}" != x"no"; then
AC_DEFUN([AC_TRY_PTHREAD], [
CPPFLAGS_SAVE="$CPPFLAGS"
LIBS_SAVE="$LIBS"
CPPFLAGS="${pthread_includes} $1 $CPPFLAGS_SAVE"
# -R is not portable without libtool, and not necessary for AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[])
LIBS="`echo $2 | sed 's/-R[[^ ]]*//g'` $LIBS_SAVE"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
void *foo(void *p){ return 0; }]], [[
pthread_t thread_id;
pthread_create(&thread_id, NULL, foo, NULL);
]])],[ ax_cv_have_pthread=yes
pthread_includes="${pthread_includes} $1"
pthread_libs="${pthread_libs} $2"
],[
if test x"${pthread_specified}" = x"explicit"; then
AC_MSG_ERROR(["$3" is specified, but cannot be linked, aborted])
fi
])
CPPFLAGS="$CPPFLAGS_SAVE"
LIBS="$LIBS_SAVE"
])
# always define _REENTRANT
pthread_includes="-D_REENTRANT"
pthread_libs=
if expr x"${with_pthread}" : x"/.*" >/dev/null; then # pathname specified?
pthread_specified=explicit
case ${with_pthread} in
/usr)
AC_TRY_PTHREAD(,-lpthread,${with_pthread})
;;
*)
AC_TRY_PTHREAD(-I${with_pthread}/include,-R${with_pthread}/lib -L${with_pthread}/lib -lpthread,${with_pthread})
;;
esac
elif test x"${with_pthread}" != x && test x"${with_pthread}" != x"yes"; then
pthread_specified=explicit
AC_TRY_PTHREAD(${with_pthread},${with_pthread},${with_pthread})
elif test x"${PTHREAD_CFLAGS+1}${PTHREAD_LDFLAGS+2}${PTHREAD_LIBS+3}" != x""
then # NetBSD pkgsrc configuration is specified?
pthread_specified=explicit
AC_TRY_PTHREAD(${PTHREAD_CFLAGS},${PTHREAD_LDFLAGS} ${PTHREAD_LIBS},${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS})
else # otherwise try system supplied pthread library
pthread_specified=yes
case $host in
*-*-aix*)
AC_TRY_PTHREAD(-mthreads,-mthreads,);;
*-*-freebsd[[2-4]].*) # FreeBSD 2.X ... 4.X (-lc_r) needs -D_THREAD_SAFE
AC_TRY_PTHREAD(-D_THREAD_SAFE -pthread,-pthread,);;
*-*-hpux*)
AC_TRY_PTHREAD(-D_POSIX_C_SOURCE=199506L -D_HPUX_SOURCE,-lpthread,);;
*-*-solaris*)
# -D_POSIX_PTHREAD_SEMANTICS is for SUSv2 compliant getpwuid_r() etc.
if test x"$GCC" = x"yes"; then
AC_TRY_PTHREAD(-pthread -D_POSIX_PTHREAD_SEMANTICS,-pthread,)
else
AC_TRY_PTHREAD(-mt -D_POSIX_PTHREAD_SEMANTICS,-mt -lpthread,)
fi;;
*-*-sysv5uw7*) # UnixWare 7
if test x"$GCC" = x"yes"; then
AC_TRY_PTHREAD(-pthread,-pthread,)
else
AC_TRY_PTHREAD(-Kthread,-Kthread,)
fi;;
*)
# Tru64 (OSF1): -pthread
# FreeBSD 5.X: -pthread, 3 libraries are available as follows:
# -lpthread (M:N, default), -lc_r (1:N), and -lthr (1:1)
# NetBSD 2.X or later: -pthread
# Linux: -pthread
AC_TRY_PTHREAD(-pthread,-pthread,);;
esac
# and if it fails too, just try default ${CFLAGS}, ${LDFLAGS} and ${LIBS}
if test x"${ax_cv_have_pthread}" != x"yes"; then
AC_TRY_PTHREAD(,,)
fi
fi
fi
case ${ax_cv_have_pthread} in
yes)
AC_MSG_RESULT([using CFLAGS="${pthread_includes}" and LDLIBS="${pthread_libs}"])
AC_DEFINE(HAVE_PTHREAD, 1, [pthread library exists])
pthread_srcs='${PTHREAD_SRCS}'
pthread_objs='${PTHREAD_OBJS}'
pthread_cflags='${PTHREAD_CFLAGS}'
pthread_targets='${PTHREAD_TARGETS}'
;;
*)
if test x"${with_pthread}" = x"no"; then
AC_MSG_RESULT([disabled])
else
# in this case, must be: test x"${pthread_specified}" != x"explicit"
AC_MSG_RESULT([no])
fi
pthread_includes=
pthread_libs=
pthread_srcs=
pthread_objs=
pthread_cflags=
pthread_targets=
;;
esac
AC_SUBST(pthread_includes)
AC_SUBST(pthread_libs)
# for conditional compilation which depends on pthread
AC_SUBST(pthread_srcs)
AC_SUBST(pthread_objs)
AC_SUBST(pthread_cflags)
AC_SUBST(pthread_targets)
###
### --with-openssl=OpenSSL_PKG
###
# sanity check for OpenSSL is deferred, because ${openssl_includes}
# and ${openssl_lib} may be overrided by Globus autoconfiguration.
AC_ARG_WITH(openssl,
[ --with-openssl=OpenSSL_PKG openssl package name
[[default=openssl]]],
[with_openssl="${withval}"
],
[with_openssl=openssl
])
PKG_CHECK_MODULES(openssl, ${with_openssl}, [
AC_MSG_RESULT([using "${with_openssl}"])
openssl_libs=$openssl_LIBS
openssl_includes=$openssl_CFLAGS
openssl_pkg=$with_openssl
], [
AC_MSG_RESULT([try using OpenSSL in default path])
# if "pkg-config --cflags --libs openssl" does not work, try default
openssl_libs='-lssl -lcrypto'
openssl_includes=
openssl_pkg=
])
AC_SUBST(openssl_includes)
AC_SUBST(openssl_libs)
AC_SUBST(openssl_pkg)
###
### common part for kerberos and globus (i.e. gssapi)
###
gss_srcs=
gss_objs=
gss_cflags=
gss_targets=
AC_SUBST(gss_srcs)
AC_SUBST(gss_objs)
AC_SUBST(gss_cflags)
AC_SUBST(gss_targets)
###
### --disable-kerberos
###
AC_ARG_ENABLE(kerberos,
AS_HELP_STRING([--disable-kerberos],[disable Kerberos authentication [default=enable]]), [], [])
if test x"${enable_kerberos}" != x"no"; then
AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context)
AC_MSG_CHECKING(Kerberos library available)
if test x"${ac_cv_lib_gssapi_krb5_gss_init_sec_context}" = x"yes"; then
AC_MSG_RESULT([yes])
enable_kerberos=yes
else
AC_MSG_RESULT([no])
if test "x${enable_kerberos}" = "xyes"; then
AC_MSG_ERROR([cannot enable Kerberos support.])
exit 1
fi
enable_kerberos=no
fi
fi
if test x"${enable_kerberos}" = x"yes"; then
kerberos_includes= # assumes standard include path, for now
kerberos_gssapi_libs=-lgssapi_krb5
kerberos_srcs='${KERBEROS_SRCS}'
kerberos_objs='${KERBEROS_OBJS}'
kerberos_cflags='${KERBEROS_CFLAGS}'
kerberos_targets='${KERBEROS_TARGETS}'
AC_DEFINE(HAVE_KERBEROS, 1, [Kerberos exists])
gss_srcs='${GSS_SRCS}'
gss_objs='${GSS_OBJS}'
gss_cflags='${GSS_CFLAGS}'
gss_targets='${GSS_TARGETS}'
AC_DEFINE(HAVE_GSS, 1, [Generic Security Standard API exists])
else
kerberos_includes=
kerberos_gssapi_libs=
kerberos_srcs=
kerberos_objs=
kerberos_cflags=
kerberos_targets=
fi
AC_SUBST(kerberos_includes)
AC_SUBST(kerberos_gssapi_libs)
AC_SUBST(kerberos_srcs)
AC_SUBST(kerberos_objs)
AC_SUBST(kerberos_cflags)
AC_SUBST(kerberos_targets)
###
### --with-globus=GLOBUS_ROOT --with-globus-flavor=FLAVOR -with-globus-static
###
AC_ARG_WITH(globus_static,
[ --with-globus-static link static version of globus libraries instead of shared version
[[default=disable]]],
[globus_static="${withval}"
],
[globus_static=""
])
AC_ARG_WITH(globus_flavor,
[ --with-globus-flavor=FLAVOR globus flavor name
[[default=guessed]]],
[globus_flavor="${withval}"
],
[globus_flavor=
])
AC_SUBST(globus_flavor)
AC_ARG_WITH(globus_libdir,
[ --with-globus-libdir=DIR globus library directory
[[default=guessed]]],
[globus_libdir="${withval}"
],
[globus_libdir=
])
AC_MSG_CHECKING([globus])
AC_ARG_WITH(globus,
[ --with-globus=GLOBUS_ROOT globus root directory
[[default=disable]]],
[
globus_location="${withval}"
case "${globus_location}" in yes) globus_location=${GLOBUS_LOCATION};; esac
# try pkg-config first
try_pkgconfig=true
if test x"$globus_libdir" != x &&
test -f "$globus_libdir/pkgconfig/globus-gssapi-gsi.pc"
then
GLOBUS_PKG_CONFIG_ENV="env PKG_CONFIG_PATH=$globus_libdir/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
elif test x"$globus_location" = x; then
: # nothing to do
elif test -f "$globus_location/lib/pkgconfig/globus-gssapi-gsi.pc"; then
GLOBUS_PKG_CONFIG_ENV="env PKG_CONFIG_PATH=$globus_location/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
elif globus_pkg_config=`
find $globus_location -name globus-gssapi-gsi.pc -print | head -1`
test x"$globus_pkg_config" != x
then
GLOBUS_PKG_CONFIG_ENV="env PKG_CONFIG_PATH=`dirname $globus_pkg_config`${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
else
# if --with-globus=DIR is specified, but globus-gssapi-gsi.pc doesn't
# exist in the DIR, do not try "pkg-config globus-gssapi-gsi"
try_pkgconfig=false
fi
if $try_pkgconfig && $GLOBUS_PKG_CONFIG_ENV pkg-config globus-gssapi-gsi; then
case ${globus_static} in
yes) globus_static=--static;;
*) globus_static= ;;
esac
globus_gssapi_libs=`$GLOBUS_PKG_CONFIG_ENV pkg-config ${globus_static} --libs globus-gssapi-gsi`
globus_includes=`$GLOBUS_PKG_CONFIG_ENV pkg-config --cflags globus-gssapi-gsi`
AC_MSG_RESULT([found])
else
# Grid Packaging Tools (GPT)
GLBlocation_candidates=${globus_location:-/usr/grid}
if test -n "$globus_flavor"; then
GLBflavor_candidates="$globus_flavor"
else
GLBflavor_candidates=
if test x"$GCC" = x"yes"; then
tmp='gcc vendorcc'
else
tmp='vendorcc gcc'
fi
for GLBbits in 64 32; do
for GLBcc in $tmp; do
for GLBdebug in "" dbg; do
# gfmd requires thread-safe library
for GLBpthread in pthr; do
GLBflavor_candidates="$GLBflavor_candidates $GLBcc$GLBbits$GLBdebug$GLBpthread"
done
done
done
done
fi
globus_found=
for d in ${GLBlocation_candidates}; do
for f in ${GLBflavor_candidates}; do
if test -f "$d/include/$f/gssapi.h"; then
globus_location=$d
globus_flavor=$f
globus_found=yes
break
fi
done
if test x"$globus_found" = x"yes"; then break; fi
done
if test x"$globus_found" != x"yes"; then
AC_MSG_RESULT([not found])
AC_MSG_RESULT([searched directories are: ${GLBlocation_candidates}])
AC_MSG_RESULT([searched flavors are: ${GLBflavor_candidates}])
if test -n "$globus_flavor"; then
AC_MSG_ERROR([cannot find the globus flavor "$globus_flavor", missing include/$globus_flavor/gssapi.h under ${GLBlocation_candidates}.])
else
AC_MSG_ERROR([cannot automatically find include/\${GLOBUS_FLAVOR}/gssapi.h under ${GLBlocation_candidates}, please specify the flavor by --with-globus-flavor=GLOBUS_FLAVOR])
fi
exit 1
fi
f_pthr=`expr "$globus_flavor" : '.*\(pthr\)'`
if test x"$f_pthr" != xpthr; then
AC_MSG_RESULT([bad flavor "$globus_flavor"])
AC_MSG_ERROR([MT-safe flavor required])
exit 1
fi
AC_MSG_RESULT([found in "${globus_location}" with "${globus_flavor}" flavor])
globus_includes="-I${globus_location}/include/${globus_flavor}"
if test x"$globus_libdir" = x; then
globus_libdir="${globus_location}/lib"
fi
cfgmhtmp=/tmp/cfgmh$$
AC_MSG_CHECKING([globus library names])
if case ${globus_static} in
yes) env GLOBUS_LOCATION=${globus_location} ${globus_location}/bin/globus-makefile-header -static -flavor=${globus_flavor} globus_gssapi_gsi;;
*) env GLOBUS_LOCATION=${globus_location} ${globus_location}/bin/globus-makefile-header -flavor=${globus_flavor} globus_gssapi_gsi;;
esac > $cfgmhtmp
then
AC_MSG_RESULT([done])
else
rm -f $cfgmhtmp
AC_MSG_RESULT([failed to call ${globus_location}/bin/globus-makefile-header command.])
AC_MSG_RESULT([Please run \${GPT_LOCATION}/sbin/gpt-postinstall, if it is not invoked yet.])
AC_MSG_ERROR([Globus installation is incomplete, aborted.])
fi
globus_gssapi_libs=`sed -n '/^GLOBUS_PKG_LIBS *=/s///p' $cfgmhtmp`
rm -f $cfgmhtmp
case ${globus_static} in
yes) :;;
*) globus_gssapi_libs="-R${globus_libdir} -L${globus_libdir} $globus_gssapi_libs"
esac
# replace openssl library with that included in globus
if test -x ${globus_location}/bin/globus-version; then
globus_version=`env GLOBUS_LOCATION=${globus_location} ${globus_location}/bin/globus-version`
case ${globus_version} in
4.0*|3*|2*)
openssl_includes="${globus_includes}"
case ${globus_static} in
yes) openssl_libs="${globus_libdir}/libssl_${globus_flavor}.a ${globus_libdir}/libcrypto_${globus_flavor}.a"
AC_MSG_RESULT([using globus static library: yes]);;
*) openssl_libs="-R${globus_libdir} -L${globus_libdir} -lssl_${globus_flavor} -lcrypto_${globus_flavor}"
AC_MSG_RESULT([using globus static library: no]);;
esac;;
*) # after 4.2.0, globus does not include openssl libarary.
;;
esac
fi
fi # End of Grid Packaging Tools (GPT)
enable_globus=yes
],
[AC_MSG_RESULT([disabled])
enable_globus=no
globus_location=
globus_includes=
globus_gssapi_libs=
])
# for conditional compilation which depends on whether globus is enabled or not
if test x"${enable_globus}" = x"yes"; then
globus_srcs='${GLOBUS_SRCS}'
globus_objs='${GLOBUS_OBJS}'
globus_cflags='${GLOBUS_CFLAGS}'
globus_targets='${GLOBUS_TARGETS}'
AC_DEFINE(HAVE_GSI, 1, [Grid Security Infrastructure exists])
gss_srcs='${GSS_SRCS}'
gss_objs='${GSS_OBJS}'
gss_cflags='${GSS_CFLAGS}'
gss_targets='${GSS_TARGETS}'
AC_DEFINE(HAVE_GSS, 1, [Generic Security Standard API exists])
else
globus_srcs=
globus_objs=
globus_cflags=
globus_targets=
fi
AC_SUBST(globus_location)
AC_SUBST(globus_includes)
AC_SUBST(globus_gssapi_libs)
# for conditional compilation which depends on whether globus is enabled or not
AC_SUBST(globus_srcs)
AC_SUBST(globus_objs)
AC_SUBST(globus_cflags)
AC_SUBST(globus_targets)
###
### --disable-cyrus-sasl
###
AC_ARG_ENABLE(cyrus-sasl,
AS_HELP_STRING([--disable-cyrus-sasl],[disable Cyrus SASL [default=enable]]), [], [])
if test x"${enable_cyrus_sasl}" != x"no"; then
AC_CHECK_LIB(sasl2, sasl_client_init)
AC_MSG_CHECKING(Cyrus SASL library available)
if test x"${ac_cv_lib_sasl2_sasl_client_init}" = x"yes"; then
AC_MSG_RESULT([yes])
enable_cyrus_sasl=yes
else
AC_MSG_RESULT([no])
if test "x${enable_cyrus_sasl}" = "xyes"; then
AC_MSG_ERROR([cannot enable SASL support.])
exit 1
fi
enable_cyrus_sasl=no
fi
fi
if test x"${enable_cyrus_sasl}" = x"yes"; then
cyrus_sasl_includes= # assumes standard include path, for now
cyrus_sasl_libs=-lsasl2
cyrus_sasl_srcs='${CYRUS_SASL_SRCS}'
cyrus_sasl_objs='${CYRUS_SASL_OBJS}'
cyrus_sasl_cflags='${CYRUS_SASL_CFLAGS}'
cyrus_sasl_targets='${CYRUS_SASL_TARGETS}'
AC_DEFINE(HAVE_CYRUS_SASL, 1, [Cyrus SASL exists])
else
cyrus_sasl_includes=
cyrus_sasl_libs=
cyrus_sasl_srcs=
cyrus_sasl_objs=
cyrus_sasl_cflags=
cyrus_sasl_targets=
fi
AC_SUBST(cyrus_sasl_includes)
AC_SUBST(cyrus_sasl_libs)
AC_SUBST(cyrus_sasl_srcs)
AC_SUBST(cyrus_sasl_objs)
AC_SUBST(cyrus_sasl_cflags)
AC_SUBST(cyrus_sasl_targets)
###
### --without-mtsafe-netdb ... are getaddrinfo(3) and getnameinfo(3) MT-Safe?
###
AC_ARG_WITH(mtsafe_netdb,
[ --without-mtsafe-netdb getaddrinfo(3) and getnameinfo(3) are MT-Safe?
[[default=yes]]],
[mtsafe_netdb="${withval}"], [mtsafe_netdb="yes"])
case ${mtsafe_netdb} in
no) :;;
*) AC_DEFINE(HAVE_MTSAFE_NETDB, 1, [getaddrinfo(3) and getnameinfo(3) are MT-Safe]);;
esac
###
### --with-infiniband ...
###
AC_MSG_CHECKING([InfiniBand])
AC_ARG_WITH(infiniband,
[ --with-infiniband=InfiniBand_ROOT support InfiniBand RDMA between client and gfsd
[[default=/usr]]],
[ib_rdma="${withval}"
], [ib_rdma=no])
rdma_includes=
rdma_libs=
case ${ib_rdma} in
yes|'')
rdma_libs=" -libverbs"
rdma_include=
ib_rdma=yes
;;
/*)
rdma_libs=" -R ${ib_rdma}/lib -L ${ib_rdma}/lib -libverbs"
rdma_includes=" -I ${ib_rdma}/include"
ib_rdma=yes
;;
no)
ib_rdma=no
;;
*)
AC_MSG_ERROR([invalid option "${ib_rdma}" options, aborted])
;;
esac
if test ${ib_rdma} = no; then
AC_MSG_RESULT([no])
else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $rdma_includes"
LIBS_SAVE="$LIBS"
LIBS="$LIBS $rdma_libs"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <infiniband/verbs.h>]], [[
struct ibv_device **dev_list;
dev_list = ibv_get_device_list(NULL);
]])],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_INFINIBAND, 1, [support InfiniBand RDMA between client and gfsd])
],[
LIBS="$LIBS_SAVE"
AC_MSG_ERROR([InfiniBand cannot be linked with "${rdma_includes} ${rdma_libs}" options, aborted])
])
fi
AC_SUBST(rdma_includes)
AC_SUBST(rdma_libs)
######
###### Checks for libraries.
######
### check sanity of $CC, $CFLAGS and $CPPFLAGS
AC_CHECK_HEADERS(stdio.h)
if test x"${ac_cv_header_stdio_h}" != x"yes"; then
AC_MSG_RESULT([preprocessor option error on: "$ac_cpp"])
#exit 1
fi
### check sanity of $CC, $CFLAGS, $CPPFLAGS and $LDFLAGS setting
AC_CHECK_FUNCS(printf)
if test x"${ac_cv_func_printf}" != x"yes"; then
AC_MSG_RESULT([linker option error on: "$ac_link"])
exit 1
fi
# We need to add those libraries to $LIBS at first,
# otherwise some libraries (e.g. OpenLDAP and OpenSSL) cannot be linked.
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(nsl, gethostname) # SVR4 and derived
AC_CHECK_LIB(socket, socket) # SVR4 and derived
AC_CHECK_LIB(crypt, crypt) # 4.4BSD and derived
AC_CHECK_LIB(compat, cuserid) # NetBSD
AC_CHECK_LIB(gen, basename) # IRIX
AC_CHECK_LIB(rt, fdatasync) # Solaris
AC_CHECK_LIB(cext, seteuid) # HP-UX
AC_CHECK_LIB(perfstat, perfstat_cpu_total) # AIX, to implement getloadavg()
# have pthread_attr_setstacksize(3)?
case ${ax_cv_have_pthread} in
yes)
AC_MSG_CHECKING([for pthread_attr_setstacksize])
CPPFLAGS_SAVE="$CPPFLAGS"
LIBS_SAVE="$LIBS"
CPPFLAGS="${pthread_includes} $CPPFLAGS"
LIBS="$LIBS ${pthread_libs}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
# include <pthread.h>
void test(void){}]], [[
pthread_attr_t at;
if (pthread_attr_init(&at) == 0)
pthread_attr_setstacksize(&at, 64 * 1024);
]])],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE, 1, [pthread_attr_setstacksize() exists])
],[
AC_MSG_RESULT([no])
])
# Checks for library functions with pthread enabled
AC_CHECK_FUNCS(pthread_barrier_wait pthread_mutex_timedlock)
CPPFLAGS="$CPPFLAGS_SAVE"
LIBS="$LIBS_SAVE"
;;
esac
# Since gfarm-1.3, libgfarm calls pthread functions internally,
# thus, we need to link ${pthread_libs}, unless libc supplies weak symbols.
# e.g. using 3rd party pthread library, FreeBSD-4.x, or NetBSD-2.x
AC_MSG_CHECKING([whether libc supplies weak symbols for pthread])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
void init(void){}]], [[
pthread_once_t once;
pthread_once(&once, init);
]])],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no. WARNING: always link pthread])
LIBS="${LIBS} ${pthread_libs}"
])
AC_MSG_CHECKING([Linux sendfile])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/sendfile.h>]], [[sendfile(0, 0, 0, 0)]])],[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [support Linux sendfile])],[AC_MSG_RESULT([no])])
### use 64bit off_t, if possible.
AC_MSG_CHECKING([Large File extention for 64bit off_t])
if ( getconf LFS_CFLAGS &&
getconf LFS_LDFLAGS &&
getconf LFS_LIBS ) > /dev/null 2>&1; then
AC_MSG_RESULT([yes])
largefile_cflags="`getconf LFS_CFLAGS`"
largefile_ldflags="`getconf LFS_LDFLAGS`"
LIBS="$LIBS `getconf LFS_LIBS`"
if test x"$host_os" = x"linux-gnu"; then
# glibc requires _GNU_SOURCE for pwrite64(2)
largefile_cflags="${largefile_cflags} -D_GNU_SOURCE"
fi
else
AC_MSG_RESULT([no])
largefile_cflags=
largefile_ldflags=
fi
AC_SUBST(largefile_cflags)
AC_SUBST(largefile_ldflags)
### is _LARGEFILE64_SOURCE API supported? i.e. can be _LFS64_LARGEFILE=1?
AC_MSG_CHECKING([_LARGEFILE64_SOURCE API])
if ( getconf LFS64_CFLAGS &&
getconf LFS64_LDFLAGS &&
getconf LFS64_LIBS ) > /dev/null 2>&1; then
AC_MSG_RESULT([yes])
largefile64_srcs='${LARGEFILE64_SRCS}'
largefile64_objs='${LARGEFILE64_OBJS}'
largefile64_cflags='${LARGEFILE64_CFLAGS}'
largefile64_targets='${LARGEFILE64_TARGETS}'
else
AC_MSG_RESULT([no])
largefile64_srcs=
largefile64_objs=
largefile64_cflags=
largefile64_targets=
fi
# for conditional compilation which depends on _LARGEFILE64_SOURCE API
AC_SUBST(largefile64_srcs)
AC_SUBST(largefile64_objs)
AC_SUBST(largefile64_cflags)
AC_SUBST(largefile64_targets)
### sanity check whether OpenSSL is really usable or not
### only OpenSSL-0.9.7 or later is supported since Gfarm-2.6.15
AC_MSG_CHECKING([openssl])
CPPFLAGS_SAVE="$CPPFLAGS"
LIBS_SAVE="$LIBS"
CPPFLAGS="${openssl_includes} $CPPFLAGS_SAVE"
# -R is not portable without libtool, and not necessary for AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[])
LIBS="`echo ${openssl_libs} | sed 's/-R[[^ ]]*//g'` $LIBS_SAVE"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <openssl/evp.h>]], [[
EVP_MD_CTX *md_ctx = EVP_MD_CTX_create();
EVP_MD *md_type = EVP_get_digestbyname("sha1");
EVP_DigestInit_ex(md_ctx, md_type, NULL);
]])],[],[
AC_MSG_ERROR([OpenSSL cannot be linked with "${openssl_includes} ${openssl_libs}" options, aborted])
])
AC_MSG_RESULT([using "${openssl_includes} ${openssl_libs}"])
# these functions disappeared since OpenSSL-1.1.0
AC_CHECK_FUNCS(CRYPTO_set_locking_callback CRYPTO_set_id_callback)
# new function since OpenSSL-3.0
AC_CHECK_FUNCS(ERR_get_error_all)
CPPFLAGS="$CPPFLAGS_SAVE"
LIBS="$LIBS_SAVE"
###
### --with-openldap=OpenLDAP_ROOT
###
# This command line option must be handled here,
# because this needs AC_CHECK_LIB(nsl, ...)
AC_MSG_CHECKING([openldap])
AC_ARG_WITH(openldap,
[ --with-openldap=OpenLDAP_ROOT openldap root directory
[[default=guessed]]
--without-openldap disable openldap],
[with_openldap="${withval}"
],
[with_openldap=
])
ldap_specified=
case ${with_openldap} in
/*)
if test -f "${with_openldap}"/include/ldap.h; then
ldap_specified=explicit
else
AC_MSG_ERROR([not found in "${with_openldap}", aborted])
fi;;
yes|'')
for d in /usr/local/openldap /usr/local /usr/pkg /usr
do
if test -f $d/include/ldap.h; then
with_openldap=$d
ldap_specified=yes
break
fi
done;;
no)
;;
*)
ldap_specified=explicit;;
esac
ldap_usable=
if test x"${ldap_specified}" = x""; then
AC_MSG_RESULT([no])
else
AC_DEFUN([AC_TRY_LDAP], [
CPPFLAGS_SAVE="$CPPFLAGS"
LIBS_SAVE="$LIBS"
CPPFLAGS="$1 $CPPFLAGS_SAVE"
# -R is not portable without libtool, and not necessary for AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[])
LIBS="`echo $2 | sed 's/-R[[^ ]]*//g'` $3 $4 ${openssl_libs} $LIBS_SAVE"
# OpenLDAP may need OpenSSL due to its SSL/TLS support.
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <lber.h>
#include <ldap.h>]], [[
LDAP *ldap_server = ldap_open("example.com", 389);
]])],[
if test x"$4" != x""; then
AC_MSG_RESULT([using "$1 $2 $3" with "$4" for LDAP])
ldap_libs="$2 $3 $4"
else
AC_MSG_RESULT([using "$1 $2 $3" for LDAP])
ldap_libs="$2 $3"
fi
ldap_usable=yes
# this needs to be checked here due to settings of $CPPFLAGS and $LIBS
AC_CHECK_FUNCS(ldap_memfree ldap_set_option ldap_start_tls_s ldap_perror)
],[])
CPPFLAGS="$CPPFLAGS_SAVE"
LIBS="$LIBS_SAVE"
])
case ${with_openldap} in
/*) case ${with_openldap} in
/usr) ldap_includes=
ldap_libs=;;
*) ldap_includes="-I${with_openldap}/include"
ldap_libs="-R${with_openldap}/lib -L${with_openldap}/lib";;
esac
# OpenLDAP since 2.x calls res_query() and dn_expand(), if dnssrv is
# configured, and DNS resolver library doesn't belongs to libc on some
# systems.
# But we cannot blindly link libresolv, because it may change behaviour
# of gethostbyname() and friends.
for libs in "-lldap -llber" "-lldap"; do
for extra_lib in "" "-lresolv" "-lbind"; do
AC_TRY_LDAP(${ldap_includes},${ldap_libs},${libs},${extra_lib})
if test x"${ldap_usable}" = x"yes"; then
break 2
fi
done
done
;;
*) ldap_includes=${with_openldap}
ldap_libs=${with_openldap}
AC_TRY_LDAP(${ldap_includes},${ldap_libs},,)
;;
esac
if test x"${ldap_usable}" != x"yes"; then
case $ldap_specified in
explicit)
AC_MSG_ERROR(["${with_openldap}" is specified, but cannot be linked, aborted]);;
yes)
AC_MSG_RESULT([found in "${with_openldap}", but cannot be linked, ignored]);;
esac
fi
fi
case $ldap_usable in
yes) AC_DEFINE(HAVE_LDAP, 1, [LDAP library exists])
ldap_srcs='${LDAP_SRCS}'
ldap_objs='${LDAP_OBJS}'
ldap_cflags='${LDAP_CFLAGS}'
ldap_targets='${LDAP_TARGETS}'
;;
*) ldap_includes=
ldap_libs=
ldap_srcs=
ldap_objs=
ldap_cflags=
ldap_targets=
;;
esac
AC_SUBST(ldap_includes)
AC_SUBST(ldap_libs)
# for conditional compilation which depends on LDAP
AC_SUBST(ldap_srcs)
AC_SUBST(ldap_objs)
AC_SUBST(ldap_cflags)
AC_SUBST(ldap_targets)
###
### --with-postgresql=PostgreSQL_ROOT
###
AC_MSG_CHECKING([PostgreSQL])
AC_ARG_WITH(postgresql,
[ --with-postgresql=PostgreSQL_ROOT PostgreSQL root directory
[[default=guessed]]
--without-postgresql disable PostgreSQL],
[with_postgresql="${withval}"
],
[with_postgresql=
])
postgresql_specified=
case ${with_postgresql} in
/*)
if test -f "${with_postgresql}"/bin/pg_config; then
postgresql_specified=explicit
else
AC_MSG_ERROR([not found in "${with_postgresql}", aborted])
fi;;
yes|'')
for d in /usr/local/pgsql /usr/local /usr/pkg /usr
do
if test -f $d/bin/pg_config; then
with_postgresql=$d
postgresql_specified=yes
break
fi
done;;
no)
;;
*)
postgresql_specified=explicit;;
esac
postgresql_usable=
if test x"${postgresql_specified}" = x""; then
AC_MSG_RESULT([no])
else
if test -x ${with_postgresql}/bin/pg_config; then
if ${with_postgresql}/bin/pg_config --version > /dev/null 2>&1; then
:
else
AC_MSG_RESULT([failed to call ${with_postgresql}/bin/pg_config command.])
AC_MSG_ERROR([PostgreSQL installation is incomplete, aborted.])
fi
postgresql_include_dir=`${with_postgresql}/bin/pg_config --includedir`
postgresql_lib_dir=`${with_postgresql}/bin/pg_config --libdir`
case ${postgresql_include_dir} in
/usr/include) postgresql_includes= ;;
*) postgresql_includes="-I${postgresql_include_dir}" ;;
esac
case ${postgresql_lib_dir} in