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

Last change on this file since 22378 was 22378, checked in by sjm84, 14 years ago

Greenstone 2 now compiles and installs on 64-bit linux machines

  • Property svn:executable set to *
File size: 9.6 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
142#Configure and compile 32-bit expat
143if test -e Makefile ; then
144 echo make distclean && \
145 make distclean
146fi
147
148echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
149
150cd "$PACKAGES/expat/expat-1.95.8" && \
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#Configure and compile 64-bit expat
164 echo ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" --libdir="$PACKAGES/expat/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
165
166 cd "$PACKAGES/expat/expat-1.95.8" && \
167 ./configure $CACHE_FILE --disable-shared --with-pic --prefix=$PACKAGES/expat --bindir="$bindir" --libdir="$PACKAGES/expat/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
168
169 echo make $ENVIRONMENT
170 make $ENVIRONMENT
171
172 echo make install $ENVIRONMENT
173 make install $ENVIRONMENT
174fi
175
176echo make distclean && \
177make distclean
178
179# configure and compile libiconv during configuration stage
180echo ""
181echo "Configuring iconv"
182echo ""
183cd "$PACKAGES/iconv"
184if test ! -d libiconv-1.13.1 ;
185then
186 gzip -dc libiconv-1.13.1.tar.gz | tar -xf -
187fi
188
189# configure
190cd "$PACKAGES/iconv/libiconv-1.13.1"
191
192if test -e Makefile ; then
193 echo make distclean && \
194 make distclean
195fi
196
197echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
198
199CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
200
201# make
202echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
203CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make $ENVIRONMENT
204
205# make install
206echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
207CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" make install $ENVIRONMENT
208
209if test ! -z "$COMPAT32BITFLAGS" ; then
210 echo "Generating native 64-bit version of iconv"
211 # used in apache web server, for example
212
213 # distclean
214 echo make distclean && \
215 make distclean
216
217 # configure
218 echo ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" $HOSTTARGETFLAGS $ENVIRONMENT
219 ./configure $CACHE_FILE --enable-shared --enable-static --prefix="$PACKAGES/iconv" --libdir="$PACKAGES/iconv/lib64" $HOSTTARGETFLAGS $ENVIRONMENT
220
221 # make
222 echo make $ENVIRONMENT
223 make $ENVIRONMENT
224
225 # make install
226 echo make install $ENVIRONMENT
227 make install $ENVIRONMENT
228fi
229
230echo make distclean && \
231make distclean
232
233#./configure $CACHE_FILE --prefix="$PACKAGES/iconv" --disable-shared $HOSTTARGETFLAGS&&
234#make && make install
235
236
237# configure GDBM
238echo ""
239echo "Configuring GDBM"
240if test $USE_GDBM ;
241then
242 echo ""
243 cd "$PACKAGES/gdbm"
244
245 echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
246
247 cd "$PACKAGES/gdbm/gdbm-1.8.3" && \
248 CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --disable-shared --prefix=$PACKAGES/gdbm $HOSTTARGETFLAGS $ENVIRONMENT
249else
250 echo " GDBM support disabled."
251 echo " add '--enable-gdbm' to the configure command to include GDBM support."
252 echo ""
253fi
254
255# configure JDBM
256echo ""
257echo "Configuring JDBM"
258if test $USE_JDBM ;
259then
260 echo ""
261 cd "$PACKAGES/jdbm"
262 if test ! -d jdbm-1.0 ;
263 then
264 gzip -dc gs-jdbm-1.0.tar.gz | tar -xf -
265 fi
266else
267 echo "JDBM support disabled."
268 echo " add '--enable-jdbm' to the configure command to include JDBM support."
269 echo ""
270fi
271
272# configure SQLite
273echo ""
274echo "Configuring SQLite"
275if test x$USE_SQLITE = xtrue ;
276then
277 echo ""
278 cd "$PACKAGES/sqlite"
279 if test ! -d sqlite-amalgamation-3.6.23.1 ;
280 then
281 gzip -dc sqlite-amalgamation-3.6.23.1.tar.gz | tar -xf -
282 fi
283
284 echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
285
286 cd "$PACKAGES/sqlite/sqlite-amalgamation-3.6.23.1" && \
287 CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure $CACHE_FILE --prefix="$PACKAGES/sqlite" --bindir="$bindir" $HOSTTARGETFLAGS $ENVIRONMENT
288else
289 echo "SQLite support disabled."
290 echo " add '--enable-sqlite' to the configure command to include SQLite support."
291 echo ""
292fi
293
294# configure search4j
295echo ""
296echo "Configuring search4j"
297echo ""
298cd "$PACKAGES/search4j"
299
300echo CFLAGS="$CFLAGS $COMPAT32BITFLAGS" CXXFLAGS="$CXXFLAGS $COMPAT32BITFLAGS" LDFLAGS="$LDFLAGS $COMPAT32BITFLAGS" ./configure --bindir="$GSDLHOME/bin/$GSDLOS" $CACHE_FILE $HOSTTARGETFLAGS $ENVIRONMENT
301
302cd "$PACKAGES/search4j" && \
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.