5 # $Date: 2010/04/14 08:58:43 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
18 VAR_DIR="./inst/var/stargazer"
21 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -I/usr/local/include"
22 LDFLAGS="$LDFLAGS -L/usr/local/lib"
24 if [ "$sys" = "Linux" ]
31 if [ "$sys" = "FreeBSD" ]
44 if [ "$OS" = "unknown" ]
46 echo "#############################################################################"
47 echo "# Sorry, but convertor currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
48 echo "#############################################################################"
52 echo "#############################################################################"
53 echo " Building convertor for $sys $release"
54 echo "#############################################################################"
65 if [ "$OS" = "linux" ]
73 DEFS="$DEFS -DFREE_BSD"
76 DEFS="$DEFS -DFREE_BSD5"
84 SHELL="/usr/local/bin/bash"
97 echo -n "Checking CC... "
98 $CC --version > /dev/null 2> /dev/null
106 echo -n "Checking CXX... "
107 $CXX --version > /dev/null 2> /dev/null
111 echo "$CXX not found"
116 echo -n "Checking endianess... "
117 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
118 $CC $CFLAGS $LDFLAGS -L/usr/lib/mysql -L/usr/local/lib/mysql build_check.c -o fake > /dev/null 2> /dev/null
122 echo "Endianess checking failed"
129 CXXFLAGS="$CXXFLAGS -DARCH_LE"
130 CFLAGS="$CFLAGS -DARCH_LE"
134 CXXFLAGS="$CXXFLAGS -DARCH_BE"
135 CFLAGS="$CFLAGS -DARCH_BE"
141 echo -n "Checking for -lfbclient... "
142 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
153 echo -n "Checking for mysql_config... "
154 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
158 echo -n "Checking for -lmysqlclient... "
159 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
165 CHECK_MYSQLCLIENT=yes
171 echo -n "Checking for mysql_config --cflags... "
172 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
178 echo "[$MYSQL_CFLAGS]"
179 echo -n "Checking for mysql_config --libs_r... "
180 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
186 CHECK_MYSQLCLIENT=yes
187 echo "[$MYSQL_LDFLAGS]"
192 echo -n "Checking for pg_config... "
193 PG_VERSION=`pg_config --version 2> /dev/null`
197 echo -n "Checking for -lpq... "
198 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
210 echo -n "Checking for pg_config --includedir... "
211 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
218 echo -n "Checking for pg_config --libdir... "
219 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
233 if [ "$CHECK_FBCLIENT" = "yes" ]
241 if [ "$CHECK_PQ" = "yes" ]
247 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
253 echo "OS=$OS" > $CONFFILE
254 echo "STG_TIME=yes" >> $CONFFILE
255 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
256 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
257 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
258 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
259 echo "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules" >> $CONFFILE
260 echo "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins" >> $CONFFILE
261 echo "ARCH=$ARCH" >> $CONFFILE
262 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
263 echo "DEFS=$DEFS" >> $CONFFILE
264 echo -n "STG_LIBS=" >> $CONFFILE
267 echo -n "$lib " >> $CONFFILE
270 echo -n "PLUGINS=" >> $CONFFILE
271 for plugin in $PLUGINS
273 echo -n "$plugin " >> $CONFFILE
276 echo "SHELL=$SHELL" >> $CONFFILE
277 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
278 echo "CFLAGS=$CFLAGS" >> $CONFFILE
279 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
280 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
281 echo "PREFIX=$PREFIX" >> $CONFFILE
282 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
283 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
284 echo "DIR_MODE=$DIR_MODE" >> $CONFFILE
285 echo "OWNER=$OWNER" >> $CONFFILE
286 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
288 mkdir -p ../stargazer/modules