options.pas 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl and Peter Vreman
  4. Reads command line options and config files
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit options;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globtype,globals,verbose,systems,cpuinfo;
  23. type
  24. TOption=class
  25. FirstPass,
  26. NoPressEnter,
  27. DoWriteLogo : boolean;
  28. FileLevel : longint;
  29. QuickInfo : string;
  30. ParaIncludePath,
  31. ParaUnitPath,
  32. ParaObjectPath,
  33. ParaLibraryPath : TSearchPathList;
  34. ParaAlignment : TAlignmentInfo;
  35. Constructor Create;
  36. Destructor Destroy;override;
  37. procedure WriteLogo;
  38. procedure WriteInfo;
  39. procedure WriteHelpPages;
  40. procedure WriteQuickInfo;
  41. procedure IllegalPara(const opt:string);
  42. function Unsetbool(var Opts:string; Pos: Longint):boolean;
  43. procedure interpret_proc_specific_options(const opt:string);virtual;
  44. procedure interpret_option(const opt :string;ispara:boolean);
  45. procedure Interpret_envvar(const envname : string);
  46. procedure Interpret_file(const filename : string);
  47. procedure Read_Parameters;
  48. procedure parsecmd(cmd:string);
  49. procedure TargetDefines(def:boolean);
  50. end;
  51. TOptionClass=class of toption;
  52. var
  53. coption : TOptionClass;
  54. procedure read_arguments(cmd:string);
  55. implementation
  56. uses
  57. widestr,
  58. {$IFDEF USE_SYSUTILS}
  59. SysUtils,
  60. {$ELSE USE_SYSUTILS}
  61. dos,
  62. {$ENDIF USE_SYSUTILS}
  63. version,
  64. cutils,cmsgs
  65. {$ifdef BrowserLog}
  66. ,browlog
  67. {$endif BrowserLog}
  68. ;
  69. const
  70. page_size = 24;
  71. var
  72. option : toption;
  73. read_configfile, { read config file, set when a cfgfile is found }
  74. disable_configfile,
  75. target_is_set : boolean; { do not allow contradictory target settings }
  76. asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
  77. fpcdir,
  78. ppccfg,
  79. ppcaltcfg,
  80. param_file : string; { file to compile specified on the commandline }
  81. {****************************************************************************
  82. Defines
  83. ****************************************************************************}
  84. procedure def_symbol(const s : string);
  85. begin
  86. if s='' then
  87. exit;
  88. initdefines.insert(upper(s));
  89. Message1(option_defining_symbol,s);
  90. end;
  91. procedure undef_symbol(const s : string);
  92. begin
  93. if s='' then
  94. exit;
  95. InitDefines.Remove(s);
  96. Message1(option_undefining_symbol,s);
  97. end;
  98. function check_symbol(const s:string):boolean;
  99. begin
  100. check_symbol:=(initdefines.find(s)<>nil);
  101. end;
  102. procedure set_default_link_type;
  103. begin
  104. { win32 and wdosx need smartlinking by default to prevent including too much
  105. dll dependencies }
  106. if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
  107. begin
  108. def_symbol('FPC_LINK_SMART');
  109. undef_symbol('FPC_LINK_STATIC');
  110. undef_symbol('FPC_LINK_DYNAMIC');
  111. initglobalswitches:=initglobalswitches+[cs_link_smart];
  112. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_static];
  113. end
  114. else
  115. begin
  116. undef_symbol('FPC_LINK_SMART');
  117. def_symbol('FPC_LINK_STATIC');
  118. undef_symbol('FPC_LINK_DYNAMIC');
  119. initglobalswitches:=initglobalswitches+[cs_link_static];
  120. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_smart];
  121. end;
  122. end;
  123. {****************************************************************************
  124. Toption
  125. ****************************************************************************}
  126. procedure StopOptions(err:longint);
  127. begin
  128. if assigned(Option) then
  129. begin
  130. Option.free;
  131. Option:=nil;
  132. end;
  133. DoneVerbose;
  134. Stop(err);
  135. end;
  136. procedure Toption.WriteLogo;
  137. var
  138. p : pchar;
  139. begin
  140. p:=MessagePchar(option_logo);
  141. while assigned(p) do
  142. Comment(V_Normal,GetMsgLine(p));
  143. end;
  144. procedure Toption.WriteInfo;
  145. var
  146. p : pchar;
  147. hs,hs1,s : TCmdStr;
  148. target : tsystem;
  149. begin
  150. p:=MessagePchar(option_info);
  151. while assigned(p) do
  152. begin
  153. s:=GetMsgLine(p);
  154. { list OS Targets }
  155. if pos('$OSTARGETS',s)>0 then
  156. begin
  157. for target:=low(tsystem) to high(tsystem) do
  158. if assigned(targetinfos[target]) then
  159. begin
  160. hs:=s;
  161. hs1:=targetinfos[target]^.name;
  162. if tf_under_development in targetinfos[target]^.flags then
  163. hs1:=hs1+' (under development)';
  164. Replace(hs,'$OSTARGETS',hs1);
  165. Comment(V_Normal,hs);
  166. end;
  167. end
  168. else
  169. Comment(V_Normal,s);
  170. end;
  171. StopOptions(0);
  172. end;
  173. procedure Toption.WriteHelpPages;
  174. function PadEnd(s:string;i:longint):string;
  175. begin
  176. while (length(s)<i) do
  177. s:=s+' ';
  178. PadEnd:=s;
  179. end;
  180. var
  181. lastident,
  182. j,outline,
  183. ident,
  184. lines : longint;
  185. show : boolean;
  186. opt : string[32];
  187. input,
  188. s : string;
  189. p : pchar;
  190. begin
  191. WriteLogo;
  192. Lines:=4;
  193. Message1(option_usage,system.paramstr(0));
  194. lastident:=0;
  195. p:=MessagePChar(option_help_pages);
  196. while assigned(p) do
  197. begin
  198. { get a line and reset }
  199. s:=GetMsgLine(p);
  200. ident:=0;
  201. show:=false;
  202. { parse options }
  203. case s[1] of
  204. {$ifdef UNITALIASES}
  205. 'a',
  206. {$endif}
  207. {$ifdef EXTDEBUG}
  208. 'e',
  209. {$endif EXTDEBUG}
  210. {$ifdef i386}
  211. '3',
  212. {$endif}
  213. {$ifdef x86_64}
  214. '4',
  215. {$endif}
  216. {$ifdef m68k}
  217. '6',
  218. {$endif}
  219. {$ifdef arm}
  220. 'S',
  221. {$endif}
  222. {$ifdef powerpc}
  223. 'P',
  224. {$endif}
  225. {$ifdef sparc}
  226. 'S',
  227. {$endif}
  228. {$ifdef vis}
  229. 'V',
  230. {$endif}
  231. '*' : show:=true;
  232. end;
  233. if show then
  234. begin
  235. case s[2] of
  236. {$ifdef GDB}
  237. 'g',
  238. {$endif}
  239. {$ifdef Unix}
  240. 'L',
  241. {$endif}
  242. {$ifdef os2}
  243. 'O',
  244. {$endif}
  245. '*' : show:=true;
  246. else
  247. show:=false;
  248. end;
  249. end;
  250. { now we may show the message or not }
  251. if show then
  252. begin
  253. case s[3] of
  254. '0' : begin
  255. ident:=0;
  256. outline:=0;
  257. end;
  258. '1' : begin
  259. ident:=2;
  260. outline:=7;
  261. end;
  262. '2' : begin
  263. ident:=6;
  264. outline:=11;
  265. end;
  266. '3' : begin
  267. ident:=9;
  268. outline:=6;
  269. end;
  270. end;
  271. j:=pos('_',s);
  272. opt:=Copy(s,4,j-4);
  273. if opt='*' then
  274. opt:=''
  275. else
  276. if opt=' ' then
  277. opt:=PadEnd(opt,outline)
  278. else
  279. opt:=PadEnd('-'+opt,outline);
  280. if (ident=0) and (lastident<>0) then
  281. begin
  282. Comment(V_Normal,'');
  283. inc(Lines);
  284. end;
  285. { page full ? }
  286. if (lines >= page_size - 1) then
  287. begin
  288. if not NoPressEnter then
  289. begin
  290. Message(option_help_press_enter);
  291. readln(input);
  292. if upper(input)='Q' then
  293. StopOptions(0);
  294. end;
  295. lines:=0;
  296. end;
  297. Comment(V_Normal,PadEnd('',ident)+opt+Copy(s,j+1,255));
  298. LastIdent:=Ident;
  299. inc(Lines);
  300. end;
  301. end;
  302. StopOptions(0);
  303. end;
  304. procedure Toption.IllegalPara(const opt:string);
  305. begin
  306. Message1(option_illegal_para,opt);
  307. Message(option_help_pages_para);
  308. StopOptions(1);
  309. end;
  310. function Toption.Unsetbool(var Opts:string; Pos: Longint):boolean;
  311. { checks if the character after pos in Opts is a + or a - and returns resp.
  312. false or true. If it is another character (or none), it also returns false }
  313. begin
  314. UnsetBool := false;
  315. if Length(Opts)>Pos then
  316. begin
  317. inc(Pos);
  318. UnsetBool := Opts[Pos] = '-';
  319. if Opts[Pos] in ['-','+']then
  320. delete(Opts,Pos,1);
  321. end;
  322. end;
  323. procedure TOption.interpret_proc_specific_options(const opt:string);
  324. begin
  325. end;
  326. procedure TOption.interpret_option(const opt:string;ispara:boolean);
  327. var
  328. code : integer;
  329. c : char;
  330. more : string;
  331. major,minor : longint;
  332. error : integer;
  333. j,l : longint;
  334. d : DirStr;
  335. e : ExtStr;
  336. s : string;
  337. forceasm : tasm;
  338. begin
  339. if opt='' then
  340. exit;
  341. { only parse define,undef,target,verbosity and link options the firsttime }
  342. if firstpass and
  343. not((opt[1]='-') and (opt[2] in ['i','d','v','T','u','n','X'])) then
  344. exit;
  345. Message1(option_handling_option,opt);
  346. case opt[1] of
  347. '-' :
  348. begin
  349. more:=Copy(opt,3,255);
  350. if firstpass then
  351. Message1(option_interpreting_firstpass_option,opt)
  352. else
  353. Message1(option_interpreting_option,opt);
  354. case opt[2] of
  355. '?' :
  356. WriteHelpPages;
  357. 'a' :
  358. begin
  359. include(initglobalswitches,cs_asm_leave);
  360. j:=1;
  361. while j<=length(more) do
  362. begin
  363. case more[j] of
  364. 'l' :
  365. include(initglobalswitches,cs_asm_source);
  366. 'r' :
  367. include(initglobalswitches,cs_asm_regalloc);
  368. 't' :
  369. include(initglobalswitches,cs_asm_tempalloc);
  370. 'n' :
  371. include(initglobalswitches,cs_asm_nodes);
  372. 'p' :
  373. begin
  374. exclude(initglobalswitches,cs_asm_leave);
  375. if UnsetBool(More, 0) then
  376. exclude(initglobalswitches,cs_asm_pipe)
  377. else
  378. include(initglobalswitches,cs_asm_pipe);
  379. end;
  380. '-' :
  381. initglobalswitches:=initglobalswitches -
  382. [cs_asm_leave, cs_asm_source,cs_asm_regalloc, cs_asm_tempalloc,
  383. cs_asm_nodes, cs_asm_pipe];
  384. else
  385. IllegalPara(opt);
  386. end;
  387. inc(j);
  388. end;
  389. end;
  390. 'A' :
  391. begin
  392. if set_target_asm_by_string(More) then
  393. asm_is_set:=true
  394. else
  395. IllegalPara(opt);
  396. end;
  397. 'b' :
  398. begin
  399. {$ifdef supportbrowser}
  400. if UnsetBool(More,0) then
  401. begin
  402. exclude(initmoduleswitches,cs_browser);
  403. exclude(initmoduleswitches,cs_local_browser);
  404. {$ifdef BrowserLog}
  405. exclude(initglobalswitches,cs_browser_log);
  406. {$endif}
  407. end
  408. else
  409. begin
  410. include(initmoduleswitches,cs_browser);
  411. {$ifdef BrowserLog}
  412. include(initglobalswitches,cs_browser_log);
  413. {$endif}
  414. end;
  415. if More<>'' then
  416. if (More='l') or (More='l+') then
  417. include(initmoduleswitches,cs_local_browser)
  418. else
  419. if More='l-' then
  420. exclude(initmoduleswitches,cs_local_browser)
  421. else
  422. {$ifdef BrowserLog}
  423. browserlog.elements_to_list.insert(more);
  424. {$else}
  425. IllegalPara(opt);
  426. {$endif}
  427. {$endif supportbrowser}
  428. end;
  429. 'B' :
  430. do_build:=not UnSetBool(more,0);
  431. 'C' :
  432. begin
  433. j:=1;
  434. while j<=length(more) do
  435. begin
  436. case more[j] of
  437. 'a' :
  438. Message2(option_obsolete_switch_use_new,'-Ca','-Or');
  439. 'c' :
  440. begin
  441. if not SetAktProcCall(upper(copy(more,j+1,length(more)-j)),true) then
  442. IllegalPara(opt);
  443. break;
  444. end;
  445. {$ifdef cpufpemu}
  446. 'e' :
  447. begin
  448. If UnsetBool(More, j) then
  449. exclude(initmoduleswitches,cs_fp_emulation)
  450. Else
  451. include(initmoduleswitches,cs_fp_emulation);
  452. end;
  453. {$endif cpufpemu}
  454. 'f' :
  455. begin
  456. s:=upper(copy(more,j+1,length(more)-j));
  457. if not(SetFpuType(s,true)) then
  458. IllegalPara(opt);
  459. break;
  460. end;
  461. 'g' :
  462. include(initmoduleswitches,cs_create_pic);
  463. 'i' :
  464. If UnsetBool(More, j) then
  465. exclude(initlocalswitches,cs_check_io)
  466. else
  467. include(initlocalswitches,cs_check_io);
  468. 'n' :
  469. If UnsetBool(More, j) then
  470. exclude(initglobalswitches,cs_link_extern)
  471. Else
  472. include(initglobalswitches,cs_link_extern);
  473. 'o' :
  474. If UnsetBool(More, j) then
  475. exclude(initlocalswitches,cs_check_overflow)
  476. Else
  477. include(initlocalswitches,cs_check_overflow);
  478. 'p' :
  479. begin
  480. s:=upper(copy(more,j+1,length(more)-j));
  481. if not(SetProcessor(s,true)) then
  482. IllegalPara(opt);
  483. break;
  484. end;
  485. 'r' :
  486. If UnsetBool(More, j) then
  487. exclude(initlocalswitches,cs_check_range)
  488. Else
  489. include(initlocalswitches,cs_check_range);
  490. 'R' :
  491. If UnsetBool(More, j) then
  492. begin
  493. exclude(initlocalswitches,cs_check_range);
  494. exclude(initlocalswitches,cs_check_object);
  495. end
  496. Else
  497. begin
  498. include(initlocalswitches,cs_check_range);
  499. include(initlocalswitches,cs_check_object);
  500. end;
  501. 's' :
  502. begin
  503. val(copy(more,j+1,length(more)-j),stacksize,code);
  504. if (code<>0) or (stacksize>=67107840) or (stacksize<1024) then
  505. IllegalPara(opt);
  506. break;
  507. end;
  508. 't' :
  509. If UnsetBool(More, j) then
  510. exclude(initlocalswitches,cs_check_stack)
  511. Else
  512. include(initlocalswitches,cs_check_stack);
  513. 'D' :
  514. If UnsetBool(More, j) then
  515. exclude(initmoduleswitches,cs_create_dynamic)
  516. Else
  517. include(initmoduleswitches,cs_create_dynamic);
  518. 'X' :
  519. If UnsetBool(More, j) then
  520. exclude(initmoduleswitches,cs_create_smart)
  521. Else
  522. include(initmoduleswitches,cs_create_smart);
  523. else
  524. IllegalPara(opt);
  525. end;
  526. inc(j);
  527. end;
  528. end;
  529. 'd' :
  530. def_symbol(more);
  531. 'D' :
  532. begin
  533. include(initglobalswitches,cs_link_deffile);
  534. j:=1;
  535. while j<=length(more) do
  536. begin
  537. case more[j] of
  538. 'd' :
  539. begin
  540. description:=Copy(more,j+1,255);
  541. break;
  542. end;
  543. 'v' :
  544. begin
  545. dllversion:=Copy(more,j+1,255);
  546. l:=pos('.',dllversion);
  547. dllminor:=0;
  548. error:=0;
  549. if l>0 then
  550. begin
  551. valint(copy(dllversion,l+1,255),minor,error);
  552. if (error=0) and
  553. (minor>=0) and (minor<=$ffff) then
  554. dllminor:=minor
  555. else
  556. if error=0 then
  557. error:=1;
  558. end;
  559. if l=0 then
  560. l:=256;
  561. dllmajor:=1;
  562. if error=0 then
  563. valint(copy(dllversion,1,l-1),major,error);
  564. if (error=0) and (major>=0) and (major<=$ffff) then
  565. dllmajor:=major
  566. else
  567. if error=0 then
  568. error:=1;
  569. if error<>0 then
  570. Message1(scan_w_wrong_version_ignored,dllversion);
  571. break;
  572. end;
  573. 'w' :
  574. usewindowapi:=true;
  575. '-' :
  576. begin
  577. exclude(initglobalswitches,cs_link_deffile);
  578. usewindowapi:=false;
  579. end;
  580. else
  581. IllegalPara(opt);
  582. end;
  583. inc(j);
  584. end;
  585. end;
  586. 'e' :
  587. exepath:=FixPath(More,true);
  588. 'E' :
  589. begin
  590. if UnsetBool(More, 0) then
  591. exclude(initglobalswitches,cs_link_extern)
  592. else
  593. include(initglobalswitches,cs_link_extern);
  594. end;
  595. 'F' :
  596. begin
  597. c:=more[1];
  598. Delete(more,1,1);
  599. DefaultReplacements(More);
  600. case c of
  601. 'c' :
  602. begin
  603. if not(cpavailable(more)) then
  604. Message1(option_code_page_not_available,more)
  605. else
  606. initsourcecodepage:=more;
  607. end;
  608. 'D' :
  609. utilsdirectory:=FixPath(More,true);
  610. 'e' :
  611. SetRedirectFile(More);
  612. 'E' :
  613. OutputExeDir:=FixPath(More,true);
  614. 'i' :
  615. begin
  616. if ispara then
  617. ParaIncludePath.AddPath(More,false)
  618. else
  619. includesearchpath.AddPath(More,true);
  620. end;
  621. 'g' :
  622. Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
  623. 'l' :
  624. begin
  625. if ispara then
  626. ParaLibraryPath.AddPath(More,false)
  627. else
  628. LibrarySearchPath.AddPath(More,true);
  629. end;
  630. 'L' :
  631. begin
  632. if More<>'' then
  633. ParaDynamicLinker:=More
  634. else
  635. IllegalPara(opt);
  636. end;
  637. 'o' :
  638. begin
  639. if ispara then
  640. ParaObjectPath.AddPath(More,false)
  641. else
  642. ObjectSearchPath.AddPath(More,true);
  643. end;
  644. 'r' :
  645. Msgfilename:=More;
  646. 'u' :
  647. begin
  648. if ispara then
  649. ParaUnitPath.AddPath(More,false)
  650. else
  651. unitsearchpath.AddPath(More,true);
  652. end;
  653. 'U' :
  654. OutputUnitDir:=FixPath(More,true);
  655. else
  656. IllegalPara(opt);
  657. end;
  658. end;
  659. 'g' : begin
  660. if UnsetBool(More, 0) then
  661. begin
  662. exclude(initmoduleswitches,cs_debuginfo);
  663. exclude(initglobalswitches,cs_gdb_dbx);
  664. exclude(initglobalswitches,cs_gdb_gsym);
  665. exclude(initglobalswitches,cs_gdb_heaptrc);
  666. exclude(initglobalswitches,cs_gdb_lineinfo);
  667. exclude(initlocalswitches,cs_checkpointer);
  668. end
  669. else
  670. begin
  671. {$ifdef GDB}
  672. include(initmoduleswitches,cs_debuginfo);
  673. {$else GDB}
  674. Message(option_no_debug_support);
  675. Message(option_no_debug_support_recompile_fpc);
  676. {$endif GDB}
  677. end;
  678. {$ifdef GDB}
  679. if not RelocSectionSetExplicitly then
  680. RelocSection:=false;
  681. j:=1;
  682. while j<=length(more) do
  683. begin
  684. case more[j] of
  685. 'd' :
  686. begin
  687. if UnsetBool(More, j) then
  688. exclude(initglobalswitches,cs_gdb_dbx)
  689. else
  690. include(initglobalswitches,cs_gdb_dbx);
  691. end;
  692. 'g' :
  693. begin
  694. if UnsetBool(More, j) then
  695. exclude(initglobalswitches,cs_gdb_gsym)
  696. else
  697. include(initglobalswitches,cs_gdb_gsym);
  698. end;
  699. 'h' :
  700. begin
  701. if UnsetBool(More, j) then
  702. exclude(initglobalswitches,cs_gdb_heaptrc)
  703. else
  704. include(initglobalswitches,cs_gdb_heaptrc);
  705. end;
  706. 'l' :
  707. begin
  708. if UnsetBool(More, j) then
  709. exclude(initglobalswitches,cs_gdb_lineinfo)
  710. else
  711. include(initglobalswitches,cs_gdb_lineinfo);
  712. end;
  713. 'c' :
  714. begin
  715. if UnsetBool(More, j) then
  716. exclude(initlocalswitches,cs_checkpointer)
  717. else
  718. include(initlocalswitches,cs_checkpointer);
  719. end;
  720. 'v' :
  721. begin
  722. if UnsetBool(More, j) then
  723. exclude(initglobalswitches,cs_gdb_valgrind)
  724. else
  725. include(initglobalswitches,cs_gdb_valgrind);
  726. end;
  727. 'w' :
  728. begin
  729. if UnsetBool(More, j) then
  730. exclude(initglobalswitches,cs_gdb_dwarf)
  731. else
  732. include(initglobalswitches,cs_gdb_dwarf);
  733. end;
  734. else
  735. IllegalPara(opt);
  736. end;
  737. inc(j);
  738. end;
  739. {$endif GDB}
  740. end;
  741. 'h' :
  742. begin
  743. NoPressEnter:=true;
  744. WriteHelpPages;
  745. end;
  746. 'i' :
  747. begin
  748. if More='' then
  749. WriteInfo
  750. else
  751. QuickInfo:=QuickInfo+More;
  752. end;
  753. 'I' :
  754. begin
  755. if ispara then
  756. ParaIncludePath.AddPath(More,false)
  757. else
  758. includesearchpath.AddPath(More,false);
  759. end;
  760. 'k' :
  761. begin
  762. if more<>'' then
  763. ParaLinkOptions:=ParaLinkOptions+' '+More
  764. else
  765. IllegalPara(opt);
  766. end;
  767. 'l' :
  768. DoWriteLogo:=not UnSetBool(more,0);
  769. 'm' :
  770. parapreprocess:=not UnSetBool(more,0);
  771. 'M' :
  772. begin
  773. more:=Upper(more);
  774. if not SetCompileMode(more, true) then
  775. IllegalPara(opt);
  776. end;
  777. 'n' :
  778. begin
  779. if More='' then
  780. disable_configfile:=true
  781. else
  782. IllegalPara(opt);
  783. end;
  784. 'o' :
  785. begin
  786. if More<>'' then
  787. {$IFDEF USE_SYSUTILS}
  788. begin
  789. d := SplitPath(More);
  790. OutputFile := SplitFileName(More);
  791. end
  792. {$ELSE USE_SYSUTILS}
  793. Fsplit(More,d,OutputFile,e)
  794. {$ENDIF USE_SYSUTILS}
  795. else
  796. IllegalPara(opt);
  797. end;
  798. 'p' :
  799. begin
  800. if UnsetBool(More, 0) then
  801. begin
  802. initmoduleswitches:=initmoduleswitches-[cs_profile];
  803. undef_symbol('FPC_PROFILE');
  804. end
  805. else
  806. if Length(More)=0 then
  807. IllegalPara(opt)
  808. else
  809. case more[1] of
  810. 'g' : if UnsetBool(more, 1) then
  811. begin
  812. exclude(initmoduleswitches,cs_profile);
  813. undef_symbol('FPC_PROFILE');
  814. end
  815. else
  816. begin
  817. include(initmoduleswitches,cs_profile);
  818. def_symbol('FPC_PROFILE');
  819. end;
  820. else
  821. IllegalPara(opt);
  822. end;
  823. end;
  824. 'P' : ; { Ignore used by fpc.pp }
  825. 's' :
  826. begin
  827. if UnsetBool(More, 0) then
  828. begin
  829. initglobalswitches:=initglobalswitches-[cs_asm_extern,cs_link_extern];
  830. if more<>'' then
  831. IllegalPara(opt);
  832. end
  833. else
  834. begin
  835. initglobalswitches:=initglobalswitches+[cs_asm_extern,cs_link_extern];
  836. if more='h' then
  837. initglobalswitches:=initglobalswitches-[cs_link_on_target]
  838. else if more='t' then
  839. initglobalswitches:=initglobalswitches+[cs_link_on_target]
  840. else if more='r' then
  841. initglobalswitches:=initglobalswitches+[cs_asm_leave,cs_no_regalloc]
  842. else if more<>'' then
  843. IllegalPara(opt);
  844. end;
  845. end;
  846. 'S' :
  847. begin
  848. if more[1]='I' then
  849. begin
  850. if upper(more)='ICOM' then
  851. initinterfacetype:=it_interfacecom
  852. else if upper(more)='ICORBA' then
  853. initinterfacetype:=it_interfacecorba
  854. else
  855. IllegalPara(opt);
  856. end
  857. else
  858. begin
  859. j:=1;
  860. while j<=length(more) do
  861. begin
  862. case more[j] of
  863. '2' : //an alternative to -Mobjfpc
  864. SetCompileMode('OBJFPC',true);
  865. 'a' :
  866. include(initlocalswitches,cs_do_assertion);
  867. 'c' :
  868. include(initmoduleswitches,cs_support_c_operators);
  869. 'd' : //an alternative to -Mdelphi
  870. SetCompileMode('DELPHI',true);
  871. 'e' :
  872. begin
  873. SetErrorFlags(copy(more,j+1,length(more)));
  874. break;
  875. end;
  876. 'g' :
  877. include(initmoduleswitches,cs_support_goto);
  878. 'h' :
  879. include(initlocalswitches,cs_ansistrings);
  880. 'i' :
  881. include(initmoduleswitches,cs_support_inline);
  882. 'm' :
  883. include(initmoduleswitches,cs_support_macro);
  884. 'o' : //an alternative to -Mtp
  885. SetCompileMode('TP',true);
  886. 'p' : //an alternative to -Mgpc
  887. SetCompileMode('GPC',true);
  888. 's' :
  889. include(initglobalswitches,cs_constructor_name);
  890. 't' :
  891. include(initmoduleswitches,cs_static_keyword);
  892. '-' :
  893. begin
  894. exclude(initglobalswitches,cs_constructor_name);
  895. initlocalswitches:=InitLocalswitches - [cs_do_assertion, cs_ansistrings];
  896. initmoduleswitches:=initmoduleswitches - [cs_support_c_operators, cs_support_goto,
  897. cs_support_inline, cs_support_macro,
  898. cs_static_keyword];
  899. end;
  900. else
  901. IllegalPara(opt);
  902. end;
  903. inc(j);
  904. end;
  905. end;
  906. end;
  907. 'T' :
  908. begin
  909. more:=Upper(More);
  910. if not target_is_set then
  911. begin
  912. { remove old target define }
  913. TargetDefines(false);
  914. { Save assembler if set }
  915. if asm_is_set then
  916. forceasm:=target_asm.id;
  917. { load new target }
  918. if not(set_target_by_string(More)) then
  919. IllegalPara(opt);
  920. { also initialize assembler if not explicitly set }
  921. if asm_is_set then
  922. set_target_asm(forceasm);
  923. { set new define }
  924. TargetDefines(true);
  925. target_is_set:=true;
  926. end
  927. else
  928. if More<>upper(target_info.shortname) then
  929. Message1(option_target_is_already_set,target_info.shortname);
  930. end;
  931. 'u' :
  932. undef_symbol(upper(More));
  933. 'U' :
  934. begin
  935. j:=1;
  936. while j<=length(more) do
  937. begin
  938. case more[j] of
  939. {$ifdef UNITALIASES}
  940. 'a' :
  941. begin
  942. AddUnitAlias(Copy(More,j+1,255));
  943. break;
  944. end;
  945. {$endif UNITALIASES}
  946. 'n' :
  947. exclude(initglobalswitches,cs_check_unit_name);
  948. 'p' :
  949. begin
  950. Message2(option_obsolete_switch_use_new,'-Up','-Fu');
  951. break;
  952. end;
  953. 'r' :
  954. do_release:=true;
  955. 's' :
  956. include(initmoduleswitches,cs_compilesystem);
  957. '-' :
  958. begin
  959. exclude(initmoduleswitches,cs_compilesystem);
  960. exclude(initglobalswitches,cs_check_unit_name);
  961. end;
  962. else
  963. IllegalPara(opt);
  964. end;
  965. inc(j);
  966. end;
  967. end;
  968. 'v' :
  969. begin
  970. if not setverbosity(More) then
  971. IllegalPara(opt);
  972. end;
  973. 'V' : ; { Ignore used by fpc }
  974. 'W' :
  975. begin
  976. j:=1;
  977. while j<=length(More) do
  978. begin
  979. case More[j] of
  980. 'B':
  981. begin
  982. { -WB200000 means set trefered base address
  983. to $200000, but does not change relocsection boolean
  984. this way we can create both relocatble and
  985. non relocatable DLL at a specific base address PM }
  986. if (length(More)>j) then
  987. begin
  988. if DLLImageBase=nil then
  989. DLLImageBase:=StringDup(Copy(More,j+1,255));
  990. end
  991. else
  992. begin
  993. RelocSection:=true;
  994. RelocSectionSetExplicitly:=true;
  995. end;
  996. break;
  997. end;
  998. 'C':
  999. begin
  1000. if UnsetBool(More, j) then
  1001. apptype:=app_gui
  1002. else
  1003. apptype:=app_cui;
  1004. end;
  1005. 'D':
  1006. begin
  1007. UseDeffileForExports:=not UnsetBool(More, j);
  1008. UseDeffileForExportsSetExplicitly:=true;
  1009. end;
  1010. 'F':
  1011. begin
  1012. if UnsetBool(More, j) then
  1013. apptype:=app_cui
  1014. else
  1015. apptype:=app_fs;
  1016. end;
  1017. 'G':
  1018. begin
  1019. if UnsetBool(More, j) then
  1020. apptype:=app_cui
  1021. else
  1022. apptype:=app_gui;
  1023. end;
  1024. 'T':
  1025. begin
  1026. if UnsetBool(More, j) then
  1027. apptype:=app_cui
  1028. else
  1029. apptype:=app_tool;
  1030. end;
  1031. 'N':
  1032. begin
  1033. RelocSection:=UnsetBool(More,j);
  1034. RelocSectionSetExplicitly:=true;
  1035. end;
  1036. 'R':
  1037. begin
  1038. { support -WR+ / -WR- as synonyms to -WR / -WN }
  1039. RelocSection:=not UnsetBool(More,j);
  1040. RelocSectionSetExplicitly:=true;
  1041. end;
  1042. else
  1043. IllegalPara(opt);
  1044. end;
  1045. inc(j);
  1046. end;
  1047. end;
  1048. 'X' :
  1049. begin
  1050. j:=1;
  1051. while j<=length(more) do
  1052. begin
  1053. case More[j] of
  1054. 'i' :
  1055. include(initglobalswitches,cs_link_internal);
  1056. 'm' :
  1057. include(initglobalswitches,cs_link_map);
  1058. 'f' :
  1059. include(initglobalswitches,cs_link_pthread);
  1060. 's' :
  1061. include(initglobalswitches,cs_link_strip);
  1062. 'c' : Cshared:=TRUE;
  1063. 't' :
  1064. include(initglobalswitches,cs_link_staticflag);
  1065. 'D' :
  1066. begin
  1067. def_symbol('FPC_LINK_DYNAMIC');
  1068. undef_symbol('FPC_LINK_SMART');
  1069. undef_symbol('FPC_LINK_STATIC');
  1070. exclude(initglobalswitches,cs_link_static);
  1071. exclude(initglobalswitches,cs_link_smart);
  1072. include(initglobalswitches,cs_link_shared);
  1073. LinkTypeSetExplicitly:=true;
  1074. end;
  1075. 'd' : Dontlinkstdlibpath:=TRUE;
  1076. 'P' : Begin
  1077. utilsprefix:=Copy(more,2,length(More)-1);
  1078. More:='';
  1079. End;
  1080. 'r' : Begin
  1081. rlinkpath:=Copy(more,2,length(More)-1);
  1082. More:='';
  1083. end;
  1084. 'S' :
  1085. begin
  1086. def_symbol('FPC_LINK_STATIC');
  1087. undef_symbol('FPC_LINK_SMART');
  1088. undef_symbol('FPC_LINK_DYNAMIC');
  1089. include(initglobalswitches,cs_link_static);
  1090. exclude(initglobalswitches,cs_link_smart);
  1091. exclude(initglobalswitches,cs_link_shared);
  1092. LinkTypeSetExplicitly:=true;
  1093. end;
  1094. 'X' :
  1095. begin
  1096. def_symbol('FPC_LINK_SMART');
  1097. undef_symbol('FPC_LINK_STATIC');
  1098. undef_symbol('FPC_LINK_DYNAMIC');
  1099. exclude(initglobalswitches,cs_link_static);
  1100. include(initglobalswitches,cs_link_smart);
  1101. exclude(initglobalswitches,cs_link_shared);
  1102. LinkTypeSetExplicitly:=true;
  1103. end;
  1104. '-' :
  1105. begin
  1106. exclude(initglobalswitches,cs_link_staticflag);
  1107. exclude(initglobalswitches,cs_link_strip);
  1108. exclude(initglobalswitches,cs_link_map);
  1109. set_default_link_type;
  1110. end;
  1111. else
  1112. IllegalPara(opt);
  1113. end;
  1114. inc(j);
  1115. end;
  1116. end;
  1117. { give processor specific options a chance }
  1118. else
  1119. interpret_proc_specific_options(opt);
  1120. end;
  1121. end;
  1122. '@' :
  1123. begin
  1124. Message(option_no_nested_response_file);
  1125. StopOptions(1);
  1126. end;
  1127. else
  1128. begin
  1129. if (length(param_file)<>0) then
  1130. Message(option_only_one_source_support);
  1131. param_file:=opt;
  1132. Message1(option_found_file,opt);
  1133. end;
  1134. end;
  1135. end;
  1136. procedure Toption.Interpret_file(const filename : string);
  1137. procedure RemoveSep(var fn:string);
  1138. var
  1139. i : longint;
  1140. begin
  1141. i:=0;
  1142. while (i<length(fn)) and (fn[i+1] in [',',' ',#9]) do
  1143. inc(i);
  1144. Delete(fn,1,i);
  1145. i:=length(fn);
  1146. while (i>0) and (fn[i] in [',',' ',#9]) do
  1147. dec(i);
  1148. fn:=copy(fn,1,i);
  1149. end;
  1150. function GetName(var fn:string):string;
  1151. var
  1152. i : longint;
  1153. begin
  1154. i:=0;
  1155. while (i<length(fn)) and (fn[i+1] in ['a'..'z','A'..'Z','0'..'9','_','-']) do
  1156. inc(i);
  1157. GetName:=Copy(fn,1,i);
  1158. Delete(fn,1,i);
  1159. end;
  1160. const
  1161. maxlevel=16;
  1162. var
  1163. f : text;
  1164. s,
  1165. opts : string;
  1166. skip : array[0..maxlevel-1] of boolean;
  1167. level : longint;
  1168. option_read : boolean;
  1169. begin
  1170. { avoid infinite loop }
  1171. Inc(FileLevel);
  1172. Option_read:=false;
  1173. If FileLevel>MaxLevel then
  1174. Message(option_too_many_cfg_files);
  1175. { open file }
  1176. Message1(option_using_file,filename);
  1177. assign(f,filename);
  1178. {$I-}
  1179. reset(f);
  1180. {$I+}
  1181. if ioresult<>0 then
  1182. begin
  1183. Message1(option_unable_open_file,filename);
  1184. exit;
  1185. end;
  1186. Message1(option_start_reading_configfile,filename);
  1187. fillchar(skip,sizeof(skip),0);
  1188. level:=0;
  1189. while not eof(f) do
  1190. begin
  1191. readln(f,opts);
  1192. RemoveSep(opts);
  1193. if (opts<>'') and (opts[1]<>';') then
  1194. begin
  1195. if opts[1]='#' then
  1196. begin
  1197. Message1(option_interpreting_file_option,opts);
  1198. Delete(opts,1,1);
  1199. s:=upper(GetName(opts));
  1200. if (s='SECTION') then
  1201. begin
  1202. RemoveSep(opts);
  1203. s:=upper(GetName(opts));
  1204. if level=0 then
  1205. skip[level]:=not (check_symbol(s) or (s='COMMON'));
  1206. end
  1207. else
  1208. if (s='IFDEF') then
  1209. begin
  1210. RemoveSep(opts);
  1211. if Level>=maxlevel then
  1212. begin
  1213. Message(option_too_many_ifdef);
  1214. stopOptions(1);
  1215. end;
  1216. inc(Level);
  1217. skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
  1218. end
  1219. else
  1220. if (s='IFNDEF') then
  1221. begin
  1222. RemoveSep(opts);
  1223. if Level>=maxlevel then
  1224. begin
  1225. Message(option_too_many_ifdef);
  1226. stopOptions(1);
  1227. end;
  1228. inc(Level);
  1229. skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
  1230. end
  1231. else
  1232. if (s='ELSE') then
  1233. skip[level]:=skip[level-1] or (not skip[level])
  1234. else
  1235. if (s='ENDIF') then
  1236. begin
  1237. skip[level]:=false;
  1238. if Level=0 then
  1239. begin
  1240. Message(option_too_many_endif);
  1241. stopOptions(1);
  1242. end;
  1243. dec(level);
  1244. end
  1245. else
  1246. if (not skip[level]) then
  1247. begin
  1248. if (s='DEFINE') then
  1249. begin
  1250. RemoveSep(opts);
  1251. def_symbol(upper(GetName(opts)));
  1252. end
  1253. else
  1254. if (s='UNDEF') then
  1255. begin
  1256. RemoveSep(opts);
  1257. undef_symbol(upper(GetName(opts)));
  1258. end
  1259. else
  1260. if (s='WRITE') then
  1261. begin
  1262. Delete(opts,1,1);
  1263. WriteLn(opts);
  1264. end
  1265. else
  1266. if (s='INCLUDE') then
  1267. begin
  1268. Delete(opts,1,1);
  1269. Interpret_file(opts);
  1270. end;
  1271. end;
  1272. end
  1273. else
  1274. begin
  1275. if (opts[1]='-') or (opts[1]='@') then
  1276. begin
  1277. if (not skip[level]) then
  1278. interpret_option(opts,false);
  1279. Option_read:=true;
  1280. end
  1281. else
  1282. Message1(option_illegal_para,opts);
  1283. end;
  1284. end;
  1285. end;
  1286. if Level>0 then
  1287. Message(option_too_less_endif);
  1288. if Not Option_read then
  1289. Message1(option_no_option_found,filename)
  1290. else
  1291. Message1(option_end_reading_configfile,filename);
  1292. Close(f);
  1293. Dec(FileLevel);
  1294. end;
  1295. procedure Toption.Interpret_envvar(const envname : string);
  1296. var
  1297. argstart,
  1298. env,
  1299. pc : pchar;
  1300. arglen : longint;
  1301. quote : set of char;
  1302. hs : string;
  1303. begin
  1304. Message1(option_using_env,envname);
  1305. env:=GetEnvPChar(envname);
  1306. pc:=env;
  1307. if assigned(pc) then
  1308. begin
  1309. repeat
  1310. { skip leading spaces }
  1311. while pc^ in [' ',#9,#13] do
  1312. inc(pc);
  1313. case pc^ of
  1314. #0 :
  1315. break;
  1316. '"' :
  1317. begin
  1318. quote:=['"'];
  1319. inc(pc);
  1320. end;
  1321. '''' :
  1322. begin
  1323. quote:=[''''];
  1324. inc(pc);
  1325. end;
  1326. else
  1327. quote:=[' ',#9,#13];
  1328. end;
  1329. { scan until the end of the argument }
  1330. argstart:=pc;
  1331. while (pc^<>#0) and not(pc^ in quote) do
  1332. inc(pc);
  1333. { create argument }
  1334. arglen:=pc-argstart;
  1335. hs[0]:=chr(arglen);
  1336. move(argstart^,hs[1],arglen);
  1337. interpret_option(hs,true);
  1338. { skip quote }
  1339. if pc^ in quote then
  1340. inc(pc);
  1341. until false;
  1342. end
  1343. else
  1344. Message1(option_no_option_found,'(env) '+envname);
  1345. FreeEnvPChar(env);
  1346. end;
  1347. procedure toption.read_parameters;
  1348. var
  1349. opts : string;
  1350. paramindex : longint;
  1351. begin
  1352. paramindex:=0;
  1353. while paramindex<paramcount do
  1354. begin
  1355. inc(paramindex);
  1356. opts:=system.paramstr(paramindex);
  1357. case opts[1] of
  1358. '@' :
  1359. if not firstpass then
  1360. begin
  1361. Delete(opts,1,1);
  1362. Message1(option_reading_further_from,opts);
  1363. interpret_file(opts);
  1364. end;
  1365. '!' :
  1366. if not firstpass then
  1367. begin
  1368. Delete(opts,1,1);
  1369. Message1(option_reading_further_from,'(env) '+opts);
  1370. interpret_envvar(opts);
  1371. end;
  1372. else
  1373. interpret_option(opts,true);
  1374. end;
  1375. end;
  1376. end;
  1377. procedure toption.parsecmd(cmd:string);
  1378. var
  1379. i,ps : longint;
  1380. opts : string;
  1381. begin
  1382. while (cmd<>'') do
  1383. begin
  1384. while cmd[1]=' ' do
  1385. delete(cmd,1,1);
  1386. i:=pos(' ',cmd);
  1387. if i=0 then
  1388. i:=256;
  1389. opts:=Copy(cmd,1,i-1);
  1390. Delete(cmd,1,i);
  1391. case opts[1] of
  1392. '@' :
  1393. if not firstpass then
  1394. begin
  1395. Delete(opts,1,1);
  1396. Message1(option_reading_further_from,opts);
  1397. interpret_file(opts);
  1398. end;
  1399. '!' :
  1400. if not firstpass then
  1401. begin
  1402. Delete(opts,1,1);
  1403. Message1(option_reading_further_from,'(env) '+opts);
  1404. interpret_envvar(opts);
  1405. end;
  1406. '"' :
  1407. begin
  1408. Delete(opts,1,1);
  1409. ps:=pos('"',cmd);
  1410. if (i<>256) and (ps>0) then
  1411. begin
  1412. opts:=opts + ' '+ copy(cmd,1,ps-1);
  1413. cmd:=copy(cmd,ps+1,255);
  1414. end;
  1415. interpret_option(opts,true);
  1416. end;
  1417. else
  1418. interpret_option(opts,true);
  1419. end;
  1420. end;
  1421. end;
  1422. procedure toption.writequickinfo;
  1423. var
  1424. s : string;
  1425. i : longint;
  1426. procedure addinfo(const hs:string);
  1427. begin
  1428. if s<>'' then
  1429. s:=s+' '+hs
  1430. else
  1431. s:=hs;
  1432. end;
  1433. begin
  1434. s:='';
  1435. i:=0;
  1436. while (i<length(quickinfo)) do
  1437. begin
  1438. inc(i);
  1439. case quickinfo[i] of
  1440. 'S' :
  1441. begin
  1442. inc(i);
  1443. case quickinfo[i] of
  1444. 'O' :
  1445. addinfo(lower(source_info.shortname));
  1446. 'P' :
  1447. addinfo(source_cpu_string);
  1448. else
  1449. IllegalPara('-i'+QuickInfo);
  1450. end;
  1451. end;
  1452. 'T' :
  1453. begin
  1454. inc(i);
  1455. case quickinfo[i] of
  1456. 'O' :
  1457. addinfo(lower(target_info.shortname));
  1458. 'P' :
  1459. AddInfo(target_cpu_string);
  1460. else
  1461. IllegalPara('-i'+QuickInfo);
  1462. end;
  1463. end;
  1464. 'V' :
  1465. AddInfo(version_string);
  1466. 'D' :
  1467. AddInfo(date_string);
  1468. '_' :
  1469. ;
  1470. else
  1471. IllegalPara('-i'+QuickInfo);
  1472. end;
  1473. end;
  1474. if s<>'' then
  1475. begin
  1476. writeln(s);
  1477. stopoptions(0);
  1478. end;
  1479. end;
  1480. procedure TOption.TargetDefines(def:boolean);
  1481. var
  1482. s : string;
  1483. i : integer;
  1484. begin
  1485. if def then
  1486. def_symbol(upper(target_info.shortname))
  1487. else
  1488. undef_symbol(upper(target_info.shortname));
  1489. s:=target_info.extradefines;
  1490. while (s<>'') do
  1491. begin
  1492. i:=pos(';',s);
  1493. if i=0 then
  1494. i:=length(s)+1;
  1495. if def then
  1496. def_symbol(Copy(s,1,i-1))
  1497. else
  1498. undef_symbol(Copy(s,1,i-1));
  1499. delete(s,1,i);
  1500. end;
  1501. end;
  1502. constructor TOption.create;
  1503. begin
  1504. DoWriteLogo:=false;
  1505. NoPressEnter:=false;
  1506. FirstPass:=false;
  1507. FileLevel:=0;
  1508. Quickinfo:='';
  1509. ParaIncludePath:=TSearchPathList.Create;
  1510. ParaObjectPath:=TSearchPathList.Create;
  1511. ParaUnitPath:=TSearchPathList.Create;
  1512. ParaLibraryPath:=TSearchPathList.Create;
  1513. FillChar(ParaAlignment,sizeof(ParaAlignment),0);
  1514. end;
  1515. destructor TOption.destroy;
  1516. begin
  1517. ParaIncludePath.Free;
  1518. ParaObjectPath.Free;
  1519. ParaUnitPath.Free;
  1520. ParaLibraryPath.Free;
  1521. end;
  1522. {****************************************************************************
  1523. Callable Routines
  1524. ****************************************************************************}
  1525. function check_configfile(const fn:string;var foundfn:string):boolean;
  1526. function CfgFileExists(const fn:string):boolean;
  1527. begin
  1528. Comment(V_Tried,'Configfile search: '+fn);
  1529. CfgFileExists:=FileExists(fn);
  1530. end;
  1531. var
  1532. configpath : pathstr;
  1533. begin
  1534. foundfn:=fn;
  1535. check_configfile:=true;
  1536. { retrieve configpath }
  1537. {$IFDEF USE_SYSUTILS}
  1538. configpath:=FixPath(GetEnvironmentVariable('PPC_CONFIG_PATH'),false);
  1539. {$ELSE USE_SYSUTILS}
  1540. configpath:=FixPath(dos.getenv('PPC_CONFIG_PATH'),false);
  1541. {$ENDIF USE_SYSUTILS}
  1542. {$ifdef Unix}
  1543. if configpath='' then
  1544. configpath:='/etc/';
  1545. {$endif}
  1546. {
  1547. Order to read configuration file :
  1548. try reading fpc.cfg in :
  1549. 1 - current dir
  1550. 2 - configpath
  1551. 3 - compiler path
  1552. }
  1553. if not FileExists(fn) then
  1554. begin
  1555. {$ifdef Unix}
  1556. {$IFDEF USE_SYSUTILS}
  1557. if (GetEnvironmentVariable('HOME')<>'') and CfgFileExists(FixPath(GetEnvironmentVariable('HOME'),false)+'.'+fn) then
  1558. foundfn:=FixPath(GetEnvironmentVariable('HOME'),false)+'.'+fn
  1559. {$ELSE USE_SYSUTILS}
  1560. if (dos.getenv('HOME')<>'') and CfgFileExists(FixPath(dos.getenv('HOME'),false)+'.'+fn) then
  1561. foundfn:=FixPath(dos.getenv('HOME'),false)+'.'+fn
  1562. {$ENDIF USE_SYSUTILS}
  1563. else
  1564. {$endif}
  1565. if CfgFileExists(configpath+fn) then
  1566. foundfn:=configpath+fn
  1567. else
  1568. {$ifndef Unix}
  1569. if CfgFileExists(exepath+fn) then
  1570. foundfn:=exepath+fn
  1571. else
  1572. {$endif}
  1573. check_configfile:=false;
  1574. end;
  1575. end;
  1576. procedure read_arguments(cmd:string);
  1577. begin
  1578. option:=coption.create;
  1579. disable_configfile:=false;
  1580. { default defines }
  1581. def_symbol(upper(target_info.shortname));
  1582. def_symbol('FPC');
  1583. def_symbol('VER'+version_nr);
  1584. def_symbol('VER'+version_nr+'_'+release_nr);
  1585. def_symbol('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
  1586. { Temporary defines, until things settle down }
  1587. def_symbol('HASWIDECHAR');
  1588. def_symbol('HASWIDESTRING');
  1589. def_symbol('HASOUT');
  1590. def_symbol('HASGLOBALPROPERTY');
  1591. def_symbol('FPC_HASPREFETCH');
  1592. def_symbol('FPC_LINEEND_IN_TEXTREC');
  1593. def_symbol('FPC_ALIGNSRTTI');
  1594. {$ifdef i386}
  1595. def_symbol('HASINTF');
  1596. def_symbol('HASVARIANT');
  1597. {$endif i386}
  1598. {$ifdef x86_64}
  1599. def_symbol('HASINTF');
  1600. def_symbol('HASVARIANT');
  1601. {$endif x86_64}
  1602. {$ifdef powerpc}
  1603. def_symbol('HASINTF');
  1604. def_symbol('HASVARIANT');
  1605. def_symbol('FPC_MTFSB0_CORRECTED');
  1606. {$endif powerpc}
  1607. {$ifdef arm}
  1608. def_symbol('HASINTF');
  1609. def_symbol('HASVARIANT');
  1610. {$endif arm}
  1611. {$ifdef sparc}
  1612. def_symbol('HASINTF');
  1613. def_symbol('HASVARIANT');
  1614. {$endif sparc}
  1615. def_symbol('INTERNSETLENGTH');
  1616. def_symbol('INTERNLENGTH');
  1617. def_symbol('INTERNCOPY');
  1618. def_symbol('INT64FUNCRESOK');
  1619. def_symbol('HAS_ADDR_STACK_ON_STACK');
  1620. def_symbol('NOBOUNDCHECK');
  1621. def_symbol('HASCOMPILERPROC');
  1622. def_symbol('VALUEGETMEM');
  1623. def_symbol('VALUEFREEMEM');
  1624. def_symbol('HASCURRENCY');
  1625. def_symbol('HASTHREADVAR');
  1626. def_symbol('HAS_GENERICCONSTRUCTOR');
  1627. def_symbol('NOCLASSHELPERS');
  1628. if pocall_default = pocall_register then
  1629. def_symbol('REGCALL');
  1630. def_symbol('DECRREFNOTNIL');
  1631. def_symbol('HAS_INTERNAL_INTTYPES');
  1632. def_symbol('STR_USES_VALINT');
  1633. def_symbol('NOSAVEREGISTERS');
  1634. { using a case is pretty useless here (FK) }
  1635. { some stuff for TP compatibility }
  1636. {$ifdef i386}
  1637. def_symbol('CPU86');
  1638. def_symbol('CPU87');
  1639. {$endif}
  1640. {$ifdef m68k}
  1641. def_symbol('CPU68');
  1642. {$endif}
  1643. { new processor stuff }
  1644. {$ifdef i386}
  1645. def_symbol('CPUI386');
  1646. def_symbol('CPU32');
  1647. def_symbol('FPC_HAS_TYPE_EXTENDED');
  1648. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1649. def_symbol('FPC_HAS_TYPE_SINGLE');
  1650. {$endif}
  1651. {$ifdef m68k}
  1652. def_symbol('CPU68K');
  1653. def_symbol('CPUM68K');
  1654. def_symbol('CPU32');
  1655. def_symbol('FPC_CURRENCY_IS_INT64');
  1656. def_symbol('FPC_COMP_IS_INT64');
  1657. {$endif}
  1658. {$ifdef ALPHA}
  1659. def_symbol('CPUALPHA');
  1660. def_symbol('CPU64');
  1661. {$endif}
  1662. {$ifdef powerpc}
  1663. def_symbol('CPUPOWERPC');
  1664. def_symbol('CPUPOWERPC32');
  1665. def_symbol('CPU32');
  1666. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1667. def_symbol('FPC_HAS_TYPE_SINGLE');
  1668. def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
  1669. def_symbol('FPC_CURRENCY_IS_INT64');
  1670. def_symbol('FPC_COMP_IS_INT64');
  1671. {$endif}
  1672. {$ifdef iA64}
  1673. def_symbol('CPUIA64');
  1674. def_symbol('CPU64');
  1675. {$endif}
  1676. {$ifdef x86_64}
  1677. def_symbol('CPUX86_64');
  1678. def_symbol('CPUAMD64');
  1679. def_symbol('CPU64');
  1680. { not supported for now, afaik (FK)
  1681. def_symbol('FPC_HAS_TYPE_FLOAT128'); }
  1682. def_symbol('FPC_HAS_TYPE_EXTENDED');
  1683. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1684. def_symbol('FPC_HAS_TYPE_SINGLE');
  1685. {$endif}
  1686. {$ifdef sparc}
  1687. def_symbol('CPUSPARC');
  1688. def_symbol('CPUSPARC32');
  1689. def_symbol('CPU32');
  1690. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1691. def_symbol('FPC_HAS_TYPE_SINGLE');
  1692. def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
  1693. def_symbol('FPC_CURRENCY_IS_INT64');
  1694. def_symbol('FPC_COMP_IS_INT64');
  1695. def_symbol('FPC_REQUIRES_PROPER_ALIGNMENT');
  1696. {$endif}
  1697. {$ifdef vis}
  1698. def_symbol('CPUVIS');
  1699. def_symbol('CPU32');
  1700. {$endif}
  1701. {$ifdef arm}
  1702. def_symbol('CPUARM');
  1703. def_symbol('CPU32');
  1704. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1705. def_symbol('FPC_HAS_TYPE_SINGLE');
  1706. def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
  1707. def_symbol('FPC_CURRENCY_IS_INT64');
  1708. def_symbol('FPC_COMP_IS_INT64');
  1709. def_symbol('FPC_REQUIRES_PROPER_ALIGNMENT');
  1710. {$endif arm}
  1711. { get default messagefile }
  1712. {$IFDEF USE_SYSUTILS}
  1713. msgfilename:=GetEnvironmentVariable('PPC_ERROR_FILE');
  1714. {$ELSE USE_SYSUTILS}
  1715. msgfilename:=dos.getenv('PPC_ERROR_FILE');
  1716. {$ENDIF USE_SYSUTILS}
  1717. { default configfile can be specified on the commandline,
  1718. remove it first }
  1719. if (cmd<>'') and (cmd[1]='[') then
  1720. begin
  1721. ppccfg:=Copy(cmd,2,pos(']',cmd)-2);
  1722. Delete(cmd,1,pos(']',cmd));
  1723. end
  1724. else
  1725. begin
  1726. ppccfg:='fpc.cfg';
  1727. ppcaltcfg:='ppc386.cfg';
  1728. end;
  1729. { read the parameters quick, only -i -v -T }
  1730. option.firstpass:=true;
  1731. if cmd<>'' then
  1732. option.parsecmd(cmd)
  1733. else
  1734. begin
  1735. option.read_parameters;
  1736. { Write only quickinfo }
  1737. if option.quickinfo<>'' then
  1738. option.writequickinfo;
  1739. end;
  1740. option.firstpass:=false;
  1741. { read configuration file }
  1742. if (not disable_configfile) and
  1743. (ppccfg<>'') then
  1744. begin
  1745. read_configfile:=check_configfile(ppccfg,ppccfg);
  1746. { Maybe alternative configfile ? }
  1747. if (not read_configfile) and
  1748. (ppcaltcfg<>'') then
  1749. read_configfile:=check_configfile(ppcaltcfg,ppccfg);
  1750. end
  1751. else
  1752. read_configfile := false;
  1753. { Read commandline and configfile }
  1754. target_is_set:=false;
  1755. asm_is_set:=false;
  1756. param_file:='';
  1757. { read configfile }
  1758. if read_configfile then
  1759. option.interpret_file(ppccfg);
  1760. { read parameters again to override config file }
  1761. if cmd<>'' then
  1762. option.parsecmd(cmd)
  1763. else
  1764. begin
  1765. option.read_parameters;
  1766. { Write only quickinfo }
  1767. if option.quickinfo<>'' then
  1768. option.writequickinfo;
  1769. end;
  1770. { Write help pages }
  1771. if (cmd='') and (paramcount=0) then
  1772. Option.WriteHelpPages;
  1773. { Stop if errors in options }
  1774. if ErrorCount>0 then
  1775. StopOptions(1);
  1776. { Non-core target defines }
  1777. Option.TargetDefines(true);
  1778. { endian define }
  1779. case target_info.endian of
  1780. endian_little :
  1781. begin
  1782. def_symbol('ENDIAN_LITTLE');
  1783. def_symbol('FPC_LITTLE_ENDIAN');
  1784. end;
  1785. endian_big :
  1786. begin
  1787. def_symbol('ENDIAN_BIG');
  1788. def_symbol('FPC_BIG_ENDIAN');
  1789. end;
  1790. end;
  1791. { abi define }
  1792. case target_info.abi of
  1793. abi_powerpc_sysv :
  1794. def_symbol('FPC_ABI_SYSV');
  1795. abi_powerpc_aix :
  1796. def_symbol('FPC_ABI_AIX');
  1797. end;
  1798. {$ifdef m68k}
  1799. if initoptprocessor=MC68020 then
  1800. def_symbol('CPUM68020');
  1801. {$endif m68k}
  1802. { write logo if set }
  1803. if option.DoWriteLogo then
  1804. option.WriteLogo;
  1805. { Check file to compile }
  1806. if param_file='' then
  1807. begin
  1808. Message(option_no_source_found);
  1809. StopOptions(1);
  1810. end;
  1811. {$ifndef Unix}
  1812. param_file:=FixFileName(param_file);
  1813. {$endif}
  1814. {$IFDEF USE_SYSUTILS}
  1815. inputdir := SplitPath(param_file);
  1816. inputfile := SplitName(param_file);
  1817. inputextension := SplitExtension(param_file);
  1818. {$ELSE USE_SYSUTILS}
  1819. fsplit(param_file,inputdir,inputfile,inputextension);
  1820. {$ENDIF USE_SYSUTILS}
  1821. if inputextension='' then
  1822. begin
  1823. if FileExists(inputdir+inputfile+target_info.sourceext) then
  1824. inputextension:=target_info.sourceext
  1825. else if FileExists(inputdir+inputfile+target_info.pasext) then
  1826. inputextension:=target_info.pasext
  1827. else if (m_mac in aktmodeswitches) and FileExists(inputdir+inputfile+'.p') then
  1828. inputextension:='.p';
  1829. end;
  1830. { Check output dir }
  1831. if (OutputExeDir<>'') and
  1832. not PathExists(OutputExeDir) then
  1833. begin
  1834. Message1(general_e_path_does_not_exist,OutputExeDir);
  1835. StopOptions(1);
  1836. end;
  1837. { Add paths specified with parameters to the searchpaths }
  1838. UnitSearchPath.AddList(option.ParaUnitPath,true);
  1839. ObjectSearchPath.AddList(option.ParaObjectPath,true);
  1840. IncludeSearchPath.AddList(option.ParaIncludePath,true);
  1841. LibrarySearchPath.AddList(option.ParaLibraryPath,true);
  1842. { add unit environment and exepath to the unit search path }
  1843. if inputdir<>'' then
  1844. Unitsearchpath.AddPath(inputdir,true);
  1845. if not disable_configfile then
  1846. begin
  1847. {$IFDEF USE_SYSUTILS}
  1848. UnitSearchPath.AddPath(GetEnvironmentVariable(target_info.unit_env),false);
  1849. {$ELSE USE_SYSUTILS}
  1850. UnitSearchPath.AddPath(dos.getenv(target_info.unit_env),false);
  1851. {$ENDIF USE_SYSUTILS}
  1852. end;
  1853. {$ifdef Unix}
  1854. {$IFDEF USE_SYSUTILS}
  1855. fpcdir:=FixPath(GetEnvironmentVariable('FPCDIR'),false);
  1856. {$ELSE USE_SYSUTILS}
  1857. fpcdir:=FixPath(getenv('FPCDIR'),false);
  1858. {$ENDIF USE_SYSUTILS}
  1859. if fpcdir='' then
  1860. begin
  1861. if source_info.cpu<>target_info.cpu then
  1862. begin
  1863. if PathExists('/usr/local/lib/fpc/'+version_string+'/cross/'+cpu2str[target_info.cpu]+'-'+target_info.shortname) then
  1864. fpcdir:='/usr/local/lib/fpc/'+version_string+'/cross/'+cpu2str[target_info.cpu]+'-'+target_info.shortname+'/'
  1865. else
  1866. fpcdir:='/usr/lib/fpc/'+version_string+'/cross/'+cpu2str[target_info.cpu]+'-'+target_info.shortname+'/';
  1867. end
  1868. else
  1869. begin
  1870. if PathExists('/usr/local/lib/fpc/'+version_string) then
  1871. fpcdir:='/usr/local/lib/fpc/'+version_string+'/'
  1872. else
  1873. fpcdir:='/usr/lib/fpc/'+version_string+'/';
  1874. end;
  1875. end;
  1876. {$else}
  1877. {$IFDEF USE_SYSUTILS}
  1878. fpcdir:=FixPath(GetEnvironmentVariable('FPCDIR'),false);
  1879. {$ELSE USE_SYSUTILS}
  1880. fpcdir:=FixPath(getenv('FPCDIR'),false);
  1881. {$ENDIF USE_SYSUTILS}
  1882. if fpcdir='' then
  1883. begin
  1884. fpcdir:=ExePath+'../';
  1885. if not(PathExists(fpcdir+'/units')) and
  1886. not(PathExists(fpcdir+'/rtl')) then
  1887. fpcdir:=fpcdir+'../';
  1888. end;
  1889. {$endif}
  1890. { first try development RTL, else use the default installation path }
  1891. if not disable_configfile then
  1892. begin
  1893. if source_info.cpu<>target_info.cpu then
  1894. begin
  1895. if PathExists(FpcDir+'rtl/'+lower(target_info.shortname)) then
  1896. UnitSearchPath.AddPath(FpcDir+'rtl/'+lower(target_info.shortname),false)
  1897. else
  1898. begin
  1899. UnitSearchPath.AddPath(FpcDir+'units/',false);
  1900. UnitSearchPath.AddPath(FpcDir+'units/rtl',false);
  1901. end;
  1902. end
  1903. else
  1904. begin
  1905. if PathExists(FpcDir+'rtl/'+lower(target_info.shortname)) then
  1906. UnitSearchPath.AddPath(FpcDir+'rtl/'+lower(target_info.shortname),false)
  1907. else
  1908. begin
  1909. UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.shortname),false);
  1910. UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.shortname)+'/rtl',false);
  1911. end;
  1912. end;
  1913. end;
  1914. { Add exepath if the exe is not in the current dir, because that is always searched already.
  1915. Do not add it when linking on the target because then we can maybe already find
  1916. .o files that are not for the target }
  1917. if (ExePath<>GetCurrentDir) and
  1918. not(cs_link_on_target in initglobalswitches) then
  1919. UnitSearchPath.AddPath(ExePath,false);
  1920. { Add unit dir to the object and library path }
  1921. objectsearchpath.AddList(unitsearchpath,false);
  1922. librarysearchpath.AddList(unitsearchpath,false);
  1923. { switch assembler if it's binary and we got -a on the cmdline }
  1924. if (cs_asm_leave in initglobalswitches) and
  1925. (af_outputbinary in target_asm.flags) then
  1926. begin
  1927. Message(option_switch_bin_to_src_assembler);
  1928. set_target_asm(target_info.assemextern);
  1929. end;
  1930. if (target_asm.supported_target <> system_any) and
  1931. (target_asm.supported_target <> target_info.system) then
  1932. begin
  1933. Message2(option_incompatible_asm,target_asm.idtxt,target_info.name);
  1934. set_target_asm(target_info.assemextern);
  1935. Message1(option_asm_forced,target_asm.idtxt);
  1936. end;
  1937. { turn off stripping if compiling with debuginfo or profile }
  1938. if (cs_debuginfo in initmoduleswitches) or
  1939. (cs_profile in initmoduleswitches) then
  1940. exclude(initglobalswitches,cs_link_strip);
  1941. {$ifdef x86_64}
  1942. {$warning HACK: turn off smartlinking}
  1943. exclude(initmoduleswitches,cs_create_smart);
  1944. {$endif}
  1945. if not LinkTypeSetExplicitly then
  1946. set_default_link_type;
  1947. { Default alignment settings,
  1948. 1. load the defaults for the target
  1949. 2. override with generic optimizer setting (little size)
  1950. 3. override with the user specified -Oa }
  1951. UpdateAlignment(initalignment,target_info.alignment);
  1952. if (cs_littlesize in aktglobalswitches) then
  1953. begin
  1954. initalignment.procalign:=1;
  1955. initalignment.jumpalign:=1;
  1956. initalignment.loopalign:=1;
  1957. end;
  1958. UpdateAlignment(initalignment,option.paraalignment);
  1959. option.free;
  1960. Option:=nil;
  1961. end;
  1962. initialization
  1963. coption:=toption;
  1964. finalization
  1965. if assigned(option) then
  1966. option.free;
  1967. end.
  1968. {
  1969. $Log$
  1970. Revision 1.149 2004-10-25 15:38:41 peter
  1971. * heap and heapsize removed
  1972. * checkpointer fixes
  1973. Revision 1.148 2004/10/24 20:01:08 peter
  1974. * remove saveregister calling convention
  1975. Revision 1.147 2004/10/15 09:14:17 mazen
  1976. - remove $IFDEF DELPHI and related code
  1977. - remove $IFDEF FPCPROCVAR and related code
  1978. Revision 1.146 2004/10/14 14:03:02 mazen
  1979. * Merge is complete for this file, cycles !
  1980. Revision 1.145 2004/10/05 20:21:02 florian
  1981. * bootstrapping with rtti alignment fixed
  1982. Revision 1.144 2004/09/21 23:33:43 hajny
  1983. * better PathExists, fix for too long command line, correction of message
  1984. Revision 1.143 2004/09/21 17:25:12 peter
  1985. * paraloc branch merged
  1986. Revision 1.142 2004/09/16 16:31:53 peter
  1987. * Use FExpand on paths passed to compiler
  1988. Revision 1.141 2004/09/10 21:00:23 jonas
  1989. * exit with exit code 0 instead of 1 after writing out quick options
  1990. (such as -iV)
  1991. Revision 1.140 2004/09/08 11:23:31 michael
  1992. + Check if outputdir exists, Fix exitcode when displaying help pages
  1993. Revision 1.139.4.1 2004/09/19 20:53:33 peter
  1994. * fixed compile without gdb
  1995. Revision 1.139 2004/08/27 21:59:26 peter
  1996. browser disabled
  1997. uf_local_symtable ppu flag when a localsymtable is stored
  1998. Revision 1.138 2004/07/05 21:26:28 olle
  1999. + allow fileextension .p, in mode macpas
  2000. Revision 1.137 2004/07/04 12:24:04 jonas
  2001. * fixed "-g-l" (and other "-g-*" combinations)
  2002. Revision 1.136 2004/06/20 08:55:30 florian
  2003. * logs truncated
  2004. Revision 1.135 2004/06/16 20:07:09 florian
  2005. * dwarf branch merged
  2006. Revision 1.134 2004/05/06 20:30:51 florian
  2007. * m68k compiler compilation fixed
  2008. Revision 1.133.2.10 2004/05/18 20:24:03 florian
  2009. * fixed crash with unknown symbols
  2010. Revision 1.133.2.9 2004/05/13 20:10:38 florian
  2011. * released variant and interface support
  2012. Revision 1.133.2.8 2004/05/03 14:59:57 peter
  2013. * no dlltool needed for win32 linking executables
  2014. }