OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [services/] [compress/] [zlib/] [v2_0/] [src/] [configure] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
#!/bin/sh
2
# configure script for zlib. This script is needed only if
3
# you wish to build a shared library and your system supports them,
4
# of if you need special compiler, flags or install directory.
5
# Otherwise, you can just use directly "make test; make install"
6
#
7
# To create a shared library, use "configure --shared"; by default a static
8
# library is created. If the primitive shared library support provided here
9
# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
10
#
11
# To impose specific compiler or flags or install directory, use for example:
12
#    prefix=$HOME CC=cc CFLAGS="-O4" ./configure
13
# or for csh/tcsh users:
14
#    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
15
# LDSHARED is the command to be used to create a shared library
16
 
17
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
18
# If you have problems, try without defining CC and CFLAGS before reporting
19
# an error.
20
 
21
LIBS=libz.a
22
SHAREDLIB=libz.so
23
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
24
AR=${AR-"ar rc"}
25
RANLIB=${RANLIB-"ranlib"}
26
prefix=${prefix-/usr/local}
27
exec_prefix=${exec_prefix-'${prefix}'}
28
libdir=${libdir-'${exec_prefix}/lib'}
29
includedir=${includedir-'${prefix}/include'}
30
shared_ext='.so'
31
shared=0
32
gcc=0
33
old_cc="$CC"
34
old_cflags="$CFLAGS"
35
 
36
while test $# -ge 1
37
do
38
case "$1" in
39
    -h* | --h*)
40
      echo 'usage:'
41
      echo '  configure [--shared] [--prefix=PREFIX]  [--exec_prefix=EXPREFIX]'
42
      echo '     [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
43
        exit 0;;
44
    -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
45
    -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
46
    -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
47
    -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
48
    -p* | --p*) prefix="$2"; shift; shift;;
49
    -e* | --e*) exec_prefix="$2"; shift; shift;;
50
    -l* | --l*) libdir="$2"; shift; shift;;
51
    -i* | --i*) includedir="$2"; shift; shift;;
52
    -s* | --s*) shared=1; shift;;
53
    esac
54
done
55
 
56
test=ztest$$
57
cat > $test.c <
58
extern int getchar();
59
int hello() {return getchar();}
60
EOF
61
 
62
test -z "$CC" && echo Checking for gcc...
63
cc=${CC-gcc}
64
cflags=${CFLAGS-"-O3"}
65
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
66
case "$cc" in
67
  *gcc*) gcc=1;;
68
esac
69
 
70
if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
71
  CC="$cc"
72
  SFLAGS=${CFLAGS-"-fPIC -O3"}
73
  CFLAGS="$cflags"
74
  case `(uname -s || echo unknown) 2>/dev/null` in
75
  Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
76
  *)             LDSHARED=${LDSHARED-"gcc -shared"};;
77
  esac
78
else
79
  # find system name and corresponding cc options
80
  CC=${CC-cc}
81
  case `(uname -sr || echo unknown) 2>/dev/null` in
82
  HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
83
             CFLAGS=${CFLAGS-"-O"}
84
#            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
85
             LDSHARED=${LDSHARED-"ld -b"}
86
             shared_ext='.sl'
87
             SHAREDLIB='libz.sl';;
88
  IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
89
             CFLAGS=${CFLAGS-"-ansi -O2"}
90
             LDSHARED=${LDSHARED-"cc -shared"};;
91
  OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
92
             CFLAGS=${CFLAGS-"-O -std1"}
93
             LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
94
  OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
95
             CFLAGS=${CFLAGS-"-O -std1"}
96
             LDSHARED=${LDSHARED-"cc -shared"};;
97
  QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
98
             CFLAGS=${CFLAGS-"-4 -O"}
99
             LDSHARED=${LDSHARED-"cc"}
100
             RANLIB=${RANLIB-"true"}
101
             AR="cc -A";;
102
  SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
103
             CFLAGS=${CFLAGS-"-O3"}
104
             LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
105
  SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
106
             CFLAGS=${CFLAGS-"-fast -xcg89"}
107
             LDSHARED=${LDSHARED-"cc -G"};;
108
  SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
109
             CFLAGS=${CFLAGS-"-O2"}
110
             LDSHARED=${LDSHARED-"ld"};;
111
  UNIX_System_V\ 4.2.0)
112
             SFLAGS=${CFLAGS-"-KPIC -O"}
113
             CFLAGS=${CFLAGS-"-O"}
114
             LDSHARED=${LDSHARED-"cc -G"};;
115
  UNIX_SV\ 4.2MP)
116
             SFLAGS=${CFLAGS-"-Kconform_pic -O"}
117
             CFLAGS=${CFLAGS-"-O"}
118
             LDSHARED=${LDSHARED-"cc -G"};;
119
  # send working options for other systems to support@gzip.org
120
  *)         SFLAGS=${CFLAGS-"-O"}
121
             CFLAGS=${CFLAGS-"-O"}
122
             LDSHARED=${LDSHARED-"cc -shared"};;
123
  esac
124
fi
125
 
126
if test $shared -eq 1; then
127
  echo Checking for shared library support...
128
  # we must test in two steps (cc then ld), required at least on SunOS 4.x
129
  if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
130
     test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
131
    CFLAGS="$SFLAGS"
132
    LIBS="$SHAREDLIB.$VER"
133
    echo Building shared library $SHAREDLIB.$VER with $CC.
134
  elif test -z "$old_cc" -a -z "$old_cflags"; then
135
    echo No shared library suppport.
136
    shared=0;
137
  else
138
    echo 'No shared library suppport; try without defining CC and CFLAGS'
139
    shared=0;
140
  fi
141
fi
142
if test $shared -eq 0; then
143
  LDSHARED="$CC"
144
  echo Building static library $LIBS version $VER with $CC.
145
fi
146
 
147
cat > $test.c <
148
#include 
149
int main() { return 0; }
150
EOF
151
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
152
  CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
153
  echo "Checking for unistd.h... Yes."
154
else
155
  echo "Checking for unistd.h... No."
156
fi
157
 
158
cat > $test.c <
159
#include 
160
int main() { return 0; }
161
EOF
162
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
163
  echo "Checking for errno.h...  Yes."
164
else
165
  echo "Checking for errno.h...  No."
166
  CFLAGS="$CFLAGS -DNO_ERRNO_H"
167
fi
168
 
169
cat > $test.c <
170
#include 
171
#include 
172
#include 
173
caddr_t hello() {
174
  return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
175
}
176
EOF
177
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
178
  CFLAGS="$CFLAGS -DUSE_MMAP"
179
  echo Checking for mmap support... Yes.
180
else
181
  echo Checking for mmap support... No.
182
fi
183
 
184
CPP=${CPP-"$CC -E"}
185
case $CFLAGS in
186
  *ASMV*)
187
    if test "`nm $test.o | grep _hello`" = ""; then
188
      CPP="$CPP -DNO_UNDERLINE"
189
      echo Checking for underline in external names... No.
190
    else
191
      echo Checking for underline in external names... Yes.
192
    fi;;
193
esac
194
 
195
rm -f $test.[co] $test$shared_ext
196
 
197
# udpate Makefile
198
sed < Makefile.in "
199
/^CC *=/s%=.*%=$CC%
200
/^CFLAGS *=/s%=.*%=$CFLAGS%
201
/^CPP *=/s%=.*%=$CPP%
202
/^LDSHARED *=/s%=.*%=$LDSHARED%
203
/^LIBS *=/s%=.*%=$LIBS%
204
/^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
205
/^AR *=/s%=.*%=$AR%
206
/^RANLIB *=/s%=.*%=$RANLIB%
207
/^VER *=/s%=.*%=$VER%
208
/^prefix *=/s%=.*%=$prefix%
209
/^exec_prefix *=/s%=.*%=$exec_prefix%
210
/^libdir *=/s%=.*%=$libdir%
211
/^includedir *=/s%=.*%=$includedir%
212
" > Makefile

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.