link flag setup (win32)
authorClaus Gittinger <cg@exept.de>
Sat, 10 Nov 2001 01:52:40 +0100
changeset 1217 61cca5c6d4d1
parent 1216 49495be8bc0c
child 1218 8e2f81f20c85
link flag setup (win32)
ObjectFileLoader.st
--- a/ObjectFileLoader.st	Sat Nov 10 01:50:26 2001 +0100
+++ b/ObjectFileLoader.st	Sat Nov 10 01:52:40 2001 +0100
@@ -324,104 +324,113 @@
 !ObjectFileLoader class methodsFor:'initialization'!
 
 initialize
-    |systemType|
+    |systemType libDir|
 
     OperatingSystem isMSDOSlike ifTrue:[
-	"/ default setup for msc
-	OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'tlink32'.
-		LinkCommand := 'ilink32'.
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ..\libbc\librun.lib'.
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
-	    ].
-	    SearchedLibraries := #(
-				    'import32.lib'
-				  ).
-	] ifFalse:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'link'
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
-	    ].
-	].
+        "/ default setup for msc
+        OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+            libDir := '..\libbc'.
+            libDir asFilename exists ifFalse:[
+                libDir := '..\lib\libbc'.
+                libDir asFilename exists ifFalse:[
+                    libDir := '..\lib'.
+                ]
+            ].
+
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'tlink32'.
+                LinkCommand := 'ilink32'.
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '-L',libDir,' -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ',libDir,'\librun.lib'.
+                LinkArgs := '-L',libDir,' -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
+            ].
+            SearchedLibraries := #(
+                                    'import32.lib'
+                                  ).
+        ] ifFalse:[
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'link'
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
+            ].
+        ].
     ].
 
     MySymbolTable isNil ifTrue:[
-	Verbose := false.
-	NextHandleID := 1.
-	ObjectMemory addDependent:self.
-
-	OperatingSystem isMSDOSlike ifTrue:[
-	    SearchedLibraries := #(
-				    'import32.lib'
-				  ).
-	].
-
-	OperatingSystem isUNIXlike ifTrue:[
-	    systemType := OperatingSystem getOSType.
-
-	    "/ name of object file, where initial symbol table is found
-	    "/ not req'd for all architectures.
-
-	    MySymbolTable := 'stx'.
-
-	    "/ default set of libraries to be considered when
-	    "/ unresolved symbols are encountered during the load.
-	    "/ Only req'd for linux and sunos non-ELF systems.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    SearchedLibraries := #().
-
-	    (systemType = 'linux' 
-	    or:[systemType = 'sunos']) ifTrue:[
-		'/usr/lib/libc.a' asFilename isReadable ifTrue:[
-		    SearchedLibraries := #('/usr/lib/libc.a')
-		] ifFalse:[
-		    '/lib/libc.a' asFilename isReadable ifTrue:[
-			SearchedLibraries := #('/lib/libc.a')
-		    ]
-		]
-	    ].
-
-	    "/ default libraryPath where shared objects are searched for
-	    "/ when a dynamic library is loaded without an explicit path.
-
-	    LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-	    LoadLibraryPath isNil ifTrue:[
-		LoadLibraryPath := #('.'
-				     'lib'
-				     '/usr/local/smalltalk/lib'
-				     '/usr/local/lib'
-				     '/usr/lib'
-				     '/lib'
-				    ) asOrderedCollection.
-	    ].
-
-	    "/ default libraryPath where shared objects are expected
-	    "/ when a sharedObject load requires other objects to be loaded.
-	    "/ Only req'd for aix.
-	    "/ For more compatibility with ELF systems, look for a shell variable
-	    "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    systemType = 'aix' ifTrue:[
-		LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-		LibPath isNil ifTrue:[
-		    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
-		]
-	    ].
-	]
+        Verbose := false.
+        NextHandleID := 1.
+        ObjectMemory addDependent:self.
+
+        OperatingSystem isMSDOSlike ifTrue:[
+            SearchedLibraries := #(
+                                    'import32.lib'
+                                  ).
+        ].
+
+        OperatingSystem isUNIXlike ifTrue:[
+            systemType := OperatingSystem getOSType.
+
+            "/ name of object file, where initial symbol table is found
+            "/ not req'd for all architectures.
+
+            MySymbolTable := 'stx'.
+
+            "/ default set of libraries to be considered when
+            "/ unresolved symbols are encountered during the load.
+            "/ Only req'd for linux and sunos non-ELF systems.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            SearchedLibraries := #().
+
+            (systemType = 'linux' 
+            or:[systemType = 'sunos']) ifTrue:[
+                '/usr/lib/libc.a' asFilename isReadable ifTrue:[
+                    SearchedLibraries := #('/usr/lib/libc.a')
+                ] ifFalse:[
+                    '/lib/libc.a' asFilename isReadable ifTrue:[
+                        SearchedLibraries := #('/lib/libc.a')
+                    ]
+                ]
+            ].
+
+            "/ default libraryPath where shared objects are searched for
+            "/ when a dynamic library is loaded without an explicit path.
+
+            LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+            LoadLibraryPath isNil ifTrue:[
+                LoadLibraryPath := #('.'
+                                     'lib'
+                                     '/usr/local/smalltalk/lib'
+                                     '/usr/local/lib'
+                                     '/usr/lib'
+                                     '/lib'
+                                    ) asOrderedCollection.
+            ].
+
+            "/ default libraryPath where shared objects are expected
+            "/ when a sharedObject load requires other objects to be loaded.
+            "/ Only req'd for aix.
+            "/ For more compatibility with ELF systems, look for a shell variable
+            "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            systemType = 'aix' ifTrue:[
+                LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+                LibPath isNil ifTrue:[
+                    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
+                ]
+            ].
+        ]
     ]
 
     "
+     LinkArgs := LinkCommand := nil.   
      ObjectFileLoader initialize
     "
 
-    "Modified: / 5.10.1998 / 19:39:16 / cg"
+    "Modified: / 10.11.2001 / 01:45:01 / cg"
 !
 
 lastError
@@ -2500,7 +2509,7 @@
      Other systems may require more ..."
 
     |osType oFileName soFileName expFileName librunExpFileName
-     needSharedObject ld ldArg expFile ok outfile output|
+     needSharedObject ld ldArg expFile ok outfile output libDir|
 
     osType := OperatingSystem getOSType.
 
@@ -2543,12 +2552,23 @@
                , ' /OUT:' , baseFileName , '.dll '
                , ' /DEF:' , baseFileName , '.def'.
         ] ifFalse:[
+            libDir := '..\libbc'.
+            libDir asFilename exists ifFalse:[
+                libDir := '..\lib\libbc'.
+                libDir asFilename exists ifFalse:[
+                    libDir := '..\lib'.
+                    libDir asFilename exists ifFalse:[
+                        self halt:'oops - need dir where .lib files are'
+                    ]
+                ]
+            ].
+
             OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
                 ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
                 ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
-                ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib '.
+                ld := ld , ',' , baseFileName , '.dll,,',libDir,'\librun.lib '.
                 ld := ld , (SearchedLibraries asStringCollection asStringWith: $ ).
-                ld := ld , ' ..\libbc\cs32i.lib,,'.
+                ld := ld , ' ',libDir,'\cs32i.lib,,'.
             ] ifFalse:[
                 LastError := 'currently only support borlandC'.
                 self halt:'currently only support borlandC'.
@@ -2711,7 +2731,7 @@
     "
     ^ oFileName
 
-    "Modified: / 23.12.1999 / 21:10:57 / cg"
+    "Modified: / 10.11.2001 / 01:49:06 / cg"
 ! !
 
 !ObjectFileLoader class methodsFor:'lowlevel object loading'!
@@ -4073,6 +4093,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.220 2001-08-16 17:37:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.221 2001-11-10 00:52:40 cg Exp $'
 ! !
 ObjectFileLoader initialize!