-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfigure.in
2236 lines (1901 loc) · 65.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 autoconf for heartbeat
dnl Started by David Lee <[email protected]> December 2000
dnl automake stuff
dnl added by Michael Moerz <[email protected]> February 2001
dnl
dnl License: GNU General Public License (GPL)
dnl ===============================================
dnl Bootstrap
dnl ===============================================
dnl Initialiase, with sanity check of a unique file in the hierarchy
AC_INIT(README.in)
AC_PREREQ(2.53)
PKG_FEATURES=""
AC_CONFIG_AUX_DIR(.)
AC_CANONICAL_HOST
dnl Where #defines go (e.g. `AC_CHECK_HEADERS' below)
dnl
dnl Internal header: include/config.h
dnl - Contains ALL defines
dnl - include/config.h.in is generated automatically by autoheader
dnl - NOT to be included in any header files except lha_internal.h
dnl (which is also not to be included in any other header files)
dnl
dnl External header: include/mgmt_config.h
dnl - Contains a subset of defines checked here
dnl - Manually edit include/mgmt_config.h.in to have configure include
dnl new defines
dnl - Should not include HAVE_* defines
dnl - Safe to include anywhere
AM_CONFIG_HEADER(include/config.h include/mgmt_config.h)
ALL_LINGUAS="en fr"
AC_ARG_WITH(hapkgversion,
[ --with-hapkgversion=name Override package version (if you're a packager needing to pretend) ],
[ HAPKGVERSION="$withval" ],
[ HAPKGVERSION="" ],
)
if test -z "$HAPKGVERSION" ; then
HAPKGVERSION="2.0"
fi
HB_PKG=heartbeat
PKG_NAME=pacemaker-mgmt
AM_INIT_AUTOMAKE($PKG_NAME, $HAPKGVERSION)
dnl i18n
GETTEXT_PACKAGE="haclient"
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
#IT_PROG_INTLTOOL([0.40.5], [no-xml])
AC_PROG_INTLTOOL(0.35.2)
AM_PO_SUBDIRS
# Set DATADIRNAME correctly if it is not set yet
# (copied from glib-gettext.m4)
if test -z "$DATADIRNAME"; then
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],
[[extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr]])],
[DATADIRNAME=share],
[case $host in
*-*-solaris*)
dnl On Solaris, if bind_textdomain_codeset is in libc,
dnl GNU format message catalog is always supported,
dnl since both are added to the libc all together.
dnl Hence, we'd like to go with DATADIRNAME=share
dnl in this case.
AC_CHECK_FUNC(bind_textdomain_codeset,
[DATADIRNAME=share], [DATADIRNAME=lib])
;;
*)
[DATADIRNAME=lib]
;;
esac])
fi
AC_SUBST(DATADIRNAME)
dnl ===============================================
dnl Helpers
dnl ===============================================
MISSINGTHINGS=""
MISSINGOPTIONALS=""
FatalMissingThing() {
if test X"$MISSINGTHINGS" = X; then
MISSINGTHINGS="$MISSINGTHINGS $1"
else
MISSINGTHINGS="$MISSINGTHINGS, $1"
fi
shift
AC_MSG_RESULT(configure: ERROR: $1 ====================)
shift
for j in "$@"
do
if test "X$j" != X-; then
AC_MSG_RESULT(configure: $j ==)
fi
done
}
WarnMissingThing() {
if test X"$MISSINGOPTIONALS" = X; then
MISSINGOPTIONALS="$MISSINGOPTIONALS $1"
else
MISSINGOPTIONALS="$MISSINGOPTIONALS, $1"
fi
shift
AC_MSG_RESULT(configure: WARNING: $1 ====================)
shift
for j in "$@"
do
if test "X$j" != X-; then
AC_MSG_RESULT(configure: $j ==)
fi
done
}
CheckMissingThings() {
if
test "X$MISSINGOPTIONALS" != "X"
then
AC_MSG_WARN(The following recommended components noted earlier are missing:
$MISSINGOPTIONALS
We will continue but you may have lost some non-critical functionality.)
fi
if
test "X$MISSINGTHINGS" != "X"
then
AC_MSG_ERROR(The following required components noted earlier are missing:
$MISSINGTHINGS
Please supply them and try again.)
fi
}
extract_header_define() {
AC_MSG_CHECKING(for $2 in $1)
Cfile=/tmp/extract_define.$2.${$}
printf "#include <stdio.h>\n" > ${Cfile}.c
printf "#include <%s>\n" $1 >> ${Cfile}.c
printf "int main(int argc, char **argv) { printf(\"%%s\", %s); return 0; }\n" $2 >> ${Cfile}.c
$CC $CFLAGS ${Cfile}.c -o ${Cfile}
value=`${Cfile}`
AC_MSG_RESULT($value)
printf $value
rm -f ${Cfile}.c ${Cfile}
}
dnl ===============================================
dnl Configure Options
dnl ===============================================
dnl Some systems, like Solaris require a custom package name
AC_ARG_WITH(pkgname,
[ --with-pkgname=name name for pkg (typically for Solaris) ],
[ PKGNAME="$withval" ],
[ PKGNAME="LXHAhb" ],
)
AC_SUBST(PKGNAME)
AC_ARG_ENABLE([all],
[ --enable-all Activate ALL features [default=no]])
AC_ARG_ENABLE([ansi],
[ --enable-ansi force GCC to compile to ANSI/ANSI standard for older compilers.
[default=yes]])
AC_ARG_ENABLE([fatal-warnings],
[ --enable-fatal-warnings very pedantic and fatal warnings for gcc
[default=yes]], [], [enable_fatal_warnings=unknown])
AC_ARG_ENABLE([no-long-long],
[ --enable-no-long-long removes no long long warning for gcc
[default=yes]], [], [enable_no_long_long=yes])
AC_ARG_ENABLE([traditional-warnings],
[ --enable-traditional-warnings
enable traditional warnings gcc (-Wtraditional)
[default=no]])
AC_ARG_ENABLE([quiet],
[ --enable-quiet
Supress make output unless there is an error
[default=no]])
AC_ARG_ENABLE([thread-safe],
[ --enable-thread-safe Enable some client libraries to be thread safe.
[default=no]])
AC_ARG_ENABLE([mgmt-client],
[ --enable-mgmt-client Enable building of mgmt-client related functionality.
[default=yes]], [], [enable_mgmt_client=yes])
AC_ARG_ENABLE([snmp],
[ --enable-snmp Enable building of SNMP related functionality.
[default=yes]])
AC_ARG_ENABLE([snmp-subagent],
[ --enable-snmp-subagent Enable building of our SNMP subagent (lots of dependencies).
[default=try]])
AC_ARG_ENABLE([bundled-ltdl],
[ --enable-bundled-ltdl Configure, build and install the standalone ltdl library bundled with ${PKG_NAME} [default=no]])
LTDL_LIBS=""
AC_ARG_ENABLE([cim-provider],
[ --enable-cim-provider Enable CIM providers.
[default=no]])
AC_ARG_WITH([cimom],
[ --with-cimom Specify CIM server], [], [])
AC_ARG_WITH([cmpiheader],
[ --with-cmpi-headers Specify CMPI header files], [], [])
AC_ARG_WITH([cmpiprovider],
[ --with-provider-dir Specify CMPI providers directory], [], [])
AC_ARG_ENABLE([tsa-plugin],
[ --enable-tsa-plugin Enable TSA plugin. [default=no]],
[], [enable_tsa_plugin=no])
AC_ARG_WITH(ais,
[ --with-ais
Support the Corosync-based stack ],
[ SUPPORT_CS=$withval ],
[ SUPPORT_CS=try ],
)
AC_ARG_WITH(heartbeat,
[ --with-heartbeat
Support the Heartbeat-based stack ],
[ SUPPORT_HEARTBEAT=$withval ],
[ SUPPORT_HEARTBEAT=try ],
)
CSPREFIX=""
AC_ARG_WITH(ais-prefix,
[ --with-ais-prefix=DIR Prefix used when Corosync was installed [$prefix]],
[ CSPREFIX=$withval ],
[ CSPREFIX=$prefix ])
LCRSODIR=""
AC_ARG_WITH(lcrso-dir,
[ --with-lcrso-dir=DIR Corosync lcrso files. ],
[ LCRSODIR="$withval" ])
AC_ARG_WITH([JAVA_HOME],
[ --with-java-home JAVA_HOME dir], [], [])
AC_ARG_WITH([TSA_DIR],
[ --with-tsa-dir TSA diretory, default = /opt/IBM/tsamp/], [], [])
INITDIR=""
AC_ARG_WITH(initdir,
[ --with-initdir=DIR directory for init (rc) scripts [${INITDIR}]],
[ INITDIR="$withval" ])
AC_ARG_WITH(mibsdir,
[ --with-mibsdir=DIR directory for mib files. ],
[ MIBS_DIR="$withval" ])
dnl ************ OCF (Open Cluster Framework) **********************
dnl Should be consistent with the OCF standard fixed pathname /usr/lib/ocf
dnl Changing it from this value violates the OCF standard.
dnl This is why it is not affected by the PREFIX setting.
dnl We do not recommend changing it.
dnl
OCF_ROOT_DIR="/usr/lib/ocf"
AC_ARG_WITH(ocf-root,
[ --with-ocf-root=DIR directory for OCF scripts [${OCF_ROOT_DIR}]],
[ if test x"$withval" = xprefix; then OCF_ROOT_DIR=${prefix}; else
OCF_ROOT_DIR="$withval"; fi ])
dnl TODO: Allow libdir and libexecdir to be overwitten?
dnl libdir=`dirname $libdir`/$LibDirSuffix
dnl libexecdir=`dirname $libexecdir`/$LibDirSuffix
dnl **********************************************************************
dnl TODO: Extract these values from the installed heartbeat program
AC_ARG_WITH(
group-name,
[ --with-group-name=GROUP_NAME
GROUP_NAME to run our programs as. [default=haclient] ],
[ HA_APIGROUP="$withval" ],
[ HA_APIGROUP="haclient" ],
)
AC_SUBST(HA_APIGROUP)
AC_ARG_WITH(
ccmuser-name,
[ --with-ccmuser-name=HA_CCMUSER_NAME
HA_CCMUSER_NAME to run privileged non-root things as. [default=hacluster] ],
[ HA_CCMUSER="$withval" ],
[ HA_CCMUSER="hacluster" ],
)
AC_SUBST(HA_CCMUSER)
dnl ===============================================
dnl General Processing
dnl ===============================================
AC_SUBST(HB_PKG)
AC_SUBST(PKG_NAME)
CC_IN_CONFIGURE=yes
export CC_IN_CONFIGURE
INIT_EXT=""
echo Our Host OS: $host_os/$host
AC_MSG_NOTICE(Sanitizing prefix: ${prefix})
case $prefix in
NONE) prefix=/usr;;
esac
AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix})
case $exec_prefix in
dnl For consistency with Heartbeat, map NONE->$prefix
NONE) exec_prefix=$prefix;;
prefix) exec_prefix=$prefix;;
esac
AC_MSG_NOTICE(Sanitizing ais_prefix: ${CSPREFIX})
case $CSPREFIX in
dnl For consistency with Heartbeat, map NONE->$prefix
NONE) CSPREFIX=$prefix;;
prefix) CSPREFIX=$prefix;;
esac
AC_MSG_NOTICE(Sanitizing INITDIR: ${INITDIR})
case $INITDIR in
prefix) INITDIR=$prefix;;
"")
AC_MSG_CHECKING(which init (rc) directory to use)
for initdir in /etc/init.d /etc/rc.d/init.d /sbin/init.d \
/usr/local/etc/rc.d /etc/rc.d
do
if
test -d $initdir
then
INITDIR=$initdir
break
fi
done
AC_MSG_RESULT($INITDIR);;
esac
AC_MSG_NOTICE(Sanitizing libdir: ${libdir})
case $libdir in
dnl For consistency with Heartbeat, map NONE->$prefix
prefix|NONE|*exec_prefix*)
AC_MSG_CHECKING(which lib directory to use)
for aDir in lib64 lib
do
trydir="${exec_prefix}/${aDir}"
if
test -d ${trydir}
then
libdir=${trydir}
break
fi
done
AC_MSG_RESULT($libdir);
;;
esac
dnl Expand autoconf variables so that we dont end up with '${prefix}'
dnl in #defines and python scripts
dnl NOTE: Autoconf deliberately leaves them unexpanded to allow
dnl make exec_prefix=/foo install
dnl No longer being able to do this seems like no great loss to me...
eval prefix="`eval echo ${prefix}`"
eval exec_prefix="`eval echo ${exec_prefix}`"
eval bindir="`eval echo ${bindir}`"
eval sbindir="`eval echo ${sbindir}`"
eval libexecdir="`eval echo ${libexecdir}`"
eval datadir="`eval echo ${datadir}`"
eval sysconfdir="`eval echo ${sysconfdir}`"
eval sharedstatedir="`eval echo ${sharedstatedir}`"
eval localstatedir="`eval echo ${localstatedir}`"
eval libdir="`eval echo ${libdir}`"
eval includedir="`eval echo ${includedir}`"
eval oldincludedir="`eval echo ${oldincludedir}`"
eval infodir="`eval echo ${infodir}`"
eval mandir="`eval echo ${mandir}`"
dnl Home-grown variables
eval INITDIR="${INITDIR}"
eval docdir="`eval echo ${docdir}`"
for j in prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir \
sharedstatedir localstatedir libdir includedir oldincludedir infodir \
mandir INITDIR docdir
do
dirname=`eval echo '${'${j}'}'`
if
test ! -d "$dirname"
then
AC_MSG_WARN([$j directory ($dirname) does not exist!])
fi
done
dnl This OS-based decision-making is poor autotools practice;
dnl feature-based mechanisms are strongly preferred.
dnl
dnl So keep this section to a bare minimum; regard as a "necessary evil".
pf_argv_set=""
case "$host_os" in
*bsd*) LIBS="-L/usr/local/lib"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
INIT_EXT=".sh"
;;
*solaris*)
pf_argv_set="PF_ARGV_NONE"
;;
*linux*)
AC_DEFINE_UNQUOTED(ON_LINUX, 1, Compiling for Linux platform)
;;
darwin*)
AC_DEFINE_UNQUOTED(ON_DARWIN, 1, Compiling for Darwin platform)
LIBS="$LIBS -L${prefix}/lib"
CFLAGS="$CFLAGS -I${prefix}/include"
;;
esac
CFLAGS="$CFLAGS -I${prefix}/include/heartbeat -I${prefix}/include/pacemaker"
AC_SUBST(INIT_EXT)
AC_DEFINE_UNQUOTED(HA_LOG_FACILITY, LOG_DAEMON, Default logging facility)
LDD=ldd
dnl Which C compiler?
dnl Defaults to GNU C compiler if available.
dnl Always tries to set the compiler to ANSI C via options (AM)
dnl Can force other with environment variable "CC".
AC_PROG_CC
AC_PROG_CC_STDC
case "$host_cpu" in
ppc64|powerpc64)
case $CFLAGS in
*powerpc64*) ;;
*) if test "$GCC" = yes; then
CFLAGS="$CFLAGS -m64"
fi ;;
esac
esac
#
# Other interesting variables: ${host_vendor} and ${host_os}
# sample values: suse linux
#
dnl *************************************************************************
PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin"
export PATH
dnl checks for programs
dnl
AC_PROG_YACC
AC_DECL_YYTEXT
AM_PROG_LEX
AM_PATH_PYTHON
AC_LIBTOOL_DLOPEN dnl Enable dlopen support...
AC_LIBLTDL_CONVENIENCE dnl make libltdl a convenience lib
AC_PROG_LIBTOOL
dnl ===============================================
dnl Program Paths - Most of these need to go away
dnl ===============================================
dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL
dnl was NOT being expanded all the time thus causing things to fail.
AC_CHECK_PROGS(LIBTOOL, glibtool libtool libtool15 libtool13)
AC_MSG_CHECKING(for glibtool or libtool*)
if test x"${LIBTOOL}" = x""; then
FatalMissingThing "libtool" "You need libtool to build ${PKG_NAME}." \
"You can get the source from ftp://www.gnu.org/pub/gnu/" \
"or you can locate it via http://www.gnu.org/software/libtool"
else
AC_MSG_RESULT($LIBTOOL has been found.)
fi
AC_CHECK_PROGS(MAKE, gmake make)
AC_MSG_CHECKING(for gmake or make)
if test x"${MAKE}" = x""; then
FatalMissingThing "gmake" "You need gmake to build ${PKG_NAME}." \
"You can get the source from ftp://www.gnu.org/pub/gnu/" \
"or you can locate it via http://www.gnu.org/software/make/"
else
AC_MSG_RESULT($MAKE has been found.)
fi
AC_SYS_LARGEFILE
AC_PATH_PROGS(HTML2TXT, lynx w3m)
case $HTML2TXT in
*/*) ;;
*) HTML2TXT="";;
esac
AC_PATH_PROGS(POD2MAN, pod2man, pod2man)
AC_PATH_PROGS(ROUTE, route)
AC_PATH_PROGS(RPM, rpmbuild)
if test x"${RPM}" = x""; then
AC_PATH_PROGS(RPM, rpm)
fi
AC_DEFINE_UNQUOTED(ROUTE, "$ROUTE", path to route command)
AC_PATH_PROGS(NETSTAT, netstat, /sbin/netstat)
AC_DEFINE_UNQUOTED(NETSTAT, "$NETSTAT", path to the netstat command)
AC_PATH_PROGS(PING, ping, /bin/ping)
AC_PATH_PROGS(IFCONFIG, ifconfig, /sbin/ifconfig)
AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh)
AC_PATH_PROGS(SCP, scp, /usr/bin/scp)
AC_PATH_PROGS(PYTHON, python)
dnl - Determine which mail program exists. Mailx is Solaris
AC_PATH_PROGS(MAILCMD, mail, mailx)
AC_SUBST(MAILCMD)
AC_DEFINE_UNQUOTED(IFCONFIG, "$IFCONFIG", path to the ifconfig command)
AC_PATH_PROGS(GETENT, getent)
AC_PATH_PROGS(IP2UTIL, ip, /sbin/ip)
AC_PATH_PROGS(XML2CONFIG, xml2-config)
AC_PATH_PROGS(REBOOT, reboot, /sbin/reboot)
AC_PATH_PROGS(POWEROFF_CMD, poweroff, /sbin/poweroff)
AC_SUBST(REBOOT)
AC_SUBST(POWEROFF_CMD)
AC_DEFINE_UNQUOTED(REBOOT, "$REBOOT", path to the reboot command)
AC_DEFINE_UNQUOTED(POWEROFF_CMD, "$POWEROFF_CMD", path to the poweroff command)
dnl "whoami", if it exists, may be hidden away on some System-V (e.g. Solaris)
AC_PATH_PROGS(WHOAMI, whoami, , ${PATH}:/usr/ucb)
AC_PATH_PROGS(SWIG, swig)
AC_SUBST(SWIG)
AC_PATH_PROGS(EGREP, egrep)
AC_SUBST(EGREP)
AC_PATH_PROGS(MSGFMT, msgfmt, [msgfmt not found],)
AC_SUBST(MSGFMT)
AC_PATH_PROGS(GZIP_PROG, gzip)
AC_PATH_PROGS(TAR, tar)
AC_PATH_PROGS(MD5, md5)
AC_SUBST(GZIP_PROG)
AC_SUBST(TAR)
AC_SUBST(MD5)
dnl The "test" program can be different from the "sh" builtin.
AC_PATH_PROGS(TEST, test)
AC_PATH_PROGS(PKGCONFIG, pkg-config)
dnl ************************************************************************
dnl Check whether non-root user can chown.
dnl ************************************************************************
AC_PATH_PROGS(MKTEMP, mktemp)
if test -n "$WHOAMI"; then
IAM=`$WHOAMI`
fi
AC_MSG_CHECKING(if chown works for non-root)
dnl Prefer "mktemp" command. But some OSes lack it; they can "touch".
if test -n "$MKTEMP"; then
F=`$MKTEMP "./.chown-testXXXXX"`
else
F="./.chown-test.$$"
touch $F
fi
if
case "$IAM" in
root) chown nobody $F;
su nobody -c "chown root $F";;
*) chown root $F
esac >/dev/null 2>&1
then
nonroot_chown=yes
AC_MSG_RESULT(yes)
else
nonroot_chown=no
AC_MSG_RESULT(no)
fi
rm -f $F
AM_CONDITIONAL(NONROOT_CHOWN, test "$nonroot_chown" = yes )
dnl ===============================================
dnl Libraries
dnl ===============================================
dnl ************************************************************************
dnl checks for libraries
dnl Needed for libnet test.
dnl ************************************************************************
AC_CHECK_LIB(nsl, t_open) dnl -lnsl
AC_CHECK_LIB(socket, socket) dnl -lsocket
AC_CHECK_LIB(posix4, sched_getscheduler) dnl -lposix4
AC_CHECK_LIB(c, dlopen) dnl if dlopen is in libc...
AC_CHECK_LIB(dl, dlopen) dnl -ldl (for Linux)
AC_CHECK_LIB(rt, sched_getscheduler) dnl -lrt (for Tru64)
AC_CHECK_LIB(gnugetopt, getopt_long) dnl -lgnugetopt ( if available )
AC_CHECK_LIB(pam, pam_start) dnl -lpam (if available)
EXTRALIBMSG="-"
if test "X${PKGCONFIG}" = "X"; then
AC_MSG_RESULT(not found)
FatalMissingThing "pkgconfig" "Package pkgconfig is required" \
"See http://pkgconfig.sourceforge.net/"
EXTRALIBMSG="(this message might be bogus because pkgconfig is missing)"
fi
if test "x${enable_thread_safe}" = "xyes"; then
GPKGNAME="gthread-2.0"
else
GPKGNAME="glib-2.0"
fi
if test "X${PKGCONFIG}" != "X" && $PKGCONFIG --exists $GPKGNAME; then
GLIBCONFIG="$PKGCONFIG $GPKGNAME"
else
set -x
echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
$PKGCONFIG --exists $GPKGNAME; echo $?
$PKGCONFIG --cflags $GPKGNAME; echo $?
$PKGCONFIG $GPKGNAME; echo $?
set +x
FatalMissingThing "glib2-devel" \
"Package glib2-devel is missing." \
"You can get the source from ftp://ftp.gtk.org/pub/gtk/" \
"or you can locate it via http://www.gtk.org/download/" "$EXTRALIBMSG"
fi
AC_MSG_RESULT(using $GLIBCONFIG)
AC_MSG_CHECKING(where is python installed)
if test "x${PYTHON}" = x; then
PYTHON="/usr/bin/env python";
fi
AC_MSG_RESULT(using $PYTHON);
AC_MSG_CHECKING(if netstat supports -f inet flag)
$NETSTAT -rn -f inet > /dev/null 2>&1
if test x"$?" = x"0"; then
AC_DEFINE(NETSTATPARM, "-rn -f inet ", parameters to netstat to retrieve route information)
AC_MSG_RESULT(yes)
else
AC_DEFINE(NETSTATPARM, "-rn ", parameters to netstat to retrieve route information)
AC_MSG_RESULT(no)
fi
if test X${PING} = X
then
FatalMissingThing "ping" "ping command is mandantory"
fi
dnl Determine if we use -w1 or -t1 for ping (in PYTHON Scripts)
AC_MSG_CHECKING(ping option for timeout - w or t)
for PING_TIMEOUT_OPT in "-w1" "-t1"
do
$PING -nq -c1 $PING_TIMEOUT_OPT localhost > /dev/null 2>&1
if
test "$?" = 0
then
AC_DEFINE_UNQUOTED(PING_TIMEOUT_OPT, "$PING_TIMEOUT_OPT", option for ping timeout)
AC_MSG_RESULT($PING_TIMEOUT_OPT)
break
fi
done
AC_SUBST(PING_TIMEOUT_OPT)
dnl Determining a route (particularly for "findif").
dnl There are various mechanisms on different systems.
dnl Some mechanisms require root access to evaluate, but configure is often
dnl (indeed, some say should be always) running non-root.
dnl
dnl Therefore much of the determination has to be run-time.
dnl So the principle here, at configure time, is to explore what might be
dnl available, and offer as much as possible to run-time.
dnl
AC_DEFINE(ROUTEPARM, "-n get", paramters for route to retrieve route information)
AC_DEFINE(PROCROUTE, "/proc/net/route", path were to find route information in proc)
AC_MSG_CHECKING(ifconfig option to list interfaces)
for IFCONFIG_A_OPT in "" "-A" "-a"
do
$IFCONFIG $IFCONFIG_A_OPT > /dev/null 2>&1
if
test "$?" = 0
then
AC_DEFINE_UNQUOTED(IFCONFIG_A_OPT, "$IFCONFIG_A_OPT", option for ifconfig command)
AC_MSG_RESULT($IFCONFIG_A_OPT)
break
fi
done
AC_SUBST(IFCONFIG_A_OPT)
AC_SUBST(WHOAMI)
AC_SUBST(HTML2TXT)
AC_SUBST(POD2MAN)
AC_SUBST(ROUTEPARM)
AC_SUBST(PROCROUTE)
dnl Locales check - is a real ugly workaround for now til I find
dnl something more useful
dnl
dnl "Eric Z. Ayers" wrote:
dnl >
dnl > Here are some more data points:
dnl >
dnl > SUN: /usr/lib/locale/
dnl > HP : /usr/lib/nls/loc/
dnl > OSF: /usr/lib/nls/loc/
dnl > LINUX: /usr/share/locale/
dnl > UNIXWARE: /usr/lib/locale/
dnl > FREEBSD: /usr/share/locale
dnl > VMS: just kidding
dnl
FindADir() {
type="$1"
whatfor="$2"
shift; shift;
AC_MSG_CHECKING(for $whatfor directory)
for dir
do
if
test -d "$dir"
then
AC_MSG_RESULT($dir)
echo $dir
return 0
fi
done
AC_MSG_RESULT(not found)
return 1
}
locale_locations="/usr/share/locale /usr/lib/locale /usr/lib/nls/loc"
LOCALE=`FindADir error "locale" $locale_locations`
if
test "X$LOCALE" = X
then
FatalMissingThing "Locale directory" "Locale directory is mandantory."
fi
RPMDIR=`FindADir warn "RPM" /usr/src/packages /usr/src/redhat`
if test x"${HAVE_LIBRT}" = x""; then
LIBRT=""
else
LIBRT=-lrt
fi
AC_SUBST(LIBRT)
#
# Where is dlopen?
#
if test "$ac_cv_lib_c_dlopen" = yes; then
LIBADD_DL=""
elif test "$ac_cv_lib_dl_dlopen" = yes; then
LIBADD_DL=-ldl
else
LIBADD_DL=${lt_cv_dlopen_libs}
fi
dnl
dnl Check for location of gettext
dnl
dnl On at least Solaris 2.x, where it is in libc, specifying lintl causes
dnl grief. Ensure minimal result, not the sum of all possibilities.
dnl And do libc first.
dnl Known examples:
dnl c: Linux, Solaris 2.6+
dnl intl: BSD, AIX
FunIsInLib() {
fun=$1
lib=$2
lib_var1="ac_cv_lib_${lib}_$fun"
lib_var2="ac_cv_lib_${lib}___$fun"
for v in $lib_var1 $lib_var2
do
var=`eval echo '${'${v}'}'`
case $var in
yes) return 0;;
no) return 1;;
esac
done
return 0
}
for gt_test_lib in c intl
do
AC_CHECK_LIB($gt_test_lib, gettext)
if FunIsInLib gettext $gt_test_lib; then
break
fi
done
#
# Where is gettext()?
#
if FunIsInLib gettext c ; then
LIBADD_INTL=""
elif FunIsInLib gettext intl ; then
LIBADD_INTL=-lintl
elif test -f /usr/local/lib/libintl.so -a -s /usr/local/lib/libintl.so; then
# This was added for FreeBSD
LIBADD_INTL="-lintl"
elif test -f /sw/lib/libintl.a -a -s /sw/lib/libintl.la -a -s /sw/lib/libintl.dylib; then
# This was added for Darwin + Fink
LIBADD_INTL="-lintl"
else
FatalMissingThing "gettext function" "no library providing gettext found"
fi
dnl
dnl Glib allows its headers/libraries to be installed anywhere.
dnl And they provide a command to let you know where they are.
dnl This is nice, but having them in standard places is nice too ;-)
dnl
if test "X$GLIBCONFIG" != X; then
AC_MSG_CHECKING(for special glib includes: )
GLIBHEAD=`$GLIBCONFIG --cflags`
AC_MSG_RESULT($GLIBHEAD)
CPPFLAGS="$CPPFLAGS $GLIBHEAD"
AC_SUBST(GLIBHEAD)
dnl Note: Not bundling "GLIBLIB" with general "LIBS".
dnl 1. Only very few programs require GLIBLIB
dnl (This isn't true anymore -- AlanR)
dnl 2. Danger of creating run-time dependency on build-time LD_LIBRARY_PATH
AC_MSG_CHECKING(for glib library flags)
GLIBLIB=`$GLIBCONFIG --libs`
AC_MSG_RESULT($GLIBLIB)
AC_SUBST(GLIBLIB)
fi
dnl ************************************************************************
dnl checks for header files
dnl
dnl check for ANSI *.h files first
dnl asm/page.h: Linux, for system PAGE_SIZE
AC_HEADER_STDC
AC_CHECK_HEADERS(db.h)
AC_CHECK_HEADERS(asm/page.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(stdarg.h)
AC_CHECK_HEADERS(tcpd.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS([stdint.h unistd.h])
AC_CHECK_HEADERS(sys/termios.h)
AC_CHECK_HEADERS(sys/reboot.h)
AC_CHECK_HEADERS(termios.h)
dnl ************************************************************************
dnl FreeBSD requires sys/param.h and in.h to compile test netinet headers.
dnl ************************************************************************
if test "$ac_cv_header_sys_param_h" -a "$ac_cv_header_netinet_in_h" = no; then
AC_CHECK_HEADERS(netinet/in_systm.h)
AC_CHECK_HEADERS(netinet/ip.h)
AC_CHECK_HEADERS(netinet/ip_var.h)
AC_CHECK_HEADERS(netinet/ip_compat.h)
AC_CHECK_HEADERS(netinet/ip_fw.h)
else
AC_CHECK_HEADERS(netinet/in_systm.h,[],[],[#include <sys/param.h>
#include <netinet/in.h>])
if test "$ac_cv_header_in_systm_h" = no; then
AC_CHECK_HEADERS(netinet/ip.h,[],[],[#include <sys/param.h>
#include <netinet/in.h>])
else
AC_CHECK_HEADERS(netinet/ip.h,[],[],[#include <sys/param.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>])
fi
AC_CHECK_HEADERS(netinet/ip_var.h,[],[],[#include <sys/param.h>
#include <netinet/in.h>])
AC_CHECK_HEADERS(netinet/ip_compat.h,[],[],[#include <sys/param.h>
#include <netinet/in.h>])
AC_CHECK_HEADERS(netinet/ip_fw.h,[],[],[#include <sys/param.h>
#include <netinet/in.h>])
fi
AC_CHECK_HEADERS(sys/sockio.h)
AC_CHECK_HEADERS(libintl.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(net/ethernet.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(termio.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(sys/prctl.h)
AC_CHECK_HEADERS(linux/watchdog.h,[],[],[#include <linux/types.h>])
dnl Sockets are our preferred and supported comms mechanism. But the
dnl implementation needs to be able to convey credentials: some don't.
dnl So on a few OSes, credentials-carrying streams might be a better choice.
dnl
dnl Solaris releases up to and including "9" fall into this category
dnl (its sockets don't carry credentials; streams do).
dnl
dnl At Solaris 10, "getpeerucred()" is available, for both sockets and
dnl streams, so it should probably use (preferred) socket mechanism.
AC_CHECK_HEADERS(stropts.h) dnl streams available (fallback option)
AC_CHECK_HEADERS(ucred.h) dnl e.g. Solaris 10 decl. of "getpeerucred()"
AC_CHECK_FUNCS(getpeerucred)
dnl ************************************************************************
dnl checks for headers needed by clplumbing On BSD
AC_CHECK_HEADERS(sys/syslimits.h)
if test "$ac_cv_header_sys_param_h" = no; then
AC_CHECK_HEADERS(sys/ucred.h)
else
AC_CHECK_HEADERS(sys/ucred.h,[],[],[#include <sys/param.h>])
fi
dnl ************************************************************************
dnl checks for headers needed by clplumbing On Solaris
AC_CHECK_HEADERS(sys/cred.h xti.h)
dnl ************************************************************************
dnl checks for headers needed by clplumbing On FreeBSD/Solaris
AC_CHECK_HEADERS(sys/filio.h)
AC_MSG_CHECKING(for special libxml2 includes)
if test "x$XML2CONFIG" = "x"; then
AC_MSG_RESULT(libxml2 config not found)
else
XML2HEAD=`$XML2CONFIG --cflags`
AC_MSG_RESULT($XML2HEAD)
AC_CHECK_LIB(xml2, xmlReadMemory)
fi
CPPFLAGS="$CPPFLAGS $XML2HEAD"
dnl ************************************************************************
dnl * Check for linux/icmpv6.h to make enable the IPv6addr resource agent
AC_CHECK_HEADERS(linux/icmpv6.h,[],[],[#include <asm/types.h>])
AM_CONDITIONAL(USE_IPV6ADDR, test "$ac_cv_header_linux_icmpv6_h" = yes -a $new_libnet = yes )
AC_CHECK_HEADERS(libxml/xpath.h)
dnl
dnl Could check for the libraries, but if you have the headers,
dnl you're a dolt for not having installed the libs ;-)
dnl
AM_CONDITIONAL(USE_VACM, test "$ac_cv_header_vacmclient_api_h" = yes)
AM_CONDITIONAL(USE_DRAC3, test "$ac_cv_header_curl_curl_h" = yes -a "$ac_cv_header_libxml_xpath_h" = yes)
AM_CONDITIONAL(USE_OPENHPI, test "$ac_cv_header_openhpi_SaHpi_h" = yes)
dnl
dnl On many systems libcrypto is needed when linking against libsnmp.
dnl Check to see if it exists, and if so use it.
dnl
AC_CHECK_LIB(crypto, CRYPTO_free, CRYPTOLIB="-lcrypto",)
AC_SUBST(CRYPTOLIB)
dnl ************************************************************************
dnl Handy function for checking for typedefs or struct defs
dnl ************************************************************************
check_for_type() {
type="$1"
headers=""
shift
for arg
do
headers="${headers}${arg}
"
done
program="if ((${type} *) 0) return 0;
if (sizeof(${type})) return 0;
return 0;"
have="HAVE_`echo "$type" | tr ' ' '_' | dd conv=ucase 2>/dev/null`"
varhave="heartbeat_cv_$have"
AC_CACHE_CHECK([for type $type ],$varhave,[
AC_TRY_COMPILE([$headers], [$program], eval $varhave=yes, eval $varhave=no
, eval $varhave=cross)