]> git.stg.codes - stg.git/blobdiff - projects/stargazer/build
Merge branch 'stg-2.409'
[stg.git] / projects / stargazer / build
index 4bf38506e58f8f2e943ea7454672a28b08275818..638ed3ef75028106c1b2b4b97f432b57d4e6d6ff 100755 (executable)
@@ -117,6 +117,7 @@ then
              capture/ether_linux"
     LIB_THREAD=-lpthread
 else
              capture/ether_linux"
     LIB_THREAD=-lpthread
 else
+    LIBICONV="-liconv"
     if [ "$OS" = "bsd" ]
     then
         DEFS="$DEFS -DFREE_BSD"
     if [ "$OS" = "bsd" ]
     then
         DEFS="$DEFS -DFREE_BSD"
@@ -131,6 +132,7 @@ else
             then
                 DEFS="$DEFS -DDARWIN"
                 LIB_THREAD=-lpthread
             then
                 DEFS="$DEFS -DDARWIN"
                 LIB_THREAD=-lpthread
+                LIBICONV=""
             else
                 LIB_THREAD=-lc_r
             fi
             else
                 LIB_THREAD=-lc_r
             fi
@@ -197,7 +199,7 @@ rm -f fake
 
 printf "Checking for -lexpat... "
 printf "#include <expat.h>\nint main() { return 0; }\n" > build_check.c
 
 printf "Checking for -lexpat... "
 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
+$CC $CFLAGS $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 +212,7 @@ rm -f fake
 
 printf "Checking for iconv 2nd argument... "
 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
 
 printf "Checking for iconv 2nd argument... "
 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
-$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -o fake > /dev/null 2> /dev/null
+$CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
 if [ $? != 0 ]
 then
     printf "non-const\n"
 if [ $? != 0 ]
 then
     printf "non-const\n"
@@ -227,7 +229,7 @@ then
     printf "no\n"
     printf "Checking for -lfbclient... "
     printf "int main() { return 0; }\n" > build_check.c
     printf "no\n"
     printf "Checking for -lfbclient... "
     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
+    $CC $CFLAGS $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
@@ -270,7 +272,7 @@ if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lmysqlclient... "
 then
     printf "no\n";
     printf "Checking for -lmysqlclient... "
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $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
@@ -312,7 +314,7 @@ if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lpq... "
 then
     printf "no\n";
     printf "Checking for -lpq... "
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $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
@@ -352,7 +354,7 @@ if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lxmlrpc... "
 then
     printf "no\n";
     printf "Checking for -lxmlrpc... "
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -lxmlrpc $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $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
@@ -389,9 +391,22 @@ else
     fi
 fi
 
     fi
 fi
 
+printf "Checking for -lpcap... "
+printf "#include <pcap.h>\nint main() { return 0; }\n" > build_check.c
+$CC $CFLAGS $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 <stdint.h>\n#include <netinet/in.h>\n#include <linux/netfilter.h>\nint main() { return 0; }\n" > build_check.c
 printf "Checking for -lnfnetlink... "
 printf "#include <stdint.h>\n#include <netinet/in.h>\n#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
+$CC $CFLAGS $LDFLAGS build_check.c -lnfnetlink -o fake > /dev/null 2> /dev/null
 if [ $? != 0 ]
 then
     CHECK_NFNETLINK=no
 if [ $? != 0 ]
 then
     CHECK_NFNETLINK=no
@@ -405,7 +420,7 @@ rm -f fake
 
 printf "Checking for -lnetfilter_queue... "
 printf "#include <stdint.h>\n#include <libnetfilter_queue/libnetfilter_queue.h>\nint main() { return 0; }\n" > build_check.c
 
 printf "Checking for -lnetfilter_queue... "
 printf "#include <stdint.h>\n#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
+$CC $CFLAGS $LDFLAGS build_check.c -lnetfilter_queue -o fake > /dev/null 2> /dev/null
 if [ $? != 0 ]
 then
     CHECK_NFQ=no
 if [ $? != 0 ]
 then
     CHECK_NFQ=no
@@ -423,7 +438,7 @@ then
     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
     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
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $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
@@ -472,6 +487,12 @@ 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
 if [ "$CHECK_NFNETLINK" = "yes" -a "$CHECK_NFQ" = "yes" ]
 then
     PLUGINS="$PLUGINS
@@ -513,6 +534,7 @@ then
     printf "XMLRPC_CFLAGS=$XMLRPC_CFLAGS\n" >> $CONFFILE
     printf "XMLRPC_LDFLAGS=$XMLRPC_LDFLAGS\n" >> $CONFFILE
 fi
     printf "XMLRPC_CFLAGS=$XMLRPC_CFLAGS\n" >> $CONFFILE
     printf "XMLRPC_LDFLAGS=$XMLRPC_LDFLAGS\n" >> $CONFFILE
 fi
+printf "CHECK_PCAP=$CHECK_PCAP\n" >> $CONFFILE
 printf "CHECK_NFNETLINK=$CHECK_NFNETLINK\n" >> $CONFFILE
 if [ "$CHECK_NFNETLINK" = "yes" ]
 then
 printf "CHECK_NFNETLINK=$CHECK_NFNETLINK\n" >> $CONFFILE
 if [ "$CHECK_NFNETLINK" = "yes" ]
 then
@@ -542,6 +564,7 @@ printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
+printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
 printf "PREFIX=$PREFIX\n" >> $CONFFILE
 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
 printf "PREFIX=$PREFIX\n" >> $CONFFILE
 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE