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" ]
72 DEFS="$DEFS -DFREE_BSD"
75 DEFS="$DEFS -DFREE_BSD5"
95 echo -n "Checking CC... "
96 $CC --version > /dev/null 2> /dev/null
104 echo -n "Checking CXX... "
105 $CXX --version > /dev/null 2> /dev/null
109 echo "$CXX not found"
114 echo -n "Checking endianess... "
115 echo "int main() { int probe = 0x00000001; return *(char *)&probe; }" > build_check.c
116 $CC $CFLAGS $LDFLAGS -L/usr/lib/mysql -L/usr/local/lib/mysql build_check.c -o fake > /dev/null 2> /dev/null
120 echo "Endianess checking failed"
127 CXXFLAGS="$CXXFLAGS -DARCH_LE"
128 CFLAGS="$CFLAGS -DARCH_LE"
132 CXXFLAGS="$CXXFLAGS -DARCH_BE"
133 CFLAGS="$CFLAGS -DARCH_BE"
139 echo -n "Checking for -lfbclient... "
140 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
151 echo -n "Checking for mysql_config... "
152 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
156 echo -n "Checking for -lmysqlclient... "
157 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
163 CHECK_MYSQLCLIENT=yes
169 echo -n "Checking for mysql_config --cflags... "
170 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
176 echo "[$MYSQL_CFLAGS]"
177 echo -n "Checking for mysql_config --libs_r... "
178 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
184 CHECK_MYSQLCLIENT=yes
185 echo "[$MYSQL_LDFLAGS]"
190 echo -n "Checking for pg_config... "
191 PG_VERSION=`pg_config --version 2> /dev/null`
195 echo -n "Checking for -lpq... "
196 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
208 echo -n "Checking for pg_config --includedir... "
209 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
216 echo -n "Checking for pg_config --libdir... "
217 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
231 if [ "$CHECK_FBCLIENT" = "yes" ]
239 if [ "$CHECK_PQ" = "yes" ]
245 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
251 echo "OS=$OS" > $CONFFILE
252 echo "STG_TIME=yes" >> $CONFFILE
253 echo "DIR_BUILD=$BUILD_DIR" >> $CONFFILE
254 echo "DIR_LIB=\$(DIR_BUILD)/../../lib" >> $CONFFILE
255 echo "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs" >> $CONFFILE
256 echo "DIR_INCLUDE=\$(DIR_BUILD)/../../include" >> $CONFFILE
257 echo "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules" >> $CONFFILE
258 echo "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins" >> $CONFFILE
259 echo "ARCH=$ARCH" >> $CONFFILE
260 echo "CHECK_FBCLIENT=$CHECK_FBCLIENT" >> $CONFFILE
261 echo "DEFS=$DEFS" >> $CONFFILE
262 echo -n "STG_LIBS=" >> $CONFFILE
265 echo -n "$lib " >> $CONFFILE
268 echo -n "PLUGINS=" >> $CONFFILE
269 for plugin in $PLUGINS
271 echo -n "$plugin " >> $CONFFILE
274 echo "CXXFLAGS=$CXXFLAGS" >> $CONFFILE
275 echo "CFLAGS=$CFLAGS" >> $CONFFILE
276 echo "LDFLAGS=$LDFLAGS" >> $CONFFILE
277 echo "LIB_THREAD=$LIB_THREAD" >> $CONFFILE
278 echo "PREFIX=$PREFIX" >> $CONFFILE
279 echo "BIN_MODE=$BIN_MODE" >> $CONFFILE
280 echo "DATA_MODE=$DATA_MODE" >> $CONFFILE
281 echo "DIR_MODE=$DIR_MODE" >> $CONFFILE
282 echo "OWNER=$OWNER" >> $CONFFILE
283 echo "VAR_DIR=$VAR_DIR" >> $CONFFILE
285 mkdir -p ../stargazer/modules