scanclrmake/src/idcompiler.cxx
// ==========================================================================
// Invoke a script for last-ditch identification of the compiler which
// appears in the config record by the given name, but which cannot be
// found on disk.  This takes into account the current platform.  If a
// guess is possible, returns true and sets id as per the script,
// i.e. with the name of the compiler used for configuration purposes,
// e.g. suncc.
//
Invoke a script for last-ditch identification of the compiler which
appears in the config record by the given name, but which cannot be
found on disk.  This takes into account the current platform.  If a
guess is possible, returns true and sets id as per the script,
i.e. with the name of the compiler used for configuration purposes,
e.g. suncc.
Invoke a script for last - ditch identification of the compiler which appears in the config record by the given name but which cannot be found on disk . This takes into account the current platform . If a guess is possible returns true and sets id as per the script i . e . with the name of the compiler used for configuration purposes e . g . suncc .
static bool guessCompiler(const string &compiler_name,
                          string &id, bool verbose)
{
    string plcmd = scanclrmake::psethome();
    scanclrmake::appendNameInDir(plcmd, "bin");
    scanclrmake::appendNameInDir(plcmd, "disperl");
    string compilerIdScript = scanclrmake::psethome();
    scanclrmake::appendNameInDir(compilerIdScript, "mb");
    scanclrmake::appendNameInDir(compilerIdScript, "compilerid.pl");
    static const char *argv[] = { 
        NULL, 
	scanclrmake::platformName(),
	NULL, 
	NULL };
    argv[0] = compilerIdScript.c_str();
    argv[2] = compiler_name.c_str();
    int result = start_process_and_wait(plcmd.c_str(), argv, &id);
    if (result == 0) {
	one_line(id);
	scanclrmake::trim(id);
	if (id.length() > 0) {
	    return true;
	}
    }
    if (verbose) {
	msg("compilerid command failed with result $5: $1 $2 $3 $4\n", warning_sev)
	    << plcmd << eoarg << compilerIdScript << eoarg
	    << scanclrmake::platformName() << eoarg << compiler_name << eoarg
	    << result << eoarg << eom;
    }
    return false;
}
static bool guessCompiler ( const string & compiler_name , string & id , bool verbose ) { string plcmd = scanclrmake :: psethome ( ) ; scanclrmake :: appendNameInDir ( plcmd , " " ) ; scanclrmake :: appendNameInDir ( plcmd , " " ) ; string compilerIdScript = scanclrmake :: psethome ( ) ; scanclrmake :: appendNameInDir ( compilerIdScript , " " ) ; scanclrmake :: appendNameInDir ( compilerIdScript , " " ) ; static const char * argv [ ] = { NULL , scanclrmake :: platformName ( ) , NULL , NULL } ; argv [ 0 ] = compilerIdScript . c_str ( ) ; argv [ 2 ] = compiler_name . c_str ( ) ; int result = start_process_and_wait ( plcmd . c_str ( ) , argv , & id ) ; if ( result == 0 ) { one_line ( id ) ; scanclrmake :: trim ( id ) ; if ( id . length ( ) > 0 ) { return true ; } } if ( verbose ) { msg ( " \n " , warning_sev ) << plcmd << eoarg << compilerIdScript << eoarg << scanclrmake :: platformName ( ) << eoarg << compiler_name << eoarg << result << eoarg << eom ; } return false ; }
Invoke a script for last-ditch identification of the compiler which
appears in the config record by the given name, but which cannot be
found on disk.
Invoke a script for last - ditch identification of the compiler which appears in the config record by the given name but which cannot be found on disk .
// Form the command filename and args for the Perl script. // script path // compiler name // Hard to tell catastrophic failure from a simple case // of not encountering an actual compiler.