Add a simple revision based on the git rev to the version number, like a build number.

remotes/origin/master-1.1.x
Victor Julien 16 years ago
parent 56c95bf622
commit e3bde3e95d

@ -813,6 +813,18 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)])
fi fi
fi fi
# get revision
if test -f ./revision; then
REVISION=`cat ./revision`
CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
else
GIT=`which git`
if test "$GIT" != ""; then
REVISION=`git describe --always`
CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
fi
fi
AC_SUBST(CFLAGS) AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(CPPFLAGS) AC_SUBST(CPPFLAGS)

@ -127,6 +127,11 @@
#include <assert.h> #include <assert.h>
#define BUG_ON(x) assert(!(x)) #define BUG_ON(x) assert(!(x))
/* we need this to stringify the defines which are supplied at compiletime see:
http://gcc.gnu.org/onlinedocs/gcc-3.4.1/cpp/Stringification.html#Stringification */
#define xstr(s) str(s)
#define str(s) #s
/** type for the internal signature id. Since it's used in the matching engine /** type for the internal signature id. Since it's used in the matching engine
* extensively keeping this as small as possible reduces the overall memory * extensively keeping this as small as possible reduces the overall memory
* footprint of the engine. Set to uint32_t if the engine needs to support * footprint of the engine. Set to uint32_t if the engine needs to support

@ -313,7 +313,11 @@ static void SetBpfString(int optind, char *argv[]) {
void usage(const char *progname) void usage(const char *progname)
{ {
#ifdef REVISION
printf("%s %s (rev %s)\n", PROG_NAME, PROG_VER, xstr(REVISION));
#else
printf("%s %s\n", PROG_NAME, PROG_VER); printf("%s %s\n", PROG_NAME, PROG_VER);
#endif
printf("USAGE: %s\n\n", progname); printf("USAGE: %s\n\n", progname);
printf("\t-c <path> : path to configuration file\n"); printf("\t-c <path> : path to configuration file\n");
printf("\t-i <dev or ip> : run in pcap live mode\n"); printf("\t-i <dev or ip> : run in pcap live mode\n");
@ -437,7 +441,11 @@ int main(int argc, char **argv)
} }
#endif /* OS_WIN32 */ #endif /* OS_WIN32 */
#ifdef REVISION
SCLogInfo("This is %s version %s (rev %s)", PROG_NAME, PROG_VER, xstr(REVISION));
#else
SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER); SCLogInfo("This is %s version %s", PROG_NAME, PROG_VER);
#endif
/* Initialize the configuration module. */ /* Initialize the configuration module. */
ConfInit(); ConfInit();
@ -726,7 +734,11 @@ int main(int argc, char **argv)
#endif #endif
break; break;
case 'V': case 'V':
#ifdef REVISION
printf("\nThis is %s version %s (rev %s)\n\n", PROG_NAME, PROG_VER, xstr(REVISION));
#else
printf("\nThis is %s version %s\n\n", PROG_NAME, PROG_VER); printf("\nThis is %s version %s\n\n", PROG_NAME, PROG_VER);
#endif
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
default: default:
usage(argv[0]); usage(argv[0]);

Loading…
Cancel
Save