]> git.stg.codes - stg.git/blobdiff - projects/stargazer/build
Show config only on demand.
[stg.git] / projects / stargazer / build
index 2061d538b189e2f517b948fad8fda182025f680a..48da041a6f26758c52512471b0589a7fd4b70e48 100755 (executable)
@@ -39,6 +39,7 @@ if [ "$1" = "debug" ]
 then
     DEFS="$DEFS -DDEBUG"
     MAKEOPTS="$MAKEOPTS -j1"
 then
     DEFS="$DEFS -DDEBUG"
     MAKEOPTS="$MAKEOPTS -j1"
+    CFLAGS="$CFLAGS -ggdb3 -W -Wall"
     CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
     DEBUG="yes"
 else
     CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
     DEBUG="yes"
 else
@@ -46,6 +47,7 @@ else
     DEBUG="no"
 fi
 
     DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
@@ -64,9 +66,7 @@ then
         5) OS=bsd5;;
         6) OS=bsd5;;
         7) OS=bsd7;;
         5) OS=bsd5;;
         6) OS=bsd5;;
         7) OS=bsd7;;
-        8) OS=bsd7;;
-        9) OS=bsd7;;
-        *) OS=unknown;;
+        *) OS=bsd7;;
     esac
     ETC_DIR="./inst/freebsd/etc/stargazer"
     MAKE="gmake"
     esac
     ETC_DIR="./inst/freebsd/etc/stargazer"
     MAKE="gmake"
@@ -80,7 +80,7 @@ then
 fi
 
 if [ "$OS" = "unknown" ]
 fi
 
 if [ "$OS" = "unknown" ]
-then 
+then
     printf "#############################################################################\n"
     printf "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x  #\n"
     printf "#############################################################################\n"
     printf "#############################################################################\n"
     printf "# Sorry, but stargazer currently supported by Linux, FreeBSD 4.x, 5.x, 6.x  #\n"
     printf "#############################################################################\n"
@@ -91,14 +91,13 @@ printf "########################################################################
 printf "       Building STG 2.4 for $sys $release\n"
 printf "#############################################################################\n"
 
 printf "       Building STG 2.4 for $sys $release\n"
 printf "#############################################################################\n"
 
-STG_LIBS="logger.lib 
-          locker.lib
-         crypto.lib 
-         common.lib 
-         scriptexecuter.lib 
-         conffiles.lib
-         pinger.lib 
-         dotconfpp.lib
+STG_LIBS="logger.lib
+          crypto.lib
+          common.lib
+          scriptexecuter.lib
+          conffiles.lib
+          pinger.lib
+          dotconfpp.lib
           smux.lib"
 
 PLUGINS="authorization/ao
           smux.lib"
 
 PLUGINS="authorization/ao
@@ -197,8 +196,8 @@ fi
 rm -f fake
 
 printf "Checking for -lexpat... "
 rm -f fake
 
 printf "Checking for -lexpat... "
-printf "int main() { return 0; }\n" > build_check.c
-$CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
+printf "#include <expat.h>\nint main() { return 0; }\n" > build_check.c
+$CXX $CXXFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
 if [ $? != 0 ]
 then
     CHECK_EXPAT=no
 if [ $? != 0 ]
 then
     CHECK_EXPAT=no
@@ -210,7 +209,8 @@ fi
 rm -f fake
 
 printf "Checking for -lfbclient... "
 rm -f fake
 
 printf "Checking for -lfbclient... "
-$CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
+printf "int main() { return 0; }\n" > build_check.c
+$CXX $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
 if [ $? != 0 ]
 then
     CHECK_FBCLIENT=no
 if [ $? != 0 ]
 then
     CHECK_FBCLIENT=no
@@ -222,12 +222,13 @@ fi
 rm -f fake
 
 printf "Checking for mysql_config... "
 rm -f fake
 
 printf "Checking for mysql_config... "
+printf "#include <mysql.h>\nint main() { return 0; }\n" > build_check.c
 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lmysqlclient... "
 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lmysqlclient... "
-    $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CXX $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_MYSQLCLIENT=no
     if [ $? != 0 ]
     then
         CHECK_MYSQLCLIENT=no
@@ -261,12 +262,13 @@ else
 fi
 
 printf "Checking for pg_config... "
 fi
 
 printf "Checking for pg_config... "
+printf "#include <libpq-fe.h>\nint main() { return 0; }\n" > build_check.c
 PG_VERSION=`pg_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lpq... "
 PG_VERSION=`pg_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lpq... "
-    $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CXX $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_PQ=no
     if [ $? != 0 ]
     then
         CHECK_PQ=no
@@ -300,12 +302,13 @@ else
 fi
 
 printf "Checking for xmlrpc-c-config... "
 fi
 
 printf "Checking for xmlrpc-c-config... "
+printf "#include <xmlrpc-c/base.hpp>\nint main() { return 0; }\n" > build_check.c
 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lxmlrpc... "
 XMLRPCC_VERSION=`xmlrpc-c-config $XMLRPC_FEATURES --version 2> /dev/null`
 if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lxmlrpc... "
-    $CC $CFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CXX $CXXFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_XMLRPC=no
     if [ $? != 0 ]
     then
         CHECK_XMLRPC=no
@@ -342,13 +345,52 @@ else
     fi
 fi
 
     fi
 fi
 
+printf "Checking for -lpcap... "
+printf "#include <pcap.h>\nint main() { return 0; }\n" > build_check.c
+$CXX $CXXFLAGS $LDFLAGS build_check.c -lpcap -o fake > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    CHECK_PCAP=no
+    printf "no\n"
+else
+    CHECK_PCAP=yes
+    printf "yes\n"
+fi
+rm -f fake
+
+printf "Checking for -lnfnetlink... "
+printf "#include <linux/netfilter.h>\nint main() { return 0; }\n" > build_check.c
+$CXX $CXXFLAGS $LDFLAGS build_check.c -lnfnetlink -o fake > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    CHECK_NFNETLINK=no
+    printf "no\n"
+else
+    CHECK_NFNETLINK=yes
+    printf "yes\n"
+fi
+rm -f fake
+
+printf "Checking for -lnetfilter_queue... "
+printf "#include <libnetfilter_queue/libnetfilter_queue.h>\nint main() { return 0; }\n" > build_check.c
+$CXX $CXXFLAGS $LDFLAGS build_check.c -lnetfilter_queue -o fake > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    CHECK_NFQ=no
+    printf "no\n"
+else
+    CHECK_NFQ=yes
+    printf "yes\n"
+fi
+rm -f fake
+
 if [ "$OS" = "linux" ]
 then
     printf "Checking for linux/netfilter_ipv4/ip_queue.h... "
     printf "#include <linux/types.h>\n" > build_check.c
     printf "#include <linux/netfilter_ipv4/ip_queue.h>\n" >> build_check.c
     printf "int main() { return 0; }\n" >> build_check.c
 if [ "$OS" = "linux" ]
 then
     printf "Checking for linux/netfilter_ipv4/ip_queue.h... "
     printf "#include <linux/types.h>\n" > build_check.c
     printf "#include <linux/netfilter_ipv4/ip_queue.h>\n" >> build_check.c
     printf "int main() { return 0; }\n" >> build_check.c
-    $CC $CFLAGS $LDFLAGS build_check.c -lexpat -o fake > /dev/null 2> /dev/null
+    $CXX $CXXFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_IP_QUEUE_H=no
     if [ $? != 0 ]
     then
         CHECK_IP_QUEUE_H=no
@@ -367,7 +409,7 @@ rm -f build_check.c
 
 if [ "$CHECK_EXPAT" != "yes" ]
 then
 
 if [ "$CHECK_EXPAT" != "yes" ]
 then
-    printf "-lexpat not found!\n"
+    printf -- "-lexpat not found!\n"
     exit 1
 fi
 
     exit 1
 fi
 
@@ -397,6 +439,19 @@ then
              configuration/rpcconfig"
 fi
 
              configuration/rpcconfig"
 fi
 
+if [ "$CHECK_PCAP" = "yes" ]
+then
+    PLUGINS="$PLUGINS
+             capture/pcap"
+fi
+
+if [ "$CHECK_NFNETLINK" = "yes" -a "$CHECK_NFQ" = "yes" ]
+then
+    PLUGINS="$PLUGINS
+             capture/nfqueue"
+    NFQ_LIBS="-lnfnetlink -lnetfilter_queue"
+fi
+
 printf "OS=$OS\n" > $CONFFILE
 printf "STG_TIME=yes\n" >> $CONFFILE
 printf "DEBUG=$DEBUG\n" >> $CONFFILE
 printf "OS=$OS\n" > $CONFFILE
 printf "STG_TIME=yes\n" >> $CONFFILE
 printf "DEBUG=$DEBUG\n" >> $CONFFILE
@@ -412,7 +467,11 @@ printf "CHECK_FBCLIENT=$CHECK_FBCLIENT\n" >> $CONFFILE
 printf "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT\n" >> $CONFFILE
 printf "CHECK_PQ=$CHECK_PQ\n" >> $CONFFILE
 printf "CHECK_XMLRPC=$CHECK_XMLRPC\n" >> $CONFFILE
 printf "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT\n" >> $CONFFILE
 printf "CHECK_PQ=$CHECK_PQ\n" >> $CONFFILE
 printf "CHECK_XMLRPC=$CHECK_XMLRPC\n" >> $CONFFILE
+printf "CHECK_PCAP=$CHECK_PCAP\n" >> $CONFFILE
+printf "CHECK_NFNETLINK=$CHECK_NFNETLINK\n" >> $CONFFILE
+printf "CHECK_NFQ=$CHECK_NFQ\n" >> $CONFFILE
 printf "DEFS=$DEFS\n" >> $CONFFILE
 printf "DEFS=$DEFS\n" >> $CONFFILE
+printf "NFQ_LIBS=$NFQ_LIBS\n" >> $CONFFILE
 printf "STG_LIBS=" >> $CONFFILE
 for lib in $STG_LIBS
 do
 printf "STG_LIBS=" >> $CONFFILE
 for lib in $STG_LIBS
 do