]> git.stg.codes - stg.git/blobdiff - projects/stargazer/build
Merge branch 'stg-2.409-radius'
[stg.git] / projects / stargazer / build
index a77c2e094cc8d529e568a8c8ff14eecf2245a2d3..b5e13df6aee5381b2ff25e1eaeb587b8e162843e 100755 (executable)
@@ -105,7 +105,6 @@ PLUGINS="authorization/ao
          configuration/sgconfig
          other/ping
          other/rscript
-         other/radius
          other/smux
          store/files
          capture/cap_nf"
@@ -132,7 +131,6 @@ else
             then
                 DEFS="$DEFS -DDARWIN"
                 LIB_THREAD=-lpthread
-                LIBICONV=""
             else
                 LIB_THREAD=-lc_r
             fi
@@ -199,7 +197,7 @@ rm -f fake
 
 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
@@ -212,7 +210,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
-$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -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"
@@ -229,7 +227,7 @@ then
     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
@@ -272,7 +270,7 @@ if [ $? != 0 ]
 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
@@ -314,7 +312,7 @@ if [ $? != 0 ]
 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
@@ -354,7 +352,7 @@ if [ $? != 0 ]
 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
@@ -391,9 +389,22 @@ else
     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
-$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
@@ -407,7 +418,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
-$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
@@ -419,13 +430,62 @@ else
 fi
 rm -f fake
 
+printf "Checking for -lyajl... "
+pkg-config --version > /dev/null 2> /dev/null
+if [ "$?" = "0" ]
+then
+    pkg-config --atleast-version=2.0.0 yajl
+    if [ "$?" != "0" ]
+    then
+        CHECK_YAJL=no
+        printf "no\n"
+    else
+        CHECK_YAJL=yes
+        printf `pkg-config --modversion yajl`"\n"
+    fi
+else
+    printf "#include <stdio.h>\n" > build_check.c
+    printf "#include <yajl/yajl_version.h>\n" >> build_check.c
+    printf "int main() { printf(\"%%d\", yajl_version()); return 0; }\n" >> build_check.c
+    $CC $CFLAGS $LDFLAGS build_check.c -lyajl -o fake > /dev/null 2> /dev/null
+    if [ $? != 0 ]
+    then
+        CHECK_YAJL=no
+        printf "no\n"
+    else
+        YAJL_VERSION=`./fake`
+        if [ $YAJL_VERSION -ge 20000 ]
+        then
+            CHECK_YAJL=yes
+            printf "${YAJL_VERSION}\n"
+        else
+            CHECK_YAJL=no
+            printf "no. Need at least version 2.0.0, existing version is ${YAJL_VERSION}\n"
+        fi
+    fi
+    rm -f fake
+fi
+
+printf "Checking for boost::scoped_ptr... "
+printf "#include <boost/scoped_ptr.hpp>\nint main() { boost::scoped_ptr<int> test(new int(1)); return 0; }\n" > build_check.cpp
+$CXX $CXXFLAGS $LDFLAGS build_check.cpp -o fake # > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    CHECK_BOOST_SCOPED_PTR=no
+    printf "no\n"
+else
+    CHECK_BOOST_SCOPED_PTR=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
-    $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
@@ -441,6 +501,7 @@ then
 fi
 
 rm -f build_check.c
+rm -f build_check.cpp
 
 if [ "$CHECK_EXPAT" != "yes" ]
 then
@@ -474,12 +535,26 @@ then
              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"
 fi
 
+if [ "$CHECK_YAJL" = "yes" -a "$CHECK_BOOST_SCOPED_PTR" = "yes" ]
+then
+    PLUGINS="$PLUGINS
+             other/radius"
+    STG_LIBS="$STG_LIBS
+              json.lib"
+fi
+
 printf "OS=$OS\n" > $CONFFILE
 printf "STG_TIME=yes\n" >> $CONFFILE
 printf "DEBUG=$DEBUG\n" >> $CONFFILE
@@ -515,6 +590,7 @@ then
     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