[sim/rx]
[binutils.git] / gold / version.cc
blobcaaa8a6a97ddd86c2123a44db2d0d30f15e81ab3
1 // version.c -- print gold version information
3 // Copyright 2006, 2007, 2008, 2009, 2010
4 // Free Software Foundation, Inc.
5 // Written by Ian Lance Taylor <iant@google.com>.
7 // This file is part of gold.
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3 of the License, or
12 // (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 // MA 02110-1301, USA.
24 #include "gold.h"
26 #include <string>
27 #include <cstdio>
29 #include "../bfd/bfdver.h"
31 namespace gold
34 // The version of gold.
36 // FIXME: This should eventually be PACKAGE_VERSION, and get the
37 // version number from configure.ac. But it's easier to just change
38 // this file for now.
40 static const char* version_string = "1.9";
42 // Report version information.
44 void
45 print_version(bool print_short)
47 // The --version output is intended to follow the GNU coding
48 // standards. We want to print something like:
49 // GNU gold (GNU binutils 2.19) 1.4
50 // BFD_VERSION_STRING looks like "(GNU Binutils) 2.19". We take off
51 // those parentheses.
52 std::string bfd_version(BFD_VERSION_STRING);
53 if (bfd_version[0] == '(')
55 bfd_version.erase(0, 1);
56 size_t pos = bfd_version.find(')');
57 if (pos != std::string::npos)
58 bfd_version.erase(pos, 1);
61 printf("GNU gold (%s) %s\n", bfd_version.c_str(), version_string);
63 if (!print_short)
65 // This output is intended to follow the GNU standards.
66 printf (_("Copyright 2010 Free Software Foundation, Inc.\n"));
67 printf (_("\
68 This program is free software; you may redistribute it under the terms of\n\
69 the GNU General Public License version 3 or (at your option) a later version.\n\
70 This program has absolutely no warranty.\n"));
74 // Return the version string.
76 const char*
77 get_version_string()
79 return version_string;
82 } // End namespace gold.