source: main/trunk/greenstone2/common-src/packages/configure@ 23308

Last change on this file since 23308 was 23308, checked in by sjm84, 13 years ago

search4j does not need to be 32 bit on 64 bit machines

  • Property svn:executable set to *
File size: 9.8 KB
Line 
1#! /bin/sh
2
3PACKAGES=`pwd`
4cd ../..
5GSDLHOME=`pwd`
6cd $PACKAGES
7
8GSDLOS=`uname -s |tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
9# check for running bash under cygwin
10if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
11then
12 GSDLOS=windows
13fi
14
15prefix=""
16bindir=""
17HOSTTARGETFLAGS=""
18
19# only some of the packages can take environment variables as options to
20# configure
21# format is VAR=value, e.g "LDFLAGS=-static"
22ENVIRONMENT=""
23
24# GDBM support enabled by default, can switch it off with --disable-jdbm
25USE_GDBM=1
26# JDBM support enabled by default, can switch it off with --disable-jdbm
27USE_JDBM=1
28# SQLite support enabled by default, can switch it off with --disable-sqlite
29USE_SQLITE=true
30# yaz compilation enabled by default, can switch it off with --disable-yaz
31USE_YAZ=true
32# z3950 server disabled by default, switch it on with --enable-z3950
33USE_Z3950=false
34# CORBA support disabled by default, switch it on with --enable-corba
35USE_CORBA=false
36MICO_DIR=default
37
38# parse any arguments given from toplevel configure
39while test $# -ne 0; do
40 case "$1" in
41 --cache-file=*)
42 cache_filename=`echo $1 | sed s/--cache-file=//`
43 # turn relative path into an absolute path
44 cache_dir=`echo $cache_filename | sed 's@/[^/]*$@@'`
45 cache_dir=`cd $cache_dir 2>/dev/null && pwd`
46
47 cache_basefile=`echo $cache_filename | sed 's@.*/@@'`
48 cache_file="$cache_dir/$cache_basefile"
49 if test ! -f "$cache_file"; then
50 CACHE_FILE=""
51 else
52 CACHE_FILE="--cache-file=$cache_file"
53 fi
54 ;;
55 --disable-gdbm)
56 USE_GDBM=0
57 ;;
58 --disable-jdbm)
59 USE_JDBM=0
60 ;;
61 --disable-sqlite)
62 USE_SQLITE=false
63 ;;
64 --disable-yaz)
65 USE_YAZ=false
66 ;;
67 --enable-z3950)
68 USE_Z3950=true
69 ;;
70 --enable-corba)
71 USE_CORBA=true
72 ;;
73 --with-micodir=*)
74 if test $1 = ""; then
75 $1 = "default"
76 fi
77 MICO_DIR=$1
78 ;;
79 --prefix=*)
80 prefix=`echo $1 | sed s/--prefix=//`
81 ;;
82 --bindir=*)
83 # where to install binaries to
84 bindir=`echo $1 | sed s/--bindir=//`
85 # turn relative path into an absolute path
86 if test -d "$bindir" ; then
87 bindir=`cd "$bindir" ; pwd `
88 cd "$PACKAGES"
89 elif test -z `echo $bindir | sed '/^\// p;D'` ; then
90 rel_bindir="`echo $bindir | sed s@/.*@@`"
91 cd "$rel_bindir"
92 bindir="`pwd`/`echo $bindir | sed s@^[^/]*/@@`"
93 cd "$PACKAGES"
94 else
95 # bindir doesn't exist, and isn't relative
96 true
97 fi
98 ;;
99 --host=* | --target=*)
100 HOSTTARGETFLAGS="$HOSTTARGETFLAGS $1"
101 ;;
102 *)
103 # ignore all other options for now
104 ;;
105 esac
106 shift
107done
108
109# note! Our GSDL package currently always installs into it's source
110# directory, ignoring any --prefix given to configure.
111# When this is fixed, uncomment the relevant lines below...
112
113##if test -z "$prefix" ; then
114prefix="${GSDLHOME}"
115##fi
116
117##if test -z "$bindir" ; then
118bindir="${prefix}/bin/$GSDLOS"
119##fi
120
121# This loads the top configure's cache file, with variables already set.
122if test -f "$cache_file" ; then
123 . $cache_file
124fi
125
126# we assume that gzip and tar are on the search path.
127# non-GNU versions of tar don't take the -z option.
128
129
130
131# configure expat (needs to be done before XML::Parser)
132# now compile expat during the configure stage itself
133echo ""
134echo "Configuring expat"
135echo ""
136cd "$PACKAGES/expat"
137if test ! -d expat-1.95.8 ;
138then
139 gzip -dc expat-1.95.8.tar.gz | tar -xf -
140fi
141
142cd "$PACKAGES/expat/expat-1.95.8"
143
144if test -e Makefile ; then
145 echo make distclean && \
146 make distclean
147fi
148
149#Configure and compile 32-bit expat
150echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
151CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
152
153echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
154CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
155
156echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
157CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
158
159echo make distclean && \
160make distclean
161
162if test ! -z "$COMPAT32BITFLAGS" ; then
163 echo "Generating native 64-bit version of expat"
164 #Configure and compile 64-bit expat
165 echo ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" --libdir="$PACKAGES/expat/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
166 ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" --libdir="$PACKAGES/expat/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
167
168 echo make $ENVIRONMENT
169 make $ENVIRONMENT
170
171 echo make install $ENVIRONMENT
172 make install $ENVIRONMENT
173
174 echo make distclean && \
175 make distclean
176fi
177
178# configure and compile libiconv during configuration stage
179echo ""
180echo "Configuring iconv"
181echo ""
182cd "$PACKAGES/iconv"
183if test ! -d libiconv-1.13.1 ;
184then
185 gzip -dc libiconv-1.13.1.tar.gz | tar -xf -
186fi
187
188cd "$PACKAGES/iconv/libiconv-1.13.1"
189
190if test -e Makefile ; then
191 echo make distclean && \
192 make distclean
193fi
194
195# configure
196echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
197CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
198
199# make
200echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
201CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
202
203# make install
204echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
205CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
206
207if test ! -z "$COMPAT32BITFLAGS" ; then
208 echo "Generating native 64-bit version of iconv"
209 # used in apache web server, for example
210
211 # distclean
212 echo make distclean && \
213 make distclean
214
215 # configure
216 echo ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
217 ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" --libdir="$PACKAGES/iconv/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
218
219 # make
220 echo make $ENVIRONMENT
221 make $ENVIRONMENT
222
223 # make install
224 echo make install $ENVIRONMENT
225 make install $ENVIRONMENT
226fi
227
228echo make distclean && \
229make distclean
230
231#./configure $CACHE_FILE --prefix="$PACKAGES/iconv" --disable-shared $HOSTTARGETFLAGS&&
232#make && make install
233
234
235# configure GDBM
236echo ""
237echo "Configuring GDBM"
238if test $USE_GDBM ;
239then
240 echo ""
241 cd "$PACKAGES/gdbm"
242
243 echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
244
245 cd "$PACKAGES/gdbm/gdbm-1.8.3" && \
246 CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
247else
248 echo " GDBM support disabled."
249 echo " add '--enable-gdbm' to the configure command to include GDBM support."
250 echo ""
251fi
252
253# configure JDBM
254echo ""
255echo "Configuring JDBM"
256if test $USE_JDBM ;
257then
258 echo ""
259 cd "$PACKAGES/jdbm"
260 if test ! -d jdbm-1.0 ;
261 then
262 gzip -dc gs-jdbm-1.0.tar.gz | tar -xf -
263 fi
264else
265 echo "JDBM support disabled."
266 echo " add '--enable-jdbm' to the configure command to include JDBM support."
267 echo ""
268fi
269
270# configure SQLite
271echo ""
272echo "Configuring SQLite"
273if test x$USE_SQLITE = xtrue ;
274then
275 echo ""
276 cd "$PACKAGES/sqlite"
277 if test ! -d sqlite-amalgamation-3.6.23.1 ;
278 then
279 gzip -dc sqlite-amalgamation-3.6.23.1.tar.gz | tar -xf -
280 fi
281
282 echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
283
284 cd "$PACKAGES/sqlite/sqlite-amalgamation-3.6.23.1" && \
285 CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
286else
287 echo "SQLite support disabled."
288 echo " add '--enable-sqlite' to the configure command to include SQLite support."
289 echo ""
290fi
291
292# configure search4j
293echo ""
294echo "Configuring search4j"
295echo ""
296cd "$PACKAGES/search4j"
297
298#echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
299echo ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
300
301cd "$PACKAGES/search4j" && \
302 ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
303# CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
Note: See TracBrowser for help on using the repository browser.