4 # This script will determine if the system is a System V or BSD based
5 # UNIX system and create a makefile for ee appropriate for the system.
7 # $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.13 2002/09/23 04:18:13 hugh Exp $
14 # test for existence of termcap (exists on both BSD and SysV systems)
16 if [ -f /etc/termcap -o -f /usr/share/lib/termcap -o -f /usr/share/misc/termcap ]
18 if [ -f /usr/share/lib/termcap ]
20 termcap_exists="-DTERMCAP=\"\\\"/usr/share/lib/termcap\\\"\""
21 elif [ -f /usr/share/misc/termcap ]
23 termcap_exists="-DTERMCAP=\"\\\"/usr/share/misc/termcap\\\"\""
24 elif [ -f /etc/termcap ]
26 termcap_exists="-DTERMCAP=\"\\\"/etc/termcap\\\"\""
32 # test for terminfo directory (exists on SysV systems)
34 if [ -d /usr/lib/terminfo -o -d /usr/share/lib/terminfo -o -d /usr/share/terminfo ]
38 terminfo_exists="-DCAP"
41 # test for existence of termio header (on SysV systems)
43 if [ -f /usr/include/termio.h ]
50 # test for sgtty header (on BSD systems)
52 if [ -f /usr/include/sgtty.h ]
59 # look for select call in headers, make sure headers exist
63 if [ -f /usr/include/sys/time.h ]
65 HEADER_FILES="/usr/include/sys/time.h "
68 if [ -f /usr/include/sys/types.h ]
70 HEADER_FILES="$HEADER_FILES /usr/include/sys/types.h"
75 if [ -f /usr/include/unistd.h ]
77 HAS_UNISTD=-DHAS_UNISTD
78 HEADER_FILES="$HEADER_FILES /usr/include/unistd.h"
83 if [ -n "$HEADER_FILES" ]
85 string="`grep select $HEADER_FILES`"
88 BSD_SELECT="-DBSD_SELECT"
94 # check for existence of select.h (on AIX)
96 if [ -f /usr/include/sys/select.h ]
98 select_hdr="-DSLCT_HDR"
105 if [ -f /usr/include/stdlib.h ]
107 HAS_STDLIB=-DHAS_STDLIB
114 if [ -f /usr/include/stdarg.h ]
116 HAS_STDARG=-DHAS_STDARG
123 if [ -f /usr/include/ctype.h ]
125 HAS_CTYPE=-DHAS_CTYPE
130 # check for sys/ioctl.h
132 if [ -f /usr/include/sys/ioctl.h ]
134 HAS_SYS_IOCTL=-DHAS_SYS_IOCTL
139 # check for sys/wait.h
141 if [ -f /usr/include/sys/wait.h ]
143 HAS_SYS_WAIT=-DHAS_SYS_WAIT
148 # check for localization headers
150 if [ -f /usr/include/locale.h -a -f /usr/include/nl_types.h ]
154 catgets="-DNO_CATGETS"
157 # make decisions about use of new_curse.c (use of new_curse is recommended
158 # rather than local curses)
160 if [ -n "$terminfo_exists" -a -z "$termcap_exists" ]
162 echo "Neither terminfo or termcap are on this system! "
163 if [ -f /usr/include/curses.h ]
165 echo "Relying on local curses implementation."
168 Don't know where to find curses, you'll need to modify
169 source code to be able to build!
171 Modify the file make.default and build ee by typing:
187 if [ -z "$termio" -a -z "$sgtty" ]
189 echo "Neither termio.h or sgtty.h are on this system! "
190 if [ -f /usr/include/curses.h ]
192 echo "Relying on local curses implementation."
195 Don't know where to find curses, you'll need to modify
196 source code to be able to build!
198 Modify the file make.default and build ee by typing:
211 # check if this is a SunOS system
213 if [ -d /usr/5include ]
215 five_include="-I/usr/5include"
222 five_lib="-L/usr/5lib"
228 if [ "$name_string" = "Darwin" ]
232 other_cflags="${CFLAGS} -DNO_CATGETS"
234 other_cflags="-DNO_CATGETS"
240 if [ -z "`echo $CFLAGS | grep '[-]g'`" ]
242 other_cflags="${CFLAGS} -s"
244 other_cflags="${CFLAGS}"
251 # time to write the makefile
253 echo "Generating make.local"
257 mv make.local make.lcl.old
260 echo "DEFINES = $termio $terminfo_exists $BSD_SELECT $catgets $select $curses " > make.local
261 echo "" >> make.local
262 echo "CFLAGS = $HAS_UNISTD $HAS_STDARG $HAS_STDLIB $HAS_CTYPE $HAS_SYS_IOCTL $HAS_SYS_WAIT $five_lib $five_include $select_hdr $other_cflags $termcap_exists" >> make.local
263 echo "" >> make.local
264 echo "" >> make.local
265 echo "all : $TARGET" >> make.local
267 cat >> make.local << EOF
270 cc ee.c -o ee \$(CFLAGS) -lcurses
272 ee : ee.o new_curse.o
273 cc -o ee ee.o new_curse.o \$(CFLAGS)
275 ee.o : ee.c new_curse.h
276 cc -c ee.c \$(DEFINES) \$(CFLAGS)
278 new_curse.o : new_curse.c new_curse.h
279 cc new_curse.c -c \$(DEFINES) \$(CFLAGS)
283 if [ -f make.lcl.old ]
285 diffs="`cmp make.lcl.old make.local`"
288 rm -f ee.o new_curse.o ee