scanclrmake/src/idcompiler.cxx
// ==========================================================================
// Invoke a script to determine whether the given compiler path name is gcc.
// If so, return true and set id as per the script, i.e. to "gcc".
//
Invoke a script to determine whether the given compiler path name is gcc.
If so, return true and set id as per the script, i.e.
Invoke a script to determine whether the given compiler path name is gcc . If so return true and set id as per the script i . e .
static bool tryGcc (const string &actual_path, string &id, bool verbose)
{
    string plcmd = scanclrmake::psethome();
    scanclrmake::appendNameInDir(plcmd, "bin");
    scanclrmake::appendNameInDir(plcmd, "disperl");
    string tryGccScript = scanclrmake::psethome();
    scanclrmake::appendNameInDir(tryGccScript, "mb");
    scanclrmake::appendNameInDir(tryGccScript, "trygcc.pl");
    static const char *argv[] = { 
        NULL, 
	scanclrmake::platformName(),
	NULL, 
	NULL };
    argv[0] = tryGccScript.c_str();
    argv[2] = actual_path.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("trygcc command failed with result $5: $1 $2 $3 $4\n", warning_sev)
            << plcmd << eoarg << tryGccScript << eoarg
            << scanclrmake::platformName() << eoarg << actual_path << eoarg
	    << result << eoarg << eom;
    }
    return false;
}
static bool tryGcc ( const string & actual_path , string & id , bool verbose ) { string plcmd = scanclrmake :: psethome ( ) ; scanclrmake :: appendNameInDir ( plcmd , " " ) ; scanclrmake :: appendNameInDir ( plcmd , " " ) ; string tryGccScript = scanclrmake :: psethome ( ) ; scanclrmake :: appendNameInDir ( tryGccScript , " " ) ; scanclrmake :: appendNameInDir ( tryGccScript , " " ) ; static const char * argv [ ] = { NULL , scanclrmake :: platformName ( ) , NULL , NULL } ; argv [ 0 ] = tryGccScript . c_str ( ) ; argv [ 2 ] = actual_path . 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 << tryGccScript << eoarg << scanclrmake :: platformName ( ) << eoarg << actual_path << eoarg << result << eoarg << eom ; } return false ; }
Invoke a script to determine whether the given compiler path name is gcc.
Invoke a script to determine whether the given compiler path name is gcc .
// Form the command filename and args for the Perl script. // script path // actual path // Hard to tell catastrophic failure from a simple case // of not encountering an actual compiler.