#!/bin/sh # This program will configure the makefile for various OSes. # # Config version 1.2 SYS= # Heading cat > Makefile <> Makefile <> Makefile case "$SYS" in linux) cat >> Makefile <<-EoF CC ?= gcc CFLAGS += -g -O \$(DFLAGS) -Wall DFLAGS = -DSYSV -DPOSIX -DHAS_ITIMER -DLINUX -DHASSELECT LIBS = -lm -lc EoF ;; sunos*|solaris) type gcc > /dev/null if [ $? = 0 ] ; then echo "CC ?= gcc" >> Makefile CC=gcc else echo "CC ?= cc" >> Makefile CC=cc fi cat >> Makefile <<-EoF DFLAGS = -DSYSV -DPOSIX -DSOLARIS -DLOCKDIR=\"/var/spool/locks\" -DHASSELECT CFLAGS += -g -O \$(DFLAGS) -Wall LIBS = -lm -lc EoF ;; freebsd|openbsd) cat >> Makefile <<-EoF CC ?= gcc CFLAGS += -g -O \$(DFLAGS) -Wall LIBS = -lm -lc DFLAGS= -DHASSELECT -DNEEDGTIME -DFREEBSD EoF ;; sco*) cat >> Makefile <<-EoF CC ?= cc MAN = /usr/local/man/man.1 MAN5 = /usr/local/man/man.5 CFLAGS += -O \$(DFLAGS) LIBS = -lm -lc -lsocket DFLAGS= -DSYSV -DHASSELECT -DSCO EoF CC=cc ;; generic) cat >> Makefile <<-EoF CC ?= gcc CFLAGS += -g -O \$(DFLAGS) -Wall LIBS = -lm -lc EoF ;; aix|sysv) cat >> Makefile <<-EoF CC ?= gcc CFLAGS += -g -O \$(DFLAGS) -Wall LIBS = -lm -lc DFLAGS = -DSYSV -DPOSIX EoF ;; netbsd) cat >> Makefile <<-EoF DFLAGS = -DPOSIX -DLOCKDIR=\"/var/spool/lock\" CC ?= gcc CFLAGS += -g -O \$(DFLAGS) -Wall LIBS = -lm -lc EoF ;; nextstep) cat >> Makefile <<-EoF CC ?= gcc DFLAGS = -DPOSIX CFLAGS += -g \$(DFLAGS) -posix LDFLAGS = -posix LIBS = -lm -lposix EoF ;; osf) cat >> Makefile <<-EoF GROUP = uucp CC ?= gcc CFLAGS += -g \$(DFLAGS) LIBS = -lm -lc DFLAGS = -DSYSV -DHAS_ITIMER -DOSF1 -DLOCKDIR=\"/var/spool/locks\" EoF ;; *) echo "Your system type was not understood. Please try one of " echo "the following". $0 -help exit ;; esac echo "checking for siginterrupt()" rm -f testsigi.c testsigi cat > testsigi.c < main() { int x; x=siginterrupt(SIGALRM,1); } EoF $CC -o testsigi testsigi.c >/dev/null 2>&1 if [ $? = 0 ] ; then echo "#define USESIGINT 1" >local.h echo "Using siginterrupt()" else echo "Not using siginterrupt()" fi rm -f testsigi.c testsigi if [ ! -f local.h ] ; then touch local.h fi cat >> Makefile <> Makefile echo "" echo "The Makefile has been created for $SYS." echo ""