#include "util.h"
#include "cmdline.h"
#include "git_version.h"
+#include "version.h"
#include <cerrno>
#include <cstdlib>
void
systemtap_session::version ()
{
- clog << _F("Systemtap translator/driver (version %s/%s %s%s%s)\n"
+ clog << _F("Systemtap translator/driver (version %s/%s, %s)\n"
"Copyright (C) 2005-2012 Red Hat, Inc. and others\n"
"This is free software; see the source for copying conditions.",
- VERSION, dwfl_version(NULL), GIT_MESSAGE,
- (STAP_EXTRA_VERSION[0]?", ":""),
- (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:"")) << endl;
+ VERSION, dwfl_version(NULL), STAP_EXTENDED_VERSION) << endl;
clog << _("enabled features:")
#ifdef HAVE_AVAHI
<< " AVAHI"
#include "config.h"
#include "../git_version.h"
+#include "../version.h"
#include "dynutil.h"
break;
case 'V':
- fprintf(stderr, "Systemtap Dyninst loader/runner (version %s/%s %s%s%s)\n"
+ fprintf(stderr, "Systemtap Dyninst loader/runner (version %s/%s, %s)\n"
"Copyright (C) 2012 Red Hat, Inc. and others\n"
"This is free software; see the source for copying conditions.\n",
- VERSION, DYNINST_FULL_VERSION, GIT_MESSAGE,
- (STAP_EXTRA_VERSION[0]?", ":""),
- (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:""));
+ VERSION, DYNINST_FULL_VERSION, STAP_EXTENDED_VERSION);
return 0;
default:
#include <assert.h>
#include <string.h>
#include "../git_version.h"
+#include "../version.h"
/* variables needed by parse_args() */
int verbose;
}
break;
case 'V':
- err(_("Systemtap module loader/runner (version %s %s%s%s)\n"
+ err(_("Systemtap module loader/runner (version %s, %s)\n"
"Copyright (C) 2005-2012 Red Hat, Inc. and others\n"
"This is free software; see the source for copying conditions.\n"),
- VERSION, GIT_MESSAGE,
- (STAP_EXTRA_VERSION[0]?", ":""),
- (STAP_EXTRA_VERSION[0]?STAP_EXTRA_VERSION:""));
+ VERSION, STAP_EXTENDED_VERSION);
_exit(1);
break;
case 'T':
--- /dev/null
+#ifndef VERSION_H
+#define VERSION_H
+
+/* If we're building from a git repo, always include that commit information.
+ * Otherwise, only bother using the "non-git sources" if not configured with a
+ * nice --with-extra-version.
+ */
+#ifdef GIT_REPO
+#define STAP_EXTENDED_VERSION \
+ (STAP_EXTRA_VERSION[0] ? GIT_MESSAGE ", " STAP_EXTRA_VERSION : GIT_MESSAGE)
+#else
+#define STAP_EXTENDED_VERSION \
+ (STAP_EXTRA_VERSION[0] ? STAP_EXTRA_VERSION : GIT_MESSAGE)
+#endif
+
+#endif /* VERSION_H */