find_cmd - search and find compiler command
[flag,cmd] = find_cmd(lang)
- lang : string. set the programming language
- 'c' : for C language
- 'f' : for Fortran language
- flag : string.compiler flag
- 'GCC' : return gcc command line
- 'LCC' : return lcc-win32 command line
- 'VC' : return vc command line
- cmd : the string of the of compiler command line.
//find_ccmd
//fonction qui trouve la ligne de commande
//du compilateur en fonction du compilateur choisit
//entrée lang : language 'c' ou 'f'
//sortie flag : flag compilateur (GCC,LCC,VC)
// cmd : commande du compilateur
function [flag,cmd]=find_cmd(lang)
if lang=="c" then
printf("... Search a C compiler ...\n");
elseif lang=="f" then
printf("... Search a Fortran compiler ...\n");
end
GCC_FLAG=%f;
LCC_FLAG=%f;
VC_FLAG=%f;
G77_FLAG=%f;
if MSDOS then //windob
printf(" Windows platform ?\n");
if lang=='c' then
//trouve LCC
// pause
if exists('LCC') then
//trouve LCC
if LCC==%F then
stat=unix('cl');
if stat==0 then
printf(" Found Microsoft Visual C/C++ Compiler\n %s\n",'Version ?');
VC_FLAG=%t;
end
else
LCC_FLAG=%t;
stat=unix(SCI+'\lcc\bin\lcc -v');
if stat==0 then
txt=unix_g(SCI+'\lcc\bin\lcc -v');
printf(" Found lcc-win32\n %s\n",txt(1));
LCC_FLAG=%t;
else
printf("Your LCC flag is set TRUE, but can''t find lcc compiler");
end
end
else
stat=unix('cl');
if stat==0 then
printf(" Found Microsoft Visual C/C++ Compiler\n %s\n",'Version ?');
VC_FLAG=%t;
end
end
elseif lang=='f' then
end
else //unix/linux
printf(" Posix platform ?\n");
if lang=='c' then
stat=unix('gcc --version');
if stat==0 then
txt=unix_g('gcc --version');
printf(" Found gcc\n %s\n",txt(1));
GCC_FLAG=%t;
end
elseif lang=='f' then
//myvar_tt="stat=unix(''g77 --version'');";
stat=unix('g77 --version');
if stat==0 then
txt=unix_g("g77 --version");
printf(" Found g77\n %s\n",txt(1));
G77_FLAG=%t;
end
end
end
if GCC_FLAG then
cmd="gcc ";
flag="GCC";
elseif G77_FLAG then
cmd="g77 "
flag="G77";
elseif LCC_FLAG then
cmd=pathconvert(SCI,%f,%t,'w')+"\lcc\bin\lcc ";
flag="LCC";
elseif VC_FLAG then
cmd="cl ";
flag="VC";
else
printf(" Can''t find Compiler\n");
cmd='trash';
flag='trash';
end
endfunction
IRCOM Group
Alan Layec