~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to compiler/options.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{
2
 
    $Id: options.pas,v 1.175 2005/05/05 14:53:55 florian Exp $
3
2
    Copyright (c) 1998-2002 by Florian Klaempfl and Peter Vreman
4
3
 
5
4
    Reads command line options and config files
27
26
interface
28
27
 
29
28
uses
30
 
  globtype,globals,verbose,systems,cpuinfo;
 
29
  CClasses,globtype,globals,verbose,systems,cpuinfo;
31
30
 
32
 
type
 
31
Type
33
32
  TOption=class
34
33
    FirstPass,
35
34
    ParaLogo,
79
78
  version,
80
79
  cutils,cmsgs,
81
80
  comphook,
82
 
  symtable
 
81
  symtable,scanner
83
82
{$ifdef BrowserLog}
84
83
  ,browlog
85
84
{$endif BrowserLog}
125
124
    end;
126
125
end;
127
126
 
128
 
 
129
 
 
130
127
{****************************************************************************
131
128
                                 Toption
132
129
****************************************************************************}
264
261
      '6',
265
262
{$endif}
266
263
{$ifdef arm}
267
 
      'S',
 
264
      'A',
268
265
{$endif}
269
266
{$ifdef powerpc}
270
267
      'P',
604
601
 
605
602
           'd' :
606
603
             if more <> '' then
607
 
               def_system_macro(more);
608
 
 
 
604
               begin
 
605
                 l:=Pos(':=',more);
 
606
                 if l>0 then
 
607
                   set_system_compvar(Copy(more,1,l-1),Copy(more,l+2,255))
 
608
                 else
 
609
                   def_system_macro(more);
 
610
               end;
609
611
           'D' :
610
612
             begin
611
613
               include(initglobalswitches,cs_link_deffile);
683
685
                   autoloadunits:=more;
684
686
                 'c' :
685
687
                   begin
686
 
                     if not(cpavailable(more)) then
 
688
                     if (upper(more)='UTF8') or (upper(more)='UTF-8') then
 
689
                        initsourcecodepage:='utf8'
 
690
                     else if not(cpavailable(more)) then
687
691
                       Message1(option_code_page_not_available,more)
688
692
                     else
689
693
                       initsourcecodepage:=more;
765
769
               while j<=length(more) do
766
770
                 begin
767
771
                   case more[j] of
768
 
                     'd' :
769
 
                       begin
770
 
                         if UnsetBool(More, j) then
771
 
                           exclude(initglobalswitches,cs_gdb_dbx)
772
 
                         else
773
 
                           include(initglobalswitches,cs_gdb_dbx);
774
 
                       end;
775
 
                    'g' :
776
 
                       begin
777
 
                         if UnsetBool(More, j) then
778
 
                           exclude(initglobalswitches,cs_gdb_gsym)
779
 
                         else
780
 
                           include(initglobalswitches,cs_gdb_gsym);
 
772
                     'd',
 
773
                     'g' :
 
774
                       begin
 
775
                         { ignore for compatibility,
 
776
                           the code for dbx and gsym is broken }
781
777
                       end;
782
778
                     'h' :
783
779
                       begin
877
873
           'o' :
878
874
             begin
879
875
               if More<>'' then
 
876
                 begin
 
877
                   DefaultReplacements(More);
880
878
{$IFDEF USE_SYSUTILS}
881
 
               begin
882
 
                 d := SplitPath(More);
883
 
                 OutputFile := SplitFileName(More);
884
 
               end
 
879
                   D:=SplitPath(More);
 
880
                   OutputFile:=SplitFileName(More);
 
881
                   OutputExtension:=SplitExtension(More);
885
882
{$ELSE USE_SYSUTILS}
886
 
                 Fsplit(More,d,OutputFile,e)
 
883
                   FSplit(More,D,OutputFile,OutputExtension);
887
884
{$ENDIF USE_SYSUTILS}
 
885
                   if (D<>'') then
 
886
                     OutputExeDir:=FixPath(D,True);
 
887
                 end
888
888
               else
889
889
                 IllegalPara(opt);
890
890
             end;
976
976
                         include(initlocalswitches,cs_ansistrings);
977
977
                       'i' :
978
978
                         include(initmoduleswitches,cs_support_inline);
 
979
                       'k' :
 
980
                         include(initglobalswitches,cs_load_fpcylix_unit);
979
981
                       'm' :
980
982
                         include(initmoduleswitches,cs_support_macro);
981
983
                       'o' : //an alternative to -Mtp
1187
1189
                             DefaultReplacements(rlinkpath);
1188
1190
                             More:='';
1189
1191
                          end;
 
1192
                    'L' : begin  // -XLO is link order -XLA is link alias. -XLD avoids load defaults.
 
1193
                                 // these are not aggregable.
 
1194
                            if (j=length(more)) or not (more[j+1] in ['O','A','D']) then
 
1195
                              IllegalPara(opt)
 
1196
                            else
 
1197
                              begin
 
1198
                                case more[j+1] of
 
1199
                                 'A' : begin
 
1200
                                        s:=Copy(more,3,length(More)-2);
 
1201
                                        if not LinkLibraryAliases.AddDep(s) Then
 
1202
                                           IllegalPara(opt);
 
1203
                                       end;
 
1204
                                 'O' : begin
 
1205
                                        s:=Copy(more,3,length(More)-2);
 
1206
                                        if not LinkLibraryOrder.AddWeight(s) Then
 
1207
                                           IllegalPara(opt);
 
1208
                                       end;
 
1209
                                 'D' : include(initglobalswitches,cs_link_no_default_lib_order)
 
1210
                                else
 
1211
                                  IllegalPara(opt);
 
1212
                                 end; {case}
 
1213
                                j:=length(more);
 
1214
                              end; {else begin}
 
1215
                          end;
1190
1216
                    'S' :
1191
1217
                      begin
1192
1218
                        def_system_macro('FPC_LINK_STATIC');
1207
1233
                        exclude(initglobalswitches,cs_link_shared);
1208
1234
                        LinkTypeSetExplicitly:=true;
1209
1235
                      end;
 
1236
                    'M' :
 
1237
                      begin
 
1238
                        mainaliasname:=Copy(more,2,length(More)-1);
 
1239
                        More:='';
 
1240
                      end;
1210
1241
                    '-' :
1211
1242
                      begin
1212
1243
                        exclude(initglobalswitches,cs_link_staticflag);
1286
1317
  Option_read:=false;
1287
1318
  If FileLevel>MaxLevel then
1288
1319
   Message(option_too_many_cfg_files);
 
1320
{ Maybe It's Directory ?}   //Jaro Change:
 
1321
  if DirectoryExists(filename) then
 
1322
    begin
 
1323
       Message1(option_config_is_dir,filename);
 
1324
       exit;
 
1325
    end;
1289
1326
{ open file }
1290
1327
  Message1(option_using_file,filename);
 
1328
{$ifdef USE_SYSUTILS}
 
1329
  assign(f,ExpandFileName(filename));
 
1330
{$else USE_SYSUTILS}
1291
1331
  assign(f,FExpand(filename));
 
1332
{$endif USE_SYsUTILS}
1292
1333
  {$I-}
1293
1334
  reset(f);
1294
1335
  {$I+}
1591
1632
        end;
1592
1633
      'V' :
1593
1634
        AddInfo(version_string);
 
1635
      'W' :
 
1636
        AddInfo(full_version_string);
1594
1637
      'D' :
1595
1638
        AddInfo(date_string);
1596
1639
      '_' :
1764
1807
  def_system_macro('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
1765
1808
 
1766
1809
{ Temporary defines, until things settle down }
1767
 
  def_system_macro('HASWIDECHAR');
1768
 
  def_system_macro('HASWIDESTRING');
1769
 
  def_system_macro('HASOUT');
1770
 
  def_system_macro('HASGLOBALPROPERTY');
1771
 
  def_system_macro('FPC_HASPREFETCH');
1772
 
  def_system_macro('FPC_LINEEND_IN_TEXTREC');
1773
 
  def_system_macro('FPC_ALIGNSRTTI');
1774
 
  def_system_macro('FPC_HASNOFARPOINTER');
1775
 
  def_system_macro('FPC_HASUSERDATA32');
1776
 
{$ifdef i386}
1777
 
  def_system_macro('HASINTF');
1778
 
  def_system_macro('HASVARIANT');
1779
 
{$endif i386}
1780
 
{$ifdef x86_64}
1781
 
  def_system_macro('HASINTF');
1782
 
  def_system_macro('HASVARIANT');
1783
 
{$endif x86_64}
1784
 
{$ifdef powerpc}
1785
 
  def_system_macro('HASINTF');
1786
 
  def_system_macro('HASVARIANT');
1787
 
  def_system_macro('FPC_MTFSB0_CORRECTED');
1788
 
{$endif powerpc}
1789
 
{$ifdef arm}
1790
 
  def_system_macro('HASINTF');
1791
 
  def_system_macro('HASVARIANT');
1792
 
{$endif arm}
1793
 
{$ifdef sparc}
1794
 
  def_system_macro('HASINTF');
1795
 
  def_system_macro('HASVARIANT');
1796
 
{$endif sparc}
1797
 
  def_system_macro('INTERNSETLENGTH');
1798
 
  def_system_macro('INTERNLENGTH');
1799
 
  def_system_macro('INTERNCOPY');
1800
 
  def_system_macro('INT64FUNCRESOK');
1801
 
  def_system_macro('HAS_ADDR_STACK_ON_STACK');
1802
 
  def_system_macro('NOBOUNDCHECK');
1803
 
  def_system_macro('HASCOMPILERPROC');
1804
 
  def_system_macro('INTERNCONSTINTF');
1805
 
  def_system_macro('VALUEGETMEM');
1806
 
  def_system_macro('VALUEFREEMEM');
1807
 
  def_system_macro('HASCURRENCY');
1808
 
  def_system_macro('HASTHREADVAR');
1809
 
  def_system_macro('HAS_GENERICCONSTRUCTOR');
1810
 
  def_system_macro('NOCLASSHELPERS');
 
1810
  def_system_macro('COMPPROCINLINEFIXED');
 
1811
  { "main" symbol is generated in the main program, and left out of the system unit }
 
1812
  def_system_macro('FPC_DARWIN_PASCALMAIN');
 
1813
 
1811
1814
  if pocall_default = pocall_register then
1812
1815
    def_system_macro('REGCALL');
1813
 
  def_system_macro('DECRREFNOTNIL');
1814
 
  def_system_macro('HAS_INTERNAL_INTTYPES');
1815
 
  def_system_macro('STR_USES_VALINT');
1816
 
  def_system_macro('NOSAVEREGISTERS');
1817
 
  def_system_macro('SHORTSTRCOMPAREINREG');
1818
 
  def_system_macro('HASGETHEAPSTATUS');
1819
 
  def_system_macro('HASGETFPCHEAPSTATUS');
1820
 
  def_system_macro('HASFUNCTIONCOPYDYNARR');
1821
 
  def_system_macro('HASOVERLOADASSIGNBYUNIQUERESULT');
1822
1816
 
1823
1817
{ using a case is pretty useless here (FK) }
1824
1818
{ some stuff for TP compatibility }
1825
1819
{$ifdef i386}
1826
1820
  def_system_macro('CPU86');
1827
1821
  def_system_macro('CPU87');
 
1822
  def_system_macro('CPU386');
1828
1823
{$endif}
1829
1824
{$ifdef m68k}
1830
1825
  def_system_macro('CPU68');
1837
1832
  def_system_macro('FPC_HAS_TYPE_EXTENDED');
1838
1833
  def_system_macro('FPC_HAS_TYPE_DOUBLE');
1839
1834
  def_system_macro('FPC_HAS_TYPE_SINGLE');
 
1835
  def_system_macro('FPC_HAS_RESOURCES');
1840
1836
{$endif}
1841
1837
{$ifdef m68k}
1842
1838
  def_system_macro('CPU68K');
2141
2137
  if assigned(option) then
2142
2138
   option.free;
2143
2139
end.
2144
 
{
2145
 
  $Log: options.pas,v $
2146
 
  Revision 1.175  2005/05/05 14:53:55  florian
2147
 
    + output of supported instruction sets in info page
2148
 
 
2149
 
  Revision 1.174  2005/04/28 19:32:11  florian
2150
 
    * overloading of assignment operator by different unique result types now possible
2151
 
 
2152
 
  Revision 1.173  2005/04/24 21:01:37  peter
2153
 
    * always use exceptions to stop the compiler
2154
 
    - remove stop, do_stop
2155
 
 
2156
 
  Revision 1.172  2005/04/15 15:43:54  peter
2157
 
    * -Fe on commandline redirects now all output
2158
 
 
2159
 
  Revision 1.171  2005/03/20 22:36:45  olle
2160
 
    * Cleaned up handling of source file extension.
2161
 
    + Added support for .p extension for macos and darwin
2162
 
 
2163
 
  Revision 1.170  2005/03/05 16:37:42  florian
2164
 
    * fixed copy(dyn. array,...);
2165
 
 
2166
 
  Revision 1.169  2005/03/04 16:49:22  peter
2167
 
    * getheapstatus fixes
2168
 
 
2169
 
  Revision 1.168  2005/02/26 15:43:09  florian
2170
 
    * userdata in file/textrecs now 32 bytes
2171
 
 
2172
 
  Revision 1.167  2005/02/19 18:32:16  florian
2173
 
    * defaultreplacement expansion for -XP and -Xr
2174
 
 
2175
 
  Revision 1.166  2005/02/19 18:10:57  florian
2176
 
    * cross compiliation defines
2177
 
 
2178
 
  Revision 1.165  2005/02/14 17:13:06  peter
2179
 
    * truncate log
2180
 
 
2181
 
  Revision 1.164  2005/02/06 21:33:28  peter
2182
 
    * -Fa option added, it'll load the units before the uses
2183
 
      line is parsed. Can be used to load cthreads from the commandline.
2184
 
      Example '-g -Faheaptrc,lineinfo' is the same as '-ghl'
2185
 
 
2186
 
  Revision 1.163  2005/02/05 10:24:17  florian
2187
 
  *** empty log message ***
2188
 
 
2189
 
  Revision 1.162  2005/01/20 17:05:53  peter
2190
 
    * use val() for decoding integers
2191
 
 
2192
 
  Revision 1.161  2005/01/09 20:24:43  olle
2193
 
    * rework of macro subsystem
2194
 
    + exportable macros for mode macpas
2195
 
 
2196
 
  Revision 1.160  2005/01/08 23:14:50  peter
2197
 
    * Allow #include ~/.fpc.cfg
2198
 
 
2199
 
  Revision 1.159  2005/01/04 16:19:52  florian
2200
 
    * arm sets FPUFPA by default for now
2201
 
 
2202
 
  Revision 1.158  2005/01/03 20:27:47  peter
2203
 
  fix outline of 3rd level of options (-SI option mainly)
2204
 
 
2205
 
}