SVN commit 1287631 by lunakl: recognize compiler in 'icecc ' M +21 -1 main.cpp --- trunk/icecream/client/main.cpp #1287630:1287631 @@ -224,9 +224,29 @@ } if ( arg == "--build-native" ) return create_native(); - if ( arg.size() > 0 && arg.at(0) == '/' ) + if ( arg.size() > 0 ) { + if ( arg.at(0) == '/' ) job.setCompilerName(arg); + else { + const char* env; + if ( (env = getenv( "ICECC_CC" )) && env == arg ) + job.setCompilerName(arg); + if ( (env = getenv( "ICECC_CXX" )) && env == arg ) + job.setCompilerName(arg); + if ( arg.at(0) != '-' && arg.find( '/' ) == string::npos ) { + char* path = getenv( "PATH" ); + for( char* dir = strtok( path, ":" ); dir; + dir = strtok( NULL, ":" )) { + if ( access(( string( dir ) + "/" + arg ).c_str(), + X_OK ) == 0 ) { + job.setCompilerName( arg ); + break; } + } + } + } + } + } } else if ( find_basename( compiler_name ) == "icerun") { icerun = true; if ( argc > 1 ) {