5 # $Date: 2010/04/14 08:59:11 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
24 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
31 CFLAGS="$CFLAGS -I/usr/local/include"
32 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
33 LDFLAGS="$LDFLAGS -L/usr/local/lib"
35 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 sgconf currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
65 printf "#############################################################################\n"
69 printf "#############################################################################\n"
70 printf " Building sgconf for $sys $release\n"
71 printf "#############################################################################\n"
73 STG_LIBS="conffiles.lib
78 if [ "$OS" = "linux" ]
85 DEFS="$DEFS -DFREE_BSD"
89 DEFS="$DEFS -DFREE_BSD5"
92 if [ "$OS" == "darwin" ]
113 printf "Checking CC... "
114 $CC --version > /dev/null 2> /dev/null
118 printf "$CC not found\n"
122 printf "Checking CXX... "
123 $CXX --version > /dev/null 2> /dev/null
127 printf "$CXX not found\n"
132 printf "Checking endianess... "
133 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
134 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
138 printf "Endianess checking failed\n"
145 CXXFLAGS="$CXXFLAGS -DARCH_LE"
146 CFLAGS="$CFLAGS -DARCH_LE"
147 printf "Little Endian\n"
150 CXXFLAGS="$CXXFLAGS -DARCH_BE"
151 CFLAGS="$CFLAGS -DARCH_BE"
152 printf "Big Endian\n"
157 printf "Checking for -lexpat... "
158 printf "int main() { return 0; }\n" > build_check.c
159 $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
171 if [ "$CHECK_EXPAT" != "yes" ]
173 printf "-lexpat not found!\n"
177 printf "OS=$OS\n" > $CONFFILE
178 printf "STG_TIME=yes\n" >> $CONFFILE
179 printf "DEBUG=$DEBUG\n" >> $CONFFILE
180 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
181 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
182 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
183 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
184 printf "ARCH=$ARCH\n" >> $CONFFILE
185 printf "CHECK_EXPAT=$CHECK_EXPAT\n" >> $CONFFILE
186 printf "DEFS=$DEFS\n" >> $CONFFILE
187 printf "STG_LIBS=" >> $CONFFILE
190 printf "$lib " >> $CONFFILE
192 printf "\n" >> $CONFFILE
193 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
194 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
195 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
196 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
197 printf "PREFIX=$PREFIX\n" >> $CONFFILE
198 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
199 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
200 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
201 printf "OWNER=$OWNER\n" >> $CONFFILE