home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Subject: v35i032: procmail - mail processing package v2.80, Part11/11
- Message-ID: <1993Feb5.020759.17013@sparky.imd.sterling.com>
- X-Md4-Signature: 46185aa2e6d21084c5ee8a798a32a39f
- Date: Fri, 5 Feb 1993 02:07:59 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: berg@pool.informatik.rwth-aachen.de (Stephen R. van den Berg)
- Posting-number: Volume 35, Issue 32
- Archive-name: procmail/part11
- Environment: sendmail, smail, MMDF, mailsurr, UNIX, POSIX
- Supersedes: procmail: Volume 31, Issue 40-44
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 11 (of 11)."
- # Contents: procmail280/src/autoconf
- # Wrapped by berg@hathi on Thu Feb 4 15:28:01 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'procmail280/src/autoconf' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'procmail280/src/autoconf'\"
- else
- echo shar: Extracting \"'procmail280/src/autoconf'\" \(23957 characters\)
- sed "s/^X//" >'procmail280/src/autoconf' <<'END_OF_FILE'
- X#! /bin/sh
- X:
- X#$Id: autoconf,v 1.32 1993/02/04 12:44:45 berg Exp $
- X
- X# All possible entries in autoconf.h:
- X
- X# #define UNISTD_H_MISSING
- X# #define STDDEF_H_MISSING
- X# #define STDLIB_H_MISSING
- X# #define DIRENT_H_MISSING
- X# #define SYS_DIRENT_H_MISSING
- X# #define NDIR_H_MISSING
- X# #define SYS_NDIR_H_MISSING
- X# #define SYS_DIR_H_MISSING
- X# #define SYS_WAIT_H_MISSING
- X# #define SYS_UTSNAME_H_MISSING
- X# #define STRING_H_MISSING
- X# #define SYSEXITS_H_MISSING
- X#Ok #define SYS_FILE_H_MISSING
- X# #define const
- X# #define volatile
- X# #define P(args) ()
- X# #define void char
- X# typedef int mode_t;
- X# typedef int pid_t;
- X# typedef int uid_t;
- X# typedef int gid_t;
- X# typedef unsigned size_t;
- X# typedef long time_t;
- X# #define NOmemmove
- X# #define NObcopy
- X# #define NOstrcspn
- X# #define NOstrpbrk
- X# #define NOopendir
- X# #define NOrename
- X# #define NOuname
- X# #define NOstrstr
- X# #define NOstrtol
- X# #define strchr(s,c) index(s,c)
- X# #define initgroups(n,g)
- X#Ok #define endpwent()
- X#Ok #define endgrent()
- X#Ok #define endhostent()
- X#Ok #define endservent()
- X#Ok #define endprotoent()
- X# #define h_0addr_list h_addr
- X#Ok #define NO_COMSAT
- X# #define _GUID_T
- X#Ok #define UDP_protocolno 17
- X#Ok #define BIFF_serviceport "512"
- X#Ok #define IP_localhost {127,0,0,1,}
- X# #define WMACROS_NON_POSIX
- X# #define oBRAIN_DAMAGE
- X#Ok #define LD_ENV_FIX
- X#Ok #define GOT_bin_test
- X#Ok #define SMALLHEAP
- X# #define NOfcntl_lock
- X#Ok #define USElockf
- X#Ok #define USEflock
- X#Ok #define SYSTEM_MAILBOX "/usr/spool/mail/$LOGNAME"
- X#Ok #define SENDMAIL "/usr/lib/sendmail"
- X#Ok #define CF_no_procmail_yet
- X
- X# A conforming ANSI compiler and POSIX library should not have any defines not
- X# marked as "Ok" in the autoconf.h file.
- X# Anything else indicates failure of your system to comply with either
- X# the ANSI or POSIX standards (but procmail should be installable anyway).
- X
- XSHELL=$1
- XPATH=.:$PATH
- Xshift; RM="$1"
- Xshift; MV="$1"
- Xshift; USRINC=$1
- Xshift; DEVNULL=$1
- Xshift; FGREP="$1"
- Xshift; MAKE="$1"
- Xshift; O=$1
- Xshift; ACONF=$1
- X
- Xtest 1 != $# &&
- X echo "Don't start this script directly, use \`make ../autoconf.h'" && exit 1
- X
- Xexport SHELL PATH
- Xif test -f $ACONF
- Xthen
- X trap "exit 1" 1 2 3 15
- Xelse
- X trap "$RM $ACONF; exit 1" 1 2 3 15
- Xfi
- X
- Xif test ! -z "$LD_LIBRARY_PATH"
- Xthen
- X echo '***************************** WARNING *********************************'
- X echo '* You seem to have set the LD_LIBRARY_PATH variable, this might cause *'
- X echo '* some trouble during the execution of this autoconf script. If the *'
- X echo '* the make does not finish by itself, do a: "make clean", *'
- X echo '* clear LD_LIBRARY_PATH from the environment, and start over. *'
- X echo '***************************** WARNING *********************************'
- Xfi
- X
- Xecho hi | $FGREP hi >$DEVNULL
- Xt=$?
- Xecho ho | $FGREP hi >$DEVNULL
- Xf=$?
- Xif test 0 != $t -o 0 = $f
- Xthen
- X echo "Your \"$FGREP\" program seems to be incapable of returning a proper"
- X echo "exitvalue depending on the success of the search. This script can"
- X echo "not work without it."
- X exit 2
- Xfi
- X
- Xnocore=yes
- Xtest -f core && nocore=no
- X
- Xcat >grepfor <<HERE
- X$FGREP -e "\$1" _autotst.rrr >$DEVNULL && echo "\$2" >>$ACONF
- XHERE
- Xchmod 0755 grepfor
- X
- Xcat >$ACONF <<HERE
- X/* This file was automagically generated by autoconf */
- X
- XHERE
- X
- Xecho 'Checking for POSIX and ANSI system include files'
- Xtest -f $USRINC/unistd.h || echo "#define UNISTD_H_MISSING" >>$ACONF
- Xtest -f $USRINC/stddef.h || echo "#define STDDEF_H_MISSING" >>$ACONF
- Xtest -f $USRINC/stdlib.h || echo "#define STDLIB_H_MISSING" >>$ACONF
- Xif test ! -f $USRINC/dirent.h
- Xthen echo "#define DIRENT_H_MISSING" >>$ACONF
- X if test ! -f $USRINC/ndir.h
- X then echo "#define NDIR_H_MISSING" >>$ACONF
- X if test ! -f $USRINC/sys/ndir.h
- X then echo "#define SYS_NDIR_H_MISSING" >>$ACONF
- X if test ! -f $USRINC/sys/dir.h
- X then echo "#define SYS_DIR_H_MISSING" >>$ACONF
- X test -f $USRINC/sys/dirent.h ||
- X echo "#define SYS_DIRENT_H_MISSING" >>$ACONF
- X fi
- X fi
- X fi
- Xfi
- Xtest -f $USRINC/sys/wait.h || echo "#define SYS_WAIT_H_MISSING" >>$ACONF
- Xtest -f $USRINC/sys/utsname.h || echo "#define SYS_UTSNAME_H_MISSING" >>$ACONF
- Xtest -f $USRINC/string.h || echo "#define STRING_H_MISSING" >>$ACONF
- Xtest -f $USRINC/sysexits.h || echo "#define SYSEXITS_H_MISSING" >>$ACONF
- X
- Xecho >_locktst.h
- Xtest -f $USRINC/sys/locking.h ||
- X echo "#define SYS_LOCKING_H_MISSING" >>_locktst.h
- Xtest -f $USRINC/sys/file.h || echo "#define SYS_FILE_H_MISSING" >>_locktst.h
- X$FGREP setsid $USRINC/sys/unistd.h >$DEVNULL 2>&1 ||
- X echo "#define setsid()" >>_locktst.h
- X
- X$RM _autotst.$O _autotst
- X
- Xcat >_autotst.c <<HERE
- X#include "$ACONF"
- X#include <sys/types.h>
- X#ifndef UNISTD_H_MISSING
- X#include <unistd.h>
- X#endif
- X#include <fcntl.h>
- X#ifndef SYS_FILE_H_MISSING
- X#include <sys/file.h>
- X#endif
- Xmain(){
- X#ifdef F_SETLKW
- X fcntl(0,F_SETLKW,0);
- X#endif
- X#ifdef F_LOCK
- X lockf(0,F_LOCK,0L);
- X#endif
- X#ifdef LOCK_EX
- X flock(0,LOCK_EX);
- X#endif
- X return 0;}
- XHERE
- X
- Xecho 'Initiating fcntl()/kernel-locking-support tests'
- Xecho '********************************************************************'
- Xecho '* If your system has mounted a REMOTE filesystem (like per NFS), *'
- Xecho '* then it would be advisable to compile these sources from within *'
- Xecho '* that filesystem, otherwise the locking tests might produce false *'
- Xecho '* results (locking capability is file-system dependent) *'
- Xecho '********************************************************************'
- Xif $MAKE _autotst.$O >$DEVNULL 2>&1
- Xthen
- X:
- Xelse
- X $RM _autotst.$O
- X echo 'Oops, your <sys/file.h> file seems to be incorrect.'
- X echo 'Retrying without it.'
- X echo "#define SYS_FILE_H_MISSING" >>$ACONF
- X if $MAKE _autotst.$O >_autotst.rrr 2>&1
- X then
- X :
- X else
- X echo 2>&1 "Whoeaaa! There's something fishy going on here."
- X echo 2>&1 "You have a look and see if you detect anything uncanny:"
- X echo 2>&1 "*******************************************************"
- X cat 2>&1 _autotst.rrr
- X echo 2>&1 "*******************************************************"
- X echo 2>&1 "I suggest you take a look at the definition of CFLAGS* and CC"
- X echo 2>&1 "in the Makefile before you try make again."
- X kill -15 $$
- X fi
- Xfi
- X$MAKE _autotst >_autotst.rrr 2>&1
- X$RM _autotst.$O _autotst
- X
- X$FGREP fcntl _autotst.rrr >$DEVNULL && echo "#undef F_SETLKW" >>_locktst.h
- X$FGREP lockf _autotst.rrr >$DEVNULL && echo "#undef F_LOCK" >>_locktst.h
- X$FGREP flock _autotst.rrr >$DEVNULL && cat >>_locktst.h <<HERE
- X#ifdef LOCK_EX
- X#undef LOCK_EX
- X#endif
- X#ifndef SYS_FILE_H_MISSING
- X#define SYS_FILE_H_MISSING
- X#endif
- XHERE
- X
- Xcat >_autotst.c <<HERE
- X#include "$ACONF"
- X#include "../config.h"
- X#include <sys/types.h>
- X#ifndef UNISTD_H_MISSING
- X#include <unistd.h> /* getppid() */
- X#endif
- X#include <stdio.h>
- X#include <time.h>
- X#include <fcntl.h>
- X#include <signal.h> /* SIGKILL */
- X#ifndef tell
- X#define tell(fd) lseek(fd,0L,SEEK_CUR)
- X#endif
- X#define EX_OK 0
- X#include "_locktst.h"
- X#ifndef SYS_FILE_H_MISSING
- X#include <sys/file.h>
- X#endif
- X#ifndef SEEK_SET
- X#define SEEK_SET 0
- X#define SEEK_CUR 1
- X#define SEEK_END 2
- X#endif
- X
- X#define MIN_locks 128 /* minimum of consecutive successful locks */
- X#define SLEEP_loop 64 /* iterations in the busy loop */
- X#define SLEEP_delay 0 /* sleep() time per busy iteration */
- X#define TIME_OUT_SEC 16 /* initial timeout per lock */
- X#define NR_of_forks 8 /* concurrent test-programs */
- X#define NR_of_lockfiles 2 /* lockfiles used in testing (<=4) */
- X#define GROW 3 /* when timing got worse */
- X#define DECAY 7/8 /* when timing got better */
- X#define GOBBLE 256 /* for the SunOS crash test */
- X
- X#define SHIFT_childno 3
- X#define MASK_fileno ((1<<SHIFT_childno)-1)
- X#define MASK_childno (~MASK_fileno)
- X
- X#ifdef NO_fcntl_LOCK
- X#undef F_SETLKW
- X#endif
- X#ifdef NO_lockf_LOCK
- X#undef F_LOCK
- X#endif
- X#ifdef NO_flock_LOCK
- X#undef LOCK_EX
- X#endif
- X
- X#define FIRST_lock 0x04 /* testing is in order of importance */
- X#define MSK_fcntl 0x04 /* don't change this order unless you */
- X#define MSK_lockf 0x02 /* change locking.c as well, fdlock() */
- X#define MSK_flock 0x01
- X
- Xint dolock,child[NR_of_forks],timeout;
- X
- Xvoid stimeout()
- X{ timeout=1;killchildren();
- X}
- X
- Xstatic unsigned long seed;
- X
- Xunsigned psrand()
- X{ return(unsigned)(seed*=69069L)>>8;
- X}
- X
- Xmain()
- X{ int goodlock,testlock,i,pip[2];unsigned otimet,dtimet;
- X static char filename[]="_locktst.l0";
- X close(0);goodlock=0;testlock=FIRST_lock;
- X if(fork()) /* try to ditch the controlling tty */
- X return EX_OK; /* mainly to prevent rather messy kernel-diagnostics */
- X setsid(); /* from appearing on your tty */
- X do
- X { otimet=time((char*)0);signal(SIGTERM,SIG_DFL);dolock=goodlock|testlock;
- X if(fork()) /* discard the old body, let "init" adopt our children */
- X { close(1);close(2);i=NR_of_lockfiles;
- X do /* prime the lock, see if it vanishes */
- X { filename[sizeof filename-2]='0'+--i;
- X lseek(goodlock=open(filename,O_WRONLY),0L,SEEK_END);
- X fdlock(goodlock);
- X }
- X while(i);
- X for(;;) /* synchronising "busy"-wait */
- X sleep(TIME_OUT_SEC); /* until the games can be started */
- X }
- X sleep(1);pipe(pip);i=NR_of_forks;*child=0;
- X fprintf(stderr,"\nStarting test %x\n",dolock);
- X while((child[--i]=fork())&&i); /* divide and conquer */
- X if(!*child)
- X { unsigned char lockflag;int fd,childno=i<<SHIFT_childno;
- X close(pip[0]);close(1);seed=time((char*)0)+getpid()|1;
- X for(;;) /* and lock away! */
- X { filename[sizeof filename-2]='0'+(i=psrand()%NR_of_lockfiles);
- X lockflag=childno|i<<1|1;
- X lseek(fd=open(filename,O_WRONLY),0L,SEEK_END);
- X if(sfdlock(fd))
- X lockflag&=~1,fprintf(stderr,"XX%02x",lockflag);
- X write(pip[1],&lockflag,1);
- X fprintf(stderr,"%2x%02x",i,childno>>SHIFT_childno);
- X lseek(fd,0L,SEEK_END);write(fd,&lockflag,1);
- X for(i=SLEEP_loop;i;i--,time((char*)0),sleep(SLEEP_delay));
- X lockflag&=~1;write(pip[1],&lockflag,1);
- X if(fdunlock()||close(fd))
- X { write(pip[1],&lockflag,1);fprintf(stderr,"XX%02x",lockflag);
- X return 1;
- X }
- X }
- X }
- X ;{ unsigned char lckdfil[NR_of_lockfiles],curflag;
- X int j,countlocks=MIN_locks; /* give all children a chance */
- X for(j=NR_of_lockfiles;lckdfil[--j]=0,j;);
- X close(pip[1]);timeout=0;sleep(1);kill(getppid(),SIGKILL);
- X signal(SIGALRM,(void(*)())stimeout);
- X dtimet=(((unsigned)time((char*)0)-otimet)*GROW)+TIME_OUT_SEC;
- X do
- X { unlink("_locktst.alive");alarm(dtimet+2); /* watchdog */
- X dtimet=(otimet=time((char*)0)-otimet)>dtimet?
- X otimet*GROW:otimet+(dtimet-otimet)*DECAY+1; /* load dependent */
- X otimet=time((char*)0);
- X }
- X while(1==read(pip[0],&curflag,1)&&
- X (j=lckdfil[i=(curflag&MASK_fileno)>>1],!timeout)&&
- X ((j^(lckdfil[i]=curflag))==1||!(j&1)&&curflag&1)&&--countlocks);
- X alarm(0);killchildren();close(pip[0]);
- X#ifdef FAIR_LOCK_CHECK
- X j=NR_of_lockfiles;
- X do
- X if(!lckdfil[--j]) /* was the locking fair? */
- X countlocks+=MIN_locks; /* nope */
- X while(j);
- X#endif
- X fprintf(stdout,
- X "/*locktype: %x, countlocks: %x, timeout %x, watchdog %x*/\n",dolock,
- X countlocks,timeout,dtimet);fflush(stdout);
- X if(!countlocks) /* Hurray! Locking was flawless */
- X goodlock=dolock; /* make a mark on our colt */
- X }
- X }
- X while(testlock>>=1);
- X if(!(goodlock&MSK_fcntl)) /* report our findings */
- X puts("#define NOfcntl_lock");
- X if(goodlock&MSK_lockf)
- X puts("#define USElockf");
- X if(goodlock&MSK_flock)
- X { puts("#define USEflock");
- X#ifdef SYS_FILE_H_MISSING
- X puts("#define SYS_FILE_H_MISSING");
- X#endif
- X }
- X puts("Kernel-locking tests completed.");
- X return EX_OK;
- X}
- X
- Xkillchildren()
- X{ int i;
- X i=NR_of_forks;
- X do
- X if(child[--i]>0)
- X kill(child[i],SIGTERM),child[i]=0;
- X while(i);
- X}
- X
- Xsfdlock(fd)
- X{ int i;unsigned gobble[GOBBLE>>2];
- X for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0); /* SunOS crash test */
- X return fdlock(fd);
- X}
- X
- Xstatic oldfdlock;
- X#ifdef F_SETLKW
- Xstatic struct flock flck; /* why can't it be a local variable? */
- X#endif
- X#ifdef F_LOCK
- Xstatic long oldlockoffset;
- X#endif
- X
- Xfdlock(fd)
- X{ int i;unsigned gobble[GOBBLE>>2];
- X for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0); /* SunOS crash test */
- X oldfdlock=fd;fd=0;
- X if(MSK_fcntl&dolock)
- X#ifdef F_SETLKW
- X { flck.l_type=F_WRLCK;flck.l_whence=SEEK_SET;flck.l_len=0;
- X flck.l_start=tell(oldfdlock);fd|=fcntl(oldfdlock,F_SETLKW,&flck);
- X }
- X#else
- X fd=1;
- X#endif
- X if(MSK_lockf&dolock)
- X#ifdef F_LOCK
- X oldlockoffset=tell(oldfdlock),fd|=lockf(oldfdlock,F_LOCK,0L);
- X#else
- X fd=1;
- X#endif
- X if(MSK_flock&dolock)
- X#ifdef LOCK_EX
- X fd|=flock(oldfdlock,LOCK_EX);
- X#else
- X fd=1;
- X#endif
- X return fd;
- X}
- X
- Xfdunlock()
- X{ int i;unsigned gobble[GOBBLE];
- X for(i=GOBBLE;i;gobble[--i]=~(unsigned)0); /* SunOS crash test */
- X if(MSK_flock&dolock)
- X#ifdef LOCK_EX
- X i|=flock(oldfdlock,LOCK_UN);
- X#else
- X i=1;
- X#endif
- X if(MSK_lockf&dolock)
- X#ifdef F_LOCK
- X { lseek(oldfdlock,oldlockoffset,SEEK_SET);i|=lockf(oldfdlock,F_LOCK,2L);
- X i|=lockf(oldfdlock,F_ULOCK,0L);
- X }
- X#else
- X i=1;
- X#endif
- X if(MSK_fcntl&dolock)
- X#ifdef F_SETLKW
- X { flck.l_len=2;i|=fcntl(oldfdlock,F_SETLK,&flck);flck.l_type=F_UNLCK;
- X flck.l_len=0;i|=fcntl(oldfdlock,F_SETLK,&flck);
- X }
- X#else
- X i=1;
- X#endif
- X if(!i)
- X for(i=GOBBLE;i&&gobble[--i]==~(unsigned)0;);
- X return i;
- X}
- XHERE
- X
- Xif $MAKE _autotst >_autotst.rrr 2>&1
- Xthen
- X:
- Xelse
- X echo 2>&1 "Whoeaaa! There's something fishy going on here."
- X echo 2>&1 "You have a look and see if you detect anything uncanny:"
- X echo 2>&1 "*******************************************************"
- X cat 2>&1 _autotst.rrr
- X echo 2>&1 "*******************************************************"
- X echo 2>&1 "I suggest you take a look at the definition of LDFLAGS*"
- X echo 2>&1 "in the Makefile before you try make again."
- X kill -15 $$
- Xfi
- X
- X$MV _locktst _locktst.$$ 2>$DEVNULL
- X$RM _autotst.$O _autotst.rrr locktst* 2>$DEVNULL
- X$MV _autotst _locktst
- Xfor a in 0 1 2 3
- Xdo echo dummy_file >_locktst.l$a
- Xdone
- X_locktst >_locktst.rrr 2>lock.log # this will finish in the background
- Xecho 'Proceeding with kernel-locking-support tests in the background'
- X
- Xtest -f $USRINC/sys/socket.h -a -f $USRINC/netdb.h -a -f $USRINC/netinet/in.h||
- X echo "#define NO_COMSAT" >>$ACONF
- X
- Xcat >_autotst.c <<HERE
- X#include "$ACONF"
- X#ifndef UNISTD_H_MISSING
- X#include <unistd.h> /* execvp() */
- X#endif
- Xmain()
- X{ char r[]="",*const*p;char*q="";static struct{const int a;int b;}c[2];
- X --(c+1)->b; /* AIX 3.1.5 machines can't do this */
- X p= &q;
- X execvp(q,p); /* IRIX 4.0.1 system-include files are wrong on this point */
- X return *r;
- X}
- XHERE
- X
- Xecho 'Testing for const'
- Xif $MAKE _autotst.$O 2>&1 | $FGREP -v include/ >_autotst.rrr &&
- X test -f _autotst.$O
- Xthen
- X grepfor const '#define const'
- Xelse
- X echo '#define const' >>$ACONF
- Xfi
- X$RM _autotst.$O
- X
- Xcat >_autotst.c <<HERE
- Xmain(){volatile int i;return(i=0);}
- XHERE
- X
- Xecho 'Testing for volatile'
- Xif $MAKE _autotst.$O >$DEVNULL 2>&1 && test -f _autotst.$O
- Xthen
- X:
- Xelse
- X echo '#define volatile' >>$ACONF
- Xfi
- X$RM _autotst.$O
- X
- Xif $FGREP const $ACONF >$DEVNULL
- Xthen
- X echo '#define P(args) ()' >>$ACONF
- Xelse
- X cat >_autotst.c <<HERE
- Xmain(const argc,const char*const argv[]){return argc;}
- XHERE
- X
- X echo 'Testing for prototypes'
- X if $MAKE _autotst.$O >$DEVNULL 2>&1 && test -f _autotst.$O
- X then
- X :
- X else
- X echo '#define P(args) ()' >>$ACONF
- X fi
- X $RM _autotst.$O
- Xfi
- X
- Xcat >_autotst.c <<HERE
- X#include "includes.h"
- X#ifndef NO_COMSAT
- X#include "network.h"
- X#endif
- Xvoid*vvoid;
- Xmain(){int i;char*p="t";
- X {size_t vsize_t;i=vsize_t=1;}
- X {pid_t vpid_t;i=vpid_t=1;}
- X {time_t vtime_t;i=vtime_t=1;}
- X {mode_t vmode_t;i=vmode_t=1;}
- X {uid_t vuid_t;i=vuid_t=1;}
- X {gid_t vgid_t;i=vgid_t=1;}
- X#ifndef NO_COMSAT
- X {struct hostent host;i=!(host.h_addr_list=0);}
- X#endif
- X vvoid=p;
- X return !vvoid;}
- XHERE
- X
- Xecho 'Testing for void*,size_t,pid_t,time_t,mode_t,uid_t,gid_t'
- X$MAKE _autotst.$O 2>&1 | $FGREP -v include/ >_autotst.rrr
- X$RM _autotst.$O
- X
- Xgrepfor void '#define void char'
- Xgrepfor size_t 'typedef unsigned size_t;'
- Xgrepfor pid_t 'typedef int pid_t;'
- Xgrepfor time_t 'typedef long time_t;'
- Xgrepfor mode_t 'typedef int mode_t;'
- Xgrepfor uid_t 'typedef int uid_t;'
- Xgrepfor gid_t 'typedef int gid_t;'
- Xgrepfor h_addr_list '#define h_0addr_list h_addr' ||
- X grepfor struct '#define h_0addr_list h_addr'
- X
- Xcat >_autotst.c <<HERE
- X#include "includes.h"
- Xmain(){int i;i=1;
- X i+=WIFEXITED(i);
- X i+=WIFSTOPPED(i);
- X i+=WEXITSTATUS(i);
- X return i;}
- XHERE
- X
- Xecho 'Testing for WIFEXITED(), WIFSTOPPED() & WEXITSTATUS()'
- Xif $MAKE _autotst.$O 2>&1 | $FGREP -v include/ >_autotst.rrr
- Xthen
- X grepfor struct '#define WMACROS_NON_POSIX' ||
- X grepfor union '#define WMACROS_NON_POSIX'
- Xelse
- X echo '#define WMACROS_NON_POSIX' >>$ACONF
- Xfi
- X$RM _autotst.$O
- X
- Xcat >_autotst.c <<HERE
- X#include "includes.h"
- X#ifndef NO_COMSAT
- X#include "network.h"
- X#endif
- Xmain(){char a[2];
- X endpwent();endgrent();memmove(a,"0",1);bcopy("0",a,1);strcspn(a,"0");
- X strtol("0",(char**)0,10);strchr("0",'0');strpbrk(a,"0");rename(a,"0");
- X opendir("0");initgroups("0",0);strstr("0","0");
- X#ifndef NOuname
- X {struct utsname b;uname(&b);}
- X#endif
- X#ifndef NO_COMSAT
- X gethostbyname("0");getprotobyname(COMSATprotocol);endhostent();endservent();
- X endprotoent();
- X#endif
- X return 0;}
- XHERE
- X
- Xecho 'Testing for memmove, strchr, strpbrk, strcspn, strtol, strstr & opendir'
- Xif $MAKE _autotst.$O >_autotst.rrr 2>&1
- Xthen
- X:
- Xelse
- X echo 2>&1 "Whoeaaa! There's something fishy going on here."
- X echo 2>&1 "You have a look and see if you detect anything uncanny:"
- X echo 2>&1 "*******************************************************"
- X cat 2>&1 _autotst.rrr
- X echo 2>&1 "*******************************************************"
- X if $FGREP NO_COMSAT $ACONF >$DEVNULL
- X then
- X echo 2>&1 "Your include files seem to be beyond repair <sigh>."
- X echo 2>&1 "I give up."
- X kill -15 $$
- X else
- X echo 2>&1 "Maybe your network-support include files are messed up."
- X echo 2>&1 "Continuing the compilation, throwing out network"
- X echo 2>&1 "support..."
- X $RM _autotst.$O
- X echo "#define NO_COMSAT" >>$ACONF
- X if $MAKE _autotst.$O >$DEVNULL 2>&1
- X then
- X echo "It seems to be all right."
- X else
- X echo 2>&1 "Your include files seem to be beyond repair <sigh>."
- X echo 2>&1 "I give up."
- X kill -15 $$
- X fi
- X fi
- Xfi
- X$MAKE _autotst 2>&1 | $FGREP -v include/ >_autotst.rrr
- X$RM _autotst _autotst.$O
- X
- Xgrepfor strcspn '#define NOstrcspn'
- Xgrepfor strpbrk '#define NOstrpbrk'
- Xgrepfor opendir "
- X#define NOopendir /* the readdir library does not seem to be available
- X this will slightly affect the way a filenumber is
- X selected in MH-folders by procmail */
- X"
- Xgrepfor rename '#define NOrename'
- Xgrepfor strchr '#define strchr(s,c) index(s,c)'
- Xgrepfor uname "\
- X#define NOuname \
- X/* the include files define it, the libraries don't */"
- Xgrepfor initgroups '#define initgroups(n,g)'
- Xgrepfor endpwent '#define endpwent()'
- Xgrepfor endgrent '#define endgrent()'
- Xif grepfor gethostbyname '#define NO_COMSAT'
- Xthen
- X:
- Xelse
- X grepfor getprotobyname '#define UDP_protocolno 17'
- X grepfor endhostent '#define endhostent()'
- X grepfor endservent '#define endservent()'
- X grepfor endprotoent '#define endprotoent()'
- Xfi
- Xgrepfor strtol '#define NOstrtol'
- Xgrepfor strstr '#define NOstrstr'
- Xgrepfor memmove '#define NOmemmove' &&
- Xif $FGREP -e bcopy _autotst.rrr >$DEVNULL
- Xthen
- X echo '#define NObcopy' >>$ACONF
- X
- X echo 'Testing for brain damage'
- X cat >_autotst.c <<HERE
- X#include "includes.h"
- Xstruct tests{int a,b;};
- Xmain(){
- X return offsetof(struct tests,b);}
- XHERE
- X if $MAKE _autotst.$O >$DEVNULL 2>&1
- X then
- X :
- X else
- X echo 'Yep, it is' # ISC chokes on its own offsetof()
- X echo '#define oBRAIN_DAMAGE' >>$ACONF
- X fi
- X $RM _autotst.$O
- X
- Xelse
- X
- X cat >_autotst.c <<HERE
- X#include "includes.h"
- X#define M256 256
- X#define F33 33
- Xmain(){int j=0,i=M256-1;static char a[M256];
- X do a[i]=i;while(i--);
- X bcopy(a+F33,a,M256-F33);bcopy(a,a+F33,M256-F33);i=F33-1;
- X do j|=a[i]!=(char)(i+F33);while(i--);i=M256-1;
- X do j|=a[i]!=(char)i;while(--i!=F33-1);return!j;}
- XHERE
- X
- X echo 'Testing for bcopy handling overlaps'
- X $MAKE _autotst >$DEVNULL 2>&1
- X
- X if _autotst
- X then
- X echo 'Sorry, incompetent bcopy'
- X echo '#define NObcopy' >>$ACONF
- X fi
- X $RM _autotst
- Xfi
- X
- X$FGREP -e LD_ /bin/ld >/dev/null 2>&1 && echo "#define LD_ENV_FIX" >>$ACONF
- Xtest -f /bin/test && echo "#define GOT_bin_test" >>$ACONF
- X
- Xcat >_autotst.c <<HERE
- X#include "includes.h"
- X#ifndef NO_COMSAT
- X#include "network.h" /* also for ntohs() */
- X#endif
- Xmain(argc)
- X{ unsigned long s=(size_t)~0;int i;
- X for(i=1;s>>=1;i++);
- X if(argc==1)
- X {
- X#ifndef NO_COMSAT
- X#ifndef UDP_protocolno
- X ;{ const struct protoent*p;
- X if(p=getprotobyname(COMSATprotocol))
- X { printf("#define UDP_protocolno %d\n",p->p_proto);
- X#else
- X ;{ if(1)
- X {
- X#endif
- X ;{ const struct servent*serv;
- X if(serv=getservbyname(COMSATservice,COMSATprotocol))
- X printf("#define BIFF_serviceport \"%d\"\n",
- X ntohs(serv->s_port));
- X }
- X#ifdef AF_INET
- X ;{ const struct hostent*host;
- X if(!strcmp("localhost",COMSAThost)&&
- X (host=gethostbyname(COMSAThost))&&
- X host->h_0addr_list&&host->h_addrtype==AF_INET&&
- X host->h_length)
- X { int j=host->h_length;
- X const unsigned char*ad=(void*)host->h_0addr_list;
- X printf("#define IP_localhost {");
- X do printf("%d,",*ad++);
- X while(--j);
- X puts("}");
- X }
- X }
- X#endif /* AF_INET */
- X }
- X else
- X puts("#define NO_COMSAT");
- X }
- X#endif /* NO_COMSAT */
- X if(i<=16)
- X { puts("#define SMALLHEAP");return 1;
- X }
- X#ifdef _GUID_T /* ISC cc hack */
- X ;{ struct passwd*p;
- X if(sizeof(int)>sizeof(uid_t)&&(p=getpwnam("root"))&&(*p->pw_dir!='/'||
- X (*p->pw_shell&&!(p->pw_shell)[1])))
- X puts("#define _GUID_T\ntypedef int uid_t;\ntypedef int gid_t;");
- X }
- X#endif
- X }
- X#ifdef SYSTEM_MBOX
- X if(argc==2)
- X { printf("#define SYSTEM_MAILBOX %s\n",SYSTEM_MBOX);return 1;
- X }
- X#endif
- X#ifdef DEFsendmail
- X if(argc==3)
- X { printf("#define SENDMAIL %s\n",DEFsendmail);return 1;
- X }
- X#endif
- X return 0;
- X}
- XHERE
- X
- Xecho 'Determining the most applicable block size'
- X
- X$MAKE _autotst >$DEVNULL 2>&1
- X_autotst >>$ACONF
- X
- Xfound=no
- Xfor a in /usr/spool/mail /usr/mail /var/spool/mail /var/mail
- Xdo
- X test -d $a -a $found != yes &&
- X echo '#define SYSTEM_MAILBOX "'$a'/$LOGNAME"' >>$ACONF && found=yes
- Xdone
- Xif test $found != yes && _autotst 2 >>$ACONF
- Xthen
- X echo '#define SYSTEM_MAILBOX "$HOME/.mail"' >>$ACONF
- X echo Could not find the system-mailbox directory, supplied substitute
- Xfi
- X
- Xcat >lookfor <<HERE
- Xfor a in /usr/lib /lib /usr/etc /etc /usr/bin /bin /usr/local/bin /usr/lbin \
- X /usr/local/lib /usr/local /usr/.lib
- Xdo
- X if test -f "\$a/\$1"
- X then
- X echo "#define SENDMAIL \"\$a/\$1\"" >>$ACONF
- X exit 0
- X fi
- Xdone
- Xexit 1
- XHERE
- Xchmod 0755 lookfor
- X
- Xif lookfor sendmail || lookfor smail
- Xthen
- X:
- Xelif _autotst 2 3 >>$ACONF
- Xthen
- X echo 'Could not find any mailer. It should be a mailer accepting at least'
- X echo 'one plain destination address as its only argument (any sendmail'
- X echo 'compatible mailer will do), and the mail-to-be-sent on stdin.'
- X echo 'What is your mailer called? (You can override this in config.h)'
- X read a
- X echo "#define SENDMAIL \"$a\"" >>$ACONF
- Xfi
- X
- Xcat /usr/lib/sendmail.cf /etc/sendmail.cf 2>$DEVNULL |
- X grep 'Mlocal.*procmail' >$DEVNULL ||
- X echo '#define CF_no_procmail_yet' >>$ACONF
- X
- Xtailpid=""
- X
- Xwhile $FGREP -e "Kernel-locking tests completed." _locktst.rrr >$DEVNULL; \
- X test 0 != $?
- Xdo
- X if test -z "$tailpid"
- X then
- X echo "Waiting for kernel-locking tests to finish..."
- X exec 9>&2 2>$DEVNULL
- X tail -f lock.log &
- X tailpid=$!
- X exec 2>&9 9>&-
- X fi
- X# if test ! -f _locktst.alive
- X# then
- X# echo >_locktst.alive
- X# echo "Waiting for kernel-locking tests to finish..."
- X# fi
- X sleep 4
- Xdone
- Xexec 9>&2 2>$DEVNULL
- Xtest ! -z "$tailpid" && kill $tailpid && echo && echo
- Xexec 2>&9 9>&-
- Xecho "Collecting results from kernel-locking tests"
- Xsed -e '/^Kernel-locking tests completed./,$ d' <_locktst.rrr >>$ACONF
- Xif test -f core -a $nocore = yes
- Xthen
- X echo "Removing core file (probably from the locking tests)"
- X $RM core
- Xfi
- X
- X$RM _autotst* _locktst* lookfor grepfor 2>$DEVNULL
- X
- Xecho =============================autoconf.h===================================
- Xcat $ACONF
- Xecho ==========================================================================
- END_OF_FILE
- if test 23957 -ne `wc -c <'procmail280/src/autoconf'`; then
- echo shar: \"'procmail280/src/autoconf'\" unpacked with wrong size!
- fi
- chmod +x 'procmail280/src/autoconf'
- # end of 'procmail280/src/autoconf'
- fi
- echo shar: End of archive 11 \(of 11\).
- cp /dev/null ark11isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 11 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Sincerely, berg@pool.informatik.rwth-aachen.de
- Stephen R. van den Berg (AKA BuGless). berg@physik.tu-muenchen.de
-
- "Be spontaneous!"
-
- exit 0 # Just in case...
-