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 sgcp.lib"
66 if [ "$OS" = "linux" ]
73 DEFS="$DEFS -DFREE_BSD"
75 DEFS="$DEFS -DFREE_BSD5"
83 CXXFLAGS="$CXXFLAGS -DHAVE_CLOSEFROM"
96 printf "Checking CC... "
97 $CC --version > /dev/null 2> /dev/null
101 printf "$CC not found\n"
105 printf "Checking CXX... "
106 $CXX --version > /dev/null 2> /dev/null
110 printf "$CXX not found\n"
115 printf "Checking endianess... "
116 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
117 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
121 printf "Endianess checking failed\n"
128 CXXFLAGS="$CXXFLAGS -DARCH_LE"
129 CFLAGS="$CFLAGS -DARCH_LE"
130 printf "Little Endian\n"
133 CXXFLAGS="$CXXFLAGS -DARCH_BE"
134 CFLAGS="$CFLAGS -DARCH_BE"
135 printf "Big Endian\n"
140 printf "OS=$OS\n" > $CONFFILE
141 printf "STG_TIME=yes\n" >> $CONFFILE
142 printf "DEBUG=$DEBUG\n" >> $CONFFILE
143 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
144 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
145 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
146 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
147 printf "ARCH=$ARCH\n" >> $CONFFILE
148 printf "DEFS=$DEFS\n" >> $CONFFILE
149 printf "STG_LIBS=" >> $CONFFILE
152 printf "$lib " >> $CONFFILE
154 printf "\n" >> $CONFFILE
155 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
156 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
157 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
158 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
159 printf "PREFIX=$PREFIX\n" >> $CONFFILE
160 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
161 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
162 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
163 printf "OWNER=$OWNER\n" >> $CONFFILE
165 if [ "$1" != "debug" ]
169 printf "\n\n\nDebug build. Type $MAKE explicitly\n"