5 # $Date: 2010/04/14 08:58:52 $
6 ######################################################
11 major=`printf "%s" "$release" | cut -d. -f1`
13 CONFFILE="../../Makefile.conf"
23 MAKEOPTS="$MAKEOPTS -j1"
24 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
25 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
32 CFLAGS="$CFLAGS -I/usr/local/include"
33 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
34 LDFLAGS="$LDFLAGS -L/usr/local/lib"
36 if [ "$sys" = "Linux" ]
42 if [ "$sys" = "FreeBSD" ]
54 if [ "$sys" = "Darwin" ]
57 ETC_DIR="./inst/freebsd/etc/stargazer"
61 if [ "$OS" = "unknown" ]
63 printf "#############################################################################\n"
64 printf "# Sorry, but rscriptd is currently supported by Linux, FreeBSD and Darwin. #\n"
65 printf "#############################################################################\n"
69 printf "#############################################################################\n"
70 printf " Building rscriptd for $sys $release\n"
71 printf "#############################################################################\n"
79 if [ "$OS" = "linux" ]
87 DEFS="$DEFS -DFREE_BSD"
91 DEFS="$DEFS -DFREE_BSD5"
94 if [ "$OS" == "darwin" ]
115 printf "Checking CC... "
116 $CC --version > /dev/null 2> /dev/null
120 printf "$CC not found\n"
124 printf "Checking CXX... "
125 $CXX --version > /dev/null 2> /dev/null
129 printf "$CXX not found\n"
134 printf "Checking endianess... "
135 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
136 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
140 printf "Endianess checking failed\n"
147 CXXFLAGS="$CXXFLAGS -DARCH_LE"
148 CFLAGS="$CFLAGS -DARCH_LE"
149 printf "Little Endian\n"
152 CXXFLAGS="$CXXFLAGS -DARCH_BE"
153 CFLAGS="$CFLAGS -DARCH_BE"
154 printf "Big Endian\n"
159 printf "Checking for iconv 2nd argument... "
160 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
161 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
166 DEFS="$DEFS -DCONST_ICONV"
173 printf "OS=$OS\n" > $CONFFILE
174 printf "STG_TIME=yes\n" >> $CONFFILE
175 printf "DEBUG=$DEBUG\n" >> $CONFFILE
176 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
177 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
178 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
179 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
180 printf "ARCH=$ARCH\n" >> $CONFFILE
181 printf "DEFS=$DEFS\n" >> $CONFFILE
182 printf "STG_LIBS=" >> $CONFFILE
185 printf "$lib " >> $CONFFILE
187 printf "\n" >> $CONFFILE
188 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
189 printf "CC=$CC\n" >> $CONFFILE
190 printf "CXX=$CXX\n" >> $CONFFILE
191 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
192 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
193 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
194 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
195 printf "PREFIX=$PREFIX\n" >> $CONFFILE
196 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
197 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
198 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
199 printf "OWNER=$OWNER\n" >> $CONFFILE
201 if [ "$1" != "debug" ]
205 printf "\n\n\nDebug build. Type $MAKE explicitly\n"