1 // version.c -- print gold version information 2 3 // Copyright 2006, 2007, 2008, 2009, 2010 4 // Free Software Foundation, Inc. 5 // Written by Ian Lance Taylor <iant@google.com>. 6 7 // This file is part of gold. 8 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. 13 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. 18 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. 23 24 #include "gold.h" 25 26 #include <string> 27 #include <cstdio> 28 29 #include "../bfd/bfdver.h" 30 31 namespace gold 32 { 33 34 // The version of gold. 35 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. 39 40 static const char* version_string = "1.11"; 41 42 // Report version information. 43 44 void 45 print_version(bool print_short) 46 { 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] == '(') 54 { 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); 59 } 60 61 printf("GNU gold (%s) %s\n", bfd_version.c_str(), version_string); 62 63 if (!print_short) 64 { 65 // This output is intended to follow the GNU standards. 66 printf(_("Copyright 2011 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")); 71 } 72 } 73 74 // Return the version string. 75 76 const char* 77 get_version_string() 78 { 79 return version_string; 80 } 81 82 } // End namespace gold. 83