7 if [ "X${ARGV}" = "X" ]; then
9 echo "No argument. Available options are:"
19 # Increasing maximum number of agents
20 if [ "X$1" = "Xsetmaxagents" ]; then
21 echo -n "Specify maximum number of agents: ";
23 echo "HEXTRA=-DMAX_AGENTS=$AGMAX" >> ./Config.OS
24 echo "Maximum number of agents set to $AGMAX."
29 ZLIBV="external/zlib-1.2.3/"
35 VERSION=`cat ./VERSION`
38 # Libraries. They need to be compiled before.
39 LIBS="os_xml os_regex os_net os_crypto"
41 SOURCES="shared config"
43 BINARIES="os_maild os_dbd os_csyslogd agentlessd os_execd analysisd logcollector remoted client-agent addagent util rootcheck syscheckd monitord os_auth"
44 ROOTCHECKBIN="rootcheck"
45 DIRECTORIES="" # Directories to make
49 if [ "X$OS" = "XSunOS" ]; then
50 PATH=$PATH:/usr/ccs/bin:/usr/xpg4/bin:/opt/csw/gcc3/bin:/opt/csw/bin:/usr/sfw/bin
56 if [ "X${ARGV}" = "Xall" -o "X${ARGV}" = "Xrootcheck" -o "X${ARGV}" = "Xlibs" ]; then
57 ls ./Config.OS >/dev/null 2>&1
62 # Checking for OpenSSLconf.h
63 ls /usr/include/openssl/opensslconf.h > /dev/null 2>&1
65 echo "DEXTRA=-DUSE_OPENSSL" >> Config.OS
66 echo "OPENSSLCMD=-lssl -lcrypto" >> Config.OS
69 # Checking for inotify
70 if [ "X$OS" = "XLinux" ]; then
71 #ls /usr/include/sys/inotify.h > /dev/null 2>&1
73 # echo "EEXTRA=-DUSEINOTIFY" >> Config.OS
76 if [ -e /usr/include/sys/inotify.h ]; then
77 echo "EEXTRA=-DUSEINOTIFY" >> Config.OS
78 elif [ -e /usr/include/x86_64-linux-gnu/sys/inotify.h ]; then
79 echo "EEXTRA=-DUSEINOTIFY" >> Config.OS
84 if [ "X$OS" = "XAIX" ]; then
85 echo "EEXTRA=-DAIX -DHIGHFIRST" >> Config.OS
86 PATH=$PATH:/usr/vac/bin
89 elif [ "X$OS" = "XSunOS" ]; then
90 # Set CPU optimization for Sun UltraSparc
91 # by Eric Straavaldsen
92 # Disabled by default. To enable it, just uncomment the following
93 # lines and comment the EEXTRA below.
95 #if [ $PROC = sparcv9 ]; then
96 # echo "EEXTRA=-lsocket -lnsl -lresolv -DSOLARIS -DHIGHFIRST -O3 -mcpu=ultrasparc">>Config.OS
98 echo "EEXTRA=-DSOLARIS -DHIGHFIRST">>Config.OS
99 echo "IEXTRA=-lsocket -lnsl -lresolv" >> Config.OS
101 elif [ "X$OS" = "XHP-UX" ]; then
102 echo "EEXTRA=-DHPUX -D_XOPEN_SOURCE_EXTENDED -DHIGHFIRST -D_REENTRANT" >> Config.OS
104 elif [ "X$OS" = "XDarwin" ]; then
105 echo "EEXTRA=-DDarwin -DHIGHFIRST" >> Config.OS
109 echo 'int main() { short one = 1; char *cp = (char*)&one; if ( *cp == 0 ) return(1); else return(0); }' > isbigendian.c
110 gcc -o isbigendian isbigendian.c
113 echo "INFO: Big endian set."
114 echo "GEXTRA=-DHIGHFIRST" >> Config.OS
116 echo "INFO: Little endian set."
121 if [ "X$OS" = "XFreeBSD" -o "X$OS" = "XDragonFly" ]; then
122 echo "TEXTRA=-pthread" >> Config.OS
124 echo "TEXTRA=-lpthread" >> Config.OS
130 if [ "X${ARGV}" = "Xclean" ]; then
131 echo "" > ./Config.OS
135 # Getting values for each action
136 if [ "X${ARGV}" = "Xall" ]; then
137 DIRECTORIES="${LIBS} ${SOURCES} ${BINARIES}"
139 elif [ "X${ARGV}" = "Xlibs" ]; then
140 DIRECTORIES="${LIBS} ${SOURCES}"
142 elif [ "X${ARGV}" = "Xrootcheck" ]; then
143 DIRECTORIES="os_xml os_regex os_net ${SOURCES} ${ROOTCHECKBIN}"
144 elif [ "X${ARGV}" = "Xbuild" ]; then
145 DIRECTORIES="${BINARIES}" # Only binaries need to be built
147 DIRECTORIES="${LIBS} ${SOURCES} ${BINARIES}"
151 if [ "X${DOZLIB}" = "Xx" ]; then
154 echo " *** Making zlib (by Jean-loup Gailly and Mark Adler) *** "
155 cd ${ZLIBV}; make; make ossec;
161 if [ "X${ARGV}" = "Xclean" ]; then
163 cd ${ZLIBV}; make clean;
168 # Checking if the bin directory is present
169 if [ ! "X${ARGV}" = "Xrootcheck" ]; then
170 ls ../bin >/dev/null 2>&1
175 echo "Compiling Rootcheck..."
181 # Making each directory
182 for i in ${DIRECTORIES}; do
186 echo "Error acessing directory $i"
189 if [ "X${ARGV}" = "Xclean" ]; then
192 elif [ "X${ARGV}" = "Xbuild" ]; then
196 echo "Error Making the binaries"
199 elif [ "X${ARGV}" = "Xrootcheck" ]; then
201 if [ $i = "rootcheck" ]; then
208 echo "Error Making $i"
214 echo " *** Making $i *** "
219 echo "Error Making $i"
227 if [ "X${ARGV}" = "Xrootcheck" ]; then
228 cp -pr ./rootcheck/ossec-rootcheck ../
229 cp -pr ./rootcheck/db ../
230 cp -pr ./rootcheck/rootcheck.conf ../
232 echo "Rootcheck compilation completed."
233 echo "Just run './ossec-rootcheck' to execute it."