-
Notifications
You must be signed in to change notification settings - Fork 106
/
Configure
executable file
·5213 lines (4831 loc) · 131 KB
/
Configure
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
#!/bin/sh
#
# Configure -- configure lsof
#
# See the LSOF_HLP here document for usage.
#
# See the lsof distribution file 00XCONFIG for information on setting
# environment variables for cross-configuring lsof -- e.g., for configuring
# for Linux 2.3 on a machine running 2.4. Marty Leisner suggested this
# support and provided the Linux Configure stanza modifications.
#
# When configuring for a particular dialect, <target-dialect>, this script
# requires that the subdirectory ./dialects/<target-dialect> contain a
# shell script, named $LSOF_MK, that places its source modules in this
# directory.
#
# $Id: Configure,v 1.166 2018/07/14 12:13:52 abe Exp $
# LSOF_CFLAGS_OVERRIDE=1 may be introduced through the environment to cause
# the library Makefile's CFLAGS definition to override any in the
# environment.
# LSOF_DISTRIBKVM may be introduced through the environment to specify the
# Sun4 kernel virtual memory type of distrib.cf
LSOF_F="ddev.c dfile.c dlsof.h dmnt.c dnode*.c dproc.c dproto.h dsock.c dstore.c dzfs.h kernelbase.h machine.h machine.h.old new_machine.h __lseek.s"
LSOF_HLP_BASE=./cfghlp.
LSOF_HLP=${LSOF_HLP_BASE}$$
# LSOF_LOCALSUFFIX may be introduced through the environment to select a local
# version of a Makefile. It is used as a suffix to $LSOF_MKF.
# LSOF_MAKE may be introduced through the environment to specify a path to the
# make command. It defaults to `which make`, if that is non-NULL;
# otherwise to the string "make".
if test "X$LSOF_MAKE" = "X" # {
then
LSOF_MAKE=`which make`
if test "X$LSOF_MAKE" = "X" # {
then
LSOF_MAKE=make
fi # }
fi # }
LSOF_MK=Mksrc
# LSOF_MKC is the dialect's Mksrc create command -- default "ln -s".
# LSOF_MKFC may be introduced though the environment to change the name
# used for the created make file.
if test "X$LSOF_MKFC" = "X" # {
then
LSOF_MKFC=Makefile
fi # }
LSOF_LIB=lib
LSOF_MKF=Makefile
LSOF_LIBMKF=Makefile
LSOF_LIBMKFSKEL=Makefile.skel
LSOF_VF=version
# Make sure no other variable important to Makefile construction is
# already set in the environment.
#
# $AFS_VICE locatiion of AFS VICE directory
# (default = /usr/vice)
# $LSOF_AFS AFS temporary
# $LSOF_AFS_NQ AFS-not-qualified flag
# $LSOF_AFSV AFS version
# $LSOF_AR archive command and its arguments for making the
# lsof library
# $LSOF_ARCH Unix dialect architecture as a string (may be
# supplied externally)
# $LSOF_CC C compiler name (may be supplied externally)
# $LSOF_CCV C compiler version (may be supplied externally)
# $LSOF_CDIR configuration directory
# $LSOF_CFGD depend options
# $LSOF_CFGDN depend file name
# $LSOF_CFGF C flags -- e.g., -D's
# $LSOF_CFGL last lsof library loader flags -- e.g., -l's
# $LSOF_CINFO Configure information for LSOF_CINFO in version.h
# $LSOF_CTFH Solaris 10 and above libctf.h status
# $LSOF_CTFL Solaris 10 and above -lctf status
# $LSOF_DEBUG Makefile's DEBUG string
# $LSOF_DINC include flags -- -I's
# $LSOF_DINC_ADD include flags status
# $LSOF_DOC special document (man page) directory path
# $LSOF_ERR internal error flag
# $LSOF_FCFGL first lsof library loader flags -- e.g., -l's
# that must precede $LSOF_LIB
# $LSOF_FBSD_ZFS FreeBSD $LSOF_FBSD_ZFS_MKF status
# $LSOF_FBSD_ZFS_CFGF FreeBSD ZFS configure flags
# $LSOF_FBSD_ZFS_MKF FreeBSD ZFS Makefile name
# $LSOF_FBSD_ZFS_SYS FreeBSD ZFS system sources location
# $LSOF_HOST host name (e.g., from uname -n)
# $LSOF_INCLUDE directory where header files are found
# (default = /usr/include)
# $LSOF_LD loader name if not $LSOF_CC
# $LSOF_LIB_NO if "N" don't configure the lsof library
# $LSOF_LOCALSUFFIX local suffix for Makefile
# $LSOF_NBSD_BUFQH NetBSD <sys/bufq.h> copy status
# $LSOF_NBSD_PTYFS NetBSD ${NETBSD_SYS}/sys/fs/ptyfs/ copy status
# $LSOF_N_UNIXV *BSD system's kernel file
# $LSOF_OPINC supplies additional -I/path arguments for the
# Makefile's CFLAGS.
# $LSOF_PL patch level
# $LSOF_RANLIB randomizing command for the lsof library
# $LSOF_RANLIB_SUP if non-NULL $LSOF_RANLIB was supplied
# $LSOF_SCRIPT_CALL Customize and Inventory scripts call status
# $LSOF_SPMKF Special Makefile name
# $LSOF_TGT canonical target abbreviation (shortest)
# $LSOF_TMP internal temporary
# $LSOF_TMP1 internal temporary
# $LSOF_TMP2 internal temporary
# $LSOF_TMP3 internal temporary
# $LSOF_TMP4 internal temporary
# $LSOF_TMP5 internal temporary
# $LSOF_TMP6 internal temporary
# $LSOF_TMPC_BASE base name for $LSOF_TMPC
# $LSOF_TMPC temporary C source file base name
# $LSOF_TSTBIGF big file capability (for $LSOF_TSTCFLG)
# $LSOF_TSTCC tests CC file
# $LSOF_TSTCFLG tests CFLAGS file
# $LSOF_TSTDFLG dialect-specific values for $LSOF_TSTCFLG
# $LSOF_TSTK64 status of 64 bit kernel (for $LSOF_TSTCFLG)
# $LSOF_TSTKMEM /dev/kmem usage status (for $LSOF_TSTCFLG)
# $LSOF_TSTLFF tests LDFLAGS file
# $LSOF_TSTLFLG tests LDFLAGS values
# $LSOF_TSTSUBD test subdirectory
# $LSOF_TSTVPATH test v_path state (for $LSOF_TSTCFLG)
# $LSOF_TSTXO test extra objects (for $LSOF_TSTXOC)
# $LSOF_TSTXOC test extra objects file
# $LSOF_UNSUP Lsof is unsupported on this dialect
# $LSOF_UNSUP2 Second message about lack of support
# $LSOF_VERS Unix dialect version as a decimal number (may
# be supplied externally)
# $LSOF_VSTR Unix dialect version as a string -- may be supplied
# externally
if test "X$AFS_VICE" = "X" # {
then
AFS_VICE="/usr/vice"
fi # }
LSOF_AFS=""
LSOF_AFS_NQ=""
LSOF_AFSV=""
if test "X$LSOF_ARCH" = "X" # {
then
LSOF_ARCH=""
fi # }
LSOF_CDIR=""
LSOF_CFGD=""
LSOF_CFGDN=""
LSOF_CINFO=""
LSOF_CTFH=0
LSOF_CTFL=0
LSOF_DEBUG=""
LSOF_DOC=""
LSOF_ERR=""
LSOF_FCFGL=""
LSOF_FBSD_ZFS=0
LSOF_FBSD_ZFS_CFGF=""
LSOF_FBSD_ZFS_MKF="Makefile.zfs"
LSOF_FBSD_ZFS_SYS=""
LSOF_HOST=""
if test "X$LSOF_INCLUDE" = "X" # {
then
LSOF_DINC=""
LSOF_INCLUDE="/usr/include"
else
LSOF_DINC="-I$LSOF_INCLUDE"
fi # }
LSOF_LD=""
LSOF_LIB_NO=""
LSOF_PL=""
if test "X$LSOF_RANLIB" = "X" # {
then
LSOF_RANLIB="ranlib"
LSOF_RANLIB_SUP=""
else
LSOF_RANLIB_SUP="Y"
fi # }
LSOF_SCRIPT_CALL="yes"
LSOF_SPMKF=""
LSOF_TMP1=""
LSOF_TMP2=""
LSOF_TMPC_BASE=./lsof_Configure_tmp_
LSOF_TMPC=${LSOF_TMPC_BASE}$$
LSOF_TSTBIGF=""
LSOF_TSTSUBD="./tests"
LSOF_TSTCC="${LSOF_TSTSUBD}/config.cc"
LSOF_TSTCFLG="${LSOF_TSTSUBD}/config.cflags"
LSOF_TSTDFLG=""
LSOF_TSTK64=0
LSOF_TSTKMEM=1
LSOF_TSTLFF="${LSOF_TSTSUBD}/config.ldflags"
LSOF_TSTLFLG=""
LSOF_TSTVPATH=0
LSOF_TSTXO=""
LSOF_TSTXOC="${LSOF_TSTSUBD}/config.xobj"
LSOF_UNSUP="WARNING: unsupported dialect or version"
LSOF_UNSUP2=""
if test "X$LSOF_VERS" = "X" # {
then
LSOF_VERS=""
fi # }
if test "X$LSOF_VSTR" = "X" # {
then
LSOF_VSTR=""
fi # }
# Establish echo type -- Berkeley or SYSV.
j=`echo -n ""`
if test "X$j" = "X-n "
then
EC="\c"
EO=""
else
EC=""
EO="-n"
fi
# Make sure temporary files are removed before an abnormal exit.
trap 'rm -f ${LSOF_HLP_BASE}* ${LSOF_TMPC_BASE}*; exit 1' 1 2 3 15
rm -f $LSOF_HLP
cat > $LSOF_HLP << LSOF_HLP
Usage: Configure <options> <target-dialect>
<options>: -clean : clean up previous configuration
-d|-dialects : display a list of supported dialect versions
-h|-help : display help information
-n : avoid AFS, customization, and inventory checks
<target-dialect> (****USE -d TO GET TESTED DIALECT VERSION NUMBERS****):
aix|aixgcc : IBM AIX xlc (aix) or gcc (aixgcc)
darwin : Apple Darwin
freebsd : FreeBSD
hpux|hpuxgcc : HP-UX cc (hpux) or gcc (hpuxgcc)
linux : Linux
netbsd : NetBSD
openbsd : OpenBSD
osr|sco : SCO OpenServer < 6.0.0, SCO developer's compiler
osrgcc|scogcc : SCO OpenServer < 6.0.0, gcc compiler
osr6 : SCO OpenServer 6.0.0, SCO compiler
solaris|solariscc : Solaris gcc (solaris) or cc (solariscc)
unixware|uw : SCO|Caldera UnixWare
LSOF_HLP
LSOF_TGT="no-target"
args=$#
while test $args -gt 0 # {
do
case $1 in # {
-clean)
if test -r $LSOF_MKFC # {
then
echo "$LSOF_MAKE -f $LSOF_MKFC clean"
$LSOF_MAKE -f $LSOF_MKFC clean
else
if test -r ${LSOF_LIB}/${LSOF_LIBMKF} # {
then
echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)"
(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)
else
if test -r ${LSOF_LIB}/${LSOF_LIBMKF}.skel # {
then
echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)"
(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)
fi # }
fi # }
fi # }
if test -r ${LSOF_TSTSUBD}/Makefile # {
then
echo "(cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)"
(cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)
else
echo '(cd ${LSOF_TSTSUBD}; rm *.o config.*)'
(cd ${LSOF_TSTSUBD}; rm *.o config.*)
fi # }
rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
echo rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h
echo "rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h"
rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h
echo "rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h"
rm -f opt_kdtrace.h opt_random.h
echo "rm -f opt_kdtrace.h opt_random.h"
rm -f lib/dialects/aix/aix5/j2/j2_snapshot.h
echo "rm -f lib/dialects/aix/aix5/j2/j2_snapshot.h"
rm -f dialects/sun/solaris10 # DEBUG -- for s10_44
echo "rm -f dialects/sun/solaris10" # DEBUG -- for s10_44
rm -f dialects/hpux/kmem/hpux_mount.h
echo "rm -f dialects/hpux/kmem/hpux_mount.h"
rm -rf lib/dialects/netbsd/include
echo "rm -rf lib/dialects/netbsd/include"
rm -f dialects/uw/uw7/vm/swap.h
echo "rm -f dialects/uw/uw7/vm/swap.h"
rm -f ${LSOF_LIB}/${LSOF_LIBMKF}
echo "rm -f ${LSOF_LIB}/${LSOF_LIBMKF}"
exit 0
;;
-d|-dialects)
if test -r ./00DIALECTS -a -r ./version # {
then
V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
echo "lsof $V has been *tested* on these UNIX dialect versions:"
cat 00DIALECTS
echo Although "$V hasn't been tested on other versions of these dialects,"
echo "it may work. Try \`Configure <dialect>\` and \`make\` to see."
rm -f $LSOF_HLP
exit 0
else
echo "Can't display UNIX dialect version information:"
if test ! -r ./00DIALECTS # {
then
echo " ./00DIALECTS is inaccessible."
fi # }
if test ! -r ./version # {
then
echo " ./version is inaccessible."
fi # }
rm -f $LSOF_HLP
exit 1
fi # }
;;
-h|-help) cat $LSOF_HLP
rm -f $LSOF_HLP
exit 0
;;
-n*)
LSOF_SCRIPT_CALL="no"
;;
*)
if test "X$LSOF_TGT" != "Xno-target" # {
then
echo "Only one dialect may be configured at a time."
echo 'Both "$LSOF_TGT" and "$1" were specified.'
cat $LSOF_HLP
rm -f $LSOF_HLP
exit 1
else
LSOF_TGT=$1
fi # }
;;
esac # }
shift
args=`expr $args - 1`
done # }
case $LSOF_TGT in # {
no-target)
echo "No target dialect was specified."
cat $LSOF_HLP
rm -f $LSOF_HLP
exit 1
;;
# Configure for AIX xlc and AIX gcc.
aix|aixgcc)
# AIXA stands for AIX architecture. It is assigned these values in this
# stanza:
#
# 0 The AIX version is < 5.0, or the AIX 5.0 architecture is
# Power and the kernel bit size is 32.
#
# 1 The AIX version is >= 5.0, the AIX architecture is Power,
# and the kernel bit size is 64.
#
# 2 The AIX version is >= 5.0 and the architecture is IA64.
if test "X$LSOF_RANLIB_SUP" = "X" # {
then
LSOF_RANLIB="@echo \\\\\\\\c" # AIX make doesn't like a null ${RANLIB}.
fi # }
if test "X$LSOF_VSTR" = "X" # {
then
# If the AIX version isn't pre-defined, determine it.
LSOF_TMP1=`uname -v`
if test "X$LSOF_TMP1" = "X5" # {
then
# If the AIX version is 5, build the version string with `uname -rv`
# output.
LSOF_VSTR=`uname -r | awk '{printf "5.%d.0.0\n",\$1}'`
echo "Uname reports the version is $LSOF_VSTR."
else
# See if oslevel can determine the version.
LSOF_TMP1=/usr/bin/oslevel
if test -x $LSOF_TMP1 # {
then
echo "Determining AIX version with $LSOF_TMP1."
echo "This may take a while, depending on your maintenance level."
LSOF_VSTR=`$LSOF_TMP1 | sed 's/[^0-9]*\([0-9\.]*\).*/\1/'`
echo "$LSOF_TMP1 reports the version is $LSOF_VSTR."
else
# If oslevel can't be used, build the version string with
# `uname -rv` and issue a warning.
LSOF_VSTR=`uname -rv | awk '{printf "%d.%d.0.0\n",\$2,\$1}'`
echo "WARNING: can't execute $LSOF_TMP1; uname -rv reports"
echo " the version is $LSOF_VSTR; edit CFGF in Makefile and"
echo " lib/Makefile to refine AIXV and LSOF_VSTR."
fi # }
fi # }
fi # }
if test "X$LSOF_VERS" = "X" # {
then
LSOF_VERS=`echo $LSOF_VSTR | sed 's/\.//g'`
fi # }
if test $LSOF_VERS -ge 4320 # {
then
LSOF_TSTBIGF=" "
fi # }
if test "X$LSOF_CC" = "X" # {
then
if test "X$LSOF_TGT" = "Xaixgcc" # {
then
LSOF_CC=gcc
LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
else
LSOF_CC=cc
fi # }
fi # }
LSOF_TGT="aix"
echo $LSOF_CC | grep gcc > /dev/null
if test $? -eq 0 # {
then
# Prevent use of gcc for AIX below 4.1.
if test $LSOF_VERS -lt 4100 # {
then
echo "********************************************************"
echo "* Sorry, but gcc can't be used to compile lsof for AIX *"
echo "* versions less than 4.1, because of possible kernel *"
echo "* structure alignment differences between it and xlc. *"
echo "********************************************************"
rm -f $LSOF_HLP
exit 1
fi # }
fi # }
# Test for AFS.
if test "X$AIX_HAS_AFS" != "X" # {
then
LSOF_AFS=$AIX_HAS_AFS
fi # }
if test "X$LSOF_AFS" != "Xno" # {
then
if test "X$LSOF_AFS" = "Xyes" -o -r ${AFS_VICE}/etc/ThisCell # {
then
if test "X$LSOF_AFS" != "Xyes" # {
then
if test "X$LSOF_SCRIPT_CALL" = "Xno" # {
then
if test -r ./AFSHeaders -a -r ./AFSVersion # {
then
LSOF_AFS="yes"
fi # }
else
if test ! -x ./AFSConfig # {
then
echo "Can't find or execute the AFSConfig script"
rm -f $LSOF_HLP
exit 1
fi # }
./AFSConfig
if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion # {
then
LSOF_AFS="yes"
fi # }
fi # }
fi # }
if test "X$LSOF_AFS" = "Xyes" # {
then
if test "X$LSOF_AFSV" = "X" # {
then
if test -r ./AFSVersion # {
then
LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
else
echo "!!!FATAL: no ./AFSVersion file. It should have been"
echo " created by a previous AFS configuration run."
rm -f $LSOF_HLP
exit 1
fi # }
fi # }
if test $LSOF_VERS -gt 4330 -o LSOF_AFSV -gt 305 # {
then
echo "!!!FATAL: Lsof does not support AFS on this combination of"
echo " AIX ($LSOF_VERS) and AFS ($LSOF_AFSV) versions."
echo " To disable AFS, set the value of the AIX_HAS_AFS"
echo " environment variable to \"no\"."
rm -f $LSOF_HLP
exit 1
else
LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
if test -r ${LSOF_INCLUDE}/sys/inttypes.h # {
then
grep "^typedef.*int16;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -DHASINT16TYPE"
fi # }
grep "^typedef.*u_int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -DHASUINT16TYPE"
fi # }
grep "^typedef.*int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -DHASINT32TYPE"
fi # }
fi # }
fi # }
fi # }
fi # }
fi # }
# Miscellaneous AIX tests
if test -d ${LSOF_INCLUDE}/nfs # {
then
LSOF_CFGF="$LSOF_CFGF -DHAS_NFS"
fi # }
echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
if test $? -eq 0 -a $LSOF_VERS -ge 4140 -a $LSOF_VERS -lt 5000 # {
then
LSOF_CFGL="$LSOF_CFGL -bnolibpath"
fi # }
if test -r ${LSOF_INCLUDE}/sys/socket.h # {
then
grep AF_INET6 ${LSOF_INCLUDE}/sys/socket.h > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
fi # }
fi # }
if test -r ${LSOF_INCLUDE}/sys/stat.h # {
then
grep stat64 ${LSOF_INCLUDE}/sys/stat.h > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -DHASSTAT64"
fi # }
fi # }
#DEBUG SANFS if test -r ${LSOF_INCLUDE}/sys/sanfs/sanfsnode.h??? # {
#DEBUG SANFS then
#DEBUG SANFS LSOF_CFGF="$LSOF_CFGF -DHAS_SANFS"
#DEBUG SANFS fi # }
if test $LSOF_VERS -ge 5000 # {
then
# This is AIX 5 or greater.
if test -d ${LSOF_INCLUDE}/j2 # {
then
# The AIX > 5.0 system has jfs2 support. Make the necesssary definitions
# and adjustments.
rm -f lib/dialects/aix/aix5/j2/j2_snapshot.h
(cd lib/dialects/aix/aix5/j2; ln -s private_j2_snapshot.h j2_snapshot.h)
LSOF_CFGF="$LSOF_CFGF -DHAS_JFS2"
LSOF_CFGF="$LSOF_CFGF -I`pwd`/lib/dialects/aix/aix5"
if test $LSOF_VERS -ge 5200 # {
then
if test -r ${LSOF_INCLUDE}/j2/j2_snapshot.h # {
then
# The system has its own j2_snapshot.h, so make sure the
# private lsof copy is discarded.
rm -f lib/dialects/aix/aix5/j2/j2_snapshot.h
fi # }
echo $LSOF_CC | grep gcc > /dev/null
if test $? -eq 0 # {
then
# Test gcc version for AIX 5.2.
LSOF_TMP1=`echo $LSOF_CCV | awk -F . '{printf "%d%02d",$1,$2}'`
if test $LSOF_TMP1 -ge 303 # {
then
# Add gcc >= 3.3 option to handle use of i_dev from the wInode
# anonymous structure reference in the JFS2 inode structure of
# <j2/j2_inode.h>.
LSOF_CFGF="$LSOF_CFGF -fms-extensions"
fi # }
fi #}
fi # }
fi # }
# Determine the AIX architecture type and set AIXA accordingly.
if test "X$AIX_ARCH" = "X" # {
then
uname -a | grep -i ia64 > /dev/null
if test $? -eq 0 # {
then
AIX_ARCH="ia64"
else
AIX_ARCH=""
fi # }
fi # }
if test "X$AIX_ARCH" = "Xia64" # {
then
# This is AIX >= 5 on ia64.
LSOF_TSTK64=1
echo $LSOF_CC | grep gcc > /dev/null
if test $? -eq 0 # {
then
# Quit if gcc was specified as the compiler, since the gcc options to
# do an ia64 lsof compilation are unknown.
echo "*************************************************************"
echo "* *"
echo "* !!!!!!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!!!!!!!! *"
echo "* *"
echo "* Gcc can't be used to compile lsof for AIX 5 and above on *"
echo "* the ia64 architecture. Consult lsof's FAQ (in the file *"
echo "* 00FAQ) for more information. *"
echo "* *"
echo "*************************************************************"
rm -f $LSOF_HLP
exit 1
fi # }
LSOF_TMP1=2
if test "X$LSOF_AR" = "X" # {
then
LSOF_AR="/usr/bin/ar cr"
fi # }
LSOF_CFGF="$LSOF_CFGF -q64"
LSOF_CFGL="$LSOF_CFGL -lelf"
else
# This is AIX >= 5 on Power architecture.
echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGL="$LSOF_CFGL -bnolibpath"
fi # }
if test "X$AIX_KERNBITS" = "X" # {
then
# The kernel bit size wasn't predefined. Determine it by compiling
# and executing a test program.
rm -f ${LSOF_TMPC}.*
echo "#include <sys/systemcfg.h>" > ${LSOF_TMPC}.c
echo 'int main(){ if (__KERNEL_32()) printf("32\\n");' >> ${LSOF_TMPC}.c
echo 'else if (__KERNEL_64()) printf("64\\n");' >> ${LSOF_TMPC}.c
echo 'else printf("0\\n");' >> ${LSOF_TMPC}.c
echo "return(0); }" >> ${LSOF_TMPC}.c
echo "Testing kernel bit size with $LSOF_CC"
$LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
if test ! -x ${LSOF_TMPC}.x # {
then
echo "!!!FATAL: can't compile test program, ${LSOF_TMPC}.c."
rm -f $LSOF_HLP rm -f ${LSOF_TMPC}.*
exit 1
fi # }
AIX_KERNBITS=`./${LSOF_TMPC}.x`
rm -f ${LSOF_TMPC}.*
fi # }
# Use the kernel bit size specification to select archiver and compiler
# options, and to update AIXA.
case $AIX_KERNBITS in # {
32)
if test "X$LSOF_AR" = "X" # {
then
LSOF_AR="/usr/bin/ar cr"
fi # }
LSOF_TMP1=0
;;
64)
if test "X$LSOF_AR" = "X" # {
then
LSOF_AR="/usr/bin/ar -X 64 -v -q"
fi # }
LSOF_TSTK64=1
LSOF_TMP1=1
echo $LSOF_CC | grep gcc > /dev/null
if test $? -eq 0 # {
then
LSOF_CFGF="$LSOF_CFGF -maix64"
else
LSOF_CFGF="$LSOF_CFGF -q64"
fi # }
;;
*)
echo "!!!FATAL: unrecognized kernel bit size: $AIX_KERNBITS"
rm -f $LSOF_HLP
exit 1
esac # }
# Put kernel bit size information in $LSOF_CINFO and $LSOF_CFGF.
echo "Kernel bit size: $AIX_KERNBITS"
LSOF_TMP2="${AIX_KERNBITS} bit kernel"
if test "X$LSOF_CINFO" != "X" # {
then
LSOF_CINFO="${LSOF_CINFO} ${LSOF_TMP2}"
else
LSOF_CINFO="${LSOF_TMP2}"
fi # }
LSOF_CFGF="$LSOF_CFGF -DAIX_KERNBITS=${AIX_KERNBITS}"
fi # }
LSOF_CFGF="$LSOF_CFGF -DAIXA=$LSOF_TMP1"
if test "X$LSOF_TSTDFLG" = "X" # {
then
LSOF_TSTDFLG="-DLT_AIXA=$LSOF_TMP1"
else
LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=$LSOF_TMP1"
fi # }
else
# AIX is < 5, so set AIXA accordingly.
LSOF_CFGF="$LSOF_CFGF -DAIXA=0"
if test "X$LSOF_TSTDFLG" = "X" # {
then
LSOF_TSTDFLG="-DLT_AIXA=0"
else
LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=0"
fi # }
fi #}
LSOF_CFGF="$LSOF_CFGF -DAIXV=$LSOF_VERS"
LSOF_DIALECT_DIR=aix
echo $LSOF_CC | grep gcc > /dev/null
if test $? -eq 0 # {
then
# Do gcc tests.
if test $LSOF_VERS -ge 4100 -a $LSOF_VERS -lt 4200 # {
then
if test "X$AIX_USHACK" = "X" # {
then
# Compile and run a gcc test program to evaluate the user structure.
rm -f ${LSOF_TMPC}.*
echo "#include <stddef.h>" > ${LSOF_TMPC}.c
echo "#include <sys/user.h>" >> ${LSOF_TMPC}.c
echo "int main(){exit((offsetof(struct user, U_irss) & 0x7) ? 1 : 0);}" >>${LSOF_TMPC}.c
echo "Testing user.h with $LSOF_CC"
$LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
if ! ${LSOF_TMPC}.x # {
then
LSOF_TMP1=1
else
LSOF_TMP1=0
fi # }
rm -f ${LSOF_TMPC}.*
else
if test "$AIX_USHACK" = "Y" -o "$AIX_USHACK" = "y" # {
then
LSOF_TMP1=1
else
LSOF_TMP1=0
fi # }
fi # }
if test ${LSOF_TMP1} -eq 1 # {
then
echo "Applying gcc AIX 4.1+ user struct alignment hack"
rm -rf ./dialects/aix/aix$LSOF_VERS
mkdir ./dialects/aix/aix$LSOF_VERS
mkdir ./dialects/aix/aix${LSOF_VERS}/sys
sed 's/U_irss\[/dummy_for_alignment, U_irss\[/' < ${LSOF_INCLUDE}/sys/user.h > ./dialects/aix/aix${LSOF_VERS}/sys/user.h
LSOF_CFGF="$LSOF_CFGF -U_LONG_LONG -I`pwd`/dialects/aix/aix$LSOF_VERS"
fi # }
fi # }
else
# Get xlc version number
rm -f ${LSOF_TMPC}.*
echo "int main(){}" > ${LSOF_TMPC}.c
echo "Getting version number of ${LSOF_CC}."
$LSOF_CC -c ${LSOF_TMPC}.c -I${LSOF_INCLUDE} -o ${LSOF_TMPC}.o -qlist > /dev/null 2>&1
LSOF_CCV=`head -1 ${LSOF_TMPC}.lst | sed 's/\(.*\) ---.*/\1/'`
rm ${LSOF_TMPC}.*
echo "The version is \"${LSOF_CCV}\"."
echo $LSOF_CCV | grep "Version [0-9]" > /dev/null
if test $? -eq 0 # {
then
LSOF_TMP=`echo $LSOF_CCV | sed 's/.*Version \([0-9]*\).*/\1/'`
if test "X$LSOF_TMP" != "X" -a $LSOF_TMP -ge 4 # {
then
if test $LSOF_TMP -ge 6 # {
then
LSOF_CFGF="$LSOF_CFGF -qmaxmem=-1"
else
LSOF_CFGF="$LSOF_CFGF -qmaxmem=16384"
fi # }
fi # }
fi # }
fi # }
if test $LSOF_VERS -ge 5300 # {
then
LSOF_UNSUP=""
fi # }
;;
# Configure for Apple Darwin.
darwin)
if test "X$LSOF_CC" = "X" # {
then
LSOF_CC=cc
LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
fi # }
if test "X$LSOF_VSTR" = "X" # {
then
LSOF_VSTR=`uname -r`
fi # }
if test "X$LSOF_VERS" = "X" # {
then
# If the Darwin / Mac OS X version isn't pre-defined, determine it.
case $LSOF_VSTR in # {
1.2*)
LSOF_VERS=120
;;
1.3*)
LSOF_VERS=130
;;
1.4*)
LSOF_VERS=140
;;
5.[012]*)
LSOF_VERS=500
;;
5.[3-9]*)
LSOF_VERS=530
;;
6.*)
LSOF_VERS=600
;;
7.*) # Mac OS X 10.3 (Panther)
LSOF_VERS=700
;;
8.*) # Mac OS X 10.4 (Tiger)
LSOF_VERS=800
;;
9.*) # Mac OS X 10.5 (Leopard)
LSOF_VERS=900
;;
10.*) # Mac OS X 10.6 (SnowLeopard)
LSOF_VERS=1000
;;
11.*) # Mac OS X 10.7 (Lion)
LSOF_VERS=1100
;;
12.*) # Mac OS X 10.8 (Mountain Lion)
LSOF_VERS=1200
;;
13.*) # Mac OS X 10.9 (Mavericks)
LSOF_VERS=1300
;;
14.*) # Mac OS X 10.10 (Yosemite)
LSOF_VERS=1400
;;
15.*) # Mac OS X 10.11 (El Capitan)
LSOF_VERS=1500
;;
16.*) # macOS 10.12 (Sierra)
LSOF_VERS=1600
;;
17.*) # macOS 10.13 (High Sierra)
LSOF_VERS=1700
;;
18.*) # macOS 10.14 (Mojave)
LSOF_VERS=1800
;;
19.*) # macOS 10.15 (Catalina)
LSOF_VERS=1900
;;
*)
echo Unknown Darwin release: `uname -r`
echo Assuming Darwin 19.0
LSOF_VERS=1900
;;
esac # }
fi # }
# Do Darwin version-specific stuff.
case $LSOF_VERS in # {
120|130)
LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h"
;;
140|500)
LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h"
;;
530)
LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv.h net/ndrv_var.h"
;;
600)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1="hfs/hfs.h hfs/hfs_catalog.h hfs/hfs_cnode.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h"
;;
700)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1="hfs/hfs.h hfs/hfs_catalog.h hfs/hfs_cnode.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h sys/eventvar.h"
;;
800)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1="net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h sys/eventvar.h sys/file_internal.h sys/mount_internal.h sys/proc_internal.h sys/vnode_internal.h"
;;
900|1000|1100|1200)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1=""
LSOF_UNSUP=""
LSOF_TSTBIGF=" " # enable LTbigf test
if test $LSOF_VERS -eq 900 # {
then
LSOF_CFGF="$LSOF_CFGF -DNEEDS_MACH_PORT_T"
fi # }
;;
1300|1400|1500|1600|1700|1800|1900)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1=""
LSOF_UNSUP=""
LSOF_TSTBIGF=" " # enable LTbigf test
;;
*)
echo "Unsupported Darwin version: $LSOF_VERS"
rm -f $LSOF_HLP
exit 1
;;
esac # }
LSOF_TMP2=""
LSOF_TMP3=""
LSOF_TMP4=""
LSOF_CFGF="$LSOF_CFGF -mdynamic-no-pic"
LSOF_CFGL="$LSOF_CFGL -lcurses"
# Test Darwin base.
if test "X$DARWIN_BASE" = "X" -o "X$DARWIN_BASE" = "Xlibproc" # {
then
LSOF_TMP5=""
if test $LSOF_VERS -ge 800 -o "X$DARWIN_BASE" = "Xlibproc" # {
then
if test -r ${LSOF_INCLUDE}/libproc.h # {
then
DARWIN_BASE="libproc"
else
if test -r ${LSOF_INCLUDE}/../local/include/libproc.h # {
then
DARWIN_BASE="libproc"
LSOF_TMP5="${LSOF_INCLUDE}/../local/include"
else
if test -r /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libproc.h # {
then
DARWIN_BASE="libproc"
LSOF_TMP5="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/"
else
echo "FATAL: can't find libproc.h"
rm -f $LSOF_HLP
exit 1
fi
fi # }
fi # }
else
# The default Darwin base is libproc
DARWIN_BASE="libproc"