home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- #
- # Automatic configuration shell script for finger
- # Not quite up to Larry Wall's level...
- #
- # Copyright (C) 1988, 1990 Philip L. Budne
- #
- # This file is part of "Phil's Finger Program".
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 1, or (at your option)
- # any later version.
- #
-
- # $Id: autoconfig,v 3.0 90/07/06 13:10:22 budd Rel $
-
- #
- #
- TMPDIR=/tmp
- #
- SYSTEM=''
- #
- E=/bin/echo
- #
- # blank line
- B=$E
- #
- # should return status
- CONTAINS=grep
- #
- # hope its on your path, or built in
- T=test
- # end test
- ET=
- #
- # test flags:
- #
- # existance
- EXI=-f
- # directory
- DIR=-d
- # negation
- NOT=!
- #
- OR=-o
- AND=-a
- STR=
- LP='('
- RP=')'
- #
- # S5
- BLK=-b
- CHR=-c
- # also -f means regular file only!
- #
- # shorthand...
- TEXI="$T $EXI"
- TSTR="$T $STR"
- TDIR="$T $DIR"
- #
- if $TEXI /bin/hostname $ET; then
- HOSTNAME=`/bin/hostname`
- elif $TEXI /bin/uname $ET; then
- HOSTNAME=`/bin/uname -n`
- else
- HOSTNAME='idunno'
- fi
- #
- $E '/*'
- $E ' * local.h for '$HOSTNAME
- $E ' * created on '`date` by `./mywhoami` using autoconfig
- $E ' *'
- $E ' * do not edit this file. instead put #define and #undef lines'
- $E ' * in the file local-flags which is inserted at the end of this file.'
- $E ' */'
- $B
- ################
- if $TEXI /bin/sun $ET && /bin/sun; then
- # check for /usr/lib/liblwp.a ?
- if $TDIR /var $ET; then
- if $TEXI /bin/uname $ET; then
- SOS=`uname -r -v | sed -e 's/\.//g' -e 's/ //g'`
- elif $TDIR /usr/kvm $ET; then
- # consdev fixed/broken in 4.0.3
- SOS=403
- else
- SOS=400
- fi
- else
- # 3.something
- SOS=300
- fi
- $E '# define SunOS '$SOS
- $B
- elif $TEXI /Umax.image $ET; then
- if $TDIR /var $ET; then
- $E '# define Umax 43 /* Encore Umax 4.3 */'
- else
- $E '# define Umax 42 /* Encore Umax 4.2 */'
- fi
- $B
- elif $CONTAINS BSD4_3 /usr/include/sys/param.h > /dev/null; then
- $E '# define bsd4_3'
- $B
- fi
- # accel, ultrix cpp have predefines
- ################
- # Sun, A/UX
- if $TEXI /etc/in.rlogind $OR $EXI /usr/etc/in.rlogind $ET; then
- $E '# define IN_DOT_DAEMON /* internet daemon names prefixed with in. */'
- $B
- fi
- ################
- # check for /usr/adm/lastlog as well?
- if $TEXI /usr/include/lastlog.h $ET; then
- $E '# define LASTLOG /* BSD last login file */'
- $B
- fi
- ################
- # check libc.a for wait3??
- if $T $NOT $EXI /usr/include/sys/wait.h $ET; then
- $E '# define NO_WAIT_H /* no BSD sys/wait.h */'
- $B
- fi
- ################
- # BSD systems have drum
- # use checkmode to avoid incompatabilities in test
- # RT AIX and UmaxV lack /dev/swap
- if ./checkmode /dev/drum 0 >/dev/null 2>&1; then
- $E '# define SWAP_DEVICE "/dev/drum" /* swap device */'
- $B
- elif ./checkmode /dev/swap 0 >/dev/null 2>&1; then
- $E '# define SWAP_DEVICE "/dev/swap" /* swap device */'
- $B
- USG=true
- elif $T $CHR /dev/ipldevice $ET; then
- $E '# define AIX3 /* AIX release 3 (RS/6000) */'
- USG=true
- elif $TEXI /bin/vrmfmt $ET; then
- # AIX defined by cc command (what about PS/2 AIX?)
- USG=true
- UNDERSCORE=true
- $E '# define AIX_RT /* IBM PC/RT AIX */'
- $B
- elif $T $CHR /dev/bbram $ET; then
- $E '# define UmaxV /* Encore Umax V */'
- $B
- USG=true
- UNDERSCORE=true
- elif $TEXI /usr/include/sys/sysi86.h $ET; then
- # Interactive SVR3.2 (others?)
- USG=true
- $E '# define SYSI86 /* 386/ix */'
- $B
- fi
- ####
- if $TSTR "$USG" $ET; then
- $E '# define USG /* AT&T Unix */'
- $B
- if $T $CHR /dev/pts1 $ET; then
- # AIX at least...
- $E '# define PTYPATH "/dev/pts1"'
- $B
- $E '# define PTS_PTY_NAMES'
- $B
- elif $T $CHR /dev/ttyq1 $ET; then
- # SGI at least...
- $E '# define PTYPATH "/dev/ttyq1"'
- $B
- fi
- if $TEXI /usr/include/sys/dir.h $ET; then
- $E '# define DIR_H'
- $B
- fi
- if $TEXI /usr/include/sys/i386/ps2mous.h $ET; then
- $E '# define AIX_PS2'
- $B
- fi
- fi
- ################
- if $TEXI /usr/include/filehdr.h $ET; then
- $E '# define COFF /* Common Object File Fiasco */'
- $B
- else
- UNDERSCORE=true
- fi
- ####
- if $TSTR "$UNDERSCORE"; then
- $E '# define UNDERSCORE_NLIST_NAMES'
- $B
- fi
- ################
- # SOS3.4 has (empty) stream.h!
- if $TEXI /usr/include/sys/stropts.h $ET; then
- $E '# define STREAMS'
- $B
- fi
- ################
- # check for SVR3 state names
- if $CONTAINS SXBRK /usr/include/sys/proc.h >/dev/null; then
- $E '# define SVR3_STATES'
- $B
- fi
- ################
- # check for short *{u,p}_ttyp (streams tty driver) sgi and SOS4
- if $CONTAINS 'short[ ]*\*[ ]*[ups]_ttyp' \
- /usr/include/sys/user.h /usr/include/sys/proc.h >/dev/null 2>&1 ||
- $TEXI /usr/include/sys/session.h $ET; then
- $E '# define SHORT_TTYP'
- $B
- fi
- ################
- # p_addr on AOS/ACIS 4.3 (RT) loses
- if $TDIR /usr/ibm $ET; then
- $E '# define NEED_USRPT'
- $B
- fi
- ################
- # USG uname(2) call (or simulation)
- # perhaps grep nm of libc.a too?
- if $TEXI /usr/include/sys/utsname.h $ET; then
- $E '# define UTSNAME /* USG uname(2) call */'
- $B
- fi
- ################
- if $T $NOT $EXI /usr/include/strings.h $ET; then
- $E '# define NO_STRINGS_H /* No BSD strings */'
- $B
- fi
- ################
- LIB=/lib/libc.a
- LIBNM=/tmp/auto$$
- if $TEXI /usr/include/netdb.h $ET && \
- $CONTAINS h_errno /usr/include/netdb.h >/dev/null; then
- $E "netdb.h has h_errno. Checking libc.a..." 1>&2
- nm $LIB > $LIBNM
- if $CONTAINS 'h_errlist' $LIBNM >/dev/null; then
- $E "The world is safe! $LIB contains h_errlist" 1>&2
- $E '# define HAVE_H_ERRNO /* found h_errno */'
- else
- # SunOS 4.0 strikes again!
- $E "$LIB lacks h_errlist!!" 1>&2
- fi
- $B
- rm -f $LIBNM
- fi
- ################
- if $TEXI /bin/write $ET; then
- if ./checkmode /bin/write gs >/dev/null; then
- set foo `./getgroup /bin/write`
- $E "# define TTY_GROUP_NUMBER $3"
- $B
- if $TSTR "$4" $ET; then
- $E '# define TTY_GROUP "'$4'"'
- $B
- fi
- fi
- fi
- ################
- # for Install.cpp -- shell orif to avoid confusing BSD test with -c
- # check for protected swap device as well??
- if $TEXI /dev/kmem $ET || $T $CHR /dev/kmem $ET; then
- if ./checkmode /dev/kmem gr+o gr >/dev/null; then
- $E '/* for Install.cpp */'
- set foo `./getgroup /dev/kmem`
- if $TSTR "$4" $ET; then
- $E "# define KMEM_GROUP $4"
- else
- $E "# define KMEM_GROUP $3"
- fi
- $B
- fi
- fi
- ################
- if $TEXI /bin/domainname $ET; then
- YPDOMAIN=`/bin/domainname`
- elif $TEXI /usr/bin/domainname $ET; then
- YPDOMAIN=`/usr/bin/domainname`
- fi
- ################
- if $TEXI /etc/ypbind $OR $EXI /usr/etc/ypbind $ET; then
- if $TSTR "$YPDOMAIN" $ET; then
- $E "IF YOU ARE NOT USING YP, YOU MAY NEED TO DEFINE 'GETPWNAM_SLOW'"\
- 1>&2
- $E '/* getpwnam(3) is fast (yellow pages) */'
- else
- $E "IF YOU ARE USING YP, YOU MAY WANT TO UNDEFINE 'GETPWNAM_SLOW'"\
- 1>&2
- $E '# define GETPWNAM_SLOW /* yp not enabled */'
- fi
- elif $TEXI /etc/passwd.pag $OR $EXI /etc/passwd.dir $ET; then
- $E '/* getpwnam(3) is fast (dbm passwd file) */'
- else
- $E '# define GETPWNAM_SLOW /* 4.2 getpwnam(3) is losing */'
- fi
- $B
- ################
- # should check libc.a for yp_match.o
- if $TEXI /usr/include/rpcsvc/ypclnt.h $AND $STR "$YPDOMAIN" $ET; then
- $E '# define HAVE_YP_MATCH /* have yp_match(3) */'
- $B
- fi
- ################
- if $TEXI /etc/aliases $ET; then
- ALIASES=/etc/aliases
- elif $TEXI /usr/lib/aliases $ET; then
- ALIASES=/usr/lib/aliases
- fi
- #
- if $TSTR "$ALIASES" $ET; then
- $E '# define ALIASES "'$ALIASES'" /* sendmail aliases file */'
- $B
- fi
- ################
- # 4.3 and Ultrix
- # note: use exists. let them see grep error!
- if $TEXI /usr/include/sys/tty.h $ET; then
- if $CONTAINS t_winsize /usr/include/sys/tty.h >/dev/null; then
- $E '# define TTY_REQUIRES_IOCTL /* struct winsize */'
- $B
- fi
- fi
- ################
- # 4.3 and Ultrix
- # perhaps search libc.a too?
- if $TEXI /usr/include/ttyent.h $ET; then
- $E '# define TTYENT /* use getttyent(3) */'
- $B
- fi
- ################
- # 4.3, Ultrix and Sun
- if $TEXI /etc/inetd $OR $EXI /usr/etc/inetd $ET; then
- $E '# define INETD /* use inetd for fingerd */'
- $B
- fi
- ################
- # SunOS 4.x, Ultrix 3.x, SVR3?
- if $CONTAINS 'void.*signal' /usr/include/signal.h >/dev/null; then
- $E '# define VOIDSIG /* signal() declared as void * */'
- $B
- fi
- ################
- # Ultrix 3.x, A/UX
- if $CONTAINS p_ttyp /usr/include/sys/proc.h >/dev/null; then
- $E '# define P_TTYP /* tty pointer in proc struct */'
- $B
- fi
- ################
- # USG
- if $CONTAINS ut_host /usr/include/utmp.h >/dev/null; then
- $E '/* utmp has ut_host field */'
- else
- $E '# define UTMP_NO_HOST /* utmp file lacks host field */'
- fi
- $B
- ################
- if $TEXI /vmunix $ET; then
- $E '# define KERNEL_FILE "/vmunix"'
- elif $TEXI /unix $ET; then
- $E '# define KERNEL_FILE "/unix"'
- elif $TEXI /dynix $ET; then
- $E '# define KERNEL_FILE "/dynix"'
- elif $TEXI /Umax.image $ET; then
- $E '# define KERNEL_FILE "/Umax.image"'
- else
- $E '/* no KERNEL_FILE found */'
- fi
- $B
- ################
- # AIX has both? check /usr/mail first!!
- if $TDIR /usr/mail $ET; then
- $E '# define MAIL_SPOOL "/usr/mail"'
- elif $TDIR /usr/spool/mail $ET; then
- $E '# define MAIL_SPOOL "/usr/spool/mail"'
- else
- $E '/* no MAIL_SPOOL found */'
- fi
- $B
- ################
- if $TEXI /usr/include/syslog.h $ET; then
- $E '# define SYSLOG /* fingerd does syslog-ing */'
- $B
- fi
- ################
- if $TEXI /usr/include/inquir.h $ET; then
- $E '# define INQUIRE /* use inquire database */'
- $B
- fi
-
- # Boilerplate...
- cat <<END_OF_STUFF
- # define SAVED_NLIST "/etc/finger-saved-nlist" /* save nlist to this file */
-
- # define AUTONLIST /* update nlist save file as needed */
-
- # define NLIST_MODE 0664 /* creation mode for nlist file */
-
- # define NETBERK /* network finger implies /berk */
- /* (I hate this) */
-
- # define NETFOLLOW /* net finger implies /follow */
-
- /**************** REQUIRED!! (used by Install) ****************/
-
- # define TTYLOC_DIR "/usr/spool/ttyloc"
-
- # define TTYLOC_MODE 0644
-
- END_OF_STUFF
- #
- if $TEXI local-flags $ET; then
- $E '/* local-flags: *****************/'
- cat local-flags
- $B
- $E '/* end of local-flags ***********/'
- else
- $E '/* host name prefixes to remove */'
- $E '/*# define PREFIXES "PREFIX1", "PFX2" /**/'
- $B
- $E '/* extra paths to try to exec finger */'
- $E '/* # define FINGERPATHS "/usr/local/local/bin/finger", "/bin/who" /**/'
- $B
- $E '# define C_FLAGS -g /* compiler debug on by default */'
- $E '# define DEBUGSW /* include /debug switch */'
- $E '# define UNPREFIX_NODOMAIN /* unprefix hosts with no dots */'
- fi
- $B
- cat <<END_OF_STUFF
- /*
- * Local variables:
- * comment-column: 40
- * End:
- */
- END_OF_STUFF
-