root/common/trunk/configure @ 47

Revision 47, 5.2 KB (checked in by ucacoxh, 15 years ago)

- Added a simple test for in_addr_t. Maybe too simple :-)

  • 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"
62
63case $OSTYPE in
64  SunOS   ) CC="gcc"
65            WFLAGS=$GCCWFLAGS
66            INCLUDE=""
67            LDLIBS="-laudio -lm"
68            DEBUG="-g"
69            CHAR="-fsigned-char"
70            OPTIMIZE="-O4"
71            PROFILE="-pg"
72            ;;
73  Solaris ) CC="gcc -pipe"
74            WFLAGS=$GCCWFLAGS
75            INCLUDE=""
76            LDLIBS="-lsocket -ldl -lnsl -lm"
77            DEBUG="-g"
78            CHAR="-fsigned-char"
79            OPTIMIZE="-O4"
80            PROFILE="-pg"
81            ;;
82  IRIX    ) CC="cc"
83            WFLAGS="-fullwarn -w2"
84            INCLUDE=""
85            LDLIBS="-lm"
86            DEBUG="-g"
87            CHAR="-signed"
88            OPTIMIZE="-O2"
89            PROFILE=""
90            ;;
91  Linux   ) CC="gcc"
92            WFLAGS=$GCCWFLAGS
93            INCLUDE=""
94            LDLIBS="-lm -ldl"
95            DEBUG="-g"
96            CHAR="-fsigned-char"
97            OPTIMIZE="-O4"
98            PROFILE="-pg"
99            ;;
100  FreeBSD ) CC="gcc"
101            WFLAGS=$GCCWFLAGS
102            INCLUDE="-I/usr/local/include"
103            LDLIBS="-lm"
104            DEBUG="-g"
105            CHAR="-fsigned-char"
106            OPTIMIZE="-O4"
107            PROFILE="-pg"
108            ;;
109  HPUX    ) CC="gcc"
110            WFLAGS=$GCCWFLAGS
111            INCLUDE=""
112            LDLIBS="-lm -ldld"
113            DEBUG="-g"
114            CHAR="-fsigned-char"
115            OPTIMIZE="-O4"
116            PROFILE="-pg"
117            ;;
118  NetBSD )  CC="gcc"
119            WFLAGS=$GCCWFLAGS
120            INCLUDE="-I/usr/local/include"
121            LDLIBS="-lm"
122            DEBUG="-g"
123            CHAR="-fsigned-char"
124            OPTIMIZE="-O4"
125            PROFILE="-pg"
126            ;;
127esac
128
129# Tests...NEED_INADDR_T
130T1=`grep -c in_addr_t /usr/include/netinet/in.h`
131if [ $T1 = 0 ]; then
132    DEFS="$DEFS -DNEED_IN_ADDR_T"
133    echo "Need in_addr_t."
134fi
135
136# Process options to the configure script...
137DEBUG2=""
138OPTIMIZE2=""
139PROFILE2=""
140CHECK_FLAG=""
141CHECK_LIB=""
142while test $# -gt 0
143do
144        if [ $1 = "-debug" ]; then
145                DEBUG2=$DEBUG
146                DEFS="$DEFS -DDEBUG"
147                echo "Enabled debug option"
148        elif [ $1 = "-optimize" ]; then
149                OPTIMIZE2=$OPTIMIZE
150                DEFS="-DNDEBUG"
151                echo "Enabled optimize option"
152        elif [ $1 = "-profile" ]; then
153                PROFILE2=$PROFILE
154                echo "Enabled profile option"
155        elif [ $1 = "-bounds" ]; then
156                CHECK_FLAG=-fbounds-checking
157                CHECK_LIB=-lcheck
158                echo "Enabled bounds checking option" 
159        else 
160                DEFS="$DEFS $1"
161                echo "Added $1 compile flag"
162        fi
163        shift
164done
165
166# Create Makefile
167echo "Generating Makefile"
168echo "# Generated automatically from Makefile.in" > Makefile
169echo "# DO NOT EDIT THIS FILE" >> Makefile
170
171cat > Makefile.sed <<EOF
172s@__OSTYPE__@$OSTYPE@
173s@__CC__@$CC@
174s@__AR__@$AR@
175s@__RANLIB__@$RANLIB@
176s@__WFLAGS__@$WFLAGS@
177s@__INCLUDE__@$INCLUDE@
178s@__LDLIBS__@$LDLIBS@
179s@__CHAR__@$CHAR@
180s@__DEBUG__@$DEBUG2@
181s@__OPTIMIZE__@$OPTIMIZE2@
182s@__PROFILE__@$PROFILE2@
183s@__DEFS__@$DEFS@
184s@__CHECK_FLAG__@$CHECK_FLAG@
185s@__CHECK_LIB__@$CHECK_LIB@
186EOF
187
188sed -f Makefile.sed Makefile.in >> Makefile
189
190# Create version.h
191echo "Generating version.h"
192echo \#define CCL_VERSION \"CCL v$VERSION $OSTYPE\" > version.h
Note: See TracBrowser for help on using the browser.