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

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

Added a mac-specific version of libiconv to fix issues with the 1.13.1 version conflicting with the system version. This mac-specific 1.11 version is the same as the system version but it needed to be included because the system does not contain a static version of the library and we need a static version for mgpp and library.cgi

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