options.pas 63 KB

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