root/common/trunk/configure @ 72

Revision 72, 6.0 KB (checked in by ucaccsp, 15 years ago)

Fixes for compilation on Solaris7

  • 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# Copyright (c) 1998 University College London
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14# 3. All advertising materials mentioning features or use of this software
15#    must display the following acknowledgement:
16#      This product includes software developed by the Computer Science
17#      Department at University College London
18# 4. Neither the name of the University nor of the Department may be used
19#    to endorse or promote products derived from this software without
20#    specific prior written permission.
21# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
22# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
25# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31# SUCH DAMAGE.
32#
33
34VERSION=`cat VERSION`
35
36OSTYPE=`uname -s`
37case $OSTYPE in
38  SunOS                  ) OSTYPE=`uname -s`_`uname -r | awk -F. '{print $1}'`
39                           if [ $OSTYPE = SunOS_4 ]; then
40                                OSTYPE=SunOS
41                           elif [ $OSTYPE = SunOS_5 ]; then
42                                OSTYPE=Solaris
43                           fi
44                           ;;
45  HP-UX                  ) OSTYPE=HPUX
46                           ;;
47  Linux | IRIX | FreeBSD | NetBSD )
48                           ;;
49  *                      ) echo "$OSTYPE"
50                           echo "Not supported."
51                           exit
52                           ;;
53esac
54
55echo "Configuring common code library v$VERSION for $OSTYPE"
56
57GCCWFLAGS="-W -Wall -Wbad-function-cast -Wmissing-prototypes -Werror"
58DEFS=""
59
60AR="ar"
61RANLIB="ranlib"
62ECHO="echo"
63
64case $OSTYPE in
65  SunOS   ) CC="gcc"
66            WFLAGS=$GCCWFLAGS
67            INCLUDE=""
68            LDLIBS="-laudio -lm"
69            DEBUG="-g"
70            CHAR="-fsigned-char"
71            OPTIMIZE="-O4"
72            PROFILE="-pg"
73            ;;
74  Solaris ) CC="gcc -pipe"
75            WFLAGS=$GCCWFLAGS
76            INCLUDE=""
77            LDLIBS="-lsocket -ldl -lnsl -lm"
78            DEBUG="-g"
79            CHAR="-fsigned-char"
80            OPTIMIZE="-O4"
81            PROFILE="-pg"
82            ECHO=/usr/bin/echo
83            ;;
84  IRIX    ) CC="cc"
85            WFLAGS="-fullwarn -w2"
86            INCLUDE=""
87            LDLIBS="-lm"
88            DEBUG="-g"
89            CHAR="-signed"
90            OPTIMIZE="-O2"
91            PROFILE=""
92            ;;
93  Linux   ) CC="gcc"
94            WFLAGS=$GCCWFLAGS
95            INCLUDE=""
96            LDLIBS="-lm -ldl"
97            DEBUG="-g"
98            CHAR="-fsigned-char"
99            OPTIMIZE="-O4"
100            PROFILE="-pg"
101            ECHO="echo -e"
102            ;;
103  FreeBSD ) CC="gcc"
104            WFLAGS=$GCCWFLAGS
105            INCLUDE="-I/usr/local/include"
106            LDLIBS="-lm"
107            DEBUG="-g"
108            CHAR="-fsigned-char"
109            OPTIMIZE="-O4"
110            PROFILE="-pg"
111            ECHO=/bin/echo
112            ;;
113  HPUX    ) CC="gcc"
114            WFLAGS=$GCCWFLAGS
115            INCLUDE=""
116            LDLIBS="-lm -ldld"
117            DEBUG="-g"
118            CHAR="-fsigned-char"
119            OPTIMIZE="-O4"
120            PROFILE="-pg"
121            ;;
122  NetBSD )  CC="gcc"
123            WFLAGS=$GCCWFLAGS
124            INCLUDE="-I/usr/local/include"
125            LDLIBS="-lm"
126            DEBUG="-g"
127            CHAR="-fsigned-char"
128            OPTIMIZE="-O4"
129            PROFILE="-pg"
130            ;;
131esac
132
133${ECHO} "Searching for in_addr_t in <netinet/in.h>... \c"
134T1=`grep -c in_addr_t /usr/include/netinet/in.h`
135if [ $T1 = 0 ]; then
136        DEFS="$DEFS -DNEED_IN_ADDR_T"
137        ${ECHO} "no"
138else 
139        ${ECHO} "yes"
140fi
141
142# This is the usual place for inet_pton()...
143${ECHO} "Searching for inet_pton in <arpa/inet.h>... \c"
144T2=`grep -c inet_pton /usr/include/arpa/inet.h`
145if [ $T2 = 0 ]; then
146        ${ECHO} "no"
147        DEFS="$DEFS -DNEED_INET_PTON"
148else 
149        ${ECHO} "yes"
150fi
151
152# This is the usual place for inet_aton()...
153${ECHO} "Searching for inet_aton in <arpa/inet.h>... \c"
154T2=`grep -c inet_aton /usr/include/arpa/inet.h`
155if [ $T2 = 0 ]; then
156        ${ECHO} "no"
157        DEFS="$DEFS -DNEED_INET_ATON"
158else 
159        ${ECHO} "yes"
160fi
161
162${ECHO} "Searching for getipnodebyname in <netdb.h>... \c"
163T1=`grep -c getipnodebyname /usr/include/netdb.h`
164if [ $T1 = 0 ]; then
165        ${ECHO} "no"
166else 
167        DEFS="$DEFS -DHAVE_IPv6"
168        ${ECHO} "yes"
169fi
170
171
172# Process options to the configure script...
173DEBUG2=""
174OPTIMIZE2=""
175PROFILE2=""
176CHECK_FLAG=""
177CHECK_LIB=""
178while test $# -gt 0
179do
180        if [ $1 = "-debug" ]; then
181                DEBUG2=$DEBUG
182                DEFS="$DEFS -DDEBUG"
183                echo "Enabled debug option"
184        elif [ $1 = "-optimize" ]; then
185                OPTIMIZE2=$OPTIMIZE
186                DEFS="$DEFS -DNDEBUG"
187                echo "Enabled optimize option"
188        elif [ $1 = "-profile" ]; then
189                PROFILE2=$PROFILE
190                echo "Enabled profile option"
191        elif [ $1 = "-bounds" ]; then
192                CHECK_FLAG=-fbounds-checking
193                CHECK_LIB=-lcheck
194                echo "Enabled bounds checking option" 
195        else 
196                DEFS="$DEFS $1"
197                echo "Added $1 compile flag"
198        fi
199        shift
200done
201
202# Create Makefile
203echo "Generating Makefile"
204echo "# Generated automatically from Makefile.in" > Makefile
205echo "# DO NOT EDIT THIS FILE" >> Makefile
206
207cat > Makefile.sed <<EOF
208s@__OSTYPE__@$OSTYPE@
209s@__CC__@$CC@
210s@__AR__@$AR@
211s@__RANLIB__@$RANLIB@
212s@__WFLAGS__@$WFLAGS@
213s@__INCLUDE__@$INCLUDE@
214s@__LDLIBS__@$LDLIBS@
215s@__CHAR__@$CHAR@
216s@__DEBUG__@$DEBUG2@
217s@__OPTIMIZE__@$OPTIMIZE2@
218s@__PROFILE__@$PROFILE2@
219s@__DEFS__@$DEFS@
220s@__CHECK_FLAG__@$CHECK_FLAG@
221s@__CHECK_LIB__@$CHECK_LIB@
222EOF
223
224sed -f Makefile.sed Makefile.in >> Makefile
225rm -f Makefile.sed
226
227# Create version.h
228echo "Generating version.h"
229echo \#define CCL_VERSION \"CCL v$VERSION $OSTYPE\" > version.h
Note: See TracBrowser for help on using the browser.