root/rat/trunk/configure @ 2342

Revision 2342, 6.7 KB (checked in by ucaccsp, 15 years ago)

Random cleanups....

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/bin/sh
2#
3# Configure script for rat. This script determines the type of machine it's
4# running on, and builds a Makefile with the appropriate macro definitions
5# to set up the machine specific includes etc.
6#
7# Copyright (c) 1998-99 University College London
8# All rights reserved.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. All advertising materials mentioning features or use of this software
19#    must display the following acknowledgement:
20#      This product includes software developed by the Computer Science
21#      Department at University College London
22# 4. Neither the name of the University nor of the Department may be used
23#    to endorse or promote products derived from this software without
24#    specific prior written permission.
25#
26# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
27# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
30# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36# SUCH DAMAGE.
37#
38
39VERSION=`cat VERSION`
40
41OSTYPE=`uname -s`
42case $OSTYPE in
43  SunOS                  ) OSTYPE=`uname -s`_`uname -r | awk -F. '{print $1}'`
44                           if [ $OSTYPE = SunOS_4 ]; then
45                                OSTYPE=SunOS
46                           elif [ $OSTYPE = SunOS_5 ]; then
47                                OSTYPE=Solaris
48                           fi
49                           ;;
50  HP-UX                  ) OSTYPE=HPUX
51                           ;;
52  Linux | IRIX | FreeBSD | NetBSD )
53                           ;;
54  *                      ) echo "$OSTYPE"
55                           echo "Not supported."
56                           exit
57                           ;;
58esac
59
60echo "Configuring RAT v$VERSION for $OSTYPE"
61
62GCCWFLAGS="-W -Wall -Wbad-function-cast -Wmissing-prototypes -Werror -Wno-implicit-int"
63TCL_LIBS="../tk-8.0/unix/libtk8.0.a ../tcl-8.0/unix/libtcl8.0.a"
64TCL_INCL="-I../tk-8.0/generic -I../tcl-8.0/generic"
65DEFS=""
66
67case $OSTYPE in
68  SunOS   ) CC="gcc"
69            WFLAGS=$GCCWFLAGS
70            INCLUDE="-I/usr/ucl/X11/include -I/usr/demo/SOUND"
71            LDLIBS="-lXext -lX11 -L/usr/demo/SOUND -laudio -lm"
72            AUDIO="auddev_sparc.o"
73            DEBUG="-g"
74            CHAR="-fsigned-char"
75            OPTIMIZE="-O4"
76            PROFILE="-pg"
77            ;;
78  Solaris ) CC="gcc -pipe"
79            WFLAGS=$GCCWFLAGS
80            INCLUDE="-I/usr/demo/SOUND/include -I/usr/openwin/include"
81            LDLIBS="-L/usr/openwin/lib -lXext -lX11 -L/usr/demo/SOUND/lib -laudio -lsocket -ldl -lnsl -lm"
82            AUDIO="auddev_sparc.o"
83            DEBUG="-g"
84            CHAR="-fsigned-char"
85            OPTIMIZE="-O4"
86            PROFILE="-pg"
87            ;;
88  IRIX    ) CC="cc"
89            WFLAGS="-fullwarn -w2"
90            INCLUDE="-I/usr/ucl/X11/include"
91            LDLIBS="-L/usr/lib/X11 -lX11 -laudio -lm"
92            AUDIO="auddev_sgi.o"
93            DEBUG="-g"
94            CHAR="-signed"
95            OPTIMIZE="-O2"
96            PROFILE=""
97            ;;
98  Linux   ) CC="gcc"
99            WFLAGS=$GCCWFLAGS
100            INCLUDE="-I/usr/X11R6/include"
101            LDLIBS="-L/usr/X11R6/lib -lX11 -lm -ldl"
102            AUDIO="auddev_oss.o"
103            DEBUG="-g"
104            CHAR="-fsigned-char"
105            OPTIMIZE="-O4"
106            PROFILE="-pg"
107            ;;
108  FreeBSD ) CC="gcc"
109            WFLAGS=$GCCWFLAGS
110            INCLUDE="-I/usr/X11R6/include -I/usr/local/include"
111            LDLIBS="-L/usr/X11R6/lib -lXext -lX11 -lm"
112            TCL_LIBS="../tk-8.0/unix/libtk80.a ../tcl-8.0/unix/libtcl80.a"
113            AUDIO="auddev_luigi.o"
114            DEBUG="-g"
115            CHAR="-fsigned-char"
116            OPTIMIZE="-O4"
117            PROFILE="-pg"
118            ;;
119  HPUX    ) CC="gcc"
120            WFLAGS=$GCCWFLAGS
121            INCLUDE="-I/usr/include/X11"
122            LDLIBS="-L/usr/lib/X11R5 -lXext -lX11 -lAlib -lm -ldld"
123            AUDIO="auddev_hpux_raw.o"
124            DEBUG="-g"
125            CHAR="-fsigned-char"
126            OPTIMIZE="-O4"
127            PROFILE="-pg"
128            ;;
129  NetBSD )  CC="gcc"
130            WFLAGS=$GCCWFLAGS
131            INCLUDE="-I/usr/X11R6/include -I/usr/local/include"
132            LDLIBS="-L/usr/X11R6/lib -lXext -lX11 -lm"
133            TCL_LIBS="../tk-8.0/unix/libtk80.a ../tcl-8.0/unix/libtcl80.a"
134            AUDIO="auddev_netbsd.o"
135            DEBUG="-g"
136            CHAR="-fsigned-char"
137            OPTIMIZE="-O4"
138            PROFILE="-pg"
139            ;;
140esac
141
142# Does linux have pca? FreeBSD does...
143if [ -r /usr/include/machine/pcaudioio.h ] ; then
144    DEFS="$DEFS -DHAVE_PCA"
145    AUDIO="$AUDIO auddev_pca.o"
146    INCLUDE="$INCLUDE -I/usr/include/machine"
147    echo "PCA Audio support found"
148fi
149
150# Do we have osprey audio device (AKA SunVideo Plus audio)
151O1KHOME=${O1KHOME:=/opt/SUNWo1kp}
152if [ -r $O1KHOME/include/oti_audio_device.h ] ; then
153    AUDIO="$AUDIO auddev_osprey.o"
154    INCLUDE="$INCLUDE -I${O1KHOME}/include"
155    DEFS="$DEFS -DHAVE_OSPREY"
156    echo "Osprey Audio support found"
157fi
158
159# Process options to the configure script...
160DEBUG2=""
161OPTIMIZE2=""
162PROFILE2=""
163CHECK_FLAG=""
164CHECK_LIB=""
165while test $# -gt 0
166do
167        if [ $1 = "-debug" ]; then
168                DEBUG2=$DEBUG
169                DEFS="$DEFS -DDEBUG"
170                echo "Enabled debug option"
171        elif [ $1 = "-optimize" ]; then
172                OPTIMIZE2=$OPTIMIZE
173                DEFS="-DNDEBUG"
174                echo "Enabled optimize option"
175        elif [ $1 = "-profile" ]; then
176                PROFILE2=$PROFILE
177                echo "Enabled profile option"
178        elif [ $1 = "-bounds" ]; then
179                CHECK_FLAG=-fbounds-checking
180                CHECK_LIB=-lcheck
181                echo "Enabled bounds checking option" 
182        else 
183                DEFS="$DEFS $1"
184                echo "Added $1 compile flag"
185        fi
186        shift
187done
188
189# Create Makefile
190echo "Generating Makefile"
191echo "# Generated automatically from Makefile.in" > Makefile
192echo "# DO NOT EDIT THIS FILE" >> Makefile
193
194cat > Makefile.sed <<EOF
195s@__OSTYPE__@$OSTYPE@
196s@__CC__@$CC@
197s@__WFLAGS__@$WFLAGS@
198s@__INCLUDE__@$TCL_INCL $INCLUDE -I../common@
199s@__LDLIBS__@$TCL_LIBS ../common/libcommon.a $LDLIBS@
200s@__AUDIO__@$AUDIO@
201s@__CHAR__@$CHAR@
202s@__DEBUG__@$DEBUG2@
203s@__OPTIMIZE__@$OPTIMIZE2@
204s@__PROFILE__@$PROFILE2@
205s@__DEFS__@$DEFS@
206s@__CHECK_FLAG__@$CHECK_FLAG@
207s@__CHECK_LIB__@$CHECK_LIB@
208EOF
209
210sed -f Makefile.sed Makefile.in >> Makefile
211rm  -f Makefile.sed
212
213# Create version.h
214echo "Generating version.h"
215echo \#define RAT_VERSION \"RAT v$VERSION $OSTYPE\" > version.h
Note: See TracBrowser for help on using the browser.