5 # $Date: 2010/04/14 08:58:44 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
30 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
31 LDFLAGS="$LDFLAGS -L/usr/local/lib"
33 if [ "$sys" = "Linux" ]
40 if [ "$sys" = "FreeBSD" ]
52 if [ "$OS" = "unknown" ]
54 printf "#############################################################################\n"
55 printf "# Sorry, but rlm_stg currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
56 printf "#############################################################################\n"
60 printf "#############################################################################\n"
61 printf " Building rlm_stg for $sys $release\n"
62 printf "#############################################################################\n"
64 STG_LIBS="crypto.lib common.lib"
66 if [ "$OS" = "linux" ]
74 DEFS="$DEFS -DFREE_BSD"
76 DEFS="$DEFS -DFREE_BSD5"
84 CXXFLAGS="$CXXFLAGS -DHAVE_CLOSEFROM"
97 printf "Checking CC... "
98 $CC --version > /dev/null 2> /dev/null
102 printf "$CC not found\n"
106 printf "Checking CXX... "
107 $CXX --version > /dev/null 2> /dev/null
111 printf "$CXX not found\n"
116 printf "Checking endianess... "
117 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
118 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
122 printf "Endianess checking failed\n"
129 CXXFLAGS="$CXXFLAGS -DARCH_LE"
130 CFLAGS="$CFLAGS -DARCH_LE"
131 printf "Little Endian\n"
134 CXXFLAGS="$CXXFLAGS -DARCH_BE"
135 CFLAGS="$CFLAGS -DARCH_BE"
136 printf "Big Endian\n"
141 printf "Checking for iconv 2nd argument... "
142 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
143 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
148 DEFS="$DEFS -DCONST_ICONV"
153 printf "OS=$OS\n" > $CONFFILE
154 printf "STG_TIME=yes\n" >> $CONFFILE
155 printf "DEBUG=$DEBUG\n" >> $CONFFILE
156 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
157 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
158 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
159 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
160 printf "ARCH=$ARCH\n" >> $CONFFILE
161 printf "DEFS=$DEFS\n" >> $CONFFILE
162 printf "STG_LIBS=" >> $CONFFILE
165 printf "$lib " >> $CONFFILE
167 printf "\n" >> $CONFFILE
168 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
169 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
170 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
171 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
172 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
173 printf "PREFIX=$PREFIX\n" >> $CONFFILE
174 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
175 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
176 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
177 printf "OWNER=$OWNER\n" >> $CONFFILE
179 if [ "$1" != "debug" ]
183 printf "\n\n\nDebug build. Type $MAKE explicitly\n"