5 # $Date: 2010/04/14 08:58:43 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
17 VAR_DIR="./inst/var/stargazer"
20 CXXFLAGS="$CXXFLAGS -g3 -W -Wall -I/usr/local/include"
21 LDFLAGS="$LDFLAGS -L/usr/local/lib"
23 if [ "$sys" = "Linux" ]
30 if [ "$sys" = "FreeBSD" ]
43 if [ "$OS" = "unknown" ]
45 echo "#############################################################################"
46 echo "# Sorry, but convertor currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #"
47 echo "#############################################################################"
51 echo "#############################################################################"
52 echo " Building convertor for $sys $release"
53 echo "#############################################################################"
64 if [ "$OS" = "linux" ]
72 DEFS="$DEFS -DFREE_BSD"
75 DEFS="$DEFS -DFREE_BSD5"
83 SHELL="/usr/local/bin/bash"
86 echo -n "Checking gcc... "
87 gcc --version > /dev/null 2> /dev/null
95 echo -n "Checking g++... "
96 g++ --version > /dev/null 2> /dev/null
105 echo -n "Checking endianess... "
106 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
107 gcc $CXXFLAGS $LDFLAGS -L/usr/lib/mysql -L/usr/local/lib/mysql build_check.c -o fake > /dev/null 2> /dev/null
111 echo "Endianess checking failed"
118 CXXFLAGS="$CXXFLAGS -DARCH_LE"
122 CXXFLAGS="$CXXFLAGS -DARCH_BE"
128 echo -n "Checking for -lfbclient... "
129 gcc $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
140 echo -n "Checking for mysql_config... "
141 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
145 echo -n "Checking for -lmysqlclient... "
146 gcc $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
152 CHECK_MYSQLCLIENT=yes
158 echo -n "Checking for mysql_config --cflags... "
159 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
165 #CXXFLAGS="$CXXFLAGS $MYSQL_CFLAGS"
166 echo "[$MYSQL_CFLAGS]"
167 echo -n "Checking for mysql_config --libs_r... "
168 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
174 CHECK_MYSQLCLIENT=yes
175 #LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
176 echo "[$MYSQL_LDFLAGS]"
181 echo -n "Checking for pg_config... "
182 PG_VERSION=`pg_config --version 2> /dev/null`
186 echo -n "Checking for -lpq... "
187 gcc $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
199 echo -n "Checking for pg_config --includedir... "
200 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
207 echo -n "Checking for pg_config --libdir... "
208 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
222 if [ "$CHECK_FBCLIENT" = "yes" ]
230 if [ "$CHECK_PQ" = "yes" ]
236 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
242 echo "OS=$OS" > $CONFFILE
243 echo "STG_TIME=yes" >> $CONFFILE
244 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
245 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
246 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
247 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
248 echo "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules" >> $CONFFILE
249 echo "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins" >> $CONFFILE
250 echo "ARCH=$ARCH" >> $CONFFILE
251 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
252 echo "DEFS=$DEFS" >> $CONFFILE
253 echo -n "STG_LIBS=" >> $CONFFILE
256 echo -n "$lib " >> $CONFFILE
259 echo -n "PLUGINS=" >> $CONFFILE
260 for plugin in $PLUGINS
262 echo -n "$plugin " >> $CONFFILE
265 echo "SHELL=$SHELL" >> $CONFFILE
266 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
267 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
268 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
269 echo "PREFIX=$PREFIX" >> $CONFFILE
270 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
271 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
272 echo "OWNER=$OWNER" >> $CONFFILE
273 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
275 mkdir -p ../stargazer/modules