| | 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++ : "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++ : g++ ] ; |
| | 90 | if $(tool-command) |
| | 91 | { |
| | 92 | local tool-version = [ MATCH "^([0-9.]+)" : [ SHELL "g++ -dumpversion" ] ] ; |
| | 93 | if $(tool-version) != $(version) |
| | 94 | { |
| | 95 | errors.error "toolset gcc initialization:" : |
| | 96 | "version '$(version)' requested but 'g++-$(version)' not found and version '$(tool-version)' of default 'g++' does not match" : |
| | 97 | "initialized from" [ errors.nearest-user-location ] ; |
| | 98 | tool-command = ; |
| | 99 | } |
| | 100 | } |
| | 101 | else |
| | 102 | { |
| | 103 | errors.error "toolset gcc initialization:" : |
| | 104 | "version '$(version)' requested but neither 'g++-$(version)' nor default 'g++' found" : |
| | 105 | "initialized from" [ errors.nearest-user-location ] ; |
| | 106 | } |
| | 107 | } |
| | 108 | } |
| | 109 | #3) default: no command and no version specified, try using default command "g++" |
| | 110 | else |
| | 111 | { |
| | 112 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ : g++ ] ; |
| | 113 | if ! $(tool-command) |
| | 114 | { |
| | 115 | errors.error "toolset gcc initialization:" : |
| | 116 | "no command provided, default command 'g++' not found" : |
| | 117 | "initialized from" [ errors.nearest-user-location ] ; |
| | 118 | } |
| | 119 | } |
| | 120 | |
| | 121 | |