monotone

monotone Mtn Source Tree

Root/src/mt_version.cc

1// Copyright (C) 2004 Nathaniel Smith <njs@pobox.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10// This is split off into its own file to minimize recompilation time; it is
11// the only .cc file that depends on the revision/full_revision header files,
12// which change constantly.
13
14
15#include "base.hh"
16
17#include <boost/version.hpp>
18#include <boost/config.hpp>
19#include <iostream>
20
21/* Include third party headers needed for version info */
22#include <botan/version.h>
23#include <sqlite3.h>
24// Lua assumed included by lua.hh
25#include <pcre.h>
26
27#include "app_state.hh"
28#include "lua.hh"
29#include "platform.hh"
30#include "mt_version.hh"
31#include "sanity.hh"
32
33using std::cout;
34using std::string;
35
36void
37get_version(string & out)
38{
39 out = (F("%s (base revision: %s)")
40 % PACKAGE_STRING % string(package_revision_constant)).str();
41}
42
43void
44print_version()
45{
46 string s;
47 get_version(s);
48 cout << s << '\n';
49}
50
51void
52get_full_version(string & out)
53{
54 string base_version;
55 get_version(base_version);
56 string flavour;
57 get_system_flavour(flavour);
58 out = (F("%s\n"
59 "Running on : %s\n"
60 "C++ compiler : %s\n"
61 "C++ standard library: %s\n"
62 "Boost version : %s\n"
63 "SQLite version : %s (compiled against %s)\n"
64 "Lua version : %s\n"
65 "PCRE version : %s (compiled against %d.%d)\n"
66 "Botan version : %d.%d.%d (compiled against %d.%d.%d)\n"
67 "Changes since base revision:\n"
68 "%s")
69 % base_version % flavour
70 % BOOST_COMPILER
71 % BOOST_STDLIB
72 % BOOST_LIB_VERSION
73 % sqlite3_libversion() % SQLITE_VERSION
74 % LUA_VERSION
75 % pcre_version() % PCRE_MAJOR % PCRE_MINOR
76 % Botan::version_major() % Botan::version_minor() % Botan::version_patch()
77 % BOTAN_VERSION_MAJOR % BOTAN_VERSION_MINOR % BOTAN_VERSION_PATCH
78 % string(package_full_revision_constant))
79 .str();
80}
81
82void
83print_full_version()
84{
85 string s;
86 get_full_version(s);
87 cout << s << '\n';
88}
89
90// Local Variables:
91// mode: C++
92// fill-column: 76
93// c-file-style: "gnu"
94// indent-tabs-mode: nil
95// End:
96// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status