Merge pull request #9 from lucagiove/dev

Introduced incremental versioning from git tag and -r option to ndpiReader to print revision
This commit is contained in:
Luca Deri
2015-05-21 19:09:29 +02:00
2 changed files with 30 additions and 26 deletions
+15 -16
View File
@@ -10,32 +10,31 @@ AC_PROG_CC
AX_PTHREAD AX_PTHREAD
if test -d ".git"; then : if test -d ".git"; then :
GIT_TAG=`git rev-parse HEAD` GIT_TAG=`git log -1 --format=%H`
GIT_DATE=`date +%Y%m%d` GIT_DATE=`git log -1 --format=%cd`
GIT_RELEASE="${PACKAGE_VERSION} (${GIT_TAG}:${GIT_DATE})" GIT_RELEASE=`git describe --tags --long --dirty --always`
else else
GIT_RELEASE="${PACKAGE_VERSION}" GIT_RELEASE="${PACKAGE_VERSION}"
SVN_DATE=`date` GIT_DATE=`date`
fi fi
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "r${GIT_RELEASE}", [SVN Release]) AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
AC_DEFINE_UNQUOTED(NDPI_SVN_DATE, "${SVN_DATE}", [Last SVN change]) AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h]) AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h])
PCAP_HOME=$HOME/PF_RING/userland PCAP_HOME=$HOME/PF_RING/userland
if test -d $PCAP_HOME; then : if test -d $PCAP_HOME; then :
echo -n "" echo -n ""
else else
PCAP_HOME=`pwd`/../../PF_RING/userland PCAP_HOME=`pwd`/../../PF_RING/userland
fi fi
SHORT_MACHINE=`uname -m | cut -b1-3` SHORT_MACHINE=`uname -m | cut -b1-3`
if test $SHORT_MACHINE = "arm"; then if test $SHORT_MACHINE = "arm"; then
LIBNUMA="" LIBNUMA=""
else else
LIBNUMA="-lnuma" LIBNUMA="-lnuma"
fi fi
if test -f $PCAP_HOME/libpcap/libpcap.a; then : if test -f $PCAP_HOME/libpcap/libpcap.a; then :
@@ -57,11 +56,11 @@ else
fi fi
if test -d /usr/local/include/json-c/; then : if test -d /usr/local/include/json-c/; then :
CFLAGS="$CFLAGS -I/usr/local/include/json-c/" CFLAGS="$CFLAGS -I/usr/local/include/json-c/"
LDFLAGS="$LDFLAGS -L/usr/local/lib -ljson-c" LDFLAGS="$LDFLAGS -L/usr/local/lib -ljson-c"
else else
CFLAGS="$CFLAGS $(pkg-config --cflags json-c)" CFLAGS="$CFLAGS $(pkg-config --cflags json-c)"
LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)" LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)"
fi fi
OLD_LIBS=$LIBS OLD_LIBS=$LIBS
+6 -1
View File
@@ -208,6 +208,7 @@ static void help(u_int long_help) {
" -d | Disable protocol guess and use only DPI\n" " -d | Disable protocol guess and use only DPI\n"
" -q | Quiet mode\n" " -q | Quiet mode\n"
" -t | Dissect GTP tunnels\n" " -t | Dissect GTP tunnels\n"
" -r | Print nDPI version and git revision\n"
" -w <path> | Write test output on the specified file. This is useful for\n" " -w <path> | Write test output on the specified file. This is useful for\n"
" | testing purposes in order to compare results across runs\n" " | testing purposes in order to compare results across runs\n"
" -h | This help\n" " -h | This help\n"
@@ -232,7 +233,7 @@ static void parseOptions(int argc, char **argv) {
u_int num_cores = sysconf(_SC_NPROCESSORS_ONLN); u_int num_cores = sysconf(_SC_NPROCESSORS_ONLN);
#endif #endif
while ((opt = getopt(argc, argv, "df:g:i:hp:l:s:tv:V:n:j:w:q")) != EOF) { while ((opt = getopt(argc, argv, "df:g:i:hp:l:s:tv:V:n:j:rp:w:q")) != EOF) {
switch (opt) { switch (opt) {
case 'd': case 'd':
enable_protocol_guess = 0; enable_protocol_guess = 0;
@@ -271,6 +272,10 @@ static void parseOptions(int argc, char **argv) {
decode_tunnels = 1; decode_tunnels = 1;
break; break;
case 'r':
printf("ndpiReader, nDPI (%s)\n\n", ndpi_revision());
exit(0);
case 'v': case 'v':
verbose = atoi(optarg); verbose = atoi(optarg);
break; break;