
			Cross-configuring Lsof

Introduction
============

Lsof cross-configuration is useful when the target dialect or target
dialect version for which lsof is to be configured and built differs
from the one on which the Configure operation is done.

Marty Leisner <leisner@sdsp.mc.xerox.com> suggested the method
described here for lsof cross-configuration, and he supplied
modifications to the Configure script for cross-configuring Linux
lsof.

Marty says:

    "I used this to successfully compile (lsof) on the same machine
     for (Linux) 2.0.30 and 2.1.42.  (I normally don't bring up a
     2.1.42 machine all the time).  Also it (the 2.0.30 system)
     doesn't have much storage and compiles on it are slow.

     Set LSOF_VERS if it's not the (version of the) current system.
     (Actually, you should get the version out of include/linux/version.h.)

     Define LINUX_KERNEL to (the path) where the kernel sources
     are (located).

     This should work on most systems; they put a kernel in
     /usr/src/linux, which is the default.

     Now I can just do:

	LINUX_KERNEL=/some/other/kernel LSOF_VERS=2142 ./Configure linux

     Comments?  Its very convenient when running multiple kernels.
     (It would be (have been) very handy when the structures changed
     between 2.0.2* and 2.0.30 , or whatever.)

     I run multiple OSes at a time (not to mention multiple
     architectures.  It's very pleasant to cross-build either
     operating systems or versions."

So, the situation is that you have lsof sources on a UNIX dialect
version, and you want to configure them to build lsof for some
other version of the same dialect, or perhaps for some other UNIX
dialect altogether.


The Cross-Configure Method
==========================

The lsof cross-configure method uses environment variables to tell
the lsof Configure script about the target dialect.  The environment
variables may specify alternate locations for Configure to examine
when it determines characteristics of the target, or they may
specify the values Configure would discover when it examined the
target's characteristics.

Consult each environment variable description for the UNIX dialect
in which you're interested to see how it affects the operation of
the Configure script.

The number and values of the variables differ by dialect.  Each
variable begins with an upper case version of the dialect's Configure
abbreviation -- e.g., AIX for aix or aixgcc, LINUX for linux,
UW for uw (UnixWare), etc.

There is usually an <abbreviation>_INCLUDE environment variable.
It may give a path to the standard header files that differs from
the standard /usr/include.  Thus, for example, if you have the
include files from a test version of the UNIX dialect in
/test/usr/include, and you want to configure lsof for the test
version, set the <abbreviation>_INCLUDE environment variable to

    <abbreviation>_INCLUDE=/test/usr/include ./Configure -n <abbreviation>

Of course, the UNIX dialect's version is probably different from
that of the system on which you're doing the cross-configuration,
so you will need to specify the new version, too.  For example, to
configure for FreeBSD 3.0 on a 2.1.7 system, where the standard
3.0 header files are in /3.0/usr/include and the 3.0 system sources
are in /3.0/sys, do this:

	LSOF_VERS=300 FREEBSD_INCLUDE=/3.0/usr/include \
	FREEBSD_SYS=/3.0/sys Configure -n freebsd


Special Environment Variables
=============================

There are three special environment variables whose names don't
begin with an upper case rendering of a dialect abbreviation.

One is for AFS configuration, AFS_VICE.   It need be set only if
lsof supports AFS on your dialect and you want to specify an alternate
path to the VICE files.

The second is for path to the standard header files, LSOF_INCLUDE.
You may need to specify it if you want Configure to test header
files in a different tree, and you want to compile lsof from the
header files in that different tree.

The third is the target dialect version number, LSOF_VERS.  It must
be stated in the dialect's form -- e.g., FreeBSD 2.0.5 is given as
205, IRIX 6.2 as 60200, etc.  The table, "Abbreviations, Variable
Prefixes, and Version Numbers," in this file gives the form for
LSOF_VERS for each dialect lsof supports.

AFS_VICE		specifies the path to the AFS "vice" directory.

			default: /usr/vice

LSOF_INCLUDE		specifies the path to the standard header files.

			default: /usr/include

LSOF_VERS		specifies the target dialect's version in its
			form.

			default: auto-detection (e.g., from `uname -r`)


Abbreviations, Variable Prefixes, and Version Numbers
=====================================================

The following table describes the relationship between Configure
abbreviations, environment variable prefixes, and lsof UNIX dialect
version numbers.  The lsof UNIX dialect version number must be
declared exactly in the listed form when supplied via the LSOF_VERS
environment variable.

				Dialect	   Lsof Version
   Configure	Variable	Version      Number for
Abbreviation*	  Prefix	 Number       LSOF_VERS

	 aix	     AIX	  3.2.5		   3250
      aixgcc			  4.1.0		   4100
				  4.1.4		   4140
				  4.1.4		   4150
				  4.2.0		   4200
				  4.2.1		   4210
	bsdi	    BSDI	  2.0.x		  20000
				  2.1.x		  20100
				  3.0.x		  30000
				  3.1.x		  30100
	  du	      DU	  2.0		  20000
				  3.0		  30000
				  3.2		  30200
				  4.0		  40000
     freebsd	 FREEBSD	  1.x		    100
				  2.x		    200
				  2.0.5		    205
				  2.1.x		    210
				  2.2.x		    220
				  3.x		    300
	hpux	    HPUX	  9.1		    901
     hpuxgcc			  9.5		    905
				  10.0		   1000
				  10.10		   10.10
				  10.20		   10.20
       irix	    IRIX	  5.2		   50200
				  5.3		   50300
				  6.0		   60000
				  6.0.1		   60001
				  6.1		   60100
				  6.2		   60200
				  6.3		   60300
				  6.4		   60400
      linux	   LINUX	  1.3.68	    1368
				  2.0.27	    2027
				  2.1.35	    2135
				  2.1.42	    2142
     netbsd	  NETBSD	  1.0		    1000
				  1.1		    1010
				  1.2		    1020
	 ns	      NS	  3.1		      31
    openbsd	 OPENBSD	  1.2		    1020
				  2.0		    2000
				  2.1		    2010
    pyramid	 PYRAMID	  1.1		   10100  (DC/OSx)
				  5.43		   54300  (Reliant UNIX)
	ptx	     PTX	  2.1.9		     219
				  4.0		     400
				  4.1.3		     413
				  4.1.4		     414
				  4.2.1		     421
				  4.3		     430
				  4.4		     440
     riscos	   RISCOS	  4_52		     452
	osr	      OSR	  3.2v2.0	      20
				  3.2v2.1	      21
				  3.2v4.0	      40
				  3.2v4.1	      41
				  3.2v4.2	      42
				  3.2v5.0.0	     500
				  3.2v5.0.2	     502
				  3.2v5.0.4	     504
    solaris	  SOLARIS	  2.3		   20300
  solariscc			  2.4		   20400
				  2.5		   20500
				  2.5.1		   20501
				  2.6		   20600
      sunos	    SUNOS	  4.1.3		   40103
    sunoscc			  4.1.4		   40104
     ultrix	   ULTRIX	  4.2		   40200
				  4.3		   40300
				  4.4		   40400
				  4.5		   40500
	 uw	       UW	  2.1		   20100
				  2.1.1		   20101
				  2.1.2		   20102

* -- The optional Configure abbreviations -- e.g., the ``decosf''
     and ``digital_unix'' alternatives to ``du'' -- aren't listed
     here.


Dialect-Specific Environment Variables
======================================

Here are the dialect-specific environment variables, listed
alphabetically.  The first part of any environment variable will
be the dialect abbreviation, as specified to Configure, converted
to upper case characters.  See the `Configure -help` output for a
listing of the abbreviations.

AIX_USHACK		If this environment variable has a value of "Y" or "y",
			and if the aixgcc Configure abbreviation is selected,
			the AIX 4.1 and greater gcc user structure hack will
			be activated; any other non-NULL value, it will not be
			set; a NULL value, it will be tested by compilation.

			default: none (tested by compilation)

DU_ADVFSV		specifies the Digital UNIX ADVFS file system version --
			e.g., 200 for 2.0, 400 for 4.0, etc.

			default: determined via /usr/sbin/setld

DU_CDIR			specifies the name of the Digital UNIX system
			configuration directory.

			default: first host name component, converted to upper
				 case

DU_SHLIB		specifies the Digital UNIX shared library directory
			path.

			default: /usr/shlib

DU_SYSDIR		Digital UNIX system directory path.

			2.x and 3.x default: /sys
			4.x default: /usr/sys

FREEBSD_KERNEL		specifies the path to the FreeBSD kernel for FreeBSD
			version less than 2.0.

			default: /386bsd

FREEBSD_SYS		specifies the path to the FreeBSD system source
			directory.

			default: /sys

HPUX_CCDIR1		specifies the first directory where Configure might
			find an HP-UX C compiler.

			default: /bin

HPUX_CCDIR2		specifies the second directory where Configure might
			find an HP-UX C compiler.

			default: /usr/ccs/bin

HPUX_LIBC1		specifies the first directory that might contain the
			HP-UX C library, libc.sl.

			default: /usr/lib

HPUX_LIBC2		specifies the second directory that might contain the
			HP-UX C library, libc.sl.

			default: /lib

HPUX_X25DIR		specifies path to the HP-UX X25 directory that contains
			configuration header files.

			default: /etc/conf

IRIX_53NFSROLLUP	If this environment variable has a value of "Y" or "y",
			and if the IRIX version is 5.3, HAS53NFSROLLUP will be
			defined in the Makefile's CFLAGS; any other non-NULL
			value, it will not be set; a NULL value, it will be
			tested with /usr/sbin/showprods.  When HAS53NFSROLLUP
			is defined, the IRIX 5.3 system is assumed to have the
			NFS kernel rollup patch installed.

			default: tested with /usr/sbin/showprods

IRIX_BITS		specifies the kernel bit size in `uname -s` terms.

			default: `uname -s`

IRIX_HW			If this environment variable has a value of "Y" or "y",
			USE_STAT will be defined in the Makefile's CFLAGS; any
			other non-NULL value, it will not be set; a NULL value,
			it will be set if /hw is readable.  When USE_STAT is
			defined, the IRIX readdev() function will use stat()
			instead of lstat() on device node entries, thus
			following symbolic links -- e.g., /dev/dsk->/hw/disk.

			default: USE_STAT is set if /hw is readable

IRIX_SM_CCOPTS		If this environment variable has a non-NULL value, it
			is interpreted as the output of the command:

				grep CCOPTS /var/sysgen/system/irix.sm
			
			default: `grep CCOPTS /var/sysgen/system/irix.sm`

IRIX_XFSROLLUP		If this environment variable has a value of "Y" or "y",
			and if the IRIX version is 6.2, HASXFSROLLUP will be
			defined in the Makefile's CFLAGS; any other non-NULL
			value, it will not be set; a NULL value, it will be
			tested with /usr/sbin/showprods.  When HASXFSROLLUP is
			defined, the IRIX 6.2 system is assumed to have the
			XFS rollup patch installed.

			default: tested with /usr/sbin/showprods

LINUX_CLIB		specifies the definition of the Linux C library:

			default: "" 		(standard C library)
			others: -DGLIBCV=2  	(glibc2)

LINUX_KERNEL		specifies the path to the Linux kernel sources.

			default: /usr/src/linux

LINUX_LSEEK		If this environment variable has a value of "Y" or "y",
			Configure will use Makefile.lseek in place of Makefile
			in order to enable use of the private lseek() function
			for 2.1.x kernels; any other non-NULL value,
			Makefile.lseek will not be used; a NULL value, the
			alternate lseek() need will be determined by compiling
			and executing a test program.

			default: determined by test program

NETBSD_SYS		specifies the path to the NetBSD system source
			directory.

			default: /sys

OPENBSD_SYS		specifies the path to the OpenBSD system source
			directory.

			default: /sys

OSR_STATLSTAT		If this environment variable has a value of "Y" or "y",
			HAS_STATLSTAT will be defined in the Makefile's CFLAGS;
			any other non-NULL value, it will not be defined; a
			NULL value, it will be determined with nm and grep.

			default: determined with nm and grep

PYRAMID_ARCH		If this environment variable has a non-NULL value, it
			is interpreted as the output of the command:

				/bin/pkgparam dcosx ARCH
			
			default: `/bin/pkgparam dcosx ARCH`

PYRAMID_DCOSXVERS	If this environment variable has a non-NULL value, it
			is interpreted as the output of the command:

				/bin/pkgparam dcosx VERSION

			default: `/bin/pkgparam dcosx VERSION`

PYRAMID_PROC		If this environment variable has a non-NULL value, it
			is interpreted as the output of the command:

				/bin/uname -p
			
			default: `/bin/uname -p`

PYRAMID_SYSNM		If this environment variable has a non-NULL value, it
			is interpreted as the output of the command:

				/bin/uname -s
			
			default: `/bin/uname -s`

PTX_CONF		specifies the path to the configuration header files.

			default: /usr/conf/uts

SOLARIS_23P101318	If this environment variable has a non-NULL value, the
			value is interpreted as the patch level of the Solaris
			2.3 P101318 patch.

			default: pkginfo tested with grep

SOLARIS_24P101945	If this environment variable has a non-NULL value, the
			value is interpreted as the patch level of the Solaris
			2.4 P101945 patch.

			default: pkginfo tested with grep

SOLARIS_24P102303	If this environment variable has a non-NULL value, the
			value is interpreted as the patch level of the Solaris
			2.4 P102303 patch.

			default: pkginfo tested with grep

SOLARIS_26PR_GWINDOWS	If this environment variable has a value of "Y" or "y",
			the HASPR_GWINDOWS definition will be set in the
			Solaris 2.6 Makefile's CFLAGS; any other non-NULL
			value, it will not be set; a NULL value, it will be
			tested by compilation.

			default: tested by compilation

SOLARIS_26PR_LDT	If this environment variable has value of "Y" or "y",
			the HASPR_LDT definition will be set in the Solaris 2.6
			Makefile's CFLAGS; any other non-NULL value, it will
			not be set; a NULL value, it will be tested by
			compilation.

			default: tested by compilation

SOLARIS_CCDIR		specifies the path to the SunPro C compiler.

			default: /opt/SUNWspro

SOLARIS_VSOCK		If this environment variable has value of "Y" or "y",
			the HAS_VSOCK definition will be set in the Solaris
			Makefile's CFLAGS; any other non-NULL value, it will
			not be set; a NULL value, it will be tested by
			compilation.

			default: tested by compilation

SUNOS_ACC		specifies the path to the SunOS acc C compiler.

			default: /usr/lang

SUNOS_NOCONST		If this environment variable has a value of "Y" or "y",
			the NOCONST definition will be set in the SunOS
			(Solaris 1.x) Makefile's CFLAGS; any other non-NULL
			value, it will not be set; a NULL value, it will be
			determined by compiling and executing a test program.
			
			default: tested by compilation

SUNOS_VSOCK		If this environment variable has a value of "Y" or "y",
			the HAS_VSOCK definition will be set in the SunOS
			(Solaris 1.x) Makefile's CFLAGS; any other non-NULL
			value, it will not be set; a NULL value, it will be
			determined by compiling a test program.

			default: tested by compilation

ULTRIX_HWNM		specifies the Ultrix hardware name in the form of
			the output of `uname -m`.

			default: `uname -m`

ULTRIX_DECNET		If this environment variable has a value of "Y" or "y",
			the DECnet definition will be set in the Ultrix
			Makefile's CFLAGS, and the -ldnet Makefile loader flag
			will be defined; any other non-NULL value, they will
			not be set; a NULL value, they will be determined by
			testing for ${ULTRIX_USRLIB}.libdnet.a and
			${LSOF_INCLUDE}/netdnet/dn.h.

			default: based on test for <netdnet/dn.h>

ULTRIX_USRLIB		specifies an alternate path to the Ultrix /usr/lib.

			default: /usr/lib

Vic Abell <abe@purdue.edu>
Purdue University Computing Center (PUCC)
November 24, 1997
