"*
* Encoding: iso8859-1
*
* $Header$
*
* ST/X startup configuration file:
*
* DONT add site specific things here - use your own h_xxx.rc file instead
* where xxx stands for your hostname(s)
*
* startup configuration for host specific stuff -
* looks for a system specific h_sysType.rc init file and loads it.
* looks for a host specific h_hostName.rc init file and loads it.
*"
!
|sysType host domain s conf includes incDir|
sysType := OperatingSystem getSystemType.
"------------------------------------------------------------------------"
"/ printer setup
"/ Notice that this setup may be changed by an OS-specific h_xxx file
"/
"/ only reset the printer setting, if restarted
"/ on another host.
host := OperatingSystem getHostName.
(Smalltalk at:#'_ImageHostName') ~= host ifTrue:[
sysType = 'win32' ifTrue:[
Printer := Smalltalk at:#WinPrinterStream.
] ifFalse:[
Printer := Smalltalk at:#PostscriptPrinterStream.
].
].
"------------------------------------------------------------------------"
"/ default compiler setup;
"/ can be rechanged in a h_xxx file.
"/
(Smalltalk wasStartedFromImage not and:[ Smalltalk isPlugin not ])
ifTrue:[
Compiler stcCompilation:#default.
Compiler stcCompilationOptions:'+optinline +inlineNew'.
"/
"/ setup for gcc (which is OK for most systems);
"/ Notice that this setup may be changed by an OS-specific h_xxx file
"/
conf := Smalltalk configuration.
(conf includesString:'gcc') ifTrue:[
Compiler ccPath:'gcc'
] ifFalse:[
Compiler ccPath:'cc'
].
Compiler ccCompilationOptions:'-O'.
(conf includesString:'amd64_mode32') ifTrue:[
(ObjectFileLoader linkArgs includesString:'-m32') ifFalse:[
ObjectFileLoader linkArgs:(ObjectFileLoader linkArgs , ' -m32 -m elf_i386').
].
(Compiler ccCompilationOptions includesString:'-m32') ifFalse:[
Compiler ccCompilationOptions:(Compiler ccCompilationOptions , ' -m32').
].
(Compiler stcCompilationDefines includesString:'-D__amd64_mode32__') ifFalse:[
Compiler stcCompilationDefines:(Compiler stcCompilationDefines , ' -D__amd64_mode32__').
].
].
includes := ''.
incDir := Smalltalk getSystemFileName:'include/stc.h'.
incDir notNil ifTrue:[ incDir := incDir asFilename directoryName ].
incDir notNil ifTrue:[
includes := includes , '-I' , incDir asFilename pathName , ' '
] ifFalse:[
('../../../stx/include' asFilename exists) ifTrue:[
"/ running in a development environment...
includes := includes , '-I../../../stx/include '.
] ifFalse:[
('../../include' asFilename exists) ifTrue:[
"/ running in a development environment...
includes := includes , '-I../../include '.
] ifFalse:[
"/ if this is a production program, dont care for a warning
(Smalltalk isStandAloneApp or:[Smalltalk isHeadless])
ifFalse:[
'host.rc [warning]: no >>include<< directory found along your path.' infoPrintCR.
'host.rc [warning]: this might affect stc-compilation from within the browser.' infoPrintCR.
]
]
]
].
Compiler stcCompilationIncludes:includes.
"/
"/ for myself: preset flags, so that we can accept GLXWorkstation code
"/ You probably will never do this.
"/
(Display notNil and:[Display supportsGLDrawing]) ifTrue:[
sysType = 'irix' ifTrue:[
Compiler stcCompilationDefines:'-DGLX'.
] ifFalse:[
Compiler stcCompilationIncludes:'-I../../include -I../../support/VGL/vogl/src'.
Compiler stcCompilationDefines:'-DVGL'.
]
].
].
"/
"/ try systemType-specific setup
"/ h_<osType>.rc
"/
(Smalltalk at:#'_ImageOSTypeName') ~= sysType ifTrue:[
('host.rc [info]: ') infoPrint.
"/ ('trying host setup h_' , sysType , '.rc...') infoPrintCR.
s := Smalltalk systemFileStreamFor:('h_' , sysType , '.rc').
s notNil ifTrue:[
('reading host setup h_' , sysType , '.rc...') infoPrintCR.
s fileIn.
s close.
].
Smalltalk at:#'_ImageOSTypeName' put:sysType.
].
"/
"/ try host-specific setup
"/ h_<hostname>.rc
"/
host isNil ifTrue:[
'host.rc [warning]: cannot determine host I am running on' errorPrintCR.
] ifFalse:[
"if there is a corresponding file ..."
(Smalltalk at:#'_ImageHostName') ~= host ifTrue:[
"/ ('host.rc [info]: trying host setup h_' , host , '.rc...') infoPrintCR.
s := Smalltalk systemFileStreamFor:('h_' , host , '.rc').
s notNil ifTrue:[
('host.rc [info]: reading host setup h_' , host , '.rc...') infoPrintCR.
s fileIn.
s close.
].
Smalltalk at:#'_ImageHostName' put:host.
]
].
!