3 # Configure -- configure lsof
5 # See the LSOF_HLP here document for usage.
7 # See the lsof distribution file 00XCONFIG for information on setting
8 # environment variables for cross-configuring lsof -- e.g., for configuring
9 # for Linux 2.3 on a machine running 2.4. Marty Leisner suggested this
10 # support and provided the Linux Configure stanza modifications.
12 # When configuring for a particular dialect, <target-dialect>, this script
13 # requires that the subdirectory ./dialects/<target-dialect> contain a
14 # shell script, named $LSOF_MK, that places its source modules in this
17 # $Id: Configure,v 1.164 2015/07/07 20:16:58 abe Exp $
19 # LSOF_CFLAGS_OVERRIDE=1 may be introduced through the environment to cause
20 # the library Makefile's CFLAGS definition to override any in the
23 # LSOF_DISTRIBKVM may be introduced through the environment to specify the
24 # Sun4 kernel virtual memory type of distrib.cf
26 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"
27 LSOF_HLP_BASE=./cfghlp.
28 LSOF_HLP=${LSOF_HLP_BASE}$$
30 # LSOF_LOCALSUFFIX may be introduced through the environment to select a local
31 # version of a Makefile. It is used as a suffix to $LSOF_MKF.
33 # LSOF_MAKE may be introduced through the environment to specify a path to the
34 # make command. It defaults to `which make`, if that is non-NULL;
35 # otherwise to the string "make".
37 if test "X$LSOF_MAKE" = "X" # {
39 LSOF_MAKE=`which make`
40 if test "X$LSOF_MAKE" = "X" # {
48 # LSOF_MKC is the dialect's Mksrc create command -- default "ln -s".
50 # LSOF_MKFC may be introduced though the environment to change the name
51 # used for the created make file.
53 if test "X$LSOF_MKFC" = "X" # {
61 LSOF_LIBMKFSKEL=Makefile.skel
65 # Make sure no other variable important to Makefile construction is
66 # already set in the environment.
68 # $AFS_VICE locatiion of AFS VICE directory
69 # (default = /usr/vice)
70 # $LSOF_AFS AFS temporary
71 # $LSOF_AFS_NQ AFS-not-qualified flag
72 # $LSOF_AFSV AFS version
73 # $LSOF_AR archive command and its arguments for making the
75 # $LSOF_ARCH Unix dialect architecture as a string (may be
76 # supplied externally)
77 # $LSOF_CC C compiler name (may be supplied externally)
78 # $LSOF_CCV C compiler version (may be supplied externally)
79 # $LSOF_CDIR configuration directory
80 # $LSOF_CFGD depend options
81 # $LSOF_CFGDN depend file name
82 # $LSOF_CFGF C flags -- e.g., -D's
83 # $LSOF_CFGL last lsof library loader flags -- e.g., -l's
84 # $LSOF_CINFO Configure information for LSOF_CINFO in version.h
85 # $LSOF_CTFH Solaris 10 and above libctf.h status
86 # $LSOF_CTFL Solaris 10 and above -lctf status
87 # $LSOF_DEBUG Makefile's DEBUG string
88 # $LSOF_DINC include flags -- -I's
89 # $LSOF_DINC_ADD include flags status
90 # $LSOF_DOC special document (man page) directory path
91 # $LSOF_ERR internal error flag
92 # $LSOF_FCFGL first lsof library loader flags -- e.g., -l's
93 # that must precede $LSOF_LIB
94 # $LSOF_FBSD_ZFS FreeBSD $LSOF_FBSD_ZFS_MKF status
95 # $LSOF_FBSD_ZFS_CFGF FreeBSD ZFS configure flags
96 # $LSOF_FBSD_ZFS_MKF FreeBSD ZFS Makefile name
97 # $LSOF_FBSD_ZFS_SYS FreeBSD ZFS system sources location
98 # $LSOF_HOST host name (e.g., from uname -n)
99 # $LSOF_INCLUDE directory where header files are found
100 # (default = /usr/include)
101 # $LSOF_LD loader name if not $LSOF_CC
102 # $LSOF_LIB_NO if "N" don't configure the lsof library
103 # $LSOF_LOCALSUFFIX local suffix for Makefile
104 # $LSOF_NBSD_BUFQH NetBSD <sys/bufq.h> copy status
105 # $LSOF_NBSD_PTYFS NetBSD ${NETBSD_SYS}/sys/fs/ptyfs/ copy status
106 # $LSOF_N_UNIXV *BSD system's kernel file
107 # $LSOF_OPINC supplies additional -I/path arguments for the
109 # $LSOF_PL patch level
110 # $LSOF_RANLIB randomizing command for the lsof library
111 # $LSOF_RANLIB_SUP if non-NULL $LSOF_RANLIB was supplied
112 # $LSOF_SCRIPT_CALL Customize and Inventory scripts call status
113 # $LSOF_SPMKF Special Makefile name
114 # $LSOF_TGT canonical target abbreviation (shortest)
115 # $LSOF_TMP internal temporary
116 # $LSOF_TMP1 internal temporary
117 # $LSOF_TMP2 internal temporary
118 # $LSOF_TMP3 internal temporary
119 # $LSOF_TMP4 internal temporary
120 # $LSOF_TMP5 internal temporary
121 # $LSOF_TMP6 internal temporary
122 # $LSOF_TMPC_BASE base name for $LSOF_TMPC
123 # $LSOF_TMPC temporary C source file base name
124 # $LSOF_TSTBIGF big file capability (for $LSOF_TSTCFLG)
125 # $LSOF_TSTCC tests CC file
126 # $LSOF_TSTCFLG tests CFLAGS file
127 # $LSOF_TSTDFLG dialect-specific values for $LSOF_TSTCFLG
128 # $LSOF_TSTK64 status of 64 bit kernel (for $LSOF_TSTCFLG)
129 # $LSOF_TSTKMEM /dev/kmem usage status (for $LSOF_TSTCFLG)
130 # $LSOF_TSTLFF tests LDFLAGS file
131 # $LSOF_TSTLFLG tests LDFLAGS values
132 # $LSOF_TSTSUBD test subdirectory
133 # $LSOF_TSTVPATH test v_path state (for $LSOF_TSTCFLG)
134 # $LSOF_TSTXO test extra objects (for $LSOF_TSTXOC)
135 # $LSOF_TSTXOC test extra objects file
136 # $LSOF_UNSUP Lsof is unsupported on this dialect
137 # $LSOF_UNSUP2 Second message about lack of support
138 # $LSOF_VERS Unix dialect version as a decimal number (may
139 # be supplied externally)
140 # $LSOF_VSTR Unix dialect version as a string -- may be supplied
143 if test "X$AFS_VICE" = "X" # {
150 if test "X$LSOF_ARCH" = "X" # {
165 LSOF_FBSD_ZFS_CFGF=""
166 LSOF_FBSD_ZFS_MKF="Makefile.zfs"
169 if test "X$LSOF_INCLUDE" = "X" # {
172 LSOF_INCLUDE="/usr/include"
174 LSOF_DINC="-I$LSOF_INCLUDE"
179 if test "X$LSOF_RANLIB" = "X" # {
186 LSOF_SCRIPT_CALL="yes"
190 LSOF_TMPC_BASE=./lsof_Configure_tmp_
191 LSOF_TMPC=${LSOF_TMPC_BASE}$$
193 LSOF_TSTSUBD="./tests"
194 LSOF_TSTCC="${LSOF_TSTSUBD}/config.cc"
195 LSOF_TSTCFLG="${LSOF_TSTSUBD}/config.cflags"
199 LSOF_TSTLFF="${LSOF_TSTSUBD}/config.ldflags"
203 LSOF_TSTXOC="${LSOF_TSTSUBD}/config.xobj"
204 LSOF_UNSUP="WARNING: unsupported dialect or version"
206 if test "X$LSOF_VERS" = "X" # {
210 if test "X$LSOF_VSTR" = "X" # {
215 # Establish echo type -- Berkeley or SYSV.
218 if test "X$j" = "X-n "
227 # Make sure temporary files are removed before an abnormal exit.
229 trap 'rm -f ${LSOF_HLP_BASE}* ${LSOF_TMPC_BASE}*; exit 1' 1 2 3 15
232 cat > $LSOF_HLP << LSOF_HLP
233 Usage: Configure <options> <target-dialect>
234 <options>: -clean : clean up previous configuration
235 -d|-dialects : display a list of supported dialect versions
236 -h|-help : display help information
237 -n : avoid AFS, customization, and inventory checks
238 <target-dialect> (****USE -d TO GET TESTED DIALECT VERSION NUMBERS****):
239 aix|aixgcc : IBM AIX xlc (aix) or gcc (aixgcc)
240 darwin : Apple Darwin
242 digital_unix|du : Digital UNIX
244 hpux|hpuxgcc : HP-UX cc (hpux) or gcc (hpuxgcc)
247 nextstep|next|ns|nxt : NEXTSTEP
249 openstep|os : OPENSTEP
250 osr|sco : SCO OpenServer < 6.0.0, SCO devloper's compiler
251 osrgcc|scogcc : SCO OpenServer < 6.0.0, gcc compiler
252 osr6 : SCO OpenServer 6.0.0, SCO compiler
253 solaris|solariscc : Solaris gcc (solaris) or cc (solariscc)
255 unixware|uw : SCO|Caldera UnixWare
261 while test $args -gt 0 # {
265 if test -r $LSOF_MKFC # {
267 echo "$LSOF_MAKE -f $LSOF_MKFC clean"
268 $LSOF_MAKE -f $LSOF_MKFC clean
270 if test -r ${LSOF_LIB}/${LSOF_LIBMKF} # {
272 echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)"
273 (cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)
275 if test -r ${LSOF_LIB}/${LSOF_LIBMKF}.skel # {
277 echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)"
278 (cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)
282 if test -r ${LSOF_TSTSUBD}/Makefile # {
284 echo "(cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)"
285 (cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)
287 echo '(cd ${LSOF_TSTSUBD}; rm *.o config.*)'
288 (cd ${LSOF_TSTSUBD}; rm *.o config.*)
290 rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
291 echo rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
292 rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h
293 echo "rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h"
294 rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h
295 echo "rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h"
297 echo "rm -f opt_kdtrace.h"
298 rm -f dialects/aix/aix5/j2/j2_snapshot.h
299 echo "rm -f dialects/aix/aix5/j2/j2_snapshot.h"
300 rm -f dialects/sun/solaris10 # DEBUG -- for s10_44
301 echo "rm -f dialects/sun/solaris10" # DEBUG -- for s10_44
302 rm -f dialects/du/du5_sys_malloc.h
303 echo "rm -f dialects/du/du5_sys_malloc.h"
304 rm -f dialects/hpux/kmem/hpux_mount.h
305 echo "rm -f dialects/hpux/kmem/hpux_mount.h"
306 rm -rf dialects/n+obsd/include
307 echo "rm -rf dialects/n+obsd/include"
308 rm -f dialects/uw/uw7/vm/swap.h
309 echo "rm -f dialects/uw/uw7/vm/swap.h"
310 rm -f ${LSOF_LIB}/${LSOF_LIBMKF}
311 echo "rm -f ${LSOF_LIB}/${LSOF_LIBMKF}"
316 if test -r ./00DIALECTS -a -r ./version # {
318 V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
319 echo "lsof $V has been *tested* on these UNIX dialect versions:"
321 echo Although "$V hasn't been tested on other versions of these dialects,"
322 echo "it may work. Try \`Configure <dialect>\` and \`make\` to see."
326 echo "Can't display UNIX dialect version information:"
327 if test ! -r ./00DIALECTS # {
329 echo " ./00DIALECTS is inaccessible."
331 if test ! -r ./version # {
333 echo " ./version is inaccessible."
340 -h|-help) cat $LSOF_HLP
346 LSOF_SCRIPT_CALL="no"
350 if test "X$LSOF_TGT" != "Xno-target" # {
352 echo "Only one dialect may be configured at a time."
353 echo 'Both "$LSOF_TGT" and "$1" were specified.'
363 args=`expr $args - 1`
366 case $LSOF_TGT in # {
368 echo "No target dialect was specified."
374 # Configure for AIX xlc and AIX gcc.
378 # AIXA stands for AIX architecture. It is assigned these values in this
381 # 0 The AIX version is < 5.0, or the AIX 5.0 architecture is
382 # Power and the kernel bit size is 32.
384 # 1 The AIX version is >= 5.0, the AIX architecture is Power,
385 # and the kernel bit size is 64.
387 # 2 The AIX version is >= 5.0 and the architecture is IA64.
389 if test "X$LSOF_RANLIB_SUP" = "X" # {
391 LSOF_RANLIB="@echo \\\\\\\\c" # AIX make doesn't like a null ${RANLIB}.
393 if test "X$LSOF_VSTR" = "X" # {
396 # If the AIX version isn't pre-defined, determine it.
399 if test "X$LSOF_TMP1" = "X5" # {
402 # If the AIX version is 5, build the version string with `uname -rv`
405 LSOF_VSTR=`uname -r | awk '{printf "5.%d.0.0\n",\$1}'`
406 echo "Uname reports the version is $LSOF_VSTR."
409 # See if oslevel can determine the version.
411 LSOF_TMP1=/usr/bin/oslevel
412 if test -x $LSOF_TMP1 # {
414 echo "Determining AIX version with $LSOF_TMP1."
415 echo "This may take a while, depending on your maintenance level."
416 LSOF_VSTR=`$LSOF_TMP1 | sed 's/[^0-9]*\([0-9\.]*\).*/\1/'`
417 echo "$LSOF_TMP1 reports the version is $LSOF_VSTR."
420 # If oslevel can't be used, build the version string with
421 # `uname -rv` and issue a warning.
423 LSOF_VSTR=`uname -rv | awk '{printf "%d.%d.0.0\n",\$2,\$1}'`
424 echo "WARNING: can't execute $LSOF_TMP1; uname -rv reports"
425 echo " the version is $LSOF_VSTR; edit CFGF in Makefile and"
426 echo " lib/Makefile to refine AIXV and LSOF_VSTR."
430 if test "X$LSOF_VERS" = "X" # {
432 LSOF_VERS=`echo $LSOF_VSTR | sed 's/\.//g'`
434 if test $LSOF_VERS -ge 4320 # {
438 if test "X$LSOF_CC" = "X" # {
440 if test "X$LSOF_TGT" = "Xaixgcc" # {
443 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
449 echo $LSOF_CC | grep gcc > /dev/null
453 # Prevent use of gcc for AIX below 4.1.
455 if test $LSOF_VERS -lt 4100 # {
457 echo "********************************************************"
458 echo "* Sorry, but gcc can't be used to compile lsof for AIX *"
459 echo "* versions less than 4.1, because of possible kernel *"
460 echo "* structure alignment differences between it and xlc. *"
461 echo "********************************************************"
469 if test "X$AIX_HAS_AFS" != "X" # {
471 LSOF_AFS=$AIX_HAS_AFS
473 if test "X$LSOF_AFS" != "Xno" # {
475 if test "X$LSOF_AFS" = "Xyes" -o -r ${AFS_VICE}/etc/ThisCell # {
477 if test "X$LSOF_AFS" != "Xyes" # {
479 if test "X$LSOF_SCRIPT_CALL" = "Xno" # {
481 if test -r ./AFSHeaders -a -r ./AFSVersion # {
486 if test ! -x ./AFSConfig # {
488 echo "Can't find or execute the AFSConfig script"
493 if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion # {
499 if test "X$LSOF_AFS" = "Xyes" # {
501 if test "X$LSOF_AFSV" = "X" # {
503 if test -r ./AFSVersion # {
505 LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
507 echo "!!!FATAL: no ./AFSVersion file. It should have been"
508 echo " created by a previous AFS configuration run."
513 if test $LSOF_VERS -gt 4330 -o LSOF_AFSV -gt 305 # {
515 echo "!!!FATAL: Lsof does not support AFS on this combination of"
516 echo " AIX ($LSOF_VERS) and AFS ($LSOF_AFSV) versions."
517 echo " To disable AFS, set the value of the AIX_HAS_AFS"
518 echo " environment variable to \"no\"."
522 LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
523 LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
524 if test -r ${LSOF_INCLUDE}/sys/inttypes.h # {
526 grep "^typedef.*int16;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
529 LSOF_CFGF="$LSOF_CFGF -DHASINT16TYPE"
531 grep "^typedef.*u_int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
534 LSOF_CFGF="$LSOF_CFGF -DHASUINT16TYPE"
536 grep "^typedef.*int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
539 LSOF_CFGF="$LSOF_CFGF -DHASINT32TYPE"
547 # Miscellaneous AIX tests
549 if test -d ${LSOF_INCLUDE}/nfs # {
551 LSOF_CFGF="$LSOF_CFGF -DHAS_NFS"
553 echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
554 if test $? -eq 0 -a $LSOF_VERS -ge 4140 -a $LSOF_VERS -lt 5000 # {
556 LSOF_CFGL="$LSOF_CFGL -bnolibpath"
558 if test -r ${LSOF_INCLUDE}/sys/socket.h # {
560 grep AF_INET6 ${LSOF_INCLUDE}/sys/socket.h > /dev/null
563 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
566 if test -r ${LSOF_INCLUDE}/sys/stat.h # {
568 grep stat64 ${LSOF_INCLUDE}/sys/stat.h > /dev/null
571 LSOF_CFGF="$LSOF_CFGF -DHASSTAT64"
574 #DEBUG SANFS if test -r ${LSOF_INCLUDE}/sys/sanfs/sanfsnode.h??? # {
576 #DEBUG SANFS LSOF_CFGF="$LSOF_CFGF -DHAS_SANFS"
578 if test $LSOF_VERS -ge 5000 # {
581 # This is AIX 5 or greater.
583 if test -d ${LSOF_INCLUDE}/j2 # {
586 # The AIX > 5.0 system has jfs2 support. Make the necesssary definitions
589 rm -f dialects/aix/aix5/j2/j2_snapshot.h
590 (cd dialects/aix/aix5/j2; ln -s private_j2_snapshot.h j2_snapshot.h)
591 LSOF_CFGF="$LSOF_CFGF -DHAS_JFS2"
592 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/aix/aix5"
593 if test $LSOF_VERS -ge 5200 # {
595 if test -r ${LSOF_INCLUDE}/j2/j2_snapshot.h # {
598 # The system has its own j2_snapshot.h, so make sure the
599 # private lsof copy is discarded.
601 rm -f dialects/aix/aix5/j2/j2_snapshot.h
603 echo $LSOF_CC | grep gcc > /dev/null
607 # Test gcc version for AIX 5.2.
609 LSOF_TMP1=`echo $LSOF_CCV | awk -F . '{printf "%d%02d",$1,$2}'`
610 if test $LSOF_TMP1 -ge 303 # {
613 # Add gcc >= 3.3 option to handle use of i_dev from the wInode
614 # anonymous structure reference in the JFS2 inode structure of
617 LSOF_CFGF="$LSOF_CFGF -fms-extensions"
623 # Determine the AIX architecture type and set AIXA accordingly.
625 if test "X$AIX_ARCH" = "X" # {
627 uname -a | grep -i ia64 > /dev/null
635 if test "X$AIX_ARCH" = "Xia64" # {
638 # This is AIX >= 5 on ia64.
641 echo $LSOF_CC | grep gcc > /dev/null
645 # Quit if gcc was specified as the compiler, since the gcc options to
646 # do an ia64 lsof compilation are unknown.
648 echo "*************************************************************"
650 echo "* !!!!!!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!!!!!!!! *"
652 echo "* Gcc can't be used to compile lsof for AIX 5 and above on *"
653 echo "* the ia64 architecture. Consult lsof's FAQ (in the file *"
654 echo "* 00FAQ) for more information. *"
656 echo "*************************************************************"
661 if test "X$LSOF_AR" = "X" # {
663 LSOF_AR="/usr/bin/ar cr"
665 LSOF_CFGF="$LSOF_CFGF -q64"
666 LSOF_CFGL="$LSOF_CFGL -lelf"
669 # This is AIX >= 5 on Power architecture.
671 echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
674 LSOF_CFGL="$LSOF_CFGL -bnolibpath"
676 if test "X$AIX_KERNBITS" = "X" # {
679 # The kernel bit size wasn't predefined. Determine it by compiling
680 # and executing a test program.
683 echo "#include <sys/systemcfg.h>" > ${LSOF_TMPC}.c
684 echo 'main(){ if (__KERNEL_32()) printf("32\\n");' >> ${LSOF_TMPC}.c
685 echo 'else if (__KERNEL_64()) printf("64\\n");' >> ${LSOF_TMPC}.c
686 echo 'else printf("0\\n");' >> ${LSOF_TMPC}.c
687 echo "return(0); }" >> ${LSOF_TMPC}.c
688 echo "Testing kernel bit size with $LSOF_CC"
689 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
690 if test ! -x ${LSOF_TMPC}.x # {
692 echo "!!!FATAL: can't compile test program, ${LSOF_TMPC}.c."
693 rm -f $LSOF_HLP rm -f ${LSOF_TMPC}.*
696 AIX_KERNBITS=`./${LSOF_TMPC}.x`
700 # Use the kernel bit size specification to select archiver and compiler
701 # options, and to update AIXA.
703 case $AIX_KERNBITS in # {
705 if test "X$LSOF_AR" = "X" # {
707 LSOF_AR="/usr/bin/ar cr"
712 if test "X$LSOF_AR" = "X" # {
714 LSOF_AR="/usr/bin/ar -X 64 -v -q"
718 echo $LSOF_CC | grep gcc > /dev/null
721 LSOF_CFGF="$LSOF_CFGF -maix64"
723 LSOF_CFGF="$LSOF_CFGF -q64"
727 echo "!!!FATAL: unrecognized kernel bit size: $AIX_KERNBITS"
732 # Put kernel bit size information in $LSOF_CINFO and $LSOF_CFGF.
734 echo "Kernel bit size: $AIX_KERNBITS"
735 LSOF_TMP2="${AIX_KERNBITS} bit kernel"
736 if test "X$LSOF_CINFO" != "X" # {
738 LSOF_CINFO="${LSOF_CINFO} ${LSOF_TMP2}"
740 LSOF_CINFO="${LSOF_TMP2}"
742 LSOF_CFGF="$LSOF_CFGF -DAIX_KERNBITS=${AIX_KERNBITS}"
744 LSOF_CFGF="$LSOF_CFGF -DAIXA=$LSOF_TMP1"
745 if test "X$LSOF_TSTDFLG" = "X" # {
747 LSOF_TSTDFLG="-DLT_AIXA=$LSOF_TMP1"
749 LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=$LSOF_TMP1"
753 # AIX is < 5, so set AIXA accordingly.
755 LSOF_CFGF="$LSOF_CFGF -DAIXA=0"
756 if test "X$LSOF_TSTDFLG" = "X" # {
758 LSOF_TSTDFLG="-DLT_AIXA=0"
760 LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=0"
763 LSOF_CFGF="$LSOF_CFGF -DAIXV=$LSOF_VERS"
765 echo $LSOF_CC | grep gcc > /dev/null
771 if test $LSOF_VERS -ge 4100 -a $LSOF_VERS -lt 4200 # {
773 if test "X$AIX_USHACK" = "X" # {
776 # Compile and run a gcc test program to evaluate the user structure.
779 echo "#include <stddef.h>" > ${LSOF_TMPC}.c
780 echo "#include <sys/user.h>" >> ${LSOF_TMPC}.c
781 echo "main(){exit((offsetof(struct user, U_irss) & 0x7) ? 1 : 0);}" >>${LSOF_TMPC}.c
782 echo "Testing user.h with $LSOF_CC"
783 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
784 if ! ${LSOF_TMPC}.x # {
792 if test "$AIX_USHACK" = "Y" -o "$AIX_USHACK" = "y" # {
799 if test ${LSOF_TMP1} -eq 1 # {
801 echo "Applying gcc AIX 4.1+ user struct alignment hack"
802 rm -rf ./dialects/aix/aix$LSOF_VERS
803 mkdir ./dialects/aix/aix$LSOF_VERS
804 mkdir ./dialects/aix/aix${LSOF_VERS}/sys
805 sed 's/U_irss\[/dummy_for_alignment, U_irss\[/' < ${LSOF_INCLUDE}/sys/user.h > ./dialects/aix/aix${LSOF_VERS}/sys/user.h
806 LSOF_CFGF="$LSOF_CFGF -U_LONG_LONG -I`pwd`/dialects/aix/aix$LSOF_VERS"
811 # Get xlc version number
814 echo "main(){}" > ${LSOF_TMPC}.c
815 echo "Getting version number of ${LSOF_CC}."
816 $LSOF_CC -c ${LSOF_TMPC}.c -I${LSOF_INCLUDE} -o ${LSOF_TMPC}.o -qlist > /dev/null 2>&1
817 LSOF_CCV=`head -1 ${LSOF_TMPC}.lst | sed 's/\(.*\) ---.*/\1/'`
819 echo "The version is \"${LSOF_CCV}\"."
820 echo $LSOF_CCV | grep "Version [0-9]" > /dev/null
823 LSOF_TMP=`echo $LSOF_CCV | sed 's/.*Version \([0-9]*\).*/\1/'`
824 if test "X$LSOF_TMP" != "X" -a $LSOF_TMP -ge 4 # {
826 if test $LSOF_TMP -ge 6 # {
828 LSOF_CFGF="$LSOF_CFGF -qmaxmem=-1"
830 LSOF_CFGF="$LSOF_CFGF -qmaxmem=16384"
835 if test $LSOF_VERS -ge 5300 # {
841 # Configure for Apple Darwin.
844 if test "X$LSOF_CC" = "X" # {
847 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
849 if test "X$LSOF_VSTR" = "X" # {
853 if test "X$LSOF_VERS" = "X" # {
856 # If the Darwin / Mac OS X version isn't pre-defined, determine it.
858 case $LSOF_VSTR in # {
877 7.*) # Mac OS X 10.3 (Panther)
880 8.*) # Mac OS X 10.4 (Tiger)
883 9.*) # Mac OS X 10.5 (Leopard)
886 10.*) # Mac OS X 10.6 (SnowLeopard)
889 11.*) # Mac OS X 10.7 (Lion)
892 12.*) # Mac OS X 10.8 (Mountain Lion)
895 13.*) # Next Mac OS X
899 echo Unknown Darwin release: `uname -r`
900 echo Assuming Darwin 12.0
906 # Do Darwin version-specific stuff.
908 case $LSOF_VERS in # {
910 LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h"
913 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"
916 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"
919 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
920 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"
923 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
924 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"
927 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
928 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"
931 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
934 LSOF_TSTBIGF=" " # enable LTbigf test
935 if test $LSOF_VERS -eq 900 # {
937 LSOF_CFGF="$LSOF_CFGF -DNEEDS_MACH_PORT_T"
941 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
945 echo "Unsupported Darwin version: $LSOF_VERS"
953 LSOF_CFGF="$LSOF_CFGF -mdynamic-no-pic"
954 LSOF_CFGL="$LSOF_CFGL -lcurses"
956 if test "X$DARWIN_XNUDIR" != "X" # {
958 LSOF_TMP2="${DARWIN_XNUDIR}/bsd"
959 LSOF_TMP3="${DARWIN_XNUDIR}/osfmk"
962 LSOF_TMP2="${DARWIN_XNU_HEADERS}/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders"
963 LSOF_TMP3="${DARWIN_XNU_HEADERS}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders"
965 if test "X$DARWIN_XNU_HEADERS" != "X" # {
967 LSOF_TMP4="${DARWIN_XNU_HEADERS}/usr/include"
973 if test "X$DARWIN_BASE" = "X" -o "X$DARWIN_BASE" = "Xlibproc" # {
976 if test $LSOF_VERS -ge 800 -o "X$DARWIN_BASE" = "Xlibproc" # {
978 if test -r ${LSOF_INCLUDE}/libproc.h # {
980 DARWIN_BASE="libproc"
982 if test -r ${LSOF_INCLUDE}/../local/include/libproc.h # {
984 DARWIN_BASE="libproc"
985 LSOF_TMP5="-I${LSOF_INCLUDE}/../local/include"
987 echo "FATAL: can't find libproc.h"
994 # The default Darwin base is /dev/kmem.
996 DARWIN_BASE="/dev/kmem"
999 if test "X$DARWIN_BASE" = "Xlibproc" # {
1002 # Configure for libproc-based Darwin lsof.
1004 echo "Configuring libproc-based Darwin lsof"
1005 LSOF_CINFO="libproc-based"
1006 LSOF_DIALECT_DIR=darwin/libproc
1007 if test $LSOF_VERS -lt 1000 # {
1009 LSOF_CFGL="$LSOF_CFGL -lproc"
1012 LSOF_DINC="$LSOF_DINC $LSOF_TMP5"
1013 if test ! -r ${LSOF_INCLUDE}/sys/proc_info.h # {
1015 if test "X$LSOF_TMP5" = "X" -o ! -r ${LSOF_TMP5}/sys/proc_info.h # {
1017 echo "FATAL: can't find sys/proc_info.h"
1023 # Add header file paths for libproc-based Darwin lsof.
1025 for i in $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE # {
1027 if test -d $i -a "X$i" != "X/usr/include" # {
1029 LSOF_DINC="$LSOF_DINC -I${i}"
1033 # Do other libproc-based Darwin lsof setups.
1035 if test -r ${LSOF_INCLUDE}/utmpx.h # {
1037 LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
1040 if test "X$DARWIN_BASE" != "X/dev/kmem" # {
1042 echo "Darwin base unrecognized: $DARWIN_BASE"
1047 # Configure for /dev/kmem-based Darwin lsof.
1049 echo "Configuring /dev/kmem-based Darwin lsof"
1050 LSOF_CINFO="/dev/kmem-based"
1051 LSOF_DIALECT_DIR=darwin/kmem
1053 # Make sure needed /dev/kmem-base XNU Darwin kernel header files are
1057 for i in $LSOF_TMP1 # {
1060 for j in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE # {
1062 if test "X${j}" != "X" -a -r ${j}/${i} # {
1068 if test $LSOF_TMP6 -ne 1 # {
1070 if test "X$LSOF_TMP5" = "X" # {
1074 LSOF_TMP5="$LSOF_TMP5 $i"
1078 if test "X$LSOF_TMP5" != "X" # {
1081 # If any Darwin XNU kernel header files are missing, call the
1082 # get-hdr-loc.sh script to find the path.
1084 LSOF_TMP6=`pwd`/dialects/darwin/get-hdr-loc.sh
1085 if test ! -x $LSOF_TMP6 # {
1087 echo "FATAL: can't execute: $LSOF_TMP6"
1091 DARWIN_XNUDIR=`$LSOF_TMP6 $LSOF_TMP5`
1092 if test $? -ne 0 # {
1094 echo "FATAL: $LSOF_TMP6 returns: $DARWIN_XNUDIR"
1098 LSOF_TMP2="${DARWIN_XNUDIR}/bsd"
1099 LSOF_TMP3="${DARWIN_XNUDIR}/osfmk"
1103 # Add header file paths for /dev/kmem-based Darwin lsof.
1105 for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE # {
1107 if test -d $i -a "X$i" != "X/usr/include" # {
1109 LSOF_DINC="$LSOF_DINC -I${i}"
1113 # Make conditional feature definitions for /dev/kmem-based Darwin lsof.
1115 for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE # {
1117 if test "X${i}" != "X" -a -r ${i}/sys/namei.h # {
1119 grep -q nc_vpid ${i}/sys/namei.h
1120 if test $? -eq 0 # {
1122 LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
1127 for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE # {
1129 if test "X${i}" != "X" # {
1131 if test $LSOF_VERS -ge 800 # {
1133 if test -r ${i}/sys/file_internal.h # {
1135 grep -q DTYPE_KQUEUE ${i}/sys/file_internal.h
1136 if test $? -eq 0 # {
1138 LSOF_CFGF="$LSOF_CFGF -DHASKQUEUE"
1143 if test $LSOF_VERS -ge 700 # {
1145 if test -r ${i}/sys/file.h # {
1147 grep -q DTYPE_KQUEUE ${i}/sys/file.h
1148 if test $? -eq 0 # {
1150 LSOF_CFGF="$LSOF_CFGF -DHASKQUEUE"
1158 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS"
1160 LSOF_CFGF="$LSOF_CFGF -DDARWINV=$LSOF_VERS"
1161 LSOF_CFLAGS_OVERRIDE=1
1164 # Configure for DEC OSF/1, Digital UNIX, or Tru64 UNIX.
1166 digital_unix|du|decosf|tru64)
1170 if test "X$LSOF_DINC" = "X" # {
1172 LSOF_DINC="-I/usr/include"
1174 if test "X$LSOF_VSTR" = "X" # {
1176 LSOF_VSTR=`uname -r`
1178 if test "X$LSOF_VERS" = "X" # {
1181 # If the DEC OSF/1, Digital UNIX, or Tru64 UNIX version isn't
1182 # predefined, determine it.
1184 case $LSOF_VSTR in # {
1195 LSOF_TSTXO="../lib/snpf.o"
1205 echo "WARNING: unknown version; assuming version is 2.0"
1211 # Do DEC OSF/1, Digital UNIX, or Tru64 UNIX version specific stuff.
1213 case $LSOF_VERS in # {
1215 LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
1219 LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
1221 LSOF_TMP2=-DUSELOCALREADDIR
1224 LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
1226 LSOF_TMP2=-DUSELOCALREADDIR
1229 LSOF_TMP1="/usr/sys"
1232 LSOF_CFGF="$LSOF_CFGF -DUSE_STAT"
1233 LSOF_TMP1="/usr/sys"
1236 echo "WARNING: unknown version: $LSOF_VERS"
1241 if test "X$DU_SYSDIR" = "X" # {
1243 DU_SYSDIR=$LSOF_TMP1
1245 LSOF_HOST=`uname -n`
1246 if test "X$DU_CDIR" = "X" # {
1248 LSOF_CDIR=`expr $LSOF_HOST : '\([^\.]*\)\..*$'`
1249 if test "X$LSOF_CDIR" = "X" # {
1251 LSOF_CDIR=$LSOF_HOST
1253 LSOF_CDIR=`echo $LSOF_CDIR | tr a-z A-Z`
1258 while test $LSOF_LOOP = 1 # {
1260 if test -d ${DU_SYSDIR}/$LSOF_CDIR # {
1262 echo "Using header files in ${DU_SYSDIR}/$LSOF_CDIR"
1267 Please enter the name of the subdirectory in $DU_SYSDIR that contains the
1268 configuration files for this host. Usually its name would be $LSOF_CDIR, but
1269 that subdirectory doesn't seem to exist. The lsof compilation needs header
1270 files specific to this machine's configuration found in that directory.
1272 If you can't specify the appropriate configuration subdirectory, quit this
1273 Configure step now and generate a proper configuration subdirectory with the
1274 kernel generation process.
1278 echo "$DU_SYSDIR contains:"
1282 echo -n "Configuration subdirectory name? "
1283 read LSOF_CDIR LSOF_EXCESS
1284 if test "X$LSOF_CDIR" = "X" -o ! -d ${DU_SYSDIR}/$LSOF_CDIR # {
1287 echo Cannot access directory ${DU_SYSDIR}/$LSOF_CDIR.
1292 # Determine the ADVFS file system version.
1294 if test "X$DU_ADVFSV" = "X" # {
1296 echo "Determining the ADVFS version -- this will take a while."
1297 LSOF_ADVFSV=`/usr/sbin/setld -i | grep "^OSFADVFSBIN[0-9]" | sed 's/\([^ ]*\).*/\1/' | sort -u | tail -1 | sed 's/OSFADVFSBIN//'`
1299 LSOF_ADVFSV=$DU_ADVFSV
1301 case $LSOF_ADVFSV in # {
1304 echo "The ADVFS version is 1."
1308 echo "The ADVFS version is 2."
1312 echo "The ADVFS version is 3."
1316 echo "The ADVFS version is 4."
1320 echo "The ADVFS version is 5."
1323 echo "The ADVFS version is unknown; it will be assumed to be 1."
1327 LSOF_CFGF="$LSOF_CFGF -DDUV=$LSOF_VERS -DADVFSV=$LSOF_ADVFSV $LSOF_TMP2"
1328 if test "X$DU_SYSINC" = "X" # {
1330 DU_SYSINC="/usr/sys/include"
1332 LSOF_DINC="$LSOF_DINC -I${DU_SYSDIR}/$LSOF_CDIR -I$DU_SYSINC"
1333 LSOF_CFGL="$LSOF_CFGL -lmld"
1334 if test "X${DU_SHLIB}" = "X" # {
1338 if test -r ${DU_SHLIB}/libmsfs.so # {
1340 nm ${DU_SHLIB}/libmsfs.so | grep tag_to_path > /dev/null 2>&1
1341 if test $? -eq 0 # {
1343 LSOF_CFGF="$LSOF_CFGF -DHASTAGTOPATH"
1344 LSOF_CFGL="$LSOF_CFGL -lmsfs"
1347 grep "^struct spec_node {" ${DU_SYSDIR}/include/sys/specdev.h > /dev/null 2>&1
1348 if test $? -eq 0 # {
1350 LSOF_CFGF="$LSOF_CFGF -DHASSPECNODE"
1352 if test $LSOF_VERS -ge 50000 # {
1355 # Make du5_sys_malloc.h for DU 5.0 and above. Enable strict ANSI checking
1356 # on 5.0 and 5.1A, but not 5.1B. Enable IPv6 handling.
1359 if test $LSOF_VERS -ge 50100 # {
1362 if test -x /usr/sbin/sizer # {
1364 /usr/sbin/sizer -v | grep -q 5.1A
1365 if test $? -eq 0 # {
1371 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
1372 LSOF_TMP1=${LSOF_INCLUDE}/sys/malloc.h
1373 if test -r $LSOF_TMP1 # {
1375 LSOF_TMP2=dialects/du/du5_sys_malloc.h
1377 echo "#if !defined(MANUFACTURED_DU5_SYS_MALLOC_H)" > $LSOF_TMP2
1378 echo "/* By lsof Configure:" `date` " */" >> $LSOF_TMP2
1379 echo "#define MANUFACTURED_DU5_SYS_MALLOC_H" >> $LSOF_TMP2
1380 grep "^#define[ ]MALLOC_NUM_BUCKETS" $LSOF_TMP1 >> $LSOF_TMP2
1381 echo "struct percpukmembuckets {" >> $LSOF_TMP2
1382 sed '1,/^struct percpukmembuckets/d' $LSOF_TMP1 | sed -n '1,/^};/p' >> $LSOF_TMP2
1383 echo "#endif" >> $LSOF_TMP2
1384 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/du"
1387 # Enable IPv6 for Tru64 UNIX 5.0 and above.
1389 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
1391 if test -r ${LSOF_INCLUDE}/sys/namei.h
1393 grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
1394 if test $? -eq 0 # {
1396 LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
1402 # Configure for FreeBSD.
1406 if test "X$LSOF_CC" = "X" # {
1409 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
1411 if test "X$LSOF_VSTR" = "X" # {
1413 LSOF_VSTR=`uname -r`
1415 if test "X$LSOF_VERS" = "X" # {
1418 # If the FreeBSD version isn't pre-defined, determine it.
1420 case $LSOF_VSTR in # {
1456 echo "!!!WARNING!!! Unsupported FreeBSD version: $LSOF_VSTR"
1457 echo "!!!WARNING!!! Configuring for FreeBSD 3.5"
1509 echo "!!!WARNING!!! Unsupported FreeBSD version: $LSOF_VSTR"
1510 echo "!!!WARNING!!! Configuring for FreeBSD 4.10"
1538 echo "!!!WARNING!!! Unsupported FreeBSD version: $LSOF_VSTR"
1539 echo "!!!WARNING!!! Configuring for FreeBSD 5.5"
1563 echo "!!!WARNING!!! Unsupported FreeBSD version: $LSOF_VSTR"
1564 echo "!!!WARNING!!! Configuring for FreeBSD 6.0"
1588 echo "!!!WARNING!!! Unsupported FreeBSD version: $LSOF_VSTR"
1589 echo "!!!WARNING!!! Configuring for FreeBSD 7.0"
1624 echo Unknown FreeBSD release: `uname -r`
1631 # Clear LSOF_UNSUP message for supported versions of FreeBSD.
1633 case $LSOF_VERS in # {
1634 4090|8020|8030|8040|9000|10000|11000)
1639 # Get system CFLAGS, if possible.
1641 LSOF_TMP1=`echo "all:\n.include <bsd.prog.mk>" | $LSOF_MAKE -f- -VCFLAGS`
1643 while test $LSOF_TMP -eq 1 # {
1645 echo $LSOF_TMP1 | grep -q -e '-O'
1646 if test $? -eq 0 # {
1648 if test "X$LSOF_DEBUG" = "X"
1650 LSOF_DEBUG=`echo $LSOF_TMP1 | sed 's/.*\(-O[^ $]*\).*/\1/'`
1652 LSOF_TMP1=`echo $LSOF_TMP1 | sed 's/\(.*\)-O[^ $]*\(.*\)/\1 \2/' | sed 's/^ *//g' | sed 's/ */ /g' | sed 's/ *$//'`
1656 LSOF_FBSD_ZFS_CFGF="$LSOF_CFGF $LSOF_TMP1"
1658 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
1659 echo $LSOF_CFGF | grep -q NEEDS_BOOL_TYPEDEF
1662 LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOL_TYPEDEF"
1663 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DNEEDS_BOOL_TYPEDEF"
1666 # Determine path to FreeBSD sources.
1669 if test "X$FREEBSD_SYS" = "X" # {
1671 if test -d /usr/src/sys # {
1673 FREEBSD_SYS=/usr/src/sys
1679 echo "!!!WARNING!!! No kernel sources in /usr/src/sys or /sys"
1684 # Test for thread (task) support.
1686 if test -r ${LSOF_INCLUDE}/sys/user.h # {
1688 grep -q ki_numthreads ${LSOF_INCLUDE}/sys/user.h
1689 if test $? -eq 0 # {
1691 LSOF_CFGF="$LSOF_CFGF -DHASTASKS"
1694 echo "FATAL: can't find sys/user.h"
1699 # Test pause() status in system.h.
1701 if test -r ${FREEBSD_SYS}/sys/systm.h # {
1703 grep -q pause_sbt ${FREEBSD_SYS}/sys/systm.h
1704 if test $? -eq 0 # {
1706 LSOF_CFGF="$LSOF_CFGF -DHAS_PAUSE_SBT"
1710 # Do FreeBSD version-specific stuff.
1712 case $LSOF_VERS in # {
1714 LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
1715 LSOF_CFGL="$LSOF_CFGL -lutil"
1716 LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/freebsd/include"
1717 if test "X$FREEBSD_KERNEL" = "X" # {
1719 LSOF_N_UNIXV="/386bsd"
1721 LSOF_N_UNIXV=$FREEBSD_KERNEL
1725 LSOF_CFGL="$LSOF_CFGL -lkvm"
1728 LSOF_CFGL="$LSOF_CFGL -lkvm"
1729 if test -r ${LSOF_INCLUDE}/vm/lock.h # {
1731 LSOF_CFGF="$LSOF_CFGF -DHASVMLOCKH"
1734 3000|3010|3020|3030|3040|3050)
1735 LSOF_CFGL="$LSOF_CFGL -lkvm"
1736 if test -r ${LSOF_INCLUDE}/nfs/rpcv2.h # {
1738 LSOF_CFGF="$LSOF_CFGF -DHASRPCV2H"
1740 if test -r ${LSOF_INCLUDE}/vm/lock.h # {
1742 LSOF_CFGF="$LSOF_CFGF -DHASVMLOCKH"
1746 if test -r ${LSOF_INCLUDE}/nfs/rpcv2.h # {
1748 LSOF_CFGF="$LSOF_CFGF -DHASRPCV2H"
1750 if test -r ${LSOF_INCLUDE}/sys/namei.h # {
1752 grep -q "^struct[ ]*namecache[ ]*{" ${LSOF_INCLUDE}/sys/namei.h
1753 if test $? -eq 0 # {
1755 LSOF_CFGF="$LSOF_CFGF -DHASNAMECACHE"
1758 if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h # {
1760 grep -q i_effnlink ${LSOF_INCLUDE}/ufs/ufs/inode.h
1761 if test $? -eq 0 # {
1763 LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_effnlink"
1766 if test -r ${LSOF_INCLUDE}/sys/file.h # {
1768 grep -q f_vnode ${LSOF_INCLUDE}/sys/file.h
1769 if test $? -eq 0 # {
1771 LSOF_CFGF="$LSOF_CFGF -DHASF_VNODE"
1774 LSOF_CFGL="$LSOF_CFGL -lkvm"
1775 if test $LSOF_VERS -ge 5000 # {
1778 # Do FreeBSD 5 and higher version-specific stuff.
1780 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
1782 grep VT_FDESC ${LSOF_INCLUDE}/sys/vnode.h > /dev/null 2>&1
1783 if test $? -eq 0 # {
1785 if test ! -r ${LSOF_INCLUDE}/fs/devfs/devfs.h # {
1787 if test -r ${FREEBSD_SYS}/fs/devfs/devfs.h # {
1791 echo "!!!FATAL: lsof cannot locate the devfs.h header file"
1792 echo " in ${LSOF_INCLUDE}/fs/devfs/devfs.h or"
1793 echo " ${FREEBSD_SYS}/fs/devfs/devfs.h. Consult"
1794 echo " 00FAQ for an explanation."
1801 if test -r ${FREEBSD_SYS}/sys/filedesc.h # {
1803 grep -q filedescent ${FREEBSD_SYS}/sys/filedesc.h
1804 if test $? -eq 0 # {
1806 LSOF_CFGF="$LSOF_CFGF -DHAS_FILEDESCENT"
1809 if test -r ${FREEBSD_SYS}/fs/tmpfs/tmpfs.h # {
1811 LSOF_CFGF="$LSOF_CFGF -DHAS_TMPFS"
1814 # Do FreeBSD 5.2 and higher version-specific stuff.
1816 if test -r ${LSOF_INCLUDE}/wctype.h # {
1818 LSOF_CFGF="$LSOF_CFGF -DHASWCTYPE_H"
1820 if test $LSOF_VERS -ge 5020 # {
1823 # Determine the status of the cpumask_t typedef.
1825 rm -f ${LSOF_TMPC}.*
1826 cat > ${LSOF_TMPC}.c << .LSOF_END_HERE_DOC3
1828 #include <sys/types.h>
1833 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
1835 rm -f ${LSOF_TMPC}.*
1836 if test $LSOF_TMP1 -ne 0 # {
1839 # The cpumask_t typedef is unknown when _KERNEL is not defined.
1841 if test -r ${LSOF_INCLUDE}/sys/types.h \
1842 -a -r ${LSOF_INCLUDE}/machine/_types.h # {
1844 grep -q cpumask_t ${LSOF_INCLUDE}/sys/types.h
1845 if test $? -eq 0 # {
1847 grep -q __cpumask_t ${LSOF_INCLUDE}/machine/_types.h
1848 if test $? -eq 0 # {
1850 LSOF_CFGF="$LSOF_CFGF -DHASCPUMASK_T"
1852 $LSOF_CC -E ${LSOF_INCLUDE}/machine/_types.h 2>/dev/null | grep -q __cpumask_t
1853 if test $? -eq 0 # {
1855 LSOF_CFGF="$LSOF_CFGF -DHASCPUMASK_T"
1861 if test -r ${LSOF_INCLUDE}/sys/socketvar.h # {
1863 grep -q SBS_CANT ${LSOF_INCLUDE}/sys/socketvar.h
1864 if test $? -eq 0 # {
1866 LSOF_CFGF="$LSOF_CFGF -DHASSBSTATE"
1870 if test $LSOF_VERS -ge 5030 # {
1873 # Do FreeBSD 5.3 and higher version-specific stuff.
1875 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
1877 grep -q "defined(_KVM_VNODE)" ${LSOF_INCLUDE}/sys/vnode.h
1878 if test $? -eq 0 # {
1880 LSOF_CFGF="$LSOF_CFGF -DHAS_KVM_VNODE"
1884 if test $LSOF_VERS -ge 6000 # {
1887 # Do FreeBSD 6.0 and higher version-specific stuff.
1889 if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h # {
1891 grep -q i_din2 ${LSOF_INCLUDE}/ufs/ufs/inode.h
1892 if test $? -eq 0 # {
1894 LSOF_CFGF="$LSOF_CFGF -DHAS_UFS1_2"
1897 if test -r ${LSOF_INCLUDE}/sys/conf.h # {
1899 grep -q vm_memattr_t ${LSOF_INCLUDE}/sys/conf.h
1902 LSOF_CFGF="$LSOF_CFGF -DHAS_VM_MEMATTR_T"
1904 grep -q "^#define minor(" ${LSOF_INCLUDE}/sys/conf.h
1905 if test $? -eq 0 # {
1907 LSOF_CFGF="$LSOF_CFGF -DHAS_CONF_MINOR"
1909 if test -r ${LSOF_INCLUDE}/sys/types.h # {
1911 LSOF_TMP1=`grep "^#define[ ]minor(" ${LSOF_INCLUDE}/sys/types.h`
1912 if test "X$LSOF_TMP1" != "X" # {
1914 echo "Creating fbsd_minor.h"
1915 cat > fbsd_minor.h << FBSD_MINOR1
1917 * fbsd_minor.h -- created by lsof Configure script on
1919 echo $EO " * $EC" >> ./fbsd_minor.h
1920 date >> ./fbsd_minor.h
1921 cat >> ./fbsd_minor.h << FBSD_MINOR2
1924 #if !defined(FBSD_MINOR_H)
1925 #define FBSD_MINOR_H
1928 echo $EO "${LSOF_TMP1}${EC}" >> fbsd_minor.h
1929 cat >> ./fbsd_minor.h << FBSD_MINOR3
1931 #endif /* defined(FBSD_MINOR_H) */
1936 if test -r ${FREEBSD_SYS}/fs/devfs/devfs_int.h # {
1938 grep -q cdev2priv ${FREEBSD_SYS}/fs/devfs/devfs_int.h
1939 if test $? -eq 0 # {
1941 LSOF_CFGF="$LSOF_CFGF -DHAS_CDEV2PRIV"
1945 grep -q "si_udev;" ${LSOF_INCLUDE}/sys/conf.h
1946 if test $? -ne 0 # {
1948 LSOF_CFGF="$LSOF_CFGF -DHAS_NO_SI_UDEV"
1950 grep -q si_priv ${LSOF_INCLUDE}/sys/conf.h
1951 if test $? -eq 0 # {
1953 LSOF_CFGF="$LSOF_CFGF -DHAS_SI_PRIV"
1956 if test -r ${LSOF_INCLUDE}/sys/sx.h # {
1958 LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_SX_H"
1961 # Do ZFS test. Try for the newer OpenSolaris files first -- i.e.,
1962 # the ones in ${FREEBSD_SYS}/cddl/contrib/opensolaris. If that fails,
1963 # try for the older ones in ${FREEBSD}/contrib/opensolaris.
1965 LSOF_FBSD_ZFS_SYS=${FREEBSD_SYS}/cddl
1966 if test ! -r ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h # {
1968 LSOF_FBSD_ZFS_SYS=${FREEBSD_SYS}
1969 if test ! -r ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h # {
1971 LSOF_FBSD_ZFS_SYS=""
1974 if test "X$LSOF_FBSD_ZFS_SYS" != "X" # {
1976 LSOF_CFGF="$LSOF_CFGF -DHAS_ZFS"
1978 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DFREEBSDV=$LSOF_VERS"
1979 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_ZFS"
1980 grep -q z_phys ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
1981 if test $? -eq 0 # {
1983 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_Z_PHYS"
1985 if test -r ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/sdt.h #{
1987 grep -q opt_kdtrace.h ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/sdt.h
1988 if test $? -eq 0 # {
1994 if test -r ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/kcondvar.h #{
1996 grep -q cv_timedwait_sbt ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/kcondvar.h
1997 if test $? -eq 0 # {
1999 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_CV_TIMEDWAIT_SBT"
2003 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
2006 # See if the vnode contains the byte level lock pointer.
2008 grep -q v_lockf ${LSOF_INCLUDE}/sys/vnode.h
2009 if test $? -eq 0 # {
2011 LSOF_CFGF="$LSOF_CFGF -DHAS_V_LOCKF"
2012 if test $LSOF_FBSD_ZFS -eq 1 # {
2014 LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_V_LOCKF"
2018 if test -r ${LSOF_INCLUDE}/sys/lockf.h # {
2021 # Determine the type of locking structure to which the inode or
2024 grep -q "^struct lockf_entry" ${LSOF_INCLUDE}/sys/lockf.h
2025 if test $? -eq 0 # {
2028 # Build the ./lockf_owner.h header file.
2032 echo "Creating ./lockf_owner.h from ${FREEBSD_SYS}/kern/kern_lockf.c"
2033 rm -f ./lockf_owner.h
2034 if test -r ${FREEBSD_SYS}/kern/kern_lockf.c # {
2036 LSOF_TMP1=`grep -n "^struct lock_owner" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'`
2037 if test "X$LSOF_TMP1" != "X" # {
2040 for i in `grep -n "};" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'` # {
2042 if test $LSOF_TMP2 -eq 0 -a $i -gt $LSOF_TMP1 # {
2047 if test $LSOF_TMP2 -eq 0 # {
2051 cat > ./lockf_owner.h << LOCKF_OWNER1
2053 * lockf_owner.h -- created by lsof Configure script on
2055 echo $EO " * $EC" >> ./lockf_owner.h
2056 date >> ./lockf_owner.h
2057 cat >> ./lockf_owner.h << LOCKF_OWNER2
2060 #if !defined(LOCKF_OWNER_H)
2061 #define LOCKF_OWNER_H
2064 ed -s ${FREEBSD_SYS}/kern/kern_lockf.c >> ./lockf_owner.h << LOCKF_OWNER3
2065 ${LSOF_TMP1},${LSOF_TMP2}p
2067 if test $? -ne 0 # {
2071 cat >> ./lockf_owner.h << LOCKF_OWNER4
2073 #endif /* defined(LOCKF_OWNER_H) */
2079 echo "FATAL ERROR: can't read ${FREEBSD_SYS}/kern/kern_lockf.c"
2081 if test "X$LSOF_TMP1" != "X" -a "X$LSOF_TMP2" != "X0" # {
2083 echo "./lockf_owner.h creation succeeded."
2084 LSOF_CFGF="$LSOF_CFGF -DHAS_LOCKF_ENTRY"
2086 echo "FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)"
2092 # Test for in6p_.port in inpcb structure.
2094 if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h # {
2096 grep -q 'in6p_.port' ${LSOF_INCLUDE}/netinet/in_pcb.h
2097 if test $? -ne 0 # {
2099 LSOF_CFGF="$LSOF_CFGF -DHAS_NO_6PORT"
2103 # Test for in6p_ppcb in inpcb structure.
2105 if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h # {
2107 grep -q 'in6p_ppcb' ${LSOF_INCLUDE}/netinet/in_pcb.h
2108 if test $? -ne 0 # {
2110 LSOF_CFGF="$LSOF_CFGF -DHAS_NO_6PPCB"
2113 if test -r ${LSOF_INCLUDE}/sys/conf.h # {
2115 grep -q 'doadump(boolean_t)' ${LSOF_INCLUDE}/sys/conf.h
2116 if test $? -eq 0 # {
2118 LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOLEAN_T"
2121 if test -r ${LSOF_INCLUDE}/sys/sockbuf.h # {
2123 grep -q 'u_int sb_ccc;' ${LSOF_INCLUDE}/sys/sockbuf.h
2124 if test $? -eq 0 # {
2126 LSOF_CFGF="$LSOF_CFGF -DHAS_SB_CCC"
2129 if test -r ${LSOF_INCLUDE}/sys/filedesc.h # {
2131 grep -q '^struct fdescenttbl {' ${LSOF_INCLUDE}/sys/filedesc.h
2132 if test $? -eq 0 # {
2134 LSOF_CFGF="$LSOF_CFGF -DHAS_FDESCENTTBL"
2140 if test $LSOF_VERS -eq 10000 # {
2143 # Do specific FreeBSD 10 version-specific stuff.
2145 LSOF_TMP1=`uname -m`
2146 if test "X$LSOF_TMP1" = "Xi386" # {
2148 LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOL_TYPEDEF"
2153 LSOF_CFGF="$LSOF_CFGF -DFREEBSDV=$LSOF_VERS"
2154 if test $LSOF_VERS -lt 2000 -a "X$FREEBSD_KERNEL" = "X" # {
2156 if test ! -x $LSOF_N_UNIXV # {
2158 echo "Hmmm -- $LSOF_N_UNIXV doesn't appear to be your kernel file."
2159 echo "Please enter the name of the file in / that contains"
2160 echo "the kernel for this host. It must be a regular file,"
2161 echo "not a directory, and must be executable."
2163 while test $LSOF_LOOP = 1 # {
2170 echo -n "Kernel file name? "
2171 read LSOF_N_UNIXV LSOF_EXCESS
2172 LSOF_N_UNIXV="/$LSOF_N_UNIXV"
2173 if test ! -d $LSOF_N_UNIXV -a -x $LSOF_N_UNIXV # {
2178 echo $LSOF_N_UNIXV is not a regular executable file.
2182 LSOF_N_UNIXV=`echo $LSOF_N_UNIXV | sed 's#^/*#/#'`
2183 LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=$LSOF_N_UNIXV"
2185 if test -r ${FREEBSD_SYS}/miscfs/fdesc/fdesc.h # {
2187 LSOF_TMP1=${FREEBSD_SYS}/miscfs/fdesc/fdesc.h
2189 if test $LSOF_VERS -ge 5000 -a -r ${LSOF_INCLUDE}/fs/fdescfs/fdesc.h # {
2191 LSOF_TMP1=${LSOF_INCLUDE}/fs/fdescfs/fdesc.h
2196 if test "X$LSOF_TMP1" != "X" # {
2198 grep -q Fctty $LSOF_TMP1
2199 if test $? -eq 0 # {
2201 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
2203 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
2205 grep -q fd_link $LSOF_TMP1
2206 if test $? -eq 0 # {
2208 LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
2212 if test $LSOF_VERS -ge 5000 # {
2218 if test $LSOF_VERS -lt 5000 # {
2220 if test -d ${FREEBSD_SYS}/${LSOF_TMP1}/procfs # {
2222 LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
2226 if test -d ${FREEBSD_SYS}/${LSOF_TMP1}/pseudofs # {
2228 LSOF_CFGF="$LSOF_CFGF -DHASPSEUDOFS"
2232 if test -r ${LSOF_INCLUDE}/${LSOF_TMP1}/nullfs/null.h # {
2234 LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
2236 if test -r ${FREEBSD_SYS}/${LSOF_TMP1}/nullfs/null.h # {
2238 LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
2242 if test -r ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h # {
2245 grep -q "^#ifdef [_]*KERNEL" ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h
2246 if test $? -eq 0 # {
2248 ln -s ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h cd9660_node.h
2250 sed -e '/^ \* Prototypes for ISOFS vnode operations/,$c\
2251 \ The ISOFS prototypes were removed by Configure. */' \
2252 < ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h > cd9660_node.h
2253 echo "" >> cd9660_node.h
2255 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS"
2256 if test $LSOF_VERS -ge 6000 # {
2258 grep -q "i_dev;" cd9660_node.h
2259 if test $? -ne 0 # {
2261 LSOF_CFGF="$LSOF_CFGF -DHAS_NO_ISO_DEV"
2265 if test -r ${LSOF_INCLUDE}/sys/namei.h
2267 grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
2268 if test $? -eq 0 # {
2270 LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
2273 if test $LSOF_DINC_ADD -eq 1 # {
2275 if test "X$LSOF_DINC" = "X" # {
2277 LSOF_DINC="-I${FREEBSD_SYS}"
2279 LSOF_DINC="$LSOF_DINC -I${LSOF_INCLUDE} -I${FREEBSD_SYS}"
2282 if test -r ${LSOF_INCLUDE}/netinet/in.h # {
2284 grep IPV6_INRIA_VERSION ${LSOF_INCLUDE}/netinet/in.h > /dev/null
2285 if test $? -eq 0 # {
2287 LSOF_CFGF="$LSOF_CFGF -DHASIPv6 -DHASINRIAIPv6"
2290 echo $CFGF | grep HASIPv6 > /dev/null
2291 if test $? -ne 0 -a -r ${LSOF_INCLUDE}/netinet6/in6.h # {
2293 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
2295 if test -r ${LSOF_INCLUDE}/utmpx.h # {
2297 LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
2299 LSOF_DIALECT_DIR=freebsd
2302 # Configure for HP-UX and HP-UX gcc.
2305 if test "X$LSOF_RANLIB_SUP" = "X" # {
2309 if test "X$LSOF_VSTR" = "X" # {
2311 LSOF_VSTR=`uname -r`
2313 if test "X$LSOF_VERS" = "X" # {
2316 # If the HP-UX version isn't pre-defined, determine it.
2318 LSOF_VERS=`echo $LSOF_VSTR | awk -F. '{printf "%d%02d",\$2,\$3}'`
2320 if test $LSOF_VERS -ge 1020 # {
2322 LSOF_TSTBIGF="-D_LARGEFILE64_SOURCE"
2325 # Determine compiler.
2327 if test "X$LSOF_CC" = "X" # {
2329 if test "X$LSOF_TGT" = "Xhpuxgcc" # {
2333 if test "X$HPUX_CCDIR1" = "X" # {
2337 if test "X$HPUX_CCDIR2" = "X" # {
2339 HPUX_CCDIR2="/usr/ccs/bin"
2341 if test -x ${HPUX_CCDIR1}/cc # {
2343 LSOF_CC=${HPUX_CCDIR1}/cc
2345 if test -x ${HPUX_CCDIR2}/cc # {
2347 LSOF_CC=${HPUX_CCDIR2}/cc
2349 echo "No executable cc in $HPUX_CCDIR1 or $HPUX_CCDIR2"
2354 $LSOF_CC -O < /dev/null 2>&1 | grep -q Bundled
2355 if test $? -eq 0 # {
2357 LSOF_DEBUG="No-O" # to disable -O
2358 if test "X$HPUX_LIBC1" = "X" # {
2360 HPUX_LIBC1="/usr/lib"
2362 if test -r ${HPUX_LIBC1}/libc.sl # {
2364 LSOF_FCFGL="-L$HPUX_LIBC -lc"
2366 if test "X$HPUX_LIBC2" = "X" # {
2368 HPUX_LIBC2="/usr/lib"
2370 if test -r ${HPUX_LIBC2}/libc.sl # {
2372 LSOF_FCFGL="-L$HPUX_LIBC2 -lc"
2378 echo $LSOF_CC | grep gcc > /dev/null
2379 if test $? -eq 0 # {
2381 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
2383 $LSOF_CC -O < /dev/null 2>&1 | grep -q Bundled
2384 if test $? -eq 0 # {
2386 LSOF_DEBUG="No-O" # to disable -O
2391 # Test for "const void" support.
2393 rm -f ${LSOF_TMPC}.*
2394 echo "main() { const void *x; return(0); }" >> $LSOF_TMPC.c
2395 $LSOF_CC $LSOF_TMPC.c -o $LSOF_TMPC.x > /dev/null 2>&1
2396 if test $? -eq 0 # {
2398 LSOF_CFGF="$LSOF_CFGF -DHAS_CONST"
2400 rm -f ${LSOF_TMPC}.*
2404 if test "X$HPUX_BASE" = "X" # {
2406 if test -d $LSOF_INCLUDE/sys/pstat -a $LSOF_VERS -ge 1111 # {
2410 HPUX_BASE="/dev/kmem"
2413 if test "X$HPUX_BASE" = "Xpstat" # {
2416 # Configure for pstat-based HP-UX lsof.
2418 LSOF_CINFO="PSTAT-based"
2419 echo "Configuring PSTAT-based HP-UX lsof"
2420 LSOF_DIALECT_DIR=hpux/pstat
2421 LSOF_CFGF="$LSOF_CFGF -DHPUXV=$LSOF_VERS -D_PSTAT64"
2422 LSOF_CFGL="$LSOF_CFGL -lnsl"
2425 ls -l $LSOF_CC | grep -q ansic
2427 ls -l $LSOF_CC | grep -q aCC
2428 if test $? -eq 0 -o $LSOF_TMP1 -eq 0 # {
2430 LSOF_CFGF="$LSOF_CFGF -Ae +DD32"
2432 echo $LSOF_CC | grep -q gcc
2433 if test $? -ne 0 # {
2435 LSOF_CFGF="$LSOF_CFGF +DD32"
2438 if test -r ${LSOF_INCLUDE}/netinet/in6.h # {
2440 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
2442 if test -r ${LSOF_INCLUDE}/sys/pstat/stream_pstat_body.h # {
2444 grep -q PS_STR_XPORT_DATA ${LSOF_INCLUDE}/sys/pstat/stream_pstat_body.h
2445 if test $? -eq 0 # {
2447 LSOF_CFGF="$LSOF_CFGF -D_PSTAT_STREAM_GET_XPORT"
2450 if test $LSOF_VERS -ge 1123 # {
2452 LSOF_CFGF="$LSOF_CFGF -D_LARGEFILE64_SOURCE"
2455 if test "X$HPUX_BASE" = "X/dev/kmem" # {
2458 # Configure for /dev/kmem-based HP-UX lsof.
2460 if test "X$HPUX_BOOTFILE" = "X" # {
2462 HPUX_BOOTFILE="/stand/vmunix"
2464 if test $LSOF_VERS -gt 1100 # {
2467 echo "************************************************"
2469 echo "* !!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!! *"
2471 echo "* LSOF DOES NOT SUPPORT THIS VERSION OF HP-UX. *"
2473 echo "************************************************"
2478 LSOF_CFGF="$LSOF_CFGF -DHPUXV=$LSOF_VERS"
2479 LSOF_CINFO="/dev/kmem-based"
2480 LSOF_DIALECT_DIR=hpux/kmem
2481 echo "Configuring /dev/kmem-based HP-UX lsof"
2482 if test $LSOF_VERS -lt 1000 # {
2484 if test "X$HPUX_X25DIR" = "X" # {
2486 HPUX_X25DIR="/etc/conf"
2488 HPUX_X25DIR=$HPUX_X25DIR
2490 if test -r ${HPUX_X25DIR}/x25/x25addrstr.h # {
2492 LSOF_CFGF="$LSOF_CFGF -DHPUX_CCITT"
2493 LSOF_DINC="$LSOF_DINC -I$HPUX_X25DIR"
2496 if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h -a -r ${LSOF_INCLUDE}/sys/fs/vx_hpux.h # {
2498 LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
2500 if test $LSOF_VERS -ge 1030 # {
2502 if test "X$HPUX_KERNBITS" = "X" # {
2504 HPUX_KERNBITS=`getconf _SC_KERNEL_BITS`
2506 LSOF_CFGF="$LSOF_CFGF -DHPUXKERNBITS=${HPUX_KERNBITS} -I`pwd`/dialects/hpux/kmem/hpux11"
2507 if test $HPUX_KERNBITS -eq 64 # {
2511 echo "*****************************************"
2513 echo "* NOTICE! Configuring for 64 bit HP-UX *"
2515 echo "*****************************************"
2516 echo $LSOF_CC | grep gcc > /dev/null
2517 if test $? -eq 0 # {
2520 # Test gcc for 64 bit support, trying gcc with no options, then
2521 # with -mlp64, testing the result with file.
2524 echo "Testing $LSOF_CC for 64 bit support"
2525 rm -f ${LSOF_TMPC}.*
2526 echo "main(){}" > ${LSOF_TMPC}.c
2528 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
2529 if test $? -eq 0 # {
2531 /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
2532 if test $? -eq 0 # {
2537 if test "X$LSOF_TMP1" = "X" # {
2539 rm -f ${LSOF_TMPC}.x
2540 $LSOF_CC ${LSOF_TMPC}.c -mlp64 -o ${LSOF_TMPC}.x > /dev/null 2>&1
2541 if test $? -eq 0 # {
2543 /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
2544 if test $? -eq 0 # {
2550 rm -f ${LSOF_TMPC}.*
2551 if test "X$LSOF_TMP1" = "X" # {
2554 echo "***************************************************"
2556 echo "* !!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!! *"
2558 echo "* APPARENTLY GCC CANNOT BUILD 64 BIT EXECUTABLES. *"
2559 echo "* A COMPILER MUST BE USED THAT CAN. SEE 00FAQ *"
2560 echo "* FOR MORE INFORMATION. *"
2562 echo "***************************************************"
2567 if test "X$LSOF_TMP1" != "X " # {
2569 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
2571 LSOF_CFGL="$LSOF_CFGL -lelf"
2572 LSOF_CINFO="${LSOF_CINFO}, 64 bit HP-UX"
2576 # Set options for the HP-UX compiler.
2578 LSOF_CFGF="$LSOF_CFGF +DD64"
2579 LSOF_CFGL="$LSOF_CFGL -lelf"
2580 LSOF_CINFO="${LSOF_CINFO}, 64 bit HP-UX"
2583 LSOF_CFGF="$LSOF_CFGF -D_FILE_OFFSET_BITS=64"
2584 LSOF_CINFO="${LSOF_CINFO}, 32 bit HP-UX"
2585 echo $LSOF_CC | grep gcc > /dev/null
2586 if test $? -ne 0 # {
2588 LSOF_CFGF="$LSOF_CFGF +DAportable"
2591 LSOF_CFGL="$LSOF_CFGL -lnsl"
2594 # When HP-UX is less than 10.30, but greater than or equal to 10,
2595 # check NFS3 rnode status.
2597 if test $LSOF_VERS -ge 1000 # {
2600 if test "X$HPUX_RNODE3" = "X" # {
2602 nm -x $HPUX_BOOTFILE | grep -q nfs_vnodeops3
2603 if test $? -eq 0 # {
2605 if test -r ${LSOF_INCLUDE}/nfs/rnode.h # {
2607 grep -q r_fh3 ${LSOF_INCLUDE}/nfs/rnode.h
2608 if test $? -ne 0 # {
2615 if test "X$HPUX_RNODE3" = "X1" # {
2620 if test $LSOF_TMP1 -eq 1 # {
2622 LSOF_CFGF="$LSOF_CFGF -DHASRNODE3"
2626 if test $LSOF_VERS -eq 1100 # {
2629 # Test for the ipis_s structure. If it is present, set HAS_IPC_S_PATCH.
2631 if test "X$HPUX_IPC_S_PATCH" = "X" # {
2633 if test -x /usr/contrib/Q4/bin/q4exe # {
2635 LSOF_TMP=/usr/contrib/Q4/bin/q4exe
2637 LSOF_TMP=/usr/contrib/bin/q4
2639 if test -x $LSOF_TMP # {
2641 rm -f ${LSOF_TMPC}.out
2643 echo $EO "Looking in $HPUX_BOOTFILE for ipis_s with $LSOF_TMP ... $EC"
2644 echo "yes\\nfields -c struct ipis_s" | $LSOF_TMP $HPUX_BOOTFILE > ${LSOF_TMPC}.out 2>&1
2645 if test $? -ne 0 # {
2649 echo "!!!ERROR!!! $LSOF_TMP failed and produced the following output."
2651 cat ${LSOF_TMPC}.out
2652 HPUX_IPC_S_PATCH=fail
2654 grep ipis_s ${LSOF_TMPC}.out > /dev/null 2>&1
2655 if test $? -eq 0 # {
2657 echo "ipis_s exists."
2659 # See if ipis_msgsqueued is present.
2661 grep ipis_msgsqueued ${LSOF_TMPC}.out > /dev/null 2>&1
2662 if test $? -eq 0 # {
2669 echo "ipis_s doesn't exist."
2673 rm -f ${LSOF_TMPC}.out
2675 echo "Can't locate or execute $LSOF_TMP"
2676 echo $EO "ls says: $EC"
2678 HPUX_IPC_S_PATCH=fail
2681 if test "X$HPUX_IPC_S_PATCH" = "Xfail" # {
2684 echo "!!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!"
2685 echo "Configure can't use $LSOF_TMP to examine the ipis_s"
2686 echo "structure. You must do that yourself, report the result in"
2687 echo "the HPUX_IPC_S_PATCH environment variable, then repeat the"
2688 echo "Configure step. Consult the Configure script's use of"
2689 echo "$LSOF_TMP and the 00XCONFIG file for information"
2690 echo "on ipis_s testing and the setting of HPUX_IPC_S_PATCH."
2691 echo "!!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!"
2696 if test "X$HPUX_IPC_S_PATCH" = "X1" -o "X$HPUX_IPC_S_PATCH" = "X2" # {
2698 LSOF_CFGF="$LSOF_CFGF -DHAS_IPC_S_PATCH=$HPUX_IPC_S_PATCH"
2700 if test "X$HPUX_IPC_S_PATCH" != "Xn" -a "X$HPUX_IPC_S_PATCH" != "XN" # {
2702 echo "Illegal value for HPUX_IPC_S_PATCH: $HPUX_IPC_S_PATCH"
2709 # Manufacture an hpux_mount.h header file with a mount struct in it, as
2712 if test -r ${LSOF_INCLUDE}/sys/mount.h # {
2714 LSOF_TMP1="dialects/${LSOF_DIALECT_DIR}/hpux_mount.h"
2716 echo "#if !defined(MANUFACTURED_HPUX_SYS_MOUNT_H)" > $LSOF_TMP1
2717 echo "#define MANUFACTURED_HPUX_SYS_MOUNT_H" >> $LSOF_TMP1
2718 echo "/* By lsof Configure:" `date` " */" >> $LSOF_TMP1
2719 echo "struct mount" >> $LSOF_TMP1
2720 sed '1,/struct mount/d' ${LSOF_INCLUDE}/sys/mount.h | sed -n '1,/m_dev/p' >> $LSOF_TMP1
2721 echo "};" >> $LSOF_TMP1
2722 echo "#endif" >> $LSOF_TMP1
2723 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/${LSOF_DIALECT_DIR}"
2726 # Test for OnlineJFS.
2728 if test $LSOF_VERS -ge 1100 # {
2730 if test "X$HPUX_HASONLINEJFS" = "X" -a -x /sbin/fs/vxfs/subtype # {
2732 LSOF_TMP1=`/sbin/fs/vxfs/subtype`
2733 if test "X$LSOF_TMP1" = "Xvxfs3.3"
2735 HPUX_HASONLINEJFS="Y"
2738 if test "X$HPUX_HASONLINEJFS" = "XY" -o "X$HPUX_HASONLINEJFS" = "Xy"
2741 LSOF_CFGF="$LSOF_CFGF -DHASONLINEJFS"
2747 if test -r ${AFS_VICE}/etc/ThisCell # {
2749 if test "X$LSOF_SCRIPT_CALL" = "Xno" # {
2751 if test -r ./AFSHeaders -a -r ./AFSVersion # {
2756 if test ! -x ./AFSConfig # {
2758 echo "Can't find or execute the AFSConfig script"
2763 if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion # {
2768 if test "X$LSOF_AFS" = "Xyes" # {
2770 LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
2771 LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
2772 LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
2776 echo "HP-UX base unrecognized: $HPUX_BASE"
2783 # Configure for Linux.
2786 LSOF_TSTBIGF="-D_FILE_OFFSET_BITS=64"
2788 if test "X$LSOF_CC" = "X" # {
2791 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
2793 if test "X$LINUX_CONF_CC" = "X" # {
2795 LINUX_CONF_CC=$LSOF_CC
2798 if test "X$LINUX_INCL" = "X" # {
2800 LINUX_INCL=/usr/include
2802 LSOF_DINC="$LSOF_DINC -I${LINUX_INCL}"
2804 if test "X$LINUX_VERSION_CODE" = "X" # {
2806 if test -r "$LINUX_INCL/linux/version.h" # {
2808 LINUX_VERSION_CODE=`cat $LINUX_INCL/linux/version.h | sed -n 's/.\+LINUX_VERSION_CODE \([[:digit:]]\+\)$/\1/p'`
2811 LSOF_VSTR=`echo $LINUX_VERSION_CODE | perl -e '$version=<STDIN>; chomp($version); printf("%d.%d.%d\n", ($version >> 16) & 0xFF, ($version >> 8) & 0xFF, $version & 0xFF);'`
2812 if test "X$LSOF_VSTR" = "X" # {
2814 LSOF_VSTR=`uname -r`
2816 if test "X$LSOF_VERS" = "X" # {
2819 # If the Linux version isn't predefined, determine it.
2821 LSOF_VERS=`echo $LSOF_VSTR | sed 's/\./ /g' | awk '{printf "%d%d%03d",\$1,\$2,\$3}'`
2823 LSOF_CFGF="$LSOF_CFGF -DLINUXV=$LSOF_VERS"
2824 if test $LSOF_VERS -lt 21072 # {
2827 echo "!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!"
2829 echo "! THE /PROC-BASED LSOF SOURCES HAVE NOT BEEN TESTED ON !"
2830 echo "! LINUX KERNELS BELOW 2.1.72, AND MAY NOT WORK ON THIS !"
2831 echo "! KERNEL. IT SHOULD USE A /DEV/KMEM-BASED LSOF. !"
2833 echo "!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!"
2839 # If the Linux C library type isn't predefined, determine it.
2841 if test "X$LINUX_CLIB" = "X" # {
2843 echo -n "Testing C library type with $LINUX_CONF_CC ... "
2844 rm -f ${LSOF_TMPC}.*
2845 cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC1
2846 #include <features.h>
2848 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
2849 printf("-DGLIBCV=%d\n",__GLIBC__*100+__GLIBC_MINOR__);
2850 #elif defined(__GLIBC__)
2851 printf("-DGLIBCV=%d00\n",__GLIBC__);
2857 $LINUX_CONF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
2858 if test -x ${LSOF_TMPC}.x # {
2860 LINUX_CLIB=`${LSOF_TMPC}.x`
2866 rm -f ${LSOF_TMPC}.*
2868 if test $LSOF_TMP -ne 0 # {
2870 echo "Cannot determine C library type; assuming it is not glibc."
2873 if test "X$LINUX_CLIB" = "X" # {
2875 echo "The C library type is not glibc."
2877 echo "The C library type is glibc, version \"$LINUX_CLIB\"."
2881 if test "X$LINUX_CLIB" != "X" # {
2883 LSOF_CFGF="$LSOF_CFGF $LINUX_CLIB"
2886 # Test for IPv6 support.
2888 if test -r ${LSOF_INCLUDE}/netinet/ip6.h # {
2890 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
2893 # Test for <rpc/rpc.h>.
2895 if ! test -r ${LSOF_INCLUDE}/rpc/rpc.h # {
2897 LSOF_CFGF="$LSOF_CFGF -DHASNORPC_H"
2900 # Test for TCP_* symbols.
2902 if test -r ${LSOF_INCLUDE}/netinet/tcp.h # (
2904 grep -q TCP_ESTABLISHED ${LSOF_INCLUDE}/netinet/tcp.h
2905 if test $? -eq 0 # {
2907 LSOF_CFGF="$LSOF_CFGF -DNEEDS_NETINET_TCPH"
2911 # Test for SELinux support.
2914 if test "X$LINUX_HASSELINUX" = "X" # {
2916 if test -r ${LSOF_INCLUDE}/selinux/selinux.h # {
2921 if test "X$LINUX_HASSELINUX" = "XY" -o "X$LINUX_HASSELINUX" = "Xy" # {
2926 if test $LSOF_TMP1 -eq 1 # {
2928 LSOF_CFGF="$LSOF_CFGF -DHASSELINUX"
2929 LSOF_CFGL="$LSOF_CFGL -lselinux"
2932 # Test for UNIX socket endpoint support.
2934 if test -r ${LSOF_INCLUDE}/linux/sock_diag.h -a -r ${LSOF_INCLUDE}/linux/unix_diag.h # {
2936 LSOF_CFGF="$LSOF_CFGF -DHASUXSOCKEPT"
2938 LSOF_DIALECT_DIR="linux"
2939 LSOF_CFGF="$LSOF_CFGF -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
2942 # Configure for NetBSD.
2945 if test "X$LSOF_CC" = "X" # {
2948 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
2950 if test "X$LSOF_VSTR" = "X" # {
2952 LSOF_VSTR=`uname -r`
2954 if test "X$LSOF_VERS" = "X" # {
2957 # Validate the NetBSD version.
2959 case $LSOF_VSTR in # {
2979 echo "!!!WARNING!!! Unsupported NetBSD version: $LSOF_VSTR"
2980 echo "!!!WARNING!!! Configuring for NetBSD 1.6"
3000 echo "!!!WARNING!!! Unsupported NetBSD version: $LSOF_VSTR"
3001 echo "!!!WARNING!!! Configuring for NetBSD 2.0"
3013 echo "!!!WARNING!!! Unsupported NetBSD version: $LSOF_VSTR"
3014 echo "!!!WARNING!!! Configuring for NetBSD 3.0"
3017 echo "Unknown NetBSD release: $LSOF_VSTR"
3018 echo Assuming NetBSD 1.6
3024 # Test for legal NetBSD version.
3026 case $LSOF_VERS in # {
3027 1002000|1003000|1004000|1005000|1006000)
3029 2000000|2099009|2099010)
3034 echo "Unknown NetBSD version: $LSOF_VERS"
3039 LSOF_CFGF="$LSOF_CFGF -DNETBSDV=$LSOF_VERS"
3040 LSOF_TMP1="-DN_UNIXV=/netbsd"
3041 if test -r ${LSOF_INCLUDE}/util.h # {
3043 grep -q getbootfile ${LSOF_INCLUDE}/util.h
3044 if test $? -eq 0 # {
3046 LSOF_CFGL="$LSOF_CFGL -lutil"
3047 LSOF_TMP1="-DHASGETBOOTFILE"
3050 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
3051 if test -r ${LSOF_INCLUDE}/kvm.h # {
3053 grep -q kvm_getproc2 ${LSOF_INCLUDE}/kvm.h
3054 if test $? -eq 0 # {
3056 LSOF_CFGF="$LSOF_CFGF -DHASKVMGETPROC2"
3060 # Here begin the dual tests on header files that may be in $LSOF_INCLUDE
3063 # Note that $LSOF_TMP1 holds an indicator of the need for -I$NETBSD_SYS.
3064 # LSOF_TMP4 contains a temporary indicator of the use of $NETBSD_SYS.
3067 if test "X$NETBSD_SYS" = "X" # {
3069 if test -d /usr/src # {
3071 NETBSD_SYS="/usr/src/sys"
3073 NETBSD_SYS=$LSOF_INCLUDE
3076 LSOF_TMP2="nfs/nfsproto.h"
3077 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3079 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3082 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3084 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3090 if test "X$LSOF_TMP3" != "X" # {
3092 LSOF_CFGF="$LSOF_CFGF -DHASNFSPROTO"
3093 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3098 LSOF_TMP2="netinet/ip6.h"
3099 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3101 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3104 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3106 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3112 if test "X$LSOF_TMP3" != "X" # {
3114 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
3115 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3120 LSOF_TMP2="netinet/in.h"
3121 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3123 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3126 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3128 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3134 if test "X$LSOF_TMP3" != "X" # {
3136 grep -q IPV6_INRIA_VERSION $LSOF_TMP3
3137 if test $? -eq 0 # {
3139 LSOF_CFGF="$LSOF_CFGF -DHASIPv6 -DHASINRIAIPv6"
3140 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3147 LSOF_TMP2="miscfs/fdesc/fdesc.h"
3148 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3150 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3152 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3154 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3160 if test "X$LSOF_TMP3" != "X" # {
3162 grep -q Fctty $LSOF_TMP3
3163 if test $? -eq 0 # {
3165 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
3167 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
3169 grep -q fd_link $LSOF_TMP3
3170 if test $? -eq 0 # {
3172 LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
3174 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3179 LSOF_TMP2="miscfs/nullfs/null.h"
3180 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3182 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3185 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3187 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3193 if test "X$LSOF_TMP3" != "X" # {
3195 LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
3196 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3201 LSOF_TMP2="miscfs/procfs"
3202 if test -d ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3204 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3207 if test -d ${NETBSD_SYS}/$LSOF_TMP2 # {
3209 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3215 if test "X$LSOF_TMP3" != "X" # {
3217 LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
3218 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3222 if test -r ${LSOF_TMP3}/procfs.h # {
3224 grep -q PFSroot ${LSOF_TMP3}/procfs.h
3225 if test $? -eq 0 # {
3227 LSOF_CFGF="$LSOF_CFGF -DHASPROCFS_PFSROOT"
3231 LSOF_TMP2="sys/bufq.h"
3233 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3235 LSOF_CFGF="$LSOF_CFGF -DHASBUFQ_H"
3237 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3239 if test $NETBSD_SYS != $LSOF_INCLUDE # {
3241 LSOF_CFGF="$LSOF_CFGF -DHASBUFQ_H"
3246 LSOF_TMP2="isofs/cd9660"
3247 if test -d ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3249 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3252 if test -d ${NETBSD_SYS}/$LSOF_TMP2 # {
3254 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3260 if test "X$LSOF_TMP3" != "X" # {
3262 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
3263 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3268 LSOF_TMP2="fs/cd9660"
3269 if test -d ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3271 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3274 if test -d ${NETBSD_SYS}/$LSOF_TMP2 # {
3276 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3282 if test "X$LSOF_TMP3" != "X" # {
3284 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
3285 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3292 if test -d ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3294 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3297 if test -d ${NETBSD_SYS}/$LSOF_TMP2 # {
3299 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3305 if test "X$LSOF_TMP3" != "X" # {
3307 LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=1"
3308 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3313 LSOF_TMP2="fs/msdosfs"
3314 if test -d ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3316 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3319 if test -d ${NETBSD_SYS}/$LSOF_TMP2 # {
3321 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3327 if test "X$LSOF_TMP3" != "X" # {
3329 LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=2"
3330 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3336 LSOF_TMP2="miscfs/kernfs/kernfs.h"
3337 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3339 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3342 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3344 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3350 if test "X$LSOF_TMP3" != "X" # {
3352 grep -q "kt_name;" $LSOF_TMP3
3353 if test $? -eq 0 # {
3355 LSOF_CFGF="$LSOF_CFGF -DHASKERNFS"
3356 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3360 grep -q "*kfs_kt;" $LSOF_TMP3
3361 if test $? -eq 0 # {
3363 LSOF_CFGF="$LSOF_CFGF -DHASKERNFS_KFS_KT"
3367 LSOF_TMP2="sys/namei.h"
3368 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3370 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3373 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3375 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3381 if test "X$LSOF_TMP3" != "X" # {
3383 grep -q nc_vpid $LSOF_TMP3
3384 if test $? -eq 0 # {
3386 LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
3387 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3393 LSOF_TMP2="ufs/ufs/inode.h"
3394 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3396 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3399 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3401 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3407 if test "X$LSOF_TMP3" != "X" # {
3409 grep -q i_ffs_size $LSOF_TMP3
3410 if test $? -eq 0 # {
3412 LSOF_CFGF="$LSOF_CFGF -DHASI_FFS"
3413 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3418 grep -q i_ffs1_size $LSOF_TMP3
3419 if test $? -eq 0 # {
3421 LSOF_CFGF="$LSOF_CFGF -DHASI_FFS1"
3422 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3428 grep -q i_ffs_effnlink $LSOF_TMP3
3429 if test $? -eq 0 # {
3431 LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_ffs_effnlink"
3432 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3438 LSOF_TMP2="sys/vnode.h"
3440 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3442 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3445 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3447 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3453 if test "XLSOF_TMP3" != "X" # {
3455 grep -q VT_EXT2FS $LSOF_TMP3
3456 if test $? -eq 0 # {
3458 LSOF_CFGF="$LSOF_CFGF -DHASEXT2FS"
3459 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3463 LSOF_TMP2="ufs/ufs/inode.h"
3464 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3466 LSOF_TMP5="${LSOF_INCLUDE}/$LSOF_TMP2"
3469 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3471 LSOF_TMP5="${NETBSD_SYS}/$LSOF_TMP2"
3477 if test "X$LSOF_TMP5" != "X" # {
3479 grep -q "*e2fs_din" $LSOF_TMP5
3480 if test $? -eq 0 # {
3482 LSOF_CFGF="$LSOF_CFGF -DHASI_E2FS_PTR"
3483 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3485 LSOF_TMP1=$LSOF_TMP6
3490 grep -q VT_LFS $LSOF_TMP3
3491 if test $? -eq 0 # {
3493 LSOF_CFGF="$LSOF_CFGF -DHASLFS"
3494 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3499 grep -q VT_PTYFS $LSOF_TMP3
3500 if test $? -eq 0 # {
3502 LSOF_TMP2="fs/ptyfs/ptyfs.h"
3503 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3505 LSOF_CFGF="$LSOF_CFGF -DHASPTYFS"
3507 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3509 if test $NETBSD_SYS != $LSOF_INCLUDE # {
3511 LSOF_CFGF="$LSOF_CFGF -DHASPTYFS"
3517 if test "X$NETBSD_UVM" = "X" # {
3519 grep -q UVM $LSOF_TMP3
3520 if test $? -ne 0 # {
3522 egrep -q "v_uvm;|v_uobj;" $LSOF_TMP3
3523 if test $? -eq 0 # {
3530 LSOF_TMP2="nfs/nfsnode.h"
3531 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3533 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3536 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3538 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3544 if test "X$LSOF_TMP3" != "X" # {
3546 grep -q "*n_vattr" $LSOF_TMP3
3547 if test $? -eq 0 # {
3549 LSOF_CFGF="$LSOF_CFGF -DHASNFSVATTRP"
3550 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3556 LSOF_TMP2="sys/lockf.h"
3557 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3559 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3562 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3564 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3570 if test "X$LSOF_TMP3" != "X" # {
3572 grep -q vop_advlock_args $LSOF_TMP3
3573 if test $? -eq 0 # {
3575 LSOF_CFGF="$LSOF_CFGF -DHAS_ADVLOCK_ARGS"
3576 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3581 grep -q lf_lwp $LSOF_TMP3
3582 if test $? -eq 0 # {
3584 LSOF_CFGF="$LSOF_CFGF -DHAS_LF_LWP"
3585 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3591 LSOF_TMP2="sys/lwp.h"
3592 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3594 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3597 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3599 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3605 if test "X$LSOF_TMP3" != "X" # {
3607 LSOF_CFGF="$LSOF_CFGF -DHAS_LWP_H"
3608 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3613 LSOF_TMP2="sys/filedesc.h"
3614 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3616 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3619 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3621 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3627 if test "X$LSOF_TMP3" != "X" # {
3629 grep -q "^struct cwdinfo {" $LSOF_TMP3
3630 if test $? -eq 0 # {
3632 LSOF_CFGF="$LSOF_CFGF -DHASCWDINFO"
3633 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3639 LSOF_TMP2="sys/pipe.h"
3640 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3642 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3645 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3647 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3653 if test "X$LSOF_TMP3" != "X" # {
3655 LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_PIPEH"
3656 if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1 # {
3661 if test -r ${LSOF_INCLUDE}/sys/statvfs.h # {
3663 grep -q '^struct statvfs {' ${LSOF_INCLUDE}/sys/statvfs.h
3664 if test $? -eq 0 # {
3666 LSOF_CFGF="$LSOF_CFGF -DHASSTATVFS"
3670 # Here end the dual NetBSD tests for header files in $LSOF_INCLUDE or
3673 # After this LSOF_TMP1 may be reused.
3675 if test $LSOF_TMP1 -eq 1 # {
3677 LSOF_DINC="-I$LSOF_INCLUDE -I$NETBSD_SYS"
3680 # Build special header files, as required.
3682 rm -rf dialects/n+obsd/include
3683 if test "X$NETBSD_UVM" = "XY" -o "X$NETBSD_UVM" = "Xy" # {
3685 mkdir dialects/n+obsd/include
3686 touch dialects/n+obsd/include/opt_uvmhist.h
3687 touch dialects/n+obsd/include/opt_lockdebug.h
3688 LSOF_CFGF="$LSOF_CFGF -DUVM -I`pwd`/dialects/n+obsd/include"
3689 if test -d ${LSOF_INCLUDE}/uvm # {
3691 LSOF_CFGF="$LSOF_CFGF -DHAS_UVM_INCL"
3694 LSOF_TMP2="sys/mount.h"
3695 if test -r ${LSOF_INCLUDE}/$LSOF_TMP2 # {
3697 LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
3699 if test -r ${NETBSD_SYS}/$LSOF_TMP2 # {
3701 LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
3706 if test "X$LSOF_TMP3" != "X" # {
3709 # Build a local NetBSD netexport.h header file for possible use by
3710 # <msdosfs/msdosfsmount.h>. Make sure CFGL contains a -I for it.
3712 LSOF_TMP1=${LSOF_TMPC}.edscr
3713 LSOF_TMP2=${LSOF_TMPC}.netcred
3714 LSOF_TMP3=${LSOF_TMPC}.netexport
3715 LSOF_TMP4=dialects/n+obsd/include/netexport.h
3716 if test ! -d dialects/n+obsd/include # {
3718 mkdir dialects/n+obsd/include
3720 rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4
3721 echo "/^struct netcred" > $LSOF_TMP1
3722 echo "1,.-1d" >> $LSOF_TMP1
3723 echo "/^};" >> $LSOF_TMP1
3724 echo "1,.w $LSOF_TMP2" >> $LSOF_TMP1
3725 ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
3727 echo "/^struct netexport" > $LSOF_TMP1
3728 echo "1,.-1d" >> $LSOF_TMP1
3729 echo "/^};" >> $LSOF_TMP1
3730 echo "1,.w $LSOF_TMP3" >> $LSOF_TMP1
3731 ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
3732 echo "/*" > $LSOF_TMP4
3733 echo " * netexport.h" >> $LSOF_TMP4
3734 echo -n " * Created by Configure: " >> $LSOF_TMP4
3735 echo `date` >> $LSOF_TMP4
3736 echo " */" >> $LSOF_TMP4
3737 echo "" >> $LSOF_TMP4
3738 echo "#if !defined(NETEXPORT_H)" >> $LSOF_TMP4
3739 echo "#define NETEXPORT_H" >> $LSOF_TMP4
3740 echo "" >> $LSOF_TMP4
3741 echo "#include <net/radix.h>" >> $LSOF_TMP4
3742 echo "" >> $LSOF_TMP4
3743 if test -r $LSOF_TMP2 # {
3745 cat $LSOF_TMP2 >> $LSOF_TMP4
3746 echo "" >> $LSOF_TMP4
3748 if test -r $LSOF_TMP3 # {
3750 cat $LSOF_TMP3 >> $LSOF_TMP4
3752 echo "#endif /* !defined(NETEXPORT_H) */" >> $LSOF_TMP4
3753 rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3
3754 echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
3755 if test $? -ne 0 # {
3757 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
3760 if test $LSOF_NBSD_BUFQH -eq 1 # {
3763 # Make a local copy of $NETBSD_SYS/sys/bufq.h.
3765 if test ! -d dialects/n+obsd/include # {
3767 mkdir dialects/n+obsd/include
3769 if test ! -d dialects/n+obsd/include/sys # {
3771 mkdir dialects/n+obsd/include/sys
3773 cp $NETBSD_SYS/sys/bufq.h dialects/n+obsd/include/sys
3774 echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
3775 if test $? -ne 0 # {
3777 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
3780 if test $LSOF_NBSD_PTYFS -eq 1 # {
3783 # Make a local copy of $NETBSD_SYS/sys/fs/ptyfs/.
3785 if test ! -d dialects/n+obsd/include # {
3787 mkdir dialects/n+obsd/include
3789 if test ! -d dialects/n+obsd/include/fs # {
3791 mkdir dialects/n+obsd/include/fs
3793 rm -rf dialects/n+obsd/include/fs/ptyfs
3794 mkdir dialects/n+obsd/include/fs/ptyfs
3795 cp $NETBSD_SYS/fs/ptyfs/*.h dialects/n+obsd/include/fs/ptyfs
3796 echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
3797 if test $? -ne 0 # {
3799 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
3802 LSOF_CFGL="$LSOF_CFGL -lkvm"
3803 LSOF_DIALECT_DIR=n+obsd
3806 # Configure for NeXTSTEP or OPENSTEP.
3808 nextstep|next|ns|nxt|openstep|os)
3810 LSOF_TSTXO="../lib/snpf.o"
3811 if test "X$LSOF_AR" = "X" # {
3813 LSOF_AR="rm -f \${LIB}; ar cr"
3815 if test "X$LSOF_VSTR" = "X" # {
3817 LSOF_VSTR=`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`
3819 if test "X$LSOF_VERS" = "X" # {
3822 # If the NeXSTEP version isn't predefined, determine it.
3824 LSOF_VERS=`echo $LSOF_VSTR | sed -n 's/\([0-9]*\)\.\([0-9]*\)/\1\2/p'`
3826 if test "X$LSOF_CC" = "X" # {
3828 if test -x /usr/local/bin/gcc # {
3830 LSOF_CC=/usr/local/bin/gcc
3831 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
3834 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
3837 echo $LSOF_CC | grep gcc > /dev/null
3838 if test $? -eq 0 # {
3840 LSOF_CFGL="$LSOF_CFGL -w"
3841 LSOF_DEBUG="-pedantic -O"
3843 LSOF_CFGF="$LSOF_CFGF -DSTEPV=$LSOF_VERS"
3844 LSOF_DIALECT_DIR=n+os
3848 if test -r ${AFS_VICE}/etc/ThisCell # {
3850 if test "X$LSOF_SCRIPT_CALL" = "Xno" # {
3852 if test -r ./AFSHeaders -a -r ./AFSVersion # {
3857 if test ! -x ./AFSConfig # {
3859 echo "Can't find or execute the AFSConfig script"
3864 if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion # {
3869 if test "X$LSOF_AFS" = "Xyes" # {
3871 LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
3872 LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
3873 LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
3878 # Configure for OpenBSD. (OpenBSD uses NetBSD dialect sources and version
3882 if test "X$LSOF_CC" = "X" # {
3885 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
3887 if test "X$LSOF_VSTR" = "X" # {
3889 LSOF_VSTR=`uname -r`
3891 if test "X$LSOF_VERS" = "X" # {
3894 # If the OpenBSD version isn't pre-defined, determine it.
3896 case $LSOF_VSTR in # {
3899 echo "!!!WARNING!!! Unsupported OpenBSD 1.x version: $LSOF_VSTR"
3900 echo "!!!WARNING!!! Configuring for OpenBSD 1.2"
3923 echo "!!!WARNING!!! Unsupported OpenBSD 2.x version: $LSOF_VSTR"
3924 echo "!!!WARNING!!! Configuring for OpenBSD 2.9"
3969 echo "!!!WARNING!!! Unsupported OpenBSD 3.x version: $LSOF_VSTR"
3970 echo "!!!WARNING!!! Configuring for OpenBSD 3.9"
3973 echo "Unknown OpenBSD release: $LSOF_VSTR"
3974 echo Assuming OpenBSD 3.9
3980 # Test for legal OpenBSD version.
3982 case $LSOF_VERS in # {
3983 1020|2050|2060|2070|2080|2090|3000|3010|3020|3030|3040|3050|3060|3070|3080|3090)
3986 echo "Unknown OpenBSD version: $LSOF_VERS"
3991 LSOF_CFGF="$LSOF_CFGF -DOPENBSDV=$LSOF_VERS"
3992 if test -r /dev/ksyms # {
3994 LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=/dev/ksyms"
3996 LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=/bsd"
3998 if test -r ${LSOF_INCLUDE}/nfs/nfsproto.h # {
4000 LSOF_CFGF="$LSOF_CFGF -DHASNFSPROTO"
4002 if test -r ${LSOF_INCLUDE}/netinet6/in6.h # {
4004 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
4007 if test "X$OPENBSD_SYS" = "X" # {
4011 if test -r ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h # {
4013 grep -q Fctty ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h
4014 if test $? -eq 0 # {
4016 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
4018 LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
4020 grep -q fd_link ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h
4021 if test $? -eq 0 # {
4023 LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
4027 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
4029 grep -q VT_LFS ${LSOF_INCLUDE}/sys/vnode.h
4030 if test $? -eq 0 # {
4032 LSOF_CFGF="$LSOF_CFGF -DHASLFS"
4035 if test -r ${LSOF_INCLUDE}/miscfs/nullfs/null.h # {
4037 LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
4039 if test -r ${OPENBSD_SYS}/miscfs/nullfs/null.h # {
4041 LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
4045 if test -d ${OPENBSD_SYS}/miscfs/procfs # {
4047 LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
4050 if test -d ${OPENBSD_SYS}/isofs/cd9660 # {
4052 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
4055 if test -d ${OPENBSD_SYS}/fs/cd9660 # {
4057 LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=2"
4061 if test -d ${OPENBSD_SYS}/msdosfs # {
4063 LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=1"
4066 if test -d ${OPENBSD_SYS}/fs/msdosfs # {
4068 LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=2"
4072 if test -r ${OPENBSD_SYS}/miscfs/kernfs/kernfs.h # {
4074 grep -q "kt_name;" ${OPENBSD_SYS}/miscfs/kernfs/kernfs.h
4075 if test $? -eq 0 # {
4077 LSOF_CFGF="$LSOF_CFGF -DHASKERNFS"
4081 if test $LSOF_TMP1 -eq 1 -a "X$LSOF_INCLUDE" != "X$OPENBSD_SYS" # {
4083 LSOF_DINC="-I$LSOF_INCLUDE -I$OPENBSD_SYS"
4085 grep -q VT_EXT2FS ${LSOF_INCLUDE}/sys/vnode.h
4086 if test $? -eq 0 # {
4089 if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h # {
4091 grep -q "*e2fs_din" ${LSOF_INCLUDE}/ufs/ufs/inode.h
4092 if test $? -eq 0 # {
4094 LSOF_CFGF="$LSOF_CFGF -DHASI_E2FS_PTR"
4096 grep -q "^#define[ ]i_e2din" ${LSOF_INCLUDE}/ufs/ufs/inode.h
4097 if test $? -eq 0 # {
4102 LSOF_CFGF="$LSOF_CFGF -DHASEXT2FS=$LSOF_TMP1"
4104 if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h # {
4106 grep -q i_effnlink ${LSOF_INCLUDE}/ufs/ufs/inode.h
4107 if test $? -eq 0 # {
4109 LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_effnlink"
4111 grep -q dinode_u ${LSOF_INCLUDE}/ufs/ufs/inode.h
4112 if test $? -eq 0 # {
4114 LSOF_CFGF="$LSOF_CFGF -DHAS_DINODE_U"
4116 grep -q i_ffs1_size ${LSOF_INCLUDE}/ufs/ufs/inode.h
4117 if test $? -eq 0 # {
4119 LSOF_CFGF="$LSOF_CFGF -DHASI_FFS1"
4121 grep -q UM_UFS ${LSOF_INCLUDE}/ufs/ufs/inode.h
4122 if test $? -eq 0 # {
4124 LSOF_CFGF="$LSOF_CFGF -DHAS_UM_UFS"
4127 if test -r ${LSOF_INCLUDE}/sys/namei.h
4129 grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
4130 if test $? -eq 0 # {
4132 LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
4135 if test "X$OPENBSD_UVM" = "X" # {
4137 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
4139 grep -q UVM ${LSOF_INCLUDE}/sys/vnode.h
4140 if test $? -ne 0 # {
4142 egrep -q "v_uvm;|v_uobj;" ${LSOF_INCLUDE}/sys/vnode.h
4143 if test $? -eq 0 # {
4150 if test "X$OPENBSD_UVM" = "XY" -o "X$OPENBSD_UVM" = "Xy" # {
4152 LSOF_CFGF="$LSOF_CFGF -DUVM"
4153 if test -d ${LSOF_INCLUDE}/uvm # {
4155 LSOF_CFGF="$LSOF_CFGF -DHAS_UVM_INCL"
4158 if test -r ${LSOF_INCLUDE}/sys/mount.h -a $LSOF_VERS -lt 3030 # {
4161 # Build a local OpenBSD netexport.h header file for possible use by
4162 # <msdosfs/msdosfsmount.h>. Make sure CFGL contains a -I for it.
4164 LSOF_TMP1=${LSOF_TMPC}.edscr
4165 LSOF_TMP2=${LSOF_TMPC}.netcred
4166 LSOF_TMP3=${LSOF_TMPC}.netexport
4167 LSOF_TMP4=dialects/n+obsd/include/netexport.h
4168 if test ! -d dialects/n+obsd/include # {
4170 mkdir dialects/n+obsd/include
4172 rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4
4173 echo "/^struct netcred" > $LSOF_TMP1
4174 echo "1,.-1d" >> $LSOF_TMP1
4175 echo "/^};" >> $LSOF_TMP1
4176 echo "1,.w $LSOF_TMP2" >> $LSOF_TMP1
4177 ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
4179 echo "/^struct netexport" > $LSOF_TMP1
4180 echo "1,.-1d" >> $LSOF_TMP1
4181 echo "/^};" >> $LSOF_TMP1
4182 echo "1,.w $LSOF_TMP3" >> $LSOF_TMP1
4183 ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
4184 echo "/*" > $LSOF_TMP4
4185 echo " * netexport.h" >> $LSOF_TMP4
4186 echo -n " * Created by Configure: " >> $LSOF_TMP4
4187 echo `date` >> $LSOF_TMP4
4188 echo " */" >> $LSOF_TMP4
4189 echo "" >> $LSOF_TMP4
4190 echo "#if !defined(NETEXPORT_H)" >> $LSOF_TMP4
4191 echo "#define NETEXPORT_H" >> $LSOF_TMP4
4192 echo "" >> $LSOF_TMP4
4193 echo "#include <net/radix.h>" >> $LSOF_TMP4
4194 echo "" >> $LSOF_TMP4
4195 if test -r $LSOF_TMP2 # {
4197 cat $LSOF_TMP2 >> $LSOF_TMP4
4198 echo "" >> $LSOF_TMP4
4200 if test -r $LSOF_TMP3 # {
4202 cat $LSOF_TMP3 >> $LSOF_TMP4
4204 echo "#endif /* !defined(NETEXPORT_H) */" >> $LSOF_TMP4
4205 rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3
4206 echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
4207 if test $? -ne 0 # {
4209 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
4212 if test -r ${LSOF_INCLUDE}/sys/lockf.h # {
4214 grep vop_advlock_args ${LSOF_INCLUDE}/sys/lockf.h > /dev/null
4215 if test $? -eq 0 # {
4217 LSOF_CFGF="$LSOF_CFGF -DHAS_ADVLOCK_ARGS"
4220 if test -r ${LSOF_INCLUDE}/sys/pipe.h # {
4222 LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_PIPEH"
4224 LSOF_CFGL="$LSOF_CFGL -lkvm"
4225 LSOF_DIALECT_DIR=n+obsd
4228 # Configure for SCO OpenServer.
4230 osr|osrgcc|sco|scogcc)
4231 if test "X$LSOF_RANLIB_SUP" = "X" # {
4235 if test "X$OSR_CFGF" != "X" # {
4238 # Adopt LSOF_CFGF from OSR_CFGF in environment.
4242 if test "X$OSR_CFGL" != "X" # {
4245 # Adopt LSOF_CFGL from OSR_CFGL in environment.
4250 # Evaluate compiler specification.
4252 if test "X$LSOF_CC" = "X" # {
4254 if test "X$LSOF_TGT" = "Xosr" -o "X$LSOF_TGT" = "Xsco" # {
4260 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
4268 # Determine version.
4270 if test "X$LSOF_VSTR" = "X" # {
4272 LSOF_VSTR="`LANG=C_C.C /bin/uname -X 2>/dev/null | grep Release | sed 's/Release = \(.*\)/\1/'`"
4274 if test "X$LSOF_VERS" = "X" # {
4277 # If the SCO OpenServer release version isn't predefined, determine it.
4279 case $LSOF_VSTR in # {
4296 LSOF_TSTLFLG="-lsocket"
4297 LSOF_VERS="`echo $LSOF_VSTR | sed 's/3\.2v//; s/\.//g'`"
4300 echo Unknown SCO OpenServer release: $LSOF_VSTR
4301 echo Assuming 3.2.0 or 3.2.1
4307 # Do SCO OpenServer specific stuff.
4309 case $LSOF_VERS in # {
4311 if test $LSOF_TMP1 -eq 1 # {
4313 LSOF_CFGF="$LSOF_CFGF -nointl"
4316 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4320 if test $LSOF_TMP1 -eq 1 # {
4324 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4328 if test $LSOF_TMP1 -eq 1 # {
4330 LSOF_CFGF="$LSOF_CFGF -nointl"
4333 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4337 if test $LSOF_TMP1 -eq 1 # {
4339 LSOF_CFGF="$LSOF_CFGF -nointl"
4342 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4345 if test $LSOF_TMP1 -eq 1 # {
4347 LSOF_CFGF="$LSOF_CFGF -nointl"
4350 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4353 if test $LSOF_TMP1 -eq 1 # {
4355 LSOF_CFGF="$LSOF_CFGF -nointl"
4358 LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
4361 if test $LSOF_TMP1 -eq 1 # {
4363 LSOF_CFGF="$LSOF_CFGF -belf"
4364 LSOF_DEBUG="-O3 -Kspace"
4366 LSOF_CFGL="$LSOF_CFGL -lsocket"
4369 echo "Unsupported SCO OpenServer release: $LSOF_VERS"
4374 LSOF_CFGF="$LSOF_CFGF -DOSRV=$LSOF_VERS"
4375 if test "X$OSR_STATLSTAT" = "X" # {
4377 echo "Testing libc.a for statlstat"
4378 /bin/nm /lib/libc.a | grep statlstat > /dev/null 2>&1
4379 if test $? -eq 0 # {
4381 LSOF_CFGF="$LSOF_CFGF -DHAS_STATLSTAT"
4384 if test "X$OSR_STATLSTAT" = "XY" -o "X$OSR_STATLSTAT" = "Xy" # {
4386 LSOF_CFGF="$LSOF_CFGF -DHAS_STATLSTAT"
4389 if test -r ${LSOF_INCLUDE}/sys/fs/nfs/rnode.h # {
4391 LSOF_CFGF="$LSOF_CFGF -DHAS_NFS"
4393 if test ! -r ${LSOF_INCLUDE}/netdb.h # {
4395 LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/osr/include"
4397 LSOF_DIALECT_DIR=osr
4400 # Configure for Sun Solaris, SunPro C and gcc.
4403 if test "X$LSOF_RANLIB_SUP" = "X" # {
4407 if test "X$LSOF_CC" = "X" # {
4409 if test "X$LSOF_TGT" = "Xsolariscc" # {
4411 if test "X$SOLARIS_CCDIR" = "X" # {
4413 SOLARIS_CCDIR="/opt/SUNWspro/bin"
4415 if test -x ${SOLARIS_CCDIR}/cc # {
4417 LSOF_CC=${SOLARIS_CCDIR}/cc
4419 if test -x /opt/SunStudioExpress/bin/cc # {
4421 LSOF_CC=/opt/SunStudioExpress/bin/cc
4423 echo "WARNING: no cc in ${SOLARIS_CCDIR}; using cc without path."
4427 LSOF_CCV=`$LSOF_CC -V 2>&1 | sed -n 's/^cc: \(.*\)/\1/p'`
4430 LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
4434 if test "X$LSOF_VSTR" = "X" # {
4436 LSOF_VSTR=`uname -r`
4438 if test "X$LSOF_VERS" = "X" # {
4441 # If the Solaris version isn't predefined, determine it.
4443 case $LSOF_VSTR in # {
4460 LSOF_TSTLFLG="-lsocket -lnsl"
4465 LSOF_TSTLFLG="-lsocket -lnsl"
4470 LSOF_TSTLFLG="-lsocket -lnsl"
4475 LSOF_TSTLFLG="-lsocket -lnsl"
4480 LSOF_TSTLFLG="-lsocket -lnsl"
4485 LSOF_TSTLFLG="-lsocket -lnsl"
4489 echo Unknown Solaris version: $LSOF_VSTR
4495 # Clear LSOF_UNSUP message for selected Solaris versions.
4497 case $LSOF_VERS in # {
4498 90000|100000|110000)
4503 # Do Solaris version-specific stuff.
4505 case $LSOF_VERS in # {
4508 # Solaris patch 101318-32 creates a longer kernel tcp_s structure,
4509 # and 101318-45 changes the way the vnode's v_filocks member is
4510 # handled. The following code creates a symbol definition for
4511 # patch 101318 whose value is the patch level. No symbol is defined
4512 # if the patch level is not greater than zero.
4514 if test "X$SOLARIS_23P101318" = "X" # {
4516 LSOF_PL=`grep -h SUNW_PATCHID=101318 /var/sadm/pkg/SUNWcar*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
4517 if test "X$LSOF_PL" = "X" # {
4522 LSOF_PL=$SOLARIS_23P101318
4524 if test $LSOF_PL -gt 0 # {
4526 LSOF_CFGF="$LSOF_CFGF -DP101318=$LSOF_PL"
4530 if test "X$SOLARIS_24P101945" = "X" # {
4532 LSOF_PL=`grep -h SUNW_PATCHID=101945 /var/sadm/pkg/SUNWcar*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
4533 if test "X$LSOF_PL" = "X" # {
4538 LSOF_PL=$SOLARIS_24P101945
4540 if test $LSOF_PL -ge 32 # {
4542 if test "X$SOLARIS_24P102303" = "X" # {
4544 LSOF_PL=`grep -h SUNW_PATCHID=102303 /var/sadm/pkg/SUNWhea*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
4545 if test "X$LSOF_PL" = "X" # {
4550 LSOF_PL=$SOLARIS_24P102303
4552 if test $LSOF_PL -ge 2 # {
4554 echo "WARNING: your Solaris 2.4 system appears to have patches 101945-32 and 102303-2"
4555 echo " installed. This probably means the NUM_*_VECTORS definitions in"
4556 echo " <sys/auxv.h> don't match the ones used to build your kernel. Consult"
4557 echo " the Sun Problems section of the 00FAQ file of the lsof distribution"
4558 echo " for more information on how to work around the problem."
4564 20600|70000|80000|90000|100000|110000)
4565 if test "X$SOLARIS_26PR_GWINDOWS" = "X" # {
4567 rm -f ${LSOF_TMPC}.*
4568 echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
4569 echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
4570 echo "main(){" >> ${LSOF_TMPC}.c
4571 echo "enum prnodetype p=PR_GWINDOWS;}" >> ${LSOF_TMPC}.c
4572 echo "Testing prdata.h for PR_GWINDOWS, using $LSOF_CC"
4573 echo $LSOF_CC | grep gcc > /dev/null
4574 if test $? -eq 0 # {
4576 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
4578 $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
4580 if test $? -eq 0 # {
4582 LSOF_CFGF="$LSOF_CFGF -DHASPR_GWINDOWS"
4585 if test "X$SOLARIS_26PR_GWINDOWS" = "XY" -o "X$SOLARIS_26PR_GWINDOWS" = "Xy" # {
4587 LSOF_CFGF="$LSOF_CFGF -DHASPR_GWINDOWS"
4590 if test "X$SOLARIS_26PR_LDT" = "X" # {
4592 rm -f ${LSOF_TMPC}.*
4593 echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
4594 echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
4595 echo "main(){" >> ${LSOF_TMPC}.c
4596 echo "enum prnodetype p=PR_LDT;}" >> ${LSOF_TMPC}.c
4597 echo "Testing prdata.h for PR_LDT, using $LSOF_CC"
4598 echo $LSOF_CC | grep gcc > /dev/null
4599 if test $? -eq 0 # {
4601 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
4603 $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
4605 if test $? -eq 0 # {
4607 LSOF_CFGF="$LSOF_CFGF -DHASPR_LDT"
4609 rm -f ${LSOF_TMPC}.*
4611 if test "X$SOLARIS_26PR_LDT" = "XY" -o "X$SOLARIS_26PR_LDT" = "Xy" # {
4613 LSOF_CFGF="$LSOF_CFGF -DHASPR_LDT"
4616 if test $LSOF_VERS -ge 70000 # {
4619 # Do tests for Solaris 7 and above.
4621 if test "X$SOLARIS_KERNBITS" = "X" # {
4623 SOLARIS_KERNBITS=`/bin/isainfo -kv`
4625 if test "X$SOLARIS_INSTR" = "X" # {
4627 SOLARIS_INSTR=`/bin/isainfo -k`
4629 echo $SOLARIS_KERNBITS | grep 64 > /dev/null
4630 if test $? -eq 0 # {
4632 echo $LSOF_CC | grep gcc > /dev/null
4633 if test $? -eq 0 # {
4636 # Test gcc for 64 bit support.
4638 echo "Testing $LSOF_CC for 64 bit support"
4639 rm -f ${LSOF_TMPC}.*
4640 echo "main(){}" > ${LSOF_TMPC}.c
4643 # First try gcc's -m64 option -- it's the most current possibility.
4645 $LSOF_CC ${LSOF_TMPC}.c -m64 -o ${LSOF_TMPC}.x > /dev/null 2>&1
4646 if test $? -eq 0 # {
4648 /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
4649 if test $? -eq 0 # {
4654 rm -f ${LSOF_TMPC}.*
4655 if test "X$LSOF_TMP1" = "X" # {
4658 # Try using the older -mcpu=v9 option with gcc instead of -m64.
4660 echo "main(){}" > ${LSOF_TMPC}.c
4661 $LSOF_CC ${LSOF_TMPC}.c -mcpu=v9 -o ${LSOF_TMPC}.x > /dev/null 2>&1
4662 if test $? -eq 0 # {
4664 /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
4665 if test $? -eq 0 # {
4667 LSOF_TMP1="-mcpu=v9"
4670 rm -f ${LSOF_TMPC}.*
4672 if test "X$LSOF_TMP1" = "X" # {
4675 echo "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
4677 echo "! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT !"
4678 echo "! THIS GCC DOESN'T SUPPORT THE BUILDING OF 64 BIT !"
4679 echo "! SOLARIS EXECUTABLES. LSOF WILL BE CONFIGURED FOR A !"
4680 echo "! 32 BIT KERNEL. !"
4682 echo "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
4686 echo "*********************************"
4687 echo "* Configuring for 64 bit kernel *"
4688 echo "*********************************"
4690 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
4691 LSOF_CINFO="64 bit kernel"
4696 # Test Sun compiler for 64 bit support.
4698 case $SOLARIS_INSTR in # {
4711 if test "X$LSOF_TMP1" != "X" # {
4713 echo "Testing $LSOF_CC for 64 bit $LSOF_TMP2 support"
4714 rm -f ${LSOF_TMPC}.*
4715 LSOF_TMP3="-xarch=$LSOF_TMP1"
4716 echo "main(){}" > ${LSOF_TMPC}.c
4717 LSOF_TMP4=`$LSOF_CC ${LSOF_TMPC}.c $LSOF_TMP3 -o ${LSOF_TMPC}.x 2>&1`
4718 if test $? -eq 0 # {
4720 /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
4721 if test $? -ne 0 # {
4725 echo "X$LSOF_TMP4" | grep "use -m64" > /dev/null 2>&1
4726 if test $? -eq 0 # {
4732 rm -f ${LSOF_TMPC}.*
4736 if test "X$LSOF_TMP3" != "X" # {
4739 echo "*********************************"
4740 echo "* Configuring for 64 bit kernel *"
4741 echo "*********************************"
4743 LSOF_CFGF="$LSOF_CFGF $LSOF_TMP3"
4744 LSOF_CINFO="64 bit kernel"
4748 echo "!!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!"
4750 echo "! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT"
4751 echo "! THE VERSION OF SUN C AVAILABLE DOESN'T SUPPORT THE"
4752 echo "! \"$LSOF_TMP2\" INSTRUCTION SET."
4754 echo "! LSOF WILL BE CONFIGURED FOR A 32 BIT KERNEL."
4756 echo "!!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!"
4762 echo "*********************************"
4763 echo "* Configuring for 32 bit kernel *"
4764 echo "*********************************"
4766 LSOF_CINFO="32 bit kernel"
4770 # Do tests specific to Solaris 8 and above.
4772 if test $LSOF_VERS -ge 80000 # {
4774 if test -r ${LSOF_INCLUDE}/netinet/ip6.h # {
4776 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
4780 # Do tests specific to Solaris 9 and above.
4782 if test $LSOF_VERS -ge 90000 # {
4784 if test -r ${LSOF_INCLUDE}/sys/socketvar.h # {
4786 grep soua_vp ${LSOF_INCLUDE}/sys/socketvar.h > /dev/null 2>&1
4787 if test $? -eq 0 # {
4789 LSOF_CFGF="$LSOF_CFGF -DHASSOUXSOUA"
4792 if test $LSOF_VERS -lt 110000 # {
4795 # Do tests specific to Solaris 9 and 10.
4797 if test -r ${LSOF_INCLUDE}/sys/lgrp_user.h # {
4799 if test -r ${LSOF_INCLUDE}/sys/lgrp.h # {
4801 grep lgrp_root ${LSOF_INCLUDE}/sys/lgrp_user.h > /dev/null 2>&1
4802 if test $? -eq 0 # {
4804 grep lgrp_root ${LSOF_INCLUDE}/sys/lgrp.h > /dev/null 2>&1
4807 LSOF_CFGF="$LSOF_CFGF -DHAS_LGRP_ROOT_CONFLICT"
4815 # Do tests specific to Solaris 10 and above.
4817 if test $LSOF_VERS -eq 100000 # {
4819 if test -r ${LSOF_INCLUDE}/sys/socket_proto.h # {
4821 LSOF_CFGF="$LSOF_CFGF -DHAS_SOCKET_PROTO_H"
4824 if test $LSOF_VERS -ge 100000 # {
4826 if test -r ${LSOF_INCLUDE}/inet/ipclassifier.h # {
4828 LSOF_CFGF="$LSOF_CFGF -DHAS_IPCLASSIFIER_H"
4829 grep conn_ixa ${LSOF_INCLUDE}/inet/ipclassifier.h > /dev/null 2>&1
4830 if test $? -eq 0 # {
4832 LSOF_CFGF="$LSOF_CFGF -DHAS_CONN_NEW"
4835 if test -r ${LSOF_INCLUDE}/sys/cred_impl.h # {
4837 LSOF_CFGF="$LSOF_CFGF -DHAS_CRED_IMPL_H"
4839 # DEBUG -- Begin temporary hack for Solaris 10, build s10_44.
4841 grep "c2/audit.h" ${LSOF_INCLUDE}/sys/cred_impl.h > /dev/null
4842 if test $? -eq 0 # {
4844 rm -rf `pwd`/dialects/sun/solaris10
4845 mkdir `pwd`/dialects/sun/solaris10
4846 mkdir `pwd`/dialects/sun/solaris10/c2
4847 touch `pwd`/dialects/sun/solaris10/c2/audit.h
4848 LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/sun/solaris10"
4851 # DEBUG -- End temporary hack for Solaris 10, build s10_44.
4854 if test -r ${LSOF_INCLUDE}/sys/vnode.h # {
4856 grep v_path ${LSOF_INCLUDE}/sys/vnode.h > /dev/null 2>&1
4857 if test $? -eq 0 # {
4859 LSOF_CFGF="$LSOF_CFGF -DHAS_V_PATH"
4863 if test -r ${LSOF_INCLUDE}/sys/fs/pc_fs.h # {
4865 grep pc_direntpersec ${LSOF_INCLUDE}/sys/fs/pc_fs.h > /dev/null 2>&1
4866 if test $? -eq 0 # {
4868 LSOF_CFGF="$LSOF_CFGF -DHAS_PC_DIRENTPERSEC"
4872 if test -r ${LSOF_INCLUDE}/sys/zone.h # {
4874 LSOF_CFGF="$LSOF_CFGF -DHASZONES"
4877 # Check for Solaris 10 or higher CTF library and things that depend
4880 if test -r ${LSOF_INCLUDE}/libctf.h # {
4884 if test -r ${LSOF_INCLUDE}/sys/fs/zfs.h # {
4886 if test $LSOF_CTFH -eq 1 # {
4888 LSOF_CFGF="$LSOF_CFGF -DHAS_ZFS"
4891 echo "WARNING: ZFS support not enabled; libctf.h missing."
4894 if test $LSOF_VERS -ge 110000 # {
4897 # Do things specific to Solaris 11 and above.
4899 if test $LSOF_CTFH -eq 1 # {
4903 echo "WARNING: socket support not enabled; libctf.h missing."
4907 mkdir ./solaris11/sys
4908 touch ./solaris11/sys/extdirent.h
4909 echo "./solaris11/sys/extdirent.h created"
4910 LSOF_CFGF="$LSOF_CFGF -I`pwd`/solaris11"
4911 if test -r ${LSOF_INCLUDE}/sys/mutex.h # {
4914 # Check <sys/mutex.h> 'for pad_mutex_t;'.
4916 grep 'pad_mutex_t;' ${LSOF_INCLUDE}/sys/mutex.h > /dev/null 2>&1
4917 if test $? -eq 0 # {
4919 LSOF_CFGF="$LSOF_CFGF -DHAS_PAD_MUTEX"
4924 # If -lctf was added to LSOF_CFGL, define HAS_LIBCTF.
4926 if test $LSOF_CTFL -eq 1 # {
4928 LSOF_CFGF="$LSOF_CFGF -DHAS_LIBCTF"
4929 LSOF_CFGL="$LSOF_CFGL -lctf"
4933 echo "Unsupported Solaris version: $LSOF_VERS"
4938 LSOF_CFGF="$LSOF_CFGF -Dsolaris=$LSOF_VERS"
4940 # Test for <sys/fs/cachefs_fs.h>.
4942 if test -r ${LSOF_INCLUDE}/sys/fs/cachefs_fs.h # {
4944 LSOF_CFGF="$LSOF_CFGF -DHASCACHEFS"
4947 # Test for <utmpx.h>
4949 if test -r ${LSOF_INCLUDE}/utmpx.h # {
4951 LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
4956 if test "X$SOLARIS_VSOCK" = "X" # {
4958 rm -f ${LSOF_TMPC}.*
4959 echo "#include <sys/vnode.h>" > ${LSOF_TMPC}.c
4960 echo "main(){" >> ${LSOF_TMPC}.c
4961 echo "enum vtype p=VSOCK;}" >> ${LSOF_TMPC}.c
4962 echo "Testing vnode.h for VSOCK, using $LSOF_CC"
4963 echo $LSOF_CC | grep gcc > /dev/null
4964 if test $? -eq 0 # {
4966 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
4968 $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
4970 if test $? -eq 0 # {
4972 LSOF_CFGF="$LSOF_CFGF -DHAS_VSOCK"
4974 rm -f ${LSOF_TMPC}.*
4976 if test "X$SOLARIS_VSOCK" = "XY" -o "X$SOLARIS_VSOCK" = "Xy" # {
4978 LSOF_CFGF="$LSOF_CFGF -DHAS_VSOCK"
4984 if test -r ${AFS_VICE}/etc/ThisCell # {
4986 if test "X$LSOF_SCRIPT_CALL" = "Xno" # {
4988 if test -r ./AFSHeaders -a -r ./AFSVersion # {
4993 if test ! -x ./AFSConfig # {
4995 echo "Can't find or execute the AFSConfig script"
5000 if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion # {
5005 if test "X$LSOF_AFS" = "Xyes" # {
5007 if test "X$SUN_AFSAPATHDEF" = "X" # {
5009 ls /usr/vice/etc/modload/libafs > /dev/null 2>&1
5010 if test $? -ne 0 # {
5012 LSOF_TMP1=`ls /usr/vice/etc/modload/libafs* 2>/dev/null | wc -l`
5013 if test $LSOF_TMP1 -ne 0 # {
5015 SUN_AFSAPATHDEF=`ls -t /usr/vice/etc/modload/libafs* | head -1`
5019 if test "X$SUN_AFSAPATHDEF" != "X" # {
5021 LSOF_CFGF="$LSOF_CFGF -DAFSAPATHDEF=\\\"$SUN_AFSAPATHDEF\\\""
5023 LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
5024 LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
5025 LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
5031 # If the location of the VxFS header files hasn't been defined in the
5032 # environment, establish their likely locations.
5034 LSOF_TMP2=$SOLARIS_VXFSINCL
5035 if test -d /opt/VRTS/include # {
5037 LSOF_TMP2="$LSOF_TMP2 /opt/VRTS/include"
5039 if test -d /opt/VRTSvxfs/include # {
5041 LSOF_TMP2="$LSOF_TMP2 /opt/VRTSvxfs/include"
5044 for i in $LSOF_TMP2 # {
5046 if test -r ${i}/vxfsutil.h # {
5053 if test $LSOF_TMP1 -eq 1 # {
5056 # Warn that VxFS is unsupported.
5058 LSOF_UNSUP2="WARNING: VxFS is no longer supported by Solaris lsof."
5060 # The VxFS header files are for VxFS version 3.4 or above. Enable VxFS
5061 # for those versions.
5063 LSOF_CFGF="$LSOF_CFGF -DHASVXFS -DHASVXFSUTIL -I$SOLARIS_VXFSINCL"
5065 # Determine which libvxfsutil.a is required -- 32 or 64 bit.
5067 LSOF_TMP2="" # assume 32 bit
5068 echo "X$LSOF_CINFO" | grep "^X64" > /dev/null 2>&1
5069 if test $? -eq 0-a "X$SOLARIS_INSTR" != "X" # {
5071 case $SOLARIS_INSTR in # {
5076 LSOF_TMP2="/sparcv9"
5081 # See if the correct library has been specified and exists.
5083 if test "X$SOLARIS_VXFSLIB" = "X" # {
5085 SOLARIS_VXFSLIB=`dirname $SOLARIS_VXFSINCL`/lib
5087 LSOF_TMP3="${SOLARIS_VXFSLIB}${LSOF_TMP2}/libvxfsutil.a"
5088 if test ! -r $LSOF_TMP3 # {
5090 echo "!!!FATAL: no VxFS $LSOF_TMP3"
5093 LSOF_CFGL="$LSOF_CFGL -L$SOLARIS_VXFSLIB${LSOF_TMP2} -lvxfsutil -ldl"
5095 # See if the library has the Reverse Name Lookup (RNL) function.
5097 nm $LSOF_TMP3 | grep vxfs_inotopath > /dev/null 2>&1
5098 if test $? -eq 0 # {
5100 LSOF_CFGF="$LSOF_CFGF -DHASVXFSRNL -DHASVXFSDNLC"
5104 # See if there are VxFS header files for VxFS versions below 3.4.
5106 if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h # {
5109 # Define VxFS for VxFS versions below 3.4. Make additional header
5112 LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
5113 if test -r ${LSOF_INCLUDE}/sys/fs/vx_fs.h # {
5115 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_FS_H"
5117 if test -r ${LSOF_INCLUDE}/sys/fs/vx_sol.h # {
5119 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_SOL_H"
5121 if test -r ${LSOF_INCLUDE}/sys/fs/vx_machdep.h # {
5123 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_MACHDEP_H"
5125 if test -r ${LSOF_INCLUDE}/sys/fs/vx_solaris.h # {
5127 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_SOLARIS_H"
5128 grep "off32_t;" ${LSOF_INCLUDE}/sys/fs/vx_machdep.h > /dev/null
5129 if test $? -eq 0 # {
5131 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_OFF32_T"
5133 grep "off64_t;" ${LSOF_INCLUDE}/sys/fs/vx_solaris.h > /dev/null
5134 if test $? -eq 0 # {
5136 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_OFF64_T"
5138 grep "vx_u64_t;" ${LSOF_INCLUDE}/sys/fs/vx_solaris.h > /dev/null
5139 if test $? -eq 0 # {
5141 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_U64_T"
5144 egrep "struct[ ]vx_inode[ ]\{" ${LSOF_INCLUDE}/sys/fs/vx_inode.h > /dev/null
5145 # } (dummy '}' to match '{' in above egrep)
5146 if test $? -eq 0 # {
5148 LSOF_CFGF="$LSOF_CFGF -DHASVXFS_VX_INODE"
5153 # Set libraries and dialect subdirectory.
5155 LSOF_CFGL="$LSOF_CFGL -lkvm -lelf -lsocket -lnsl"
5156 LSOF_DIALECT_DIR=sun
5158 # Set local-specific stuff.
5160 if test "X$LSOF_LOCALSUFFIX" = "XLOCAL" # {
5162 LSOF_DOC="\${DESTDIR}/usr/local/man"
5166 # Configure for SCO|Caldera OpenServer Release 6.0.0 and UnixWare.
5171 if test "X$LSOF_RANLIB_SUP" = "X" # {
5175 if test "X$LSOF_VSTR" = "X" # {
5177 LSOF_VSTR=`uname -v`
5179 if test "X$LSOF_VERS" = "X" # {
5182 # If the Openserver Release 6.0.0 or UnixWare version isn't pre-defined,
5185 LSOF_VERS=`echo $LSOF_VSTR | sed 's/\([0-9\.]*\).*/\1/; s/\./ /g' | awk '{printf "%d%02d%02d\n", $1, $2, $3;}'`
5187 if test $LSOF_TMP1 = "osr6" # {
5189 LSOF_CINFO="OSR6 support via UnixWare sources"
5191 # Convert the OpenServer Release 6.0.0 version number to a UnixWare one.
5193 case $LSOF_VERS in # {
5198 echo "Unknown OpenServer Release version: $LSOF_VERS"
5203 LSOF_CFGF="$LSOF_CFGF -DUNIXWAREV=$LSOF_VERS"
5205 # Do OpenServer Release 6.0.0 and UnixWare version-specific stuff.
5207 case $LSOF_VERS in # {
5208 20100|20101|20102|20103)
5209 if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h # {
5211 LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
5213 LSOF_CFGL="$LSOF_CFGL -lsocket -lnsl -lelf -lgen"
5215 70000|70001|70100|70101|70103|70104)
5217 LSOF_TSTLFLG="-lsocket -lnsl"
5218 if test $LSOF_VERS -lt 70103 # {
5220 LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/uw/uw7"
5221 else # $LSOF_VERS -ge 70103
5223 # Process 7.1.3 and above.
5225 if test -r ${LSOF_INCLUDE}/netinet/in6.h # {
5227 LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
5229 if test $LSOF_VERS -ge 70104 # {
5232 # Process 7.1.4 and above.
5235 if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h # {
5237 grep INKERNEL ${LSOF_INCLUDE}/netinet/in_pcb.h > /dev/null 2>&1
5238 if test $? -eq 0 # {
5243 if test $LSOF_TMP1 -eq 0 -a -r ${LSOF_INCLUDE}/netinet/tcp_var.h # {
5245 grep INKERNEL ${LSOF_INCLUDE}/netinet/tcp_var.h > /dev/null 2>&1
5246 if test $? -eq 0 # {
5251 if test $LSOF_TMP1 -eq 1 # {
5253 LSOF_CFGF="$LSOF_CFGF -DHAS_INKERNEL"
5257 if test ! -r ${LSOF_INCLUDE}/vm/swap.h -a -r ${LSOF_INCLUDE}/sys/swap.h # {
5259 (cd ./dialects/uw/uw7/vm; rm -f swap.h; ln -s ${LSOF_INCLUDE}/sys/swap.h swap.h)
5261 if test -r ${LSOF_INCLUDE}/sys/fs/vx_gemini.h # {
5263 LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
5265 LSOF_CFGL="$LSOF_CFGL -lsocket -lnsl -lelf -lgen"
5266 /bin/pkginfo 2> /dev/null | grep -i patch | grep -i ptf7038 > /dev/null
5267 if test -r ${LSOF_INCLUDE}/sys/file.h # {
5269 grep f_open ${LSOF_INCLUDE}/sys/file.h > /dev/null
5270 if test $? -eq 0 # {
5272 LSOF_CFGF="$LSOF_CFGF -DHAS_F_OPEN"
5275 if test -r ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h # {
5277 grep "cdfs_LogSecShift;" ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h > /dev/null 2>&1
5278 if test $? -eq 0 # {
5280 LSOF_TMP=`grep "cdfs_LogSecShift;" ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h | sed 's/^[ ]*\([^ ]*\).*/\1/'`
5281 if test "X$LSOF_TMP" != "X" # {
5283 LSOF_CFGF="$LSOF_CFGF -DTYPELOGSECSHIFT=$LSOF_TMP"
5287 if test -r ${LSOF_INCLUDE}/sys/proc.h # {
5289 grep p_pgid ${LSOF_INCLUDE}/sys/proc.h > /dev/null
5290 if test $? -eq 0 # {
5292 LSOF_CFGF="$LSOF_CFGF -DHAS_P_PGID"
5295 if test $LSOF_VERS -ge 70101 # {
5298 # Do OpenServer Release 6.0.0 and UnixWare 7.1.1 and above tests, as
5301 if test "X$UW_HAS_NSC" = "X" # {
5304 if test -x /bin/node_self # {
5306 /bin/node_self > /dev/null 2>&1
5307 if test $? -eq 0 # {
5313 if test "X$UW_HAS_NSC" = "XY" -o "X$UW_HAS_NSC" = "Xy" # {
5315 LSOF_CFGF="$LSOF_CFGF -DHAS_UW_NSC"
5316 LSOF_CFGL="$LSOF_CFGL -lcluster"
5318 if test -r ${LSOF_INCLUDE}/sys/nsc_synch.h # {
5320 LSOF_CFGF="$LSOF_CFGF -DHAS_UW_CFS"
5325 echo Unsupported UnixWare version: `uname -v`
5330 if test -r ${LSOF_INCLUDE}/sys/fs/xnamnode.h # {
5332 LSOF_CFGF="$LSOF_CFGF -DHASXNAMNODE"
5337 # Handle unknown abbreviation.
5340 echo "Can't configure for $LSOF_TGT."
5346 # End of LSOF_TGT cases
5350 # Do an inventory of the distribution, as required.
5352 if test "X$LSOF_SCRIPT_CALL" = "Xyes" -a ! -r ./.neverInv # {
5354 if test ! -f ./Inventory # Want -x, but Ultrix doesn't grok it. # {
5356 echo "Can't find Inventory script."
5363 # Make sure target directory exists.
5365 if test ! -d ./dialects/$LSOF_DIALECT_DIR # {
5367 echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR doesn't exist."
5372 # Make sure $LSOF_MK exists in the target directory.
5374 if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK # {
5376 echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK doesn't exist."
5381 # Make sure $LSOF_MKF, $LSOF_SPMKF, or $LSOF_MKF.$LSOF_LOCALSUFFIX) exists
5382 # in the target directory.
5384 if test "X$LSOF_SPMKF" != "X" # {
5386 LSOF_TMP1=$LSOF_SPMKF
5390 if test "X$LSOF_LOCALSUFFIX" != "X" # {
5392 LSOF_REST=$LSOF_TMP1.$LSOF_LOCALSUFFIX
5394 LSOF_REST=$LSOF_TMP1
5396 if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST # {
5398 echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST doesn't exist."
5403 # If this is FreeBSD, make sure $LSOF_FBSD_ZFS_MKF exists.
5405 if test $LSOF_FBSD_ZFS -eq 1 # {
5407 if test ! ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF # {
5409 echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF doesn't exist."
5415 # Make sure $LSOF_VF exists. Extract the version number from it.
5417 if test ! -r $LSOF_VF # {
5419 echo "Version number file, ./$LSOF_VF, doesn't exist."
5423 LSOF_VN=`sed "s/.ds VN \(.*\)/\1/" < $LSOF_VF`
5426 # Clean up in advance.
5428 rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF $LSOF_TSTCFLG $LSOF_TSTCC
5429 rm -f $LSOF_TSTXOC $LSOF_TSTLFF
5430 echo "rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF $LSOF_TSTCFLG"
5431 echo "rm -f $LSOF_TSTCC $LSOF_TSTXOC $LSOF_TSTLFF"
5433 # Make sure there's a C compiler name.
5435 if test "X$LSOF_CC" = "X" # {
5440 # Do common feature analyses.
5442 # Check for localtime(3) and strftime(3).
5444 rm -f ${LSOF_TMPC}.*
5445 cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC2
5451 if ((cl = time(NULL)) == (time_t)-1)
5453 ts = localtime(&cl);
5454 if (strftime(bf, sizeof(bf), "%D", ts) != 8)
5456 if ((bf[2] != '/') || (bf[5] != '/'))
5461 echo $EO "Testing C library for localtime() and strftime(), using $LSOF_CC ... $EC"
5462 $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
5463 if test -x ${LSOF_TMPC}.x # {
5466 if test $? -eq 0 # }
5468 LSOF_CFGF="$LSOF_CFGF -DHAS_STRFTIME"
5476 rm -f ${LSOF_TMPC}.[cox]
5478 # Make the dialect sources.
5480 if test "X$LSOF_MKC" = "X" # {
5484 LSOF_MKC=$LSOF_MKC ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK $LSOF_TGT $LSOF_VERS
5486 # Make $LSOF_MKFC and ${LSOF_LIB}/$LSOF_LIBMKF.
5488 echo "# $LSOF_TGT Makefile for lsof revision $LSOF_VN" > $LSOF_MKFC
5489 echo "" >> $LSOF_MKFC
5490 echo "CC= $LSOF_CC" >> $LSOF_MKFC
5491 if test "X$LSOF_CCV" != "X" # {
5493 echo "" >> $LSOF_MKFC
5494 echo "CCV= $LSOF_CCV" >> $LSOF_MKFC
5496 if test "X$LSOF_LIB_NO" = "X" # {
5498 echo "" >> $LSOF_MKFC
5499 echo "LIB= ${LSOF_LIB}/liblsof.a" >> $LSOF_MKFC
5501 if test "X$LSOF_LD" != "X" # {
5503 echo "" >> $LSOF_MKFC
5504 echo "LD= $LSOF_LD" >> $LSOF_MKFC
5506 if test "X$LSOF_CINFO" != "X" # {
5508 echo "" >> $LSOF_MKFC
5509 echo "CINFO= $LSOF_CINFO" >> $LSOF_MKFC
5511 if test "X$LSOF_CFGD" != "X" # {
5513 echo "CFGD= $LSOF_CFGD" >> $LSOF_MKFC
5515 if test "X$LSOF_CFGDN" != "X" # {
5517 echo "CFGDN= $LSOF_CFGDN" >> $LSOF_MKFC
5519 if test "X$LSOF_ARCH" != "X" # {
5521 LSOF_CFGF="$LSOF_CFGF -DLSOF_ARCH=\\\"$LSOF_ARCH\\\""
5523 if test "X$LSOF_VSTR" != "X" # {
5525 LSOF_TMP=`echo $LSOF_VSTR | sed 's/(/\\\\(/g' | sed 's/)/\\\\)/g'`
5526 LSOF_CFGF="$LSOF_CFGF -DLSOF_VSTR=\\\"$LSOF_TMP\\\""
5528 echo "" >> $LSOF_MKFC
5529 echo "CFGF= $LSOF_CFGF" >> $LSOF_MKFC
5530 if test "X$LSOF_LIB_NO" = "X" # {
5532 echo "" >> $LSOF_MKFC
5533 echo "CFGL= $LSOF_FCFGL -L./$LSOF_LIB -llsof $LSOF_CFGL" >> $LSOF_MKFC
5535 echo "" >> $LSOF_MKFC
5536 if test "X$LSOF_DEBUG" = "X" # {
5540 if test "X$LSOF_DEBUG" = "XNo-O" # {
5545 echo "DEBUG= $LSOF_DEBUG" >> $LSOF_MKFC
5546 if test "X$LSOF_OPINC" != "X" # {
5548 LSOF_DINC="$LSOF_DINC $LSOF_OPINC"
5550 if test "X$LSOF_DINC" != "X" # {
5552 echo "" >> $LSOF_MKFC
5553 echo "DINC= $LSOF_DINC" >> $LSOF_MKFC
5555 if test "X$LSOF_DOC" != "X" # {
5557 echo "" >> $LSOF_MKFC
5558 echo "DOC=$LSOF_DOC" >> $LSOF_MKFC
5560 if test "X$LSOF_DISTRIBKVM" != "X" -a "X$LSOF_DISTRIBKVM" != "XKVM" # {
5562 echo "" >> $LSOF_MKFC
5563 echo "KVM= $LSOF_DISTRIBKVM" >> $LSOF_MKFC
5565 rm -f ${LSOF_LIB}/$LSOF_LIBMKF
5566 if test "X$LSOF_LIB_NO" = "X" # {
5568 cp $LSOF_MKFC ${LSOF_LIB}/$LSOF_LIBMKF
5570 cat ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST >> $LSOF_MKFC
5571 if test "X$LSOF_LIB_NO" = "X" # {
5574 # Put archiving and optional randomizing strings in ${LSOF_LIB}/$LSOF_LIBMKF.
5576 # Process optional CFLAGS override.
5578 # Add the library Makefile skeleton section.
5580 echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
5581 if test "X$LSOF_AR" = "X" # {
5583 echo "AR= ar cr \${LIB} \${OBJ}" >> ${LSOF_LIB}/$LSOF_LIBMKF
5585 echo "AR= $LSOF_AR \${LIB} \${OBJ}" >> ${LSOF_LIB}/$LSOF_LIBMKF
5587 if test "X$LSOF_RANLIB" != "X" # {
5589 echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
5590 echo "RANLIB= $LSOF_RANLIB \${LIB}" >> ${LSOF_LIB}/$LSOF_LIBMKF
5592 echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
5593 if test "X$LSOF_CFLAGS_OVERRIDE" = "X" # {
5595 echo "CFLAGS= \${CDEFS} \${INCL} \${DEBUG}" >> ${LSOF_LIB}/$LSOF_LIBMKF
5597 echo "override CFLAGS=\${CDEFS} \${INCL} \${DEBUG}" >> ${LSOF_LIB}/$LSOF_LIBMKF
5599 echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
5600 cat ${LSOF_LIB}/$LSOF_LIBMKFSKEL >> ${LSOF_LIB}/$LSOF_LIBMKF
5601 echo $LSOF_MKFC and ${LSOF_LIB}/$LSOF_LIBMKF created.
5603 echo $LSOF_MKFC created.
5606 # If this is FreeBSD, create $LSOF_FBSD_ZFS_MKF.
5608 if test $LSOF_FBSD_ZFS -eq 1 # {
5610 rm -f $LSOF_FBSD_ZFS_MKF
5611 echo "# $LSOF_TGT ZFS Makefile for lsof revision $LSOF_VN" > $LSOF_FBSD_ZFS_MKF
5612 echo "" >> $LSOF_FBSD_ZFS_MKF
5613 echo "CC= $LSOF_CC" >> $LSOF_FBSD_ZFS_MKF
5614 echo "" >> $LSOF_FBSD_ZFS_MKF
5615 echo "CFLAGS= $LSOF_FBSD_ZFS_CFGF" >> $LSOF_FBSD_ZFS_MKF
5616 echo "" >> $LSOF_FBSD_ZFS_MKF
5617 if test "X$LSOF_DEBUG" = "X" # {
5621 if test "X$LSOF_DEBUG" = "XNo-O" # {
5626 echo "DEBUG= $LSOF_DEBUG" >> $LSOF_FBSD_ZFS_MKF
5627 echo "" >> $LSOF_FBSD_ZFS_MKF
5628 echo "OPENSOLARIS= $LSOF_FBSD_ZFS_SYS" >> $LSOF_FBSD_ZFS_MKF
5629 echo "" >> $LSOF_FBSD_ZFS_MKF
5630 cat ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF >> $LSOF_FBSD_ZFS_MKF
5631 echo $LSOF_FBSD_ZFS_MKF created.
5634 # Create test cc file.
5636 echo "$LSOF_CC" > $LSOF_TSTCC
5637 echo "$LSOF_TSTCC created"
5639 # Create test cflags file.
5641 echo "-DLT_DIAL_$LSOF_TGT" > $LSOF_TSTCFLG
5642 if test "X$LSOF_TSTBIGF" != "X" # {
5644 echo "-DLT_BIGF" >> $LSOF_TSTCFLG
5645 if test "X$LSOF_TSTBIGF" != "X " # {
5647 for i in $LSOF_TSTBIGF # {
5649 echo "$i" >> $LSOF_TSTCFLG
5653 if test "X$LSOF_TSTDFLG" != "X" # {
5655 for i in $LSOF_TSTDFLG # {
5657 echo "$i" >> $LSOF_TSTCFLG
5660 echo $LSOF_CC | grep gcc > /dev/null 2>&1
5661 if test $? -eq 0 # {
5663 echo "-DLT_GCC" >> $LSOF_TSTCFLG
5665 echo "-DLT_CC" >> $LSOF_TSTCFLG
5667 if test $LSOF_TSTKMEM -eq 1 # {
5669 echo "-DLT_KMEM" >> $LSOF_TSTCFLG
5671 if test $LSOF_TSTK64 -eq 1 # {
5673 echo "-DLT_K64" >> $LSOF_TSTCFLG
5675 echo "-DLT_VERS=$LSOF_VERS" >> $LSOF_TSTCFLG
5676 if test $LSOF_TSTVPATH -eq 1 # {
5678 echo "-DLT_VPATH" >> $LSOF_TSTCFLG
5680 echo "$LSOF_TSTCFLG created"
5682 # Create tests loader flags file.
5684 echo $LSOF_TSTLFLG > $LSOF_TSTLFF
5685 echo "$LSOF_TSTLFF created"
5687 # Create test extra objects file.
5689 echo "$LSOF_TSTXO" > $LSOF_TSTXOC
5690 echo "$LSOF_TSTXOC created"
5694 # Call Customize, as required.
5696 if test "X$LSOF_SCRIPT_CALL" = "Xyes" -a ! -r ./.neverCust # {
5698 if test ! -f ./Customize # { Want -x, but Ultrix doesn't grok it.
5700 echo "Can't find Customize script."
5703 ./Customize $LSOF_DIALECT_DIR
5706 # Issue unsupported warnings, as appropriate.
5708 if test "X$LSOF_UNSUP" != "X" # {
5712 if test "X$LSOF_UNSUP2" != "X" # {