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 "#############################################################################"
55 STG_LIBS="stg_logger.lib
64 if [ "$OS" = "linux" ]
72 DEFS="$DEFS -DFREE_BSD"
75 DEFS="$DEFS -DFREE_BSD5"
83 SHELL="/usr/local/bin/bash"
86 echo -n "Checking endianess... "
87 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
88 gcc $CXXFLAGS $LDFLAGS -L/usr/lib/mysql -L/usr/local/lib/mysql build_check.c -o fake > /dev/null 2> /dev/null
92 echo "Endianess checking failed"
99 CXXFLAGS="$CXXFLAGS -DARCH_LE"
103 CXXFLAGS="$CXXFLAGS -DARCH_BE"
109 echo -n "Checking for -lfbclient... "
110 gcc $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
121 echo -n "Checking for mysql_config... "
122 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
126 echo -n "Checking for -lmysqlclient... "
127 gcc $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
133 CHECK_MYSQLCLIENT=yes
139 echo -n "Checking for mysql_config --cflags... "
140 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
146 #CXXFLAGS="$CXXFLAGS $MYSQL_CFLAGS"
147 echo "[$MYSQL_CFLAGS]"
148 echo -n "Checking for mysql_config --libs_r... "
149 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
155 CHECK_MYSQLCLIENT=yes
156 #LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
157 echo "[$MYSQL_LDFLAGS]"
162 echo -n "Checking for pg_config... "
163 PG_VERSION=`pg_config --version 2> /dev/null`
167 echo -n "Checking for -lpq... "
168 gcc $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
180 echo -n "Checking for pg_config --includedir... "
181 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
188 echo -n "Checking for pg_config --libdir... "
189 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
203 if [ "$CHECK_FBCLIENT" = "yes" ]
211 if [ "$CHECK_PQ" = "yes" ]
217 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
223 echo "OS=$OS" > $CONFFILE
224 echo "STG_TIME=yes" >> $CONFFILE
225 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
226 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
227 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
228 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
229 echo "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules" >> $CONFFILE
230 echo "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins" >> $CONFFILE
231 echo "ARCH=$ARCH" >> $CONFFILE
232 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
233 echo "DEFS=$DEFS" >> $CONFFILE
234 echo -n "STG_LIBS=" >> $CONFFILE
237 echo -n "$lib " >> $CONFFILE
240 echo -n "PLUGINS=" >> $CONFFILE
241 for plugin in $PLUGINS
243 echo -n "$plugin " >> $CONFFILE
246 echo "SHELL=$SHELL" >> $CONFFILE
247 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
248 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
249 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
250 echo "PREFIX=$PREFIX" >> $CONFFILE
251 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
252 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
253 echo "OWNER=$OWNER" >> $CONFFILE
254 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
256 mkdir -p ../stargazer/modules