Parcourir la source

* support !ENVVAR for long commandlines
* win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
finally supported as installdir.

peter il y a 26 ans
Parent
commit
ada779a989
8 fichiers modifiés avec 299 ajouts et 122 suppressions
  1. 28 11
      compiler/Makefile
  2. 3 0
      compiler/Makefile.fpc
  3. 18 2
      compiler/cobjects.pas
  4. 123 64
      compiler/globals.pas
  5. 87 28
      compiler/options.pas
  6. 7 2
      compiler/symdef.inc
  7. 11 6
      compiler/t_go32v2.pas
  8. 22 9
      compiler/t_win32.pas

+ 28 - 11
compiler/Makefile

@@ -1,5 +1,5 @@
 #
-# Makefile generated by fpcmake v0.99.13 on 1999-12-02 02:30
+# Makefile generated by fpcmake v0.99.13 on 1999-12-06 18:33
 #
 
 defaultrule: all
@@ -65,12 +65,17 @@ endif
 
 # What compiler to use ?
 ifndef FPC
+# Compatibility with old makefiles
+ifdef PP
+export FPC=$(PP)
+else
 ifdef inOS2
 export FPC=ppos2$(EXEEXT)
 else
 export FPC=ppc386$(EXEEXT)
 endif
 endif
+endif
 
 # Target OS
 ifndef OS_TARGET
@@ -131,6 +136,9 @@ endif
 
 # Pre Settings
 
+# Don't export OS_SOURCE because it can change after the first compile
+unexport OS_SOURCE
+
 # Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
 ifdef ALPHA
 CPU_TARGET=alpha
@@ -262,6 +270,7 @@ endif
 
 # create fcldir,rtldir,unitdir
 ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
 ifneq ($(FPCDIR),.)
 override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
 override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
@@ -400,7 +409,15 @@ ifdef CFGFILE
 override FPCOPT+=@$(CFGFILE)
 endif
 
-override COMPILER=$(FPC) $(FPCOPT)
+# For win32 the options are passed using the environment variable FPCEXTCMD
+ifeq ($(OS_SOURCE),win32)
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+
+# Compiler commandline
+override COMPILER:=$(FPC) $(FPCOPT)
 
 #####################################################################
 # Shell tools
@@ -492,7 +509,7 @@ endif
 ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 else
-EXECPPAS=@$(PPAS)
+EXECPPAS:=@$(PPAS)
 endif
 
 # ldconfig to rebuild .so cache
@@ -781,7 +798,7 @@ fpc_debug:
 
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
-SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
 endif
 
 fpc_smart:
@@ -811,13 +828,13 @@ endif
 ifdef INSTALLPPUFILES
 ifdef PPUFILES
 ifdef inlinux
-INSTALLPPULINKFILES=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
-INSTALLPPULIBFILES=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
+INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
+INSTALLPPULIBFILES:=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
 else
-INSTALLPPULINKFILES=$(shell $(PPUFILES) $(INSTALLPPUFILES))
+INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
 endif
 else
-INSTALLPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
 endif
 endif
 
@@ -891,7 +908,7 @@ endif
 
 # Test dir if none specified
 ifndef DESTZIPDIR
-DESTZIPDIR=$(BASEDIR)
+DESTZIPDIR:=$(BASEDIR)
 endif
 
 # Add .zip/.tar.gz extension
@@ -946,9 +963,9 @@ endif
 
 ifdef CLEANPPUFILES
 ifdef PPUFILES
-CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
+CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
 else
-CLEANPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
+CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
 endif
 endif
 

+ 3 - 0
compiler/Makefile.fpc

@@ -15,6 +15,9 @@ toolcmp=1
 
 
 [presettings]
+# Don't export OS_SOURCE because it can change after the first compile
+unexport OS_SOURCE
+
 # Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
 ifdef ALPHA
 CPU_TARGET=alpha

+ 18 - 2
compiler/cobjects.pas

@@ -403,7 +403,8 @@ unit cobjects;
 
     { allocates memory for s and copies s as zero terminated string
       to that mem and returns a pointer to that mem }
-    function strpnew(const s : string) : pchar;
+    function  strpnew(const s : string) : pchar;
+    procedure strdispose(var p : pchar);
 
     { makes a char lowercase, with spanish, french and german char set }
     function lowercase(c : char) : char;
@@ -606,6 +607,16 @@ end;
       end;
 
 
+    procedure strdispose(var p : pchar);
+      begin
+        if assigned(p) then
+         begin
+           freemem(p,strlen(p)+1);
+           p:=nil;
+         end;
+      end;
+
+
     procedure stringdispose(var p : pstring);
       begin
          if assigned(p) then
@@ -2323,7 +2334,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.47  1999-11-15 14:59:55  pierre
+  Revision 1.48  1999-12-06 18:21:03  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.47  1999/11/15 14:59:55  pierre
    * last was not handled correctly in TStringQueue
 
   Revision 1.46  1999/11/14 15:56:36  peter

+ 123 - 64
compiler/globals.pas

@@ -30,17 +30,20 @@ unit globals;
   interface
 
     uses
+{$ifdef win32}
+      windows,
+{$endif}
+{$ifdef linux}
+      linux,
+{$endif}
 {$ifdef Delphi4}
       dmisc,
       sysutils,
 {$else}
       strings,dos,
 {$endif}
-{$ifdef linux}
 {$ifdef TP}
       objects,
-{$endif}
-      linux,
 {$endif}
       globtype,version,tokens,systems,cobjects;
 
@@ -250,26 +253,24 @@ unit globals;
     procedure SynchronizeFileTime(const fn1,fn2:string);
     function  FindFile(const f : string;path : string;var b : boolean) : string;
     function  FindExe(bin:string;var found:boolean):string;
+    function  GetShortName(const n:string):string;
+
     Procedure Shell(const command:string);
+    function  GetEnvPChar(const envname:string):pchar;
+    procedure FreeEnvPChar(p:pchar);
 
     procedure InitGlobals;
     procedure DoneGlobals;
 
-    procedure strdispose(var p : pchar);
 
-  implementation
+implementation
 
     uses
       comphook;
 
-    procedure strdispose(var p : pchar);
-
+    procedure abstract;
       begin
-         if assigned(p) then
-           begin
-              freemem(p,strlen(p)+1);
-              p:=nil;
-           end;
+        do_internalerror(255);
       end;
 
 
@@ -328,14 +329,12 @@ unit globals;
 {$ifdef debug}
 
     function assigned(p : pointer) : boolean;
-
 {$ifndef FPC}
     {$ifndef DPMI}
       type
          ptrrec = record
             ofs,seg : word;
          end;
-
       var
          lp : longint;
     {$endif DPMI}
@@ -454,15 +453,7 @@ unit globals;
            upper[i]:=char(byte(s[i])-32)
           else
            upper[i]:=s[i];
-         {$ifdef FPC}
-           {$ifopt H+}
-             setlength(upper,length(s));
-           {$else}
-             upper[0]:=s[0];
-           {$endif}
-         {$else}
-           upper[0]:=s[0];
-         {$endif}
+        upper[0]:=s[0];
       end;
 
 
@@ -478,15 +469,7 @@ unit globals;
            lower[i]:=char(byte(s[i])+32)
           else
            lower[i]:=s[i];
-         {$ifndef TP}
-           {$ifopt H+}
-             setlength(lower,length(s));
-           {$else}
-             lower[0]:=s[0];
-           {$endif}
-         {$else}
-           lower[0]:=s[0];
-         {$endif}
+        lower[0]:=s[0];
       end;
 
 
@@ -503,26 +486,25 @@ unit globals;
       end;
 
 
-
 {$ifdef FPC}
    function tostru(i:cardinal):string;
    {
      return string of value i, but for cardinals
    }
-   var hs:string;
-
-   begin
-       str(i,hs);
-       tostru:=hs;
-   end;
+      var
+        hs : string;
+      begin
+        str(i,hs);
+        tostru:=hs;
+      end;
 {$else FPC}
-
-   function tostru(i:longint):string;
-
-   begin
+    function tostru(i:longint):string;
+      begin
         tostru:=tostr(i);
-   end;
+      end;
 {$endif FPC}
+
+
    function trimspace(const s:string):string;
    {
      return s with all leading and ending spaces and tabs removed
@@ -1225,27 +1207,99 @@ unit globals;
 {$endif delphi}
    end;
 
-   procedure abstract;
-     begin
-        do_internalerror(255);
-     end;
-
 
-Procedure Shell(const command:string);
-{ This is already defined in the linux.ppu for linux, need for the *
-  expansion under linux }
-{$ifdef linux}
-begin
-  Linux.Shell(command);
-end;
-{$else}
-var
-  comspec : string;
-begin
-  comspec:=getenv('COMSPEC');
-  Exec(comspec,' /C '+command);
-end;
+    function GetShortName(const n:string):string;
+{$ifdef win32}
+      var
+        hs,hs2 : string;
+{$endif}
+{$ifdef go32v2}
+      var
+        hs : string;
+{$endif}
+      begin
+        GetShortName:=n;
+{$ifdef win32}
+        hs:=n+#0;
+        Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
+        hs2[0]:=chr(strlen(@hs2[1]));
+        GetShortName:=hs2;
 {$endif}
+{$ifdef go32v2}
+        hs:=n;
+        if Dos.GetShortName(hs) then
+         GetShortName:=hs;
+{$endif}
+      end;
+
+
+ {****************************************************************************
+                               OS Dependent things
+ ****************************************************************************}
+
+    function GetEnvPChar(const envname:string):pchar;
+      {$ifdef win32}
+      var
+        s     : string;
+        i,len : longint;
+        hp,p,p2 : pchar;
+      {$endif}
+      begin
+      {$ifdef linux}
+        GetEnvPchar:=Linux.Getenv(envname);
+        {$define GETENVOK}
+      {$endif}
+      {$ifdef win32}
+        GetEnvPchar:=nil;
+        p:=GetEnvironmentStrings;
+        hp:=p;
+        while hp^<>#0 do
+         begin
+           s:=strpas(hp);
+           i:=pos('=',s);
+           len:=strlen(hp);
+           if upcase(copy(s,1,i-1))=upcase(envname) then
+            begin
+              GetMem(p2,len-length(envname));
+              Move(hp[i],p2^,len-length(envname));
+              GetEnvPchar:=p2;
+              break;
+            end;
+           { next string entry}
+           hp:=hp+len+1;
+         end;
+        FreeEnvironmentStrings(p);
+        {$define GETENVOK}
+      {$endif}
+      {$ifdef GETENVOK}
+        {$undef GETENVOK}
+      {$else}
+        GetEnvPchar:=StrPNew(Dos.Getenv(envname));
+      {$endif}
+      end;
+
+    procedure FreeEnvPChar(p:pchar);
+      begin
+      {$ifndef linux}
+        StrDispose(p);
+      {$endif}
+      end;
+
+    Procedure Shell(const command:string);
+      { This is already defined in the linux.ppu for linux, need for the *
+        expansion under linux }
+      {$ifdef linux}
+      begin
+        Linux.Shell(command);
+      end;
+      {$else}
+      var
+        comspec : string;
+      begin
+        comspec:=getenv('COMSPEC');
+        Exec(comspec,' /C '+command);
+      end;
+      {$endif}
 
  {****************************************************************************
                                     Init
@@ -1358,7 +1412,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  1999-12-02 17:34:34  peter
+  Revision 1.38  1999-12-06 18:21:03  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.37  1999/12/02 17:34:34  peter
     * preprocessor support. But it fails on the caret in type blocks
 
   Revision 1.36  1999/11/18 15:34:45  pierre

+ 87 - 28
compiler/options.pas

@@ -48,6 +48,7 @@ type
     function  Unsetbool(const opts:string; pos: Longint):boolean;
     procedure interpret_proc_specific_options(const opt:string);virtual;
     procedure interpret_option(const opt :string);
+    procedure Interpret_envvar(const envname : string);
     procedure Interpret_file(const filename : string);
     procedure Read_Parameters;
     procedure parsecmd(cmd:string);
@@ -337,6 +338,12 @@ var
 begin
   if opt='' then
    exit;
+
+  { only parse define,undef,target,verbosity and link options the firsttime }
+  if firstpass and
+     not((opt[1]='-') and (opt[2] in ['i','d','v','T','u','n','X'])) then
+   exit;
+
   case opt[1] of
  '-' : begin
          more:=Copy(opt,3,255);
@@ -940,6 +947,51 @@ begin
 end;
 
 
+procedure Toption.Interpret_envvar(const envname : string);
+var
+  argstart,
+  env,
+  pc     : pchar;
+  arglen : longint;
+  quote  : set of char;
+  hs     : string;
+begin
+  env:=GetEnvPChar(envname);
+  pc:=env;
+  repeat
+    { skip leading spaces }
+    while pc^ in [' ',#9,#13] do
+     inc(pc);
+    case pc^ of
+      #0 : break;
+     '"' : begin
+             quote:=['"'];
+             inc(pc);
+           end;
+    '''' : begin
+             quote:=[''''];
+             inc(pc);
+           end;
+    else
+     quote:=[' ',#9,#13];
+    end;
+  { scan until the end of the argument }
+    argstart:=pc;
+    while (pc^<>#0) and not(pc^ in quote) do
+     inc(pc);
+  { create argument }
+    arglen:=pc-argstart;
+    hs[0]:=chr(arglen);
+    move(argstart^,hs[1],arglen);
+    interpret_option(hs);
+  { skip quote }
+    if pc^ in quote then
+     inc(pc);
+  until false;
+  FreeEnvPChar(env);
+end;
+
+
 procedure toption.read_parameters;
 var
   opts       : string;
@@ -950,23 +1002,24 @@ begin
    begin
      inc(paramindex);
      opts:=paramstr(paramindex);
-     if firstpass then
-      begin
-      { only parse define,undef,target,verbosity and link options }
-        if (opts[1]='-') and (opts[2] in ['i','d','v','T','u','n','X']) then
-         interpret_option(opts);
-      end
-     else
-      begin
-        if opts[1]='@' then
+     case opts[1] of
+       '@' :
          begin
            Delete(opts,1,1);
-           Message1(option_reading_further_from,opts);
+           if not firstpass then
+            Message1(option_reading_further_from,opts);
            interpret_file(opts);
-         end
-        else
+         end;
+       '!' :
+         begin
+           Delete(opts,1,1);
+           if not firstpass then
+            Message1(option_reading_further_from,'(env) '+opts);
+           interpret_envvar(opts);
+         end;
+       else
          interpret_option(opts);
-      end;
+     end;
    end;
 end;
 
@@ -985,23 +1038,24 @@ begin
       i:=255;
      opts:=Copy(cmd,1,i-1);
      Delete(cmd,1,i);
-     if firstpass then
-      begin
-      { only parse define,undef,target,verbosity and link options }
-        if (opts[1]='-') and (opts[2] in ['d','v','T','u','n','X']) then
-         interpret_option(opts);
-      end
-     else
-      begin
-        if opts[1]='@' then
+     case opts[1] of
+       '@' :
          begin
            Delete(opts,1,1);
-           Message1(option_reading_further_from,opts);
+           if not firstpass then
+            Message1(option_reading_further_from,opts);
            interpret_file(opts);
-         end
-        else
+         end;
+       '!' :
+         begin
+           Delete(opts,1,1);
+           if not firstpass then
+            Message1(option_reading_further_from,'(env) '+opts);
+           interpret_envvar(opts);
+         end;
+       else
          interpret_option(opts);
-      end;
+     end;
    end;
 end;
 
@@ -1183,6 +1237,7 @@ begin
        option^.parsecmd(cmd)
      else
        option^.read_parameters;
+     option^.firstpass:=false;
      if read_configfile then
       begin
 {$ifdef EXTDEBUG}
@@ -1191,7 +1246,6 @@ begin
         option^.interpret_file(ppccfg);
       end;
    end;
-  option^.firstpass:=false;
   if cmd<>'' then
     option^.parsecmd(cmd)
   else
@@ -1277,7 +1331,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.38  1999-12-02 17:34:34  peter
+  Revision 1.39  1999-12-06 18:21:03  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.38  1999/12/02 17:34:34  peter
     * preprocessor support. But it fails on the caret in type blocks
 
   Revision 1.37  1999/11/20 01:22:19  pierre

+ 7 - 2
compiler/symdef.inc

@@ -2735,7 +2735,7 @@ Const local_symtable_index : longint = $8001;
          not(use_big) and
 {$endif}
            assigned(_mangledname) then
-           globals.strdispose(_mangledname);
+           strdispose(_mangledname);
          inherited done;
       end;
 
@@ -3841,7 +3841,12 @@ Const local_symtable_index : longint = $8001;
 
 {
   $Log$
-  Revision 1.179  1999-12-01 12:42:33  peter
+  Revision 1.180  1999-12-06 18:21:03  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.179  1999/12/01 12:42:33  peter
     * fixed bug 698
     * removed some notes about unused vars
 

+ 11 - 6
compiler/t_go32v2.pas

@@ -84,23 +84,23 @@ begin
   HPath:=current_module^.locallibrarysearchpath.First;
   while assigned(HPath) do
    begin
-     LinkRes.Add('-L'+HPath^.Data^);
+     LinkRes.Add('-L'+GetShortName(HPath^.Data^));
      HPath:=HPath^.Next;
    end;
   HPath:=LibrarySearchPath.First;
   while assigned(HPath) do
    begin
-     LinkRes.Add('-L'+HPath^.Data^);
+     LinkRes.Add('-L'+GetShortName(HPath^.Data^));
      HPath:=HPath^.Next;
    end;
 
   { add objectfiles, start with prt0 always }
-  LinkRes.AddFileName(FindObjectFile('prt0'));
+  LinkRes.AddFileName(GetShortName(FindObjectFile('prt0')));
   while not ObjectFiles.Empty do
    begin
      s:=ObjectFiles.Get;
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(GetShortName(s));
    end;
 
   { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
@@ -136,7 +136,7 @@ begin
      While not StaticLibFiles.Empty do
       begin
         S:=StaticLibFiles.Get;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(GetShortName(s))
       end;
      LinkRes.Add('-)');
    end;
@@ -288,7 +288,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.5  1999-11-16 23:39:04  peter
+  Revision 1.6  1999-12-06 18:21:04  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.5  1999/11/16 23:39:04  peter
     * use outputexedir for link.res location
 
   Revision 1.4  1999/11/12 11:03:50  peter

+ 22 - 9
compiler/t_win32.pas

@@ -628,9 +628,9 @@ begin
      DllCmd[1]:='ldw $OPT $STRIP --dll $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
      if RelocSection then
        begin
-          ExeCmd[2]:='dlltool --as asw.exe --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
+          ExeCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
           ExeCmd[3]:='ldw $OPT $STRIP $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
-          DllCmd[2]:='dlltool --as asw.exe --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
+          DllCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF';
           DllCmd[3]:='ldw $OPT $STRIP --dll $APPTYPE $IMAGEBASE -o $EXE $RES exp.$$$';
        end;
    end;
@@ -654,27 +654,27 @@ begin
   HPath:=current_module^.locallibrarysearchpath.First;
   while assigned(HPath) do
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
+     LinkRes.Add('SEARCH_DIR('+GetShortName(HPath^.Data^)+')');
      HPath:=HPath^.Next;
    end;
   HPath:=LibrarySearchPath.First;
   while assigned(HPath) do
    begin
-     LinkRes.Add('SEARCH_DIR('+HPath^.Data^+')');
+     LinkRes.Add('SEARCH_DIR('+GetShortName(HPath^.Data^)+')');
      HPath:=HPath^.Next;
    end;
 
   { add objectfiles, start with prt0 always }
   LinkRes.Add('INPUT(');
   if isdll then
-   LinkRes.AddFileName(FindObjectFile('wdllprt0'))
+   LinkRes.AddFileName(GetShortName(FindObjectFile('wdllprt0')))
   else
-   LinkRes.AddFileName(FindObjectFile('wprt0'));
+   LinkRes.AddFileName(GetShortName(FindObjectFile('wprt0')));
   while not ObjectFiles.Empty do
    begin
      s:=ObjectFiles.Get;
      if s<>'' then
-      LinkRes.AddFileName(s);
+      LinkRes.AddFileName(GetShortName(s));
    end;
 
   { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
@@ -708,7 +708,7 @@ begin
      While not StaticLibFiles.Empty do
       begin
         S:=StaticLibFiles.Get;
-        LinkRes.AddFileName(s)
+        LinkRes.AddFileName(GetShortName(s));
       end;
      LinkRes.Add(')');
    end;
@@ -725,8 +725,10 @@ function TLinkerWin32.MakeExecutable:boolean;
 var
   binstr,
   cmdstr  : string;
+  found,
   success : boolean;
   i       : longint;
+  AsBinStr     : string[80];
   StripStr,
   RelocStr,
   AppTypeStr,
@@ -740,6 +742,7 @@ begin
   AppTypeStr:='';
   ImageBaseStr:='';
   StripStr:='';
+  AsBinStr:=FindExe('asw',found);
   if RelocSection then
    RelocStr:='--base-file base.$$$';
   if apptype=at_gui then
@@ -763,6 +766,7 @@ begin
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$RES',outputexedir+Info.ResName);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
+        Replace(cmdstr,'$ASBIN',AsbinStr);
         Replace(cmdstr,'$RELOC',RelocStr);
         Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
         Replace(cmdstr,'$STRIP',StripStr);
@@ -796,8 +800,10 @@ Function TLinkerWin32.MakeSharedLibrary:boolean;
 var
   binstr,
   cmdstr  : string;
+  found,
   success : boolean;
   i       : longint;
+  AsBinStr     : string[80];
   StripStr,
   RelocStr,
   AppTypeStr,
@@ -812,6 +818,7 @@ begin
   AppTypeStr:='';
   ImageBaseStr:='';
   StripStr:='';
+  AsBinStr:=FindExe('asw',found);
   if RelocSection then
    RelocStr:='--base-file base.$$$';
   if apptype=at_gui then
@@ -835,6 +842,7 @@ begin
         Replace(cmdstr,'$OPT',Info.ExtraOptions);
         Replace(cmdstr,'$RES',outputexedir+Info.ResName);
         Replace(cmdstr,'$APPTYPE',AppTypeStr);
+        Replace(cmdstr,'$ASBIN',AsbinStr);
         Replace(cmdstr,'$RELOC',RelocStr);
         Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
         Replace(cmdstr,'$STRIP',StripStr);
@@ -1050,7 +1058,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.10  1999-11-24 11:45:36  pierre
+  Revision 1.11  1999-12-06 18:21:04  peter
+    * support !ENVVAR for long commandlines
+    * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
+      finally supported as installdir.
+
+  Revision 1.10  1999/11/24 11:45:36  pierre
    * $STRIP was missign in DllCmd[1]
 
   Revision 1.9  1999/11/22 22:20:43  pierre