forked from Unidata/LDM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acinclude.m4
975 lines (905 loc) · 23.2 KB
/
acinclude.m4
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
dnl $Id: aclocal.m4,v 1.27.2.1.2.1.2.1.2.23 2009/08/21 19:58:25 steve Exp $
dnl
dnl These are the local macros used by the ldm4 configure.in
dnl autoconf 1.6
dnl
dnl This is just like AC_HAVE_FUNCS except that the sense is reversed.
dnl
define(diversion_number, divnum)dnl
divert([-1])
AC_DEFUN([UD_REGPAR], [
AC_DEFINE([REG_$1], ["$2"], [$3])
AC_SUBST([REG_$1], [$2])
m4_ifval([$4], [AC_SUBST([REG_$1_DEFAULT], [$4])])
echo '$2':'$3':'$4' >>regpar.txt
])
AC_DEFUN([UD_PREFIX],
[
AC_MSG_CHECKING(the installation prefix)
case "${prefix-}" in
NONE|'')
prefix=`cd $1; pwd`
;;
/*) ;;
*) prefix=`cd $prefix; pwd` ||
{
AC_MSG_ERROR(invalid value for prefix: $prefix)
}
;;
esac
AC_MSG_RESULT($prefix)
])
dnl
dnl Set the C-preprocessor flags as necessary.
dnl
AC_DEFUN([UD_CPPFLAGS],
[
case `uname -s` in
AIX)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1],
[Obtains extended POSIX API])
dnl AC_DEFINE([_ALL_SOURCE], [1],
dnl [Define to obtain optional system API])
AC_DEFINE([BSD], [43], [Define if on a BSD system])
;;
Darwin)
case `uname -r` in
8*) AC_DEFINE([__DARWIN_UNIX03], [1],
[Obtains optional system API])
;;
*) AC_DEFINE([_DARWIN_C_SOURCE], [1],
[Define to obtain optional system API])
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1],
[Obtains extended POSIX API])
;;
esac
;;
HP-UX)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1],
[Obtains extended POSIX API])
AC_DEFINE([HPUX_SOURCE], [1],
[Define to obtain optional system API])
;;
FreeBSD)
;;
IRIX*)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([SGI_SOURCE], [1],
[Define to obtain optional system API])
AC_DEFINE([BSD_TYPES], [1],
[Define to obtain optional system API])
;;
Linux)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([BSD_SOURCE], [1],
[Define to obtain optional system API])
;;
OSF1)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([OSF_SOURCE], [1],
[Define to obtain optional system API])
;;
SunOS)
AC_DEFINE([_XOPEN_SOURCE], [500],
[Defines level of POSIX compliance])
AC_DEFINE([_EXTENSIONS__], [1],
[Obtains optional system API])
#
# The following is a hack to prevent SunOS 5.10's c89(1) from
# defining c99(1) features and, consequently, failing to compile the
# LDM package.
#
test `uname -r` = 5.10 && \
CPPFLAGS="${CPPFLAGS+$CPPFLAGS }-U__C99FEATURES__"
;;
esac
case "${CPPFLAGS}" in
*NDEBUG*);;
*) CPPFLAGS="${CPPFLAGS+$CPPFLAGS }-DNDEBUG";;
esac
AC_SUBST([CPPFLAGS])
])
dnl Check for mmap(2).
dnl
AC_DEFUN([UD_MMAP], [dnl
AC_MSG_CHECKING(mmap());
case `uname -s` in
ULTRIX)
AC_MSG_RESULT(no)
;;
IRIX*)
AC_DEFINE(HAVE_MMAP, 1, [Creates pq(3) module that uses mmap(2)])
AC_MSG_RESULT(yes)
;;
OSF1)
AC_DEFINE(HAVE_MMAP, 1, [Creates pq(3) module that uses mmap(2)])
AC_MSG_RESULT(yes)
;;
*)
AC_DEFINE(HAVE_MMAP, 1, [Creates pq(3) module that uses mmap(2)])
AC_MSG_RESULT(yes)
;;
esac
])
dnl Find a POSIX shell.
dnl
AC_DEFUN([UD_PROG_SH], [dnl
AC_ARG_VAR([SH], [POSIX shell command])
AC_MSG_CHECKING([for POSIX shell])
case "$SH" in
'')
SH=/bin/sh
case `uname -sv` in
'AIX 4')
SH=/bin/bsh
;;
ULTRIX*)
SH=/usr/local/gnu/bin/bash
;;
esac
;;
esac
AC_MSG_RESULT($SH)
AC_SUBST([SH])
])dnl
dnl Find the perl(1) program.
dnl
AC_DEFUN([UD_PROG_PERL],
[dnl
AC_PROG_EGREP
AC_ARG_VAR([PERL], [version 5 perl(1) command])
AC_CACHE_CHECK(
[for version 5 perl(1) utility],
[ac_cv_path_PERL],
[AC_PATH_PROGS_FEATURE_CHECK([PERL], [perl],
[dnl
if $ac_path_PERL -v | $EGREP 'version 5|v5\.' >/dev/null; then
ac_cv_path_PERL=$ac_path_PERL
ac_path_PERL_found=:
fi
],
[AC_MSG_ERROR([Could not find version 5 perl(1) utility])])])
AC_SUBST([PERL], [$ac_cv_path_PERL])
])dnl
dnl Find the rpcgen(1) program.
dnl
AC_DEFUN([UD_PROG_RPCGEN], [dnl
AC_ARG_VAR([RPCGEN], [rpcgen(1) command])
AC_CACHE_VAL([ac_cv_path_RPCGEN], [AC_PATH_PROG([RPCGEN], [rpcgen])])
if test -z "$RPCGEN"; then
AC_MSG_ERROR([Could not find rpcgen(1) utility])
fi
])dnl
dnl Find the ntpdate(8) program.
dnl
AC_DEFUN([UD_PROG_NTPDATE], [dnl
AC_ARG_VAR([NTPDATE], [ntpdate(8) utility])
AC_CACHE_VAL([ac_cv_path_NTPDATE],
[AC_PATH_PROG([NTPDATE], [ntpdate], [ntpdate],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])])
])dnl
dnl Find the netstat(1) command.
dnl
AC_DEFUN([UD_PROG_NETSTAT], [dnl
AC_ARG_VAR([NETSTAT], [netstat(1) command])
AC_CACHE_CHECK(
[for netstat(1) command],
[ac_cv_path_NETSTAT],
[AC_PATH_PROGS_FEATURE_CHECK([NETSTAT], [netstat],
[dnl
for options in '-f inet -P tcp -n' '-f inet -p tcp -n' \
'-A inet -t -n'; do
cmd="$ac_path_NETSTAT $options"
if $cmd >/dev/null 2>&1; then
ac_cv_path_NETSTAT=$cmd
ac_path_NETSTAT_found=:
break
fi
done
],
[
AC_MSG_WARN("Could not find netstat(1). Using true(1)")
ac_cv_path_NETSTAT=true
])])
AC_SUBST([NETSTAT], [$ac_cv_path_NETSTAT])
])dnl
dnl Find the top(1) command.
dnl
AC_DEFUN([UD_PROG_TOP],
[dnl
AC_ARG_VAR([TOP], [top(1) command])
AC_CACHE_CHECK(
[for top(1) command],
[ac_cv_path_TOP],
[AC_PATH_PROGS_FEATURE_CHECK([TOP], [top],
[dnl
for options in '-b -n 1' '-n 0 -l 1'; do
cmd="$ac_path_TOP $options"
if $cmd >/dev/null 2>&1; then
ac_cv_path_TOP=$cmd
ac_path_TOP_found=:
break
fi
done
],
[
AC_MSG_WARN("Could not find top(1). Using true(1)")
ac_cv_path_TOP=true
])])
AC_SUBST([TOP], [$ac_cv_path_TOP])
])dnl
dnl Set the fully-qualified domain name.
dnl
AC_DEFUN([UD_FQDN], [dnl
AC_MSG_CHECKING(fully-qualified domain name)
if test -z "$FQDN"; then
name=`uname -n || hostname`
FQDN=
case "$name" in
*.*)FQDN=$name
;;
*) domain=`domainname`
case "$domain" in
noname|"")
entry=`grep $name /etc/hosts | head -1`
if test -n "$entry"; then
FQDN=`echo "$entry" | \
sed "s/.*\($name\.[[a-zA-Z0-9_.]]*\).*/\1/"`
fi
;;
*) FQDN=${name}.${domain}
;;
esac
;;
esac
case "$FQDN" in
"") echo 1>&2 "Couldn't obtain fully-qualified domain-name"
echo 1>&2 "Set environment variable FQDN and rerun configure"
echo 1>&2 " E.g. setenv FQDN foo.unidata.ucar.edu"
exit 1
;;
esac
AC_MSG_RESULT($FQDN)
AC_SUBST(FQDN)dnl
fi
])
dnl Set the domain name.
dnl
AC_DEFUN([UD_DOMAINNAME], [dnl
AC_MSG_CHECKING(domain name)
if test -z "$DOMAINNAME"; then
name=`uname -n || hostname`
case "$name" in
*.*)
changequote(,)dnl
DOMAINNAME=`echo $name | sed 's/[^.]*\.//'`
changequote([,])dnl
;;
*) domain=`domainname 2>/dev/null`
case "$domain" in
noname|"")
entry=`grep $name /etc/hosts | head -1`
if test -n "$entry"; then
DOMAINNAME=`echo "$entry" | \
sed "s/.*$name\.\([[a-zA-Z0-9_.]]*\).*/\1/"`
fi
;;
*) DOMAINNAME=$domain
;;
esac
;;
esac
case "$DOMAINNAME" in
"") echo 1>&2 "Couldn't obtain domain-name"
echo 1>&2 "Set environment variable DOMAINNAME and rerun configure"
echo 1>&2 " E.g. setenv DOMAINNAME unidata.ucar.edu"
exit 1
;;
esac
AC_MSG_RESULT($DOMAINNAME)
AC_SUBST(DOMAINNAME)dnl
fi
])
dnl Set RPC and socket references.
dnl
AC_DEFUN([UD_NETWORKING],
[dnl
AC_MSG_CHECKING(networking references)
case `uname -sr` in
"SunOS 5"*)
case "$LIBS" in
*-lnsl*)
libs=
;;
*) libs="-lnsl"
;;
esac
case "$LIBS" in
*-lsocket*)
;;
*)
libs="${libs:+$libs }-lsocket"
;;
esac
;;
"SunOS 4"*)
libs=
;;
BSD*)
libs="-lrpc"
;;
HP-UX\ ?.10.2*)
libs="-lnsl_s -lPW"
;;
HP-UX\ ?.11*)
;;
*) libs=
;;
esac
AC_MSG_RESULT($libs)
LIBS="${LIBS:+$LIBS }$libs"
unset libs
])
dnl dnl Set Berkeley socket references.
dnl dnl
dnl AC_DEFUN([UD_SOCKET],
dnl [dnl
dnl AC_MSG_CHECKING(Berkeley socket references)
dnl case `uname -s` in
dnl SunOS)
dnl case `uname -r` in
dnl 5*) case "$LIBS" in
dnl *-lsocket*)
dnl AC_MSG_RESULT()
dnl ;;
dnl *) LIBS="$LIBS -lsocket"
dnl AC_MSG_RESULT(-lsocket)
dnl ;;
dnl esac
dnl ;;
dnl *) AC_MSG_RESULT()
dnl ;;
dnl esac
dnl ;;
dnl *) AC_MSG_RESULT()
dnl ;;
dnl esac
dnl ])
dnl dnl Set RPC references.
dnl dnl
dnl AC_DEFUN([UD_RPC],
dnl [dnl
dnl AC_MSG_CHECKING(RPC references)
dnl case `uname -s` in
dnl SunOS)
dnl case `uname -r` in
dnl 5*)
dnl case "$LIBS" in
dnl *-lrpcsoc*)
dnl AC_MSG_RESULT()
dnl ;;
dnl *) LIBS="$LIBS -R/usr/ucblib -L/usr/ucblib -lrpcsoc -lnsl"
dnl AC_MSG_RESULT(-R/usr/ucblib -L/usr/ucblib -lrpcsoc -lnsl)
dnl ;;
dnl esac
dnl AC_DEFINE(PORTMAP)
dnl ;;
dnl *) AC_MSG_RESULT()
dnl ;;
dnl esac
dnl ;;
dnl BSD*)
dnl LIBS="$LIBS -lrpc"
dnl AC_MSG_RESULT(-lrpc)
dnl ;;
dnl *) AC_MSG_RESULT()
dnl ;;
dnl esac
dnl ])
dnl Set ulog parameters
dnl
AC_DEFUN([UD_ULOG], [dnl
AC_MSG_CHECKING([for system logging daemon])
if ps -e | grep -q syslog-ng; then
AC_MSG_RESULT([syslog-ng])
AC_CHECK_FILE([/etc/syslog-ng/syslog-ng.conf],
[SYSLOG_CONF=/etc/syslog-ng/syslog-ng.conf],
[AC_MSG_ERROR([system logging configuration-file not found or not readable])])
elif ps -e | grep -q rsyslog; then
AC_MSG_RESULT([rsyslog])
AC_CHECK_FILE([/etc/rsyslog.conf],
[SYSLOG_CONF=/etc/rsyslog.conf],
[AC_MSG_ERROR([system logging configuration-file not found or not readable])])
elif ps -e | grep -q syslog; then
AC_MSG_RESULT([syslog])
AC_CHECK_FILE([/etc/syslog.conf],
[SYSLOG_CONF=/etc/syslog.conf],
[AC_MSG_ERROR([system logging configuration-file not found or not readable])])
else
AC_MSG_ERROR([system logging daemon not running], 1)
fi
AC_SUBST([SYSLOG_CONF])
if test -e $LDMHOME/logs; then
AC_SUBST([LDM_LOGFILE], [$LDMHOME/logs/ldmd.log])
else
AC_SUBST([LDM_LOGFILE], [$LDMHOME/var/logs/ldmd.log])
fi
case `uname -sr` in
OSF1*|sn1036*|Linux*|Darwin*)
AC_MSG_CHECKING([if ulog(3) should define syslog(3)])
AC_DEFINE(NO_REPLACE_SYSLOG, 1,
[Causes syslog(3) to not be defined in the ulog(3) module])
AC_MSG_RESULT([no])
;;
*)
AC_MSG_CHECKING([whether syslog(3) returns an int])
AC_TRY_COMPILE(
[#include <syslog.h>],
[int i = syslog(0,0);],
AC_DEFINE(SYSLOG_RETURNS_INT, 1,
[Whether syslog(3) returns an int])
AC_MSG_RESULT([yes]),
[AC_MSG_RESULT([no])])
;;
esac
AC_MSG_CHECKING([pathname of system log file])
unset ULOGNAME
for usock in /dev/log /var/run/syslog; do
if test -w $usock; then
ULOGNAME=$usock
AC_DEFINE_UNQUOTED(ULOGNAME, "$ULOGNAME",
[Pathname of the system log file])
AC_MSG_RESULT([$ULOGNAME])
AC_MSG_CHECKING([if system log file is a socket])
if ls -lL $usock | grep '^s' >/dev/null; then
AC_DEFINE(LOGNAME_ISSOCK, 1,
[Define if the system log file is a socket])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
break
fi
done
if test -z "$ULOGNAME"; then
AC_MSG_RESULT([not found])
AC_MSG_CHECKING([pathname of console])
if test -w /dev/conslog; then
AC_DEFINE(_DEV_CONSLOG, 1,
[Define if the file /dev/conslog exists])
AC_MSG_RESULT([/dev/conslog])
else
AC_MSG_RESULT([no console found])
fi
fi
])
dnl Set syslog pid filename for hupsyslog
dnl
AC_DEFUN([UD_SYSLOG_PIDFILE], [dnl
AC_MSG_CHECKING([system logging daemon PID file])
for path in /etc/syslog.pid /var/run/syslog.pid /var/run/syslogd.pid \
/var/run/rsyslogd.pid; do
if test -f $path; then
AC_DEFINE_UNQUOTED(SYSLOG_PIDFILE, "$path",
[Pathname of system logging daemon PID file])
AC_MSG_RESULT($path)
break;
fi
done
])dnl
dnl Run configure in another directory
dnl Useful when merging packages.
dnl
AC_DEFUN([UD_SUBCONFIG],
[
if test -d $1; then
if test -f $1/config.status; then
echo " * running config.status in $1"
(cd $1 ; ${CONFIG_SHELL-/bin/sh} ./config.status)
else
echo "running configure in $1"
(cd $1 ; ${CONFIG_SHELL-/bin/sh} ./configure --prefix=${prefix})
fi
else
echo "$1 not found"
fi
])dnl
dnl Set up LDMHOME
dnl
AC_DEFUN([UD_LDMHOME],
[
AC_MSG_CHECKING(LDMHOME)
case "$LDMHOME" in
'') LDMHOME=`awk -F: '{if($''1~/ldm/) {print $''6;exit;}}' /etc/passwd`
case "$LDMHOME" in
'') AC_MSG_ERROR(\$LDMHOME not set. Set and re-execute configure script.)
;;
esac
;;
esac
AC_SUBST(LDMHOME)
AC_DEFINE_UNQUOTED(LDMHOME, "$LDMHOME", [Top-level install-point])
AC_MSG_RESULT($LDMHOME)
])dnl
dnl Set up SRCDIR
dnl
AC_DEFUN([UD_SRCDIR],
[
AC_MSG_CHECKING(LDM source directory)
SRCDIR=${SRCDIR-`pwd`}
AC_SUBST(SRCDIR)
AC_MSG_RESULT($SRCDIR)
])dnl
AC_DEFUN([UD_PROG_CPP],
[dnl
AC_REQUIRE([AC_PROG_CC]) dnl
case `uname -sr` in
'HP-UX B.11'*)
cpp="${CC-c89} -E" dnl "-w" disables warnings
;;
*)
AC_REQUIRE([AC_PROG_CPP]) dnl
AC_MSG_CHECKING(the C preprocessor)
AC_TRY_CPP([#include <stdlib.h>],
AC_MSG_RESULT(works),
AC_MSG_ERROR([[$[]0: C preprocessor, \`$CPP', doesn't work]]))
;;
esac
])
AC_DEFUN([UD_HPUX], [
AC_MSG_CHECKING(for HP-UX)
AC_BEFORE([$0], [AC_COMPILE_CHECK])
AC_BEFORE([$0], [AC_TEST_PROGRAM])
AC_BEFORE([$0], [AC_HEADER_EGREP])
AC_PROGRAM_EGREP(yes, [
#ifdef __hpux
yes
#endif
], [
AC_MSG_RESULT(yes)
dnl Under HP-UX B.11.00, <rpc/rpc.h> includes <rpc/auth.h>, which includes
dnl <sys/user.h>, which uses "kt_t", which isn't defined anywhere; so omit
dnl <sys/user.h>
AC_DEFINE(_SYS_USER_INCLUDED, 1,
[Causes <sys/user.h> to not be included])
case "$CPP" in
/bin/c89*|c89*|/bin/cc*|cc*|/lib/cpp*|cpp*)
dnl HP-UX's C compiler emits a warning about <stdlib.h> when
dnl HPUX_SOURCE is defined. This fouls tests that check output
dnl on standard error. Consequently, ensure that warning messages
dnl are suppressed.
case "$CFLAGS" in
*-w*);;
esac;;
esac
case "$CFLAGS" in
dnl In 64-bit mode, the "xnet" networking library must be used.
*+DA2.0W*) LIBS="${LIBS}${LIBS+ }-lxnet";;
esac
],
AC_MSG_RESULT(no)
)dnl
])dnl
AC_DEFUN([UD_SIG_ATOMIC_T], [
AC_MSG_CHECKING(for sig_atomic_t in signal.h)
AC_EGREP_HEADER(sig_atomic_t, signal.h,
AC_MSG_RESULT(defined),
[
AC_MSG_RESULT(not defined)
AC_DEFINE(sig_atomic_t, int,
[Type of atomic signal-handler variable])
]
)
])
dnl AC_DEFUN(UD_RPCSOC, [dnl
dnl LIBS_save="${LIBS}"
dnl LIBS="-R/usr/ucblib -L/usr/ucblib -lrpcsoc ${LIBS}"
dnl have_lib=""
dnl AC_COMPILE_CHECK([-lrpcsoc], , [main();], [have_lib="1"])dnl
dnl if test -z "${have_lib}"; then
dnl LIBS="${LIBS_save}"
dnl fi
dnl ])dnl
dnl
dnl Change defaults to be compatible with Peter Neilley's "weather" program
dnl
AC_DEFUN([UD_NEILLEY_COMPAT], [dnl
AC_SUBST(GDBMLIB)
if test -z "$GDBMLIB"; then
AC_CHECK_LIB(gdbm, gdbm_open, GDBMLIB=-lgdbm)
fi
if test -n "$GDBMLIB"; then
AC_CHECK_HEADER(gdbm.h, AC_DEFINE(USE_GDBM, 1,
[Use the gdbm(3) library instead of the ndbm(3) library]))
fi
AC_DEFINE([DB_XPROD], 0,
[Define to DBFILE entire data-product and not just data])
AC_DEFINE([DB_CONCAT], 1,
[Define to concatenate DBFILE products with same key])
])dnl
dnl Turn off DB support if not available
dnl
AC_DEFUN([UD_DB], [dnl
if test -z "$GDBMLIB"; then
AC_MSG_NOTICE("GDBMLIB not set")
AC_CHECK_FUNC(dbm_open,
,
AC_DEFINE(NO_DB, 1, [Disables the DBFILE capability])
AC_MSG_WARN("pqact DBFILE action disabled")
)
fi
])dnl
dnl Check for yacc(1) library.
dnl
AC_DEFUN([UD_LIB_YACC],
[
AC_ARG_VAR([LD_YACC], [yacc(1) library])
case `uname` in
Linux)
UD_DEFAULT(LD_YACC, )
;;
*) UD_CHECK_LIB(LD_YACC, yyerror(""), , y, yacc, -ly)
;;
esac
])
dnl Set the value of a variable. Use the environment if possible; otherwise
dnl set it to a default value. Call the substitute routine.
dnl
AC_DEFUN([UD_DEFAULT], [dnl
$1=${$1-"$2"}
AC_SUBST([$1])
])
dnl Check for a library that contains a function.
dnl
dnl NB: Always checks default library and library directories first. This
dnl obviates the need for a `-L...' reference, which can cause problems
dnl [(]e.g. a `-L/usr/lib -lsocket' reference under SunOS 5.2 can cause the
dnl wrong `-lm' to be loaded[)].
dnl
dnl This rule was changed (for some reason) to return `-lc' if the
dnl function was in the default library. This caused problems on
dnl an DecStation ULTRIX system when f77(1) was used to link a FORTRAN
dnl program: the C and FORTRAN libraries had duplicate definitions for
dnl some functions. Consequently, we return to the practice of not
dnl deciding on `-lc'.
dnl
dnl UC_CHECK_LIB(varname, func, dir ..., lib ..., libname, example)
dnl
AC_DEFUN([UD_CHECK_LIB],
[dnl
AC_MSG_CHECKING(for $5 library)
case "${$1+set}" in
set)
AC_MSG_RESULT($$1)
;;
*) AC_MSG_RESULT()
LIBS_save=$LIBS
found=no
AC_MSG_CHECKING(for $2 in default library(s))
AC_TRY_LINK(, $2;,
[
AC_MSG_RESULT(yes)
$1=
found=yes
],
[
AC_MSG_RESULT(no)
for dir in '' $3; do
for lib in $4; do
UD_LINK_REF(LIBS, $dir, $lib)
AC_MSG_CHECKING(for $2 in $LIBS)
AC_TRY_LINK(, $2;,
[
AC_MSG_RESULT(yes)
$1=$LIBS
found=yes
break 2
])
AC_MSG_RESULT(no)
done
done
])
LIBS=$LIBS_save
case $found in
no)
AC_MSG_ERROR(
[$5 library not found. Adjust library search-path (e.g., LD_LIBRARY_PATH) and/or set environment variable $1 (e.g., to \"$6\"). Then re-execute configure script.])
;;
esac
;;
esac
AC_SUBST($1) dnl
])
dnl Form a library reference for the linker/loader
dnl
dnl On a SunOS 5 system, a `-R<dir>' is added in addition to a `-L<dir>'
dnl in order to make the utility independent of LD_LIBRARY_PATH (is this
dnl a good idea?) and to ensure that it'll run regardless of who
dnl executes it.
dnl
dnl UC_LINK_REF(varname, libdir, libname)
dnl
dnl Example: UC_LINK_REF(UC_LD_MATH, /upc/netcdf/lib, netcdf)
dnl
AC_DEFUN([UD_LINK_REF], [dnl
case `uname -rs` in
unicos*)
case "$2" in
'') $1="-l $3";;
*) $1="-L $2 -l $3";;
esac
;;
SunOS\ 5*)
case "$2" in
'') $1="-l$3";;
*) $1="-R$2 -L$2 -l$3";;
esac
;;
*)
case "$2" in
'') $1="-l$3";;
*) $1="-L$2 -l$3";;
esac
;;
esac
])
dnl @synopsis TYPE_SOCKLEN_T
dnl
dnl Check whether sys/socket.h defines type socklen_t. Please note
dnl that some systems require sys/types.h to be included before
dnl sys/socket.h can be compiled.
dnl
dnl @version $Id: aclocal.m4,v 1.27.2.1.2.1.2.1.2.23 2009/08/21 19:58:25 steve Exp $
dnl @author Lars Brinkhoff <[email protected]>
dnl
AC_DEFUN([TYPE_SOCKLEN_T],
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
[
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t len = 42; return 0;],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t != yes; then
AC_DEFINE(socklen_t, int, [Type of variable for holding socket-length data])
fi
])
dnl Setup for making a manual-page database.
dnl
AC_DEFUN([UD_MAKEWHATIS],
[
#
# NB: We always want to define WHATIS to prevent the
# $(mandir)/$(WHATIS) make(1) target from being just $(mandir)/ and
# conflicting with the (directory creation) target with the same name.
#
WHATIS=whatis
case `uname -sr` in
BSD/OS*|FreeBSD*|Darwin*)
# Can't generate a user-database -- only /usr/share/man/whatis.db.
MAKEWHATIS_CMD=
;;
'IRIX64 6.5'|'IRIX 6.5')
MAKEWHATIS_CMD='/usr/lib/makewhatis -M $(mandir) $(mandir)/whatis'
;;
'IRIX 6'*)
# Can't generate a user-database.
MAKEWHATIS_CMD=
;;
HP-UX*)
# Can't generate a user-database -- only /usr/lib/whatis.
MAKEWHATIS_CMD=
;;
'Linux '*)
# /usr/sbin/makewhatis doesn't work
MAKEWHATIS_CMD=
;;
ULTRIX*)
# Can't generate a user-database -- only /usr/lib/whatis.
MAKEWHATIS_CMD=
;;
*)
if test -r /usr/man/windex; then
WHATIS=windex
fi
AC_CHECK_PROGS(prog, catman makewhatis /usr/lib/makewhatis, [catman])
case "$prog" in
*catman*)
MAKEWHATIS_CMD=$prog' -w -M $(mandir)'
;;
*makewhatis*)
MAKEWHATIS_CMD=$prog' $(mandir)'
;;
esac
;;
esac
AC_SUBST(WHATIS)
AC_SUBST(MAKEWHATIS_CMD)
AC_MSG_CHECKING(for manual-page index command)
AC_MSG_RESULT($MAKEWHATIS_CMD)
])
dnl Set an output variable to a C-preprocessor reference for a C header-file
dnl if necessary.
dnl $1 Name component (e.g., "XML2")
dnl $2 Description
dnl $3 Space-separated list of directories
dnl $4 Name of the header-file (may contain "/")
AC_DEFUN([UD_CHECK_HEADER],
[
AC_ARG_VAR([CPPFLAGS_$1], [$2])
AC_CACHE_CHECK([for header-file <$4>], [ac_cv_header_$1],
[for dir in $3; do
if test -r $dir/$4; then
ac_cv_header_$1="-I $dir"
break
fi
done])
if test -z "$ac_cv_header_$1"; then
AC_MSG_ERROR([Header-file <$4> not found])
else
CPPFLAGS_$1="$ac_cv_header_$1"
fi
])
dnl Ensure that CPPFLAGS references a header-file directory
dnl $1 Name component (e.g., "XML2")
dnl $2 Name of the header-file (may contain "/")
dnl $3 Space-separated list of directories
AC_DEFUN([UD_SEARCH_HEADER],
[
AC_MSG_NOTICE([Searching for the "$1" header-file(s)])
origCppFlags="$CPPFLAGS"
found=no
cacheName=ac_cv_header_`echo $2 | tr '/.' '__'`
for dir in "" $3; do
CPPFLAGS="${dir:+-I$dir}${CPPFLAGS:+ $CPPFLAGS}"
#AC_MSG_NOTICE([CPPFLAGS = "$CPPFLAGS"])
AC_CHECK_HEADER([$2], [found=yes; break])
unset $cacheName
CPPFLAGS="$origCppFlags"
done
test "$CPPFLAGS" || unset CPPFLAGS
if test $found != yes; then
AC_MSG_ERROR(["$1" header-file(s) not found])
else
AC_MSG_NOTICE(["$1" header-file(s) found in "$dir"])
fi
unset found
])
dnl Ensure that LIBS references a library
dnl $1 Name component (e.g., "XML2")
dnl $2 Name of a function
dnl $3 Space-separated list of directories
AC_DEFUN([UD_SEARCH_LIB],
[
AC_MSG_NOTICE([Searching for the "$1" library])
AC_SEARCH_LIBS([$2], [$1], ,
[origLibs="$LIBS"
found=no
for dir in "" $3; do
LIBS="${dir:+-L$dir }-l$1${LIBS:+ $LIBS}"
#AC_MSG_NOTICE([LIBS = "$LIBS"])
AC_CHECK_FUNC([$2], [found=yes; break])
LIBS="$origLibs"
unset ac_cv_func_$2
done
test "$LIBS" || unset LIBS
if test $found != yes; then
AC_MSG_ERROR(["$1" library not found])
else
AC_MSG_NOTICE(["$1" library found in "$dir"])
fi
unset found]
)
])
divert(diversion_number)dnl