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

Last change on this file since 30863 was 30863, checked in by ak19, 8 years ago

Changes to get libiconv issues on MacOS El Capitan straightened out, since DYLD_LIBRARY_PATH gets wiped out on these newer Mac OS versions. The current solution is to use the system libiconv on MacOS machines that are already specific to Macs (and therefore compatible with Macs).

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