-
Notifications
You must be signed in to change notification settings - Fork 3
/
aclocal.m4
2387 lines (2153 loc) · 61.6 KB
/
aclocal.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
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 define(diversion_number, divnum)dnl
dnl divert(-1)
dnl
dnl Setup for making a manual-page database.
dnl
AC_DEFUN([UC_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*)
# 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)
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 Initialize this Unidata autoconf(1)-support module without support
dnl for using the port/ subdirectory other than for the makefiles.
dnl
AC_DEFUN([UC_INIT_NOPORT],
[dnl
dnl
dnl Don't ask me why, but the ac_require() around uc_customize() is
dnl necessary to prevent the uc_port stuff from being written to the
dnl output file before the uc_customize stuff.
dnl
AC_REQUIRE([UC_CUSTOMIZE])
rm -f confdefs.missing
UC_MAKEFILE(port/master.mk) dnl
UC_MAKEFILE(port/Makefile) dnl
UC_DEFAULT(PORT_SUBDIRS, ) dnl
UC_DEFAULT(PORT_MANIFEST, ) dnl
AC_SUBST(PORT_ALL) dnl
AC_SUBST(PORT_CLEAN) dnl
AC_SUBST(PORT_DISTCLEAN) dnl
AC_SUBST(PORT_INSTALL) dnl
UC_MAKEWHATIS
])
dnl Initialize this Unidata autoconf(1)-support module.
dnl
AC_DEFUN([UC_INIT],
[dnl
AC_REQUIRE([UC_INIT_NOPORT])
AC_CONFIG_HEADER(port/misc/udposix.h)
UC_PORT
])
dnl Define a substitution for both `@...@' and C preprocessor forms.
dnl
AC_DEFUN([UC_REPLACE], [dnl
$1="$2"
AC_SUBST($1)dnl
AC_DEFINE($1,$2)
])
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([UC_DEFAULT], [dnl
$1=${$1-"$2"}
AC_SUBST([$1])
])
dnl Configure a C header file. This differs from AC_CONFIG_HEADER by
dnl accumulating the specified headers into the list rather than redefining
dnl the list each time.
dnl
dnl UC_CONFIG_HEADER(output_header_file)
dnl
AC_DEFUN([UC_CONFIG_HEADER], [dnl
ifdef([AC_LIST_HEADER], , [define([AC_LIST_HEADER], [])]) dnl
ifelse(index(AC_LIST_HEADER, $1), -1, [dnl
dnl echo Adding $1 to configuration headers
define([tmp], AC_LIST_HEADER) dnl
define([AC_LIST_HEADER], tmp $1) dnl
undefine([tmp])] dnl
) dnl
dnl echo configuration headers: AC_LIST_HEADER
])
dnl Set up for customizing the port/ subdirectory.
dnl
AC_DEFUN([UC_PORT],
[dnl
UC_UDPOSIX
UC_PROG_AR
UC_PROG_TAR
AC_PROG_RANLIB
UC_BINFTP
UC_MAKEFILE(port/Makefile) dnl
UC_MAKEFILE(port/master.mk) dnl
UC_MAKEFILE(port/misc/Makefile) dnl
UC_DEFAULT(UC_LIBOBJS, ) dnl
UC_DEFAULT(PORT_HEADERS, ) dnl
UC_DEFAULT(PORT_MANIFEST, ) dnl
UC_DEFAULT(PORT_SUBDIRS, ) dnl
UC_ENSURE(PORT_ALL, misc/all)
UC_ENSURE(PORT_INSTALL, misc/install)
UC_ENSURE(PORT_CLEAN, misc/clean)
UC_ENSURE(PORT_DISTCLEAN, misc/distclean)
AC_SUBST(PORT_ALL) dnl
AC_SUBST(PORT_INSTALL) dnl
AC_SUBST(PORT_CLEAN) dnl
AC_SUBST(PORT_DISTCLEAN) dnl
UC_DEFAULT(PORT_CPP_LDM, ) dnl
udportdir=`pwd`/port/misc
UC_LINK_REF(LD_UDPORT, $udportdir, udport) dnl
AC_SUBST(LD_UDPORT)
unset udportdir
])
dnl Finish with everything (both GNU and Unidata autoconf(1) support).
dnl
AC_DEFUN([UC_FINISH],
[dnl
UC_CHECK_MISSING dnl
AC_OUTPUT($1 ${CONFIG_FILES-},
[dnl
UC_POSTPROCESS_MAKEFILES(${CONFIG_FILES-}) dnl
],
[dnl
CC="$CC"
]dnl
) dnl
])
dnl Add a member to the list of makefiles.
dnl
AC_DEFUN([UC_MAKEFILE], [dnl
UC_ENSURE(CONFIG_FILES, $1)dnl
])
dnl Determine the operating system.
dnl
AC_DEFUN([UC_OS], [dnl
AC_MSG_CHECKING(type of operating system)
if test -z "$OPSYS"; then
OPSYS=`uname -s | tr '[[A-Z]]' '[[a-z]]' | sed 's;/;;g'`
if test -z "$OPSYS"; then
UC_NEED_VALUE(OPSYS, [operating system], sunos5)dnl
fi
fi
case $OPSYS in
aix)
OS_NAME=`uname -s`
OS_MAJOR=`uname -v | sed 's/[[^0-9]]*\([[0-9]]*\)\..*/\1/'`
;;
hp-ux)
OPSYS=hpux`uname -r | sed 's/[[A-Z.0]]*\([[0-9]]*\).*/\1/'`
OS_NAME=HPUX
OS_MAJOR=`uname -r | sed 's/[[A-Z.0]]*\([[0-9]]*\).*/\1/'`
;;
irix)
OPSYS=${OPSYS}`uname -r | sed 's/\..*//'`
OS_NAME=IRIX
OS_MAJOR=`uname -r | sed 's/\..*//'`
;;
osf*)
OS_NAME=OSF1
OS_MAJOR=`uname -r | sed 's/[[^0-9]]*\([[0-9]]*\)\..*/\1/'`
;;
sn*)
OPSYS=unicos
OS_NAME=UNICOS
OS_MAJOR=`uname -r | sed 's/[[^0-9]]*\([[0-9]]*\)\..*/\1/'`
;;
sunos)
OS_NAME=SunOS
OS_MAJOR=`uname -r | sed 's/\..*//'`
OPSYS=$OPSYS$OS_MAJOR
;;
ultrix)
OS_NAME=ULTRIX
OS_MAJOR=`uname -r | sed 's/\..*//'`
;;
*)
# On at least one UNICOS system, 'uname -s' returned the
# hostname (sigh).
if uname -a | grep CRAY >/dev/null; then
OPSYS=unicos
OS_NAME=UNICOS
else
OS_NAME=`uname -s | sed 's/[[^A-Za-z0-9_]]//g'`
fi
OS_MAJOR=`uname -r | sed 's/[[^0-9]]*\([[0-9]]*\)\..*/\1/'`
;;
esac
# Adjust OPSYS for CRAY MPP environment.
#
case "$OPSYS" in
unicos)
AC_REQUIRE([UC_PROG_CC])
case "$CC$TARGET$CFLAGS" in
*cray-t3*)
OPSYS=unicos-mpp
;;
esac
;;
esac
AC_SUBST(OPSYS)dnl
AC_DEFINE_UNQUOTED(OS_NAME, $OS_NAME)
AC_DEFINE_UNQUOTED(OS_MAJOR, $OS_MAJOR)
AC_MSG_RESULT($OPSYS)
])
dnl Check for C++ compiler. This macro is used rather than using the
dnl autoconf macro directly because we want it to obtain the native C++
dnl compiler if possible.
dnl
AC_DEFUN([UC_PROG_CXX], [dnl
case ${CXX+set} in
set)
AC_MSG_CHECKING(for C++ compiler)
AC_MSG_RESULT($CXX)
AC_SUBST(CXX)dnl
;;
*)
case `uname -s` in
AIX*)
native_cxx=xlC
;;
HP-UX*)
native_cxx=CC
;;
IRIX*)
native_cxx=CC
;;
OSF*)
native_cxx=cxx
;;
SunOS)
native_cxx=CC
;;
*)
native_cxx=
;;
esac
AC_CHECK_PROGS(CXX, $native_cxx CC cxx c++ g++ gcc, )dnl
case "${CXX-unset}" in
unset)
UC_NEED_VALUE(CXX, [C++ compiler], CC)dnl
;;
esac
;;
esac
])
dnl Check for C compiler. This macro replaces the ac_prog_cc macro because
dnl that macro prefers the GNU C compiler.
dnl
AC_DEFUN([UC_PROG_CC],
[dnl
dnl
dnl The AC_REQUIRE macro runs a diversion stack. If it gets too deep, then
dnl some things are output in the wrong order. Thus, we use AC_BEFORE here
dnl rather than AC_REQUIRE where we'd like.
AC_BEFORE([$0], [UC_FINISH])
AC_BEFORE([$0], [UC_CONST])
AC_BEFORE([$0], [UC_VOLATILE])
AC_BEFORE([$0], [UC_SIGNED])
AC_BEFORE([$0], [UC_PROTOTYPES])
AC_BEFORE([$0], [UC_MAKESTRING])
AC_BEFORE([$0], [UC_GLUE])
AC_BEFORE([$0], [UC_VOIDP])
AC_BEFORE([$0], [UC_FUNC_DECL])
AC_BEFORE([$0], [UC_TYPEDEF])
AC_BEFORE([$0], [UC_STRUCT])
AC_BEFORE([$0], [UC_MACRO])
AC_BEFORE([$0], [UC_UTHREADS])
AC_BEFORE([$0], [UC_UDPOSIX_FLOAT])
AC_BEFORE([$0], [UC_PROG_CC_MAKEDEPEND])
#
# Ensure that the CC variable is unset so that it can be
# set here rather than by the autoconf-generated
# configure-script preamble.
#
# unset CC
#
case ${CC-unset} in
unset)
case `uname -s` in
AIX)
AC_CHECK_PROGS(CC, c89 xlc cc gcc) dnl
;;
HP-UX)
AC_CHECK_PROGS(CC, c89 cc gcc) dnl
;;
IRIX*)
AC_CHECK_PROGS(CC, cc gcc) dnl
;;
OSF1|ULTRIX)
AC_CHECK_PROGS(CC, cc gcc) dnl
case "$CC" in
cc)
case `uname -m` in
VAX)
;;
*)
UC_ENSURE(CPPFLAGS, -std) dnl
;;
esac
;;
esac
;;
SunOS)
case `uname -r` in
4*)
AC_CHECK_PROGS(CC, acc cc gcc) dnl
;;
5*)
AC_CHECK_PROGS(CC, cc gcc) dnl
#
# The following is commented-out because
# the configure script uses CPPFLAGS when
# compiling C++ source and SunOS 5's CC (at
# least) emits error messages when given the
# -Xa option causing the configure script to
# abandon `$CXX -E' in favor of `/lib/cpp'.
#
# case "$CC" in
# *gcc*)
# ;;
# *)
# UC_ENSURE(CPPFLAGS, -Xa) dnl
# ;;
# esac
;;
esac
;;
*)
AC_CHECK_PROGS(CC, c89 cc gcc) dnl
;;
esac
;;
*)
AC_MSG_CHECKING(for C compiler)
AC_MSG_RESULT($CC)
;;
esac
case "${CC-}" in
'')
UC_NEED_VALUE(CC, [C compiler], /bin/cc) dnl
;;
*)
# Find out if we are using GNU C, under whatever name.
cat <<UD_EOF > conftest.c
#ifdef __GNUC__
yes
#endif
UD_EOF
${CC} -E conftest.c > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
GCC=1 # For later tests.
fi
AC_SUBST(CC) dnl
case `uname -s` in
AIX)
UC_ENSURE(CPPFLAGS, -D_ALL_SOURCE) dnl
AC_DEFINE(_ALL_SOURCE) dnl
;;
HP-UX)
UC_ENSURE(CPPFLAGS, -D_HPUX_SOURCE) dnl
AC_DEFINE(_HPUX_SOURCE) dnl
;;
esac
;;
esac
rm -f conftest*
])
dnl Check for functioning `const' keyword
dnl
AC_DEFUN([UC_CONST],
[dnl
AC_MSG_CHECKING(for C const)
AC_TRY_COMPILE(
,
[/* Ultrix mips cc rejects this. */
typedef int charset[2]; const charset x;
],
[AC_MSG_RESULT(yes)],
[
UC_REPLACE(UD_NO_CONST,1)dnl
AC_MSG_RESULT(no)
]
)
])
dnl Check for functioning `volatile' keyword
dnl
AC_DEFUN([UC_VOLATILE], [dnl
AC_MSG_CHECKING(for C volatile)
AC_TRY_COMPILE(
,
[typedef int charset[2]; volatile charset x;],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_VOLATILE,1)
]
)dnl
])
dnl Check for functioning `signed' keyword
dnl
AC_DEFUN([UC_SIGNED], [dnl
AC_MSG_CHECKING(for C signed)
AC_TRY_COMPILE(
,
[signed char x;],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_SIGNED,1)
]
)dnl
])
dnl Check for function prototypes
dnl
AC_DEFUN([UC_PROTOTYPES], [dnl
AC_MSG_CHECKING(for C function prototypes)
AC_TRY_COMPILE(
,
[extern int foo(int bar);],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_PROTOTYPES,1)
]
)dnl
])
dnl Check for the C position-independent-code compile option for building
dnl sharable libraries.
dnl
AC_DEFUN([UC_CPICOPT], [dnl
AC_REQUIRE([UC_OS]) dnl
AC_MSG_CHECKING(for C position-independent-code compile-option)
case "${CPICOPT-unset}" in
unset)
case "$GCC" in
1) CPICOPT=-fpic;;
*) case "$OPSYS" in
hpux*) CPICOPT=+z;;
sunos*)
case "$OS_MAJOR" in
4*) CPICOPT=-pic;;
5*) CPICOPT=-Kpic;;
esac;;
*) CPICOPT=;;
esac
;;
esac
orig_cflags=$CFLAGS
CFLAGS="$CFLAGS $CPICOPT"
AC_TRY_COMPILE(, , , CPICOPT=)
CFLAGS=$orig_cflags
;;
esac
AC_MSG_RESULT($CPICOPT)
AC_SUBST(CPICOPT)
])
dnl Check for the FORTRAN position-independent-code compile option for
dnl building sharable libraries.
dnl
AC_DEFUN([UC_FPICOPT], [dnl
AC_REQUIRE([UC_OS]) dnl
AC_MSG_CHECKING(for FORTRAN position-independent-code compile-option)
case "${FPICOPT-unset}" in
unset)
case "$OPSYS" in
hpux*) FPICOPT=+z;;
sunos*)
case "$OS_MAJOR" in
4*) FPICOPT=-pic;;
5*) FPICOPT=-Kpic;;
esac;;
*) FPICOPT=;;
esac
;;
esac
AC_MSG_RESULT($FPICOPT)
AC_SUBST(FPICOPT)
])
dnl Check for the position-independent-code compile options for
dnl building sharable libraries.
dnl
AC_DEFUN([UC_PICOPT], [dnl
AC_REQUIRE([UC_CPICOPT])dnl
AC_REQUIRE([UC_FPICOPT])dnl
])
dnl Convert argument to uppercase.
dnl
AC_DEFUN([UC_UPPERCASE],[translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)])
dnl Return the C macro name version of the argument.
dnl
AC_DEFUN([UC_C_MACRONAME], [UC_UPPERCASE([translit($1,/.<>,__)])])
dnl Check for cpp(1). This macro replaces the ac_prog_cpp macro because:
dnl 1. That macro, for some reason, sets the value of the shell
dnl variable `CPP' to `${CC-cc} -E' rather than to the cpp(1)
dnl program and such a value has caused trouble in shell command
dnl lines;
dnl 2. The documentation explicitly states that the ac_prog_cpp macro
dnl should be called after the ac_prog_cc macro, so there's no reason
dnl for the above value that I can see; and
dnl 3. We need to discover when ${CPP} doesn't work (e.g. when it's
dnl defined as `acc -E' under older versions of SunOS).
dnl
AC_DEFUN([UC_PROG_CPP],
[dnl
AC_REQUIRE([UC_PROG_CC])dnl
AC_PROG_CPP dnl
AC_MSG_CHECKING(the C preprocessor)
AC_TRY_CPP([#include <stdlib.h>],
[AC_MSG_RESULT(works)],
[
AC_MSG_WARN([[C preprocessor, \`$CPP', doesn't work]])
UC_NEED_VALUE(CPP, [C preprocessor], /lib/cpp)
])
AC_SUBST(CPP)
])
dnl Obtain the pathname of a system-supplied header file. The value of the
dnl associated C macro is `/dev/null' if the header-file could not be
dnl found.
dnl NB: We don't ac_require(uc_prog_cpp) here because it's too deep.
dnl
AC_DEFUN([UC_SYSTEM_H_PATH], [dnl
echo "#include <$1.h>" > conftestpath.c
#
# We add additional `/'s to the header file name to preclude compiler
# warnings about the non-portability of `#include "/usr/include/..."'.
#
case `uname -s`${GCC-} in
AIX)
#
# AIX's C compiler doesn't emit a line that gives the pathname of
# the included file.
#
# AIX's C compiler puts dependency information in a `.u' file.
#
# AIX 4.1's cc(1) makes the following complaint:
# ld: 0711-317 ERROR: Undefined symbol: .main
#
# AIX 4.1's ksh(1) has problems with `2>&5' so we redirect to
# /dev/null.
#
$CC_MAKEDEPEND $CPPFLAGS conftestpath.c 2>/dev/null
path=`sed -n '/[[^\/]]*\(\/[[^ ]]*$1\.h\).*/s//\1/p' \
conftestpath.u | head -1`
rm conftestpath.u
;;
HP-UX)
#
# HP-UX's C compiler doesn't have a dependency-generation option,
# so we use another method.
#
path=`$CC -E $CPPFLAGS conftestpath.c 2>&5 |
sed -n '/[[^\/]]*\(\/[[^ ]]*$1\.h\).*/s//\1/p' |
head -1`
;;
*)
path=`$CC_MAKEDEPEND $CPPFLAGS conftestpath.c 2>&5 |
sed -n '/[[^\/]]*\(\/[[^ ]]*$1\.h\).*/s//\1/p' |
head -1`
;;
esac
case "$path" in
'')
path=/dev/null
;;
*)
path=//$path
;;
esac
AC_DEFINE_UNQUOTED([UD_SYSTEM_[]UC_C_MACRONAME(ifelse($2,,$1,$2))_H],
"$path")dnl
])
dnl Obtain the pathname of a system-supplied header file and create a
dnl header file in the port/misc subdirectory that references it.
dnl
AC_DEFUN([UC_SYSTEM_HEADER],
[dnl
ifelse(
$2,
,
[UC_SYSTEM_H_PATH($1)],
[UC_SYSTEM_H_PATH($1, $2)]
) dnl
ifelse(
$1,
float,
,
[
UC_CONFIG_HEADER(port/misc/ifelse($2,,$1,$2).h)
UC_ENSURE(PORT_SUBDIRS, misc)dnl
] dnl
)dnl
])
dnl Define macros for variadic function support
dnl
AC_DEFUN([UC_VARIADIC_FUNCTIONS],[dnl
UC_ENSURE(PORT_MANIFEST, stdarg.h.in)dnl
AC_MSG_CHECKING(for standard C variadic functions)
AC_TRY_COMPILE([#include <stdarg.h>],
[
}
int foo(int bar, ...) {
va_list alist;
va_start(alist, bar);
bar = (int)va_arg(alist, int);
va_end(alist);
],
[
AC_MSG_RESULT(yes)
UC_SYSTEM_HEADER(stdarg)
],
[
AC_MSG_RESULT(no)
AC_DEFINE(UD_NO_STDARG)dnl
UC_SYSTEM_HEADER(varargs, stdarg)
]
)dnl
])
dnl Define macro for string generation
dnl
AC_DEFUN([UC_MAKESTRING], [dnl
AC_MSG_CHECKING(for standard C string generation)
AC_TRY_COMPILE([# define MAKESTRING(x) #x],
char *cp = MAKESTRING(foo);,
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_HASH,1)
]
)dnl
])
dnl Define macro for token pasting.
dnl
AC_DEFUN([UC_GLUE], [dnl
AC_MSG_CHECKING(for standard C token pasting)
AC_TRY_COMPILE([#define GLUE(a,b) a ## b],
char *GLUE(c,p) = "foo";,
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_HASHHASH,1)
]
)
])
dnl Define pointer-to-void macro.
dnl
AC_DEFUN([UC_VOIDP], [dnl
AC_MSG_CHECKING(C void pointer)
AC_TRY_COMPILE(,
extern void *foo();,
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
UC_REPLACE(UD_NO_VOIDSTAR,1)
]
)
])
dnl pure CFORTRAN support:
dnl
AC_DEFUN([UC_CFORTRAN_PURE], [dnl
UC_MAKEFILE(port/cfortran/Makefile) dnl
AC_REQUIRE([UC_GLUE])dnl
AC_REQUIRE([UC_OS])dnl
AC_MSG_CHECKING(style for cfortran.h)
UC_ENSURE(PORT_SUBDIRS, cfortran)dnl
UC_ENSURE(PORT_ALL, cfortran/all)dnl
UC_ENSURE(PORT_INSTALL, cfortran/install)dnl
UC_ENSURE(PORT_CLEAN, cfortran/clean)dnl
UC_ENSURE(PORT_DISTCLEAN, cfortran/distclean)dnl
case "${UD_NO_HASHHASH-}" in
1) CFORTRAN_TYPE=Reiser
;;
*) CFORTRAN_TYPE=Standard
;;
esac
AC_SUBST(CFORTRAN_TYPE)
AC_MSG_RESULT($CFORTRAN_TYPE)
])
dnl CFORTRAN support:
dnl
AC_DEFUN([UC_CFORTRAN], [dnl
UC_CFORTRAN_PURE
case "$OPSYS" in
aix*)
# Ensure adherence to the trailing-underscore convention.
UC_ENSURE(CPPFLAGS, -Dextname)dnl
UC_ENSURE(FFLAGS, -qextname)dnl
;;
hp*)
# Ensure adherence to the trailing-underscore convention.
UC_ENSURE(CPPFLAGS, -Dextname)dnl
UC_ENSURE(FFLAGS, +ppu)dnl
;;
esac
])
dnl Check for standard, udposix(3) stuff.
dnl
AC_DEFUN([UC_UDPOSIX],
[dnl
AC_REQUIRE([UC_PROG_CC])
AC_REQUIRE([UC_PROG_CC_MAKEDEPEND])
AC_REQUIRE([UC_PROG_CPP])
AC_REQUIRE([UC_CONST])
AC_REQUIRE([UC_VOLATILE])
AC_REQUIRE([UC_SIGNED])
AC_REQUIRE([UC_PROTOTYPES])
AC_REQUIRE([UC_VARIADIC_FUNCTIONS])
AC_REQUIRE([UC_MAKESTRING])
AC_REQUIRE([UC_GLUE])
AC_REQUIRE([UC_VOIDP])
UC_CONFIG_HEADER(port/misc/udposix.h)
UC_ENSURE(PORT_MANIFEST, udposix.h.in)
])
dnl Check for a function declaration in a header file.
dnl
AC_DEFUN([UC_FUNC_DECL], [dnl
AC_CHECK_HEADER(translit($1, <>),
[dnl Header-file found:
AC_MSG_CHECKING(C header file $1 for function $2())
AC_TRY_COMPILE([#include $1
extern struct {int a; int b;} *$2();
],
,
[dnl
AC_MSG_RESULT(undeclared)
UC_REPLACE([UD_NO_[]UC_UPPERCASE($2)_DECL],1)
],
[AC_MSG_RESULT(declared)]
)dnl
], dnl Header-file not found:
[
UC_REPLACE([UD_NO_[]UC_UPPERCASE($2)_DECL],1)
]) dnl
])
dnl Check for a function.
dnl
AC_DEFUN([UC_FUNC], [dnl
AC_REPLACE_FUNCS($2)dnl
UC_FUNC_DECL($1, $2)dnl
])
dnl Check for a type definition.
dnl The following line, which was in the previous version of this macro:
dnl typedef void $2;
dnl didn't cause the ip26-irix64_6 cc compiler to error-exit.
dnl So we next tried something else (typedef/variable namespace collision):
dnl int $2;
dnl Unfortunately, this didn't cause the VAX ULTRIX 4.4 /bin/cc to
dnl error-exit. So now we try it only if grep can't find the typedef.
dnl
AC_DEFUN([UC_TYPEDEF], [dnl
AC_REQUIRE([UC_PROG_CPP]) dnl
AC_CHECK_HEADER(translit($1, <>),
found=yes,
found=no)
case $found in
yes)
AC_MSG_CHECKING(C header file $1 for typedef $2)
echo '#include $1' >conftest.c
if ($CPP conftest.c | grep $2 >/dev/null) 2>&5; then
AC_MSG_RESULT(declared)
rm conftest.c
else
AC_TRY_COMPILE([#include $1
int $2;
],
,
[
AC_MSG_RESULT(undeclared)
AC_DEFINE([UD_NO_[]UC_C_MACRONAME($1[]_$2)])
],
[AC_MSG_RESULT(declared)]
)
fi
;;
no)
AC_DEFINE([UD_NO_[]UC_C_MACRONAME($1[]_$2)])
;;
esac
])
dnl Check for a structure definition.
dnl
AC_DEFUN([UC_STRUCT], [dnl
AC_MSG_CHECKING(C header file $1 for structure $2)
AC_TRY_COMPILE([#include $1
struct $2 {char *foo;};
],
,
[
AC_MSG_RESULT(undeclared)
AC_DEFINE([UD_NO_[]UC_UPPERCASE($2)[]_STRUCT])
],
[AC_MSG_RESULT(declared)]
)dnl
])
dnl Ensure a macro definition.
dnl
AC_DEFUN([UC_MACRO], [dnl
AC_MSG_CHECKING(C header file $1 for macro $2)
AC_TRY_COMPILE(
[
#include $1
#ifdef $2
error
#endif
],
,
[AC_MSG_RESULT(undefined)],
[AC_MSG_RESULT(defined)]
) dnl
])
dnl Check for a library. It would have been nice to see if a compile-link-
dnl execute sequence would have worked (via AC_TRY_RUN) but, with dynamic
dnl libraries under SunOS, the link and execution fail due to unresolved
dnl references. Ergo, we just check for the regular `.a' file.
dnl
AC_DEFUN([UC_TEST_LIB], [dnl
if test -z "$$1"; then
for dir in $2; do
for name in $3; do
if test -r $dir/lib$name.a; then
$1="-L$dir -l$name"
break 2
fi
done
done
if test -z "$$1"; then
UC_NEED_VALUE($1, [$4 library], $5)dnl
fi
fi
AC_SUBST($1)dnl
])
dnl Set up for using udport/ulog.*
dnl
AC_DEFUN([UC_PORT_ULOG], [dnl
UC_ENSURE(PORT_MANIFEST, ulog.c ulog.h inetutil.c inetutil.h)dnl
])
dnl Check for Unidata threads.
dnl
AC_DEFUN([UC_UTHREADS], [dnl
AC_REQUIRE([UC_UDPOSIX_SIGNAL])dnl
AC_REQUIRE([UC_UDPOSIX_TIME])dnl
UC_ENSURE(PORT_SUBDIRS, misc)dnl
UC_ENSURE(PORT_SUBDIRS, pthreads)dnl
UC_ENSURE(PORT_MANIFEST, uthread.c uthread.h.in nanosleep.c) dnl
UC_MAKEFILE(port/pthreads/Makefile) dnl
UC_MAKEFILE(port/pthreads/include/Makefile) dnl
UC_MAKEFILE(port/pthreads/include/pthread/Makefile) dnl
UC_MAKEFILE(port/pthreads/lib/Makefile) dnl
UC_MAKEFILE(port/pthreads/src/Makefile) dnl
UC_MAKEFILE(port/pthreads/src/gmalloc/Makefile) dnl
UC_CONFIG_HEADER(port/misc/uthread.h) dnl
CPP_THREADS=
case `uname -s` in
SunOS)
case `uname -r` in
4*)
UC_ENSURE(PORT_ALL, misc/all)
UC_ENSURE(PORT_INSTALL, misc/install)
UC_ENSURE(PORT_CLEAN, misc/clean)
UC_ENSURE(PORT_DISTCLEAN, misc/distclean)
UC_ENSURE(PORT_ALL, pthreads/all)
UC_ENSURE(PORT_INSTALL, pthreads/install)
UC_ENSURE(PORT_CLEAN, pthreads/clean)
UC_ENSURE(PORT_DISTCLEAN, pthreads/distclean)
UC_CONFIG_HEADER(port/pthreads/include/pthread/errno.h) dnl
UC_CONFIG_HEADER(port/pthreads/include/pthread/limits.h) dnl
UC_CONFIG_HEADER(port/pthreads/include/pthread/signal.h) dnl
UC_CONFIG_HEADER(port/pthreads/include/pthread/unistd.h) dnl
UC_SYSTEM_H_PATH(errno)dnl
UC_SYSTEM_H_PATH(limits)dnl
UC_SYSTEM_H_PATH(unistd)dnl
UC_DEFAULT(LD_UTHREADS, dnl
[-L[]UC_ABSPATH(port/pthreads/lib) -lpthreads])dnl
AC_DEFINE(UD_THREAD_FSU_6) dnl
CPP_THREADS=-I[]UC_ABSPATH(port/pthreads/include)
UD_OS_SUNOS_4=1
;;
5*)
AC_DEFINE(UD_THREAD_SUNOS_5) dnl
UC_STRUCT(<time.h>, timespec)dnl
AC_MSG_CHECKING(C header files <time.h> and <sys/time.h> for structure timespec)
AC_TRY_COMPILE([
# include <time.h>
# include <sys/time.h>
struct timespec {char *foo;};