home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # @(#) $Id: Configure,v 1.11 1993/07/21 01:58:08 lasse Exp $
- # Configure for cforms.
- #
- REPL=""
- CFLAGS="-g"
- config=src/config.h
-
- findpath()
- {
- dirs=`IFS=: set - $PATH; echo $*`
- for d in $dirs
- do
- if [ -x $d/$1 ]; then
- echo $d/$1
- return 0
- fi
- done
- return 1
- }
-
- if [ -f /etc/inittab ]; then
- CFLAGS="$CFLAGS -DSIGNAL_VOID -DSYSV"
- if [ -d /proc ]; then
- CFLAGS="$CFLAGS -DSVR4"
- fi
- else
- CFLAGS="$CFLAGS -DSIGNAL_INT"
- fi
-
- rm -f src/config.h
- echo "/* Do not edit this file it is created by Configure */" >> $config
-
- echo "#include <stdio.h>" >> $config
- echo "#include <curses.h>" >> $config
- echo "#include <ctype.h>" >> $config
- echo "#include <assert.h>" >> $config
- echo "#include <signal.h>" >> $config
- echo "#include <stdarg.h>" >> $config
- if [ -f /usr/include/stdlib.h ]; then
- echo "#include <stdlib.h>" >> $config
- elif [ -f /usr/include/malloc.h ]; then
- echo "#include <malloc.h>" >> $config
- fi
-
- if [ -f /usr/include/string.h ]; then
- echo "#include <string.h>" >> $config
- elif [ -f /usr/include/strings.h ]; then
- echo "#include <strings.h>" >> $config
- fi
-
- if [ -f /usr/include/memory.h ]; then
- echo "#include <memory.h>" >> $config
- fi
-
- if [ -f /usr/include/unistd.h ]; then
- echo "#include <unistd.h>" >> $config
- else
- echo "extern int read(int, void *, unsigned);" >> $config
- echo "extern int write(int, void *, unsigned);" >> $config
- fi
-
- if [ ! -f /usr/include/stdarg.h ]; then
- echo "You might have problem with the file /usr/include/stdarg.h" >&2
- fi
-
- CC=`findpath cc`
- GCC=`findpath gcc`
- CP=`findpath cp`
- LATEX=`findpath latex`
- RANLIB=`findpath ranlib`
- YACC=`findpath yacc`
- if [ -z "$YACC" ]; then
- YACC=`findpath bison`
- if [ -z "$YACC" ]; then
- echo "I could not find niether yacc nor bison, you're in trouble"
- else
- YACC="$YACC -y"
- fi
- fi
-
- #
- # CC
- #
- if [ ! -z "$GCC" ]; then
- REPL="$REPL -e 's%^@CC%CC = $GCC -ansi -Wcast-qual -Wimplicit -Wreturn-type -Wswitch
- -Wcomments -Wtrigraphs -Wpointer-arith%'"
- elif [ ! -z "$CC" ]; then
- REPL="$REPL -e 's%^@CC%$CC = CC%'"
- else
- echo "no compiler found" >&2
- exit 1
- fi
-
- #
- # CP
- #
- if [ ! -z "$CP" ]; then
- REPL="$REPL -e 's%^@CP%CP = $CP'%"
- else
- echo "the command cp not found" >&2
- exit 1
- fi
-
- #
- # LATEX
- #
- if [ ! -z "$LATEX" ]; then
- REPL="$REPL -e 's%^@LATEX%LATEX = $LATEX'%"
- else
- REPL="$REPL -e 's%^@LATEX%LATEX = echo '%"
- fi
-
- #
- # RANLIB
- #
- if [ ! -z "$RANLIB" ]; then
- REPL="$REPL -e 's%^@RANLIB%RANLIB = $RANLIB'%"
- else
- REPL="$REPL -e 's%^@RANLIB%RANLIB = echo '%"
- fi
-
- #
- # YACC
- #
- if [ ! -z "$YACC" ]; then
- REPL="$REPL -e 's%^@YACC%YACC = $YACC'%"
- else
- echo "the command bison or yacc not found" >&2
- exit 1
- fi
-
- #
- # SUN specific.
- #
- if [ -f /vmunix -a -f /usr/include/strings.h ]; then
- if [ ! -f /usr/5include/curses.h ]; then
- echo "Your Sun has not got the system 5 compability package" >&2
- exit 1
- fi
-
- REPL="$REPL -e 's%^@CFLAGS%CFLAGS = $CFLAGS -I/usr/5include -I../include \$(DEFINES)%'"
- REPL="$REPL -e 's%^@LDFLAGS%LDFLAGS = -ly -L/usr/5lib -lcurses -ltermlib /usr/5lib/libc.a%'"
- REPL="$REPL -e 's%^@LDFLAGS%LDFLAGS = $CFLAGS -lcurses -ltermlib'%"
- else
- REPL="$REPL -e 's%^@CFLAGS%CFLAGS = $CFLAGS -I../include \$(DEFINES)%'"
- REPL="$REPL -e 's%^@LDFLAGS%LDFLAGS = -ly -lcurses -ltermlib'%"
- fi
-
- ( echo "#"
- echo "# Don't edit in this file, use Makefile.src"
- eval sed $REPL Makefile.src ) > Makefile
-