| | 69 | #1): use user-provided command |
| | 70 | local tool-command = ; |
| | 71 | if $(command) |
| | 72 | { |
| | 73 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ : $(command) ] ; |
| | 74 | if ! $(tool-command) |
| | 75 | { |
| | 76 | errors.error "toolset gcc initialization:" : |
| | 77 | "provided command '$(command)' not found" : |
| | 78 | "initialized from" [ errors.nearest-user-location ] ; |
| | 79 | } |
| | 80 | } |
| | 81 | #2): enforce user-provided version |
| | 82 | else if $(version) |
| | 83 | { |
| | 84 | tool-command = [ common.get-invocation-command-nodefault gcc : "g++-$(version[1])" ] ; |
| | 85 | |
| | 86 | #2.1) fallback: check whether "g++" reports the requested version |
| | 87 | if ! $(tool-command) |
| | 88 | { |
| | 89 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ; |
| | 90 | if $(tool-command) |
| | 91 | { |
| | 92 | local tool-command-string = $(tool-command:J=" ") ; |
| | 93 | local tool-version = [ MATCH "^([0-9.]+)" : [ SHELL "$(tool-command-string) -dumpversion" ] ] ; |
| | 94 | if $(tool-version) != $(version) |
| | 95 | { |
| | 96 | errors.error "toolset gcc initialization:" : |
| | 97 | "version '$(version)' requested but 'g++-$(version)' not found and version '$(tool-version)' of default '$(tool-command)' does not match" : |
| | 98 | "initialized from" [ errors.nearest-user-location ] ; |
| | 99 | tool-command = ; |
| | 100 | } |
| | 101 | } |
| | 102 | else |
| | 103 | { |
| | 104 | errors.error "toolset gcc initialization:" : |
| | 105 | "version '$(version)' requested but neither 'g++-$(version)' nor default 'g++' found" : |
| | 106 | "initialized from" [ errors.nearest-user-location ] ; |
| | 107 | } |
| | 108 | } |
| | 109 | } |
| | 110 | #3) default: no command and no version specified, try using default command "g++" |
| | 111 | else |
| | 112 | { |
| | 113 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ; |
| | 114 | if ! $(tool-command) |
| | 115 | { |
| | 116 | errors.error "toolset gcc initialization:" : |
| | 117 | "no command provided, default command 'g++' not found" : |
| | 118 | "initialized from" [ errors.nearest-user-location ] ; |
| | 119 | } |
| | 120 | } |
| | 121 | |
| | 122 | |