]> git.stg.codes - stg.git/commitdiff
Added checks for boost and yajl.
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 24 Aug 2015 13:02:22 +0000 (16:02 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 24 Aug 2015 13:02:22 +0000 (16:02 +0300)
projects/rlm_stg/Makefile
projects/rlm_stg/build
projects/stargazer/build
projects/stargazer/plugins/other/radius/Makefile

index 548232a8a9b7a88f3748667d3c3c66580aea6d50..72788bcb7cd5825c9889be62ab288f9d29afb8cf 100644 (file)
@@ -14,7 +14,7 @@ SRCS = ./rlm_stg.c \
 
 STGLIBS = crypto \
           common \
-          sgcp
+          json
 
 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
index 4894491a84c1800e1e44074a65bec4abbca1fd3a..84d81aacd8e4de1b431889bea862f4d06336007e 100755 (executable)
@@ -61,7 +61,7 @@ printf "########################################################################
 printf "       Building rlm_stg for $sys $release\n"
 printf "#############################################################################\n"
 
-STG_LIBS="crypto.lib common.lib sgcp.lib"
+STG_LIBS="crypto.lib common.lib json.lib"
 
 if [ "$OS" = "linux" ]
 then
@@ -150,6 +150,68 @@ 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"
+        exit;
+    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"
+        exit;
+    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"
+            exit;
+        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"
+    exit;
+else
+    CHECK_BOOST_SCOPED_PTR=yes
+    printf "yes\n"
+fi
+rm -f fake
+
+rm -f build_check.c
+rm -f build_check.cpp
+
+if [ "$CHECK_YAJL" = "yes" -a "$CHECK_BOOST_SCOPED_PTR" = "yes" ]
+then
+    STG_LIBS="$STG_LIBS
+              json.lib"
+fi
+
 printf "OS=$OS\n" > $CONFFILE
 printf "STG_TIME=yes\n" >> $CONFFILE
 printf "DEBUG=$DEBUG\n" >> $CONFFILE
index 80d17d00d9c72b6461bb9866a4e56e5cd601de55..a43e3e13d8c6331cc3f94aebe7a560e8a0afaf3b 100755 (executable)
@@ -105,7 +105,6 @@ PLUGINS="authorization/ao
          configuration/sgconfig
          other/ping
          other/rscript
-         other/radius
          other/smux
          store/files
          capture/cap_nf"
@@ -419,6 +418,55 @@ 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... "
@@ -441,6 +489,7 @@ then
 fi
 
 rm -f build_check.c
+rm -f build_check.cpp
 
 if [ "$CHECK_EXPAT" != "yes" ]
 then
@@ -480,6 +529,14 @@ then
              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
index dd7366981481e63aacb82ead660ff7b35d54eaf0..14428914abb392e53d24058dbf00e26fc56b50e6 100644 (file)
@@ -4,17 +4,19 @@
 
 include ../../../../../Makefile.conf
 
-LIBS += $(LIB_THREAD)
+LIBS += $(LIB_THREAD) -lyajl
 
 PROG = mod_radius.so
 
 SRCS = radius.cpp \
-       config.cpp
+       config.cpp \
+       conn.cpp
 
 STGLIBS = common \
          crypto \
          logger \
-         scriptexecuter
+         scriptexecuter \
+         json
 
 include ../../Makefile.in