updated on Tue Jan 24 16:10:37 UTC 2012
[aur-mirror.git] / cm3 / cm3.cfg
blob11c9e52f5f47c3848dd1ce6076ea0c8cec90b34c
1 % Copyright 1996 Critical Mass, Inc. All rights reserved.
2
3 % Standard configuration file for LINUX with ELF object files
6 %-------------------------------------------------- compilation environment ---
8 %M3_PROFILING = TRUE  % set by cm3 since 5.1.2 (option -profile)
9 %M3_PROFILING = FALSE
11 readonly TARGET       = "LINUXLIBC6"      % code generation target
12 if M3_PROFILING 
13   readonly BUILD_DIR  = TARGET & "p"      % code generation target
14 else
15   readonly BUILD_DIR  = TARGET            % directory for results
16 end
17 readonly OS_TYPE      = "POSIX"           % { "WIN32" or "POSIX" }
18 readonly WORD_SIZE    = "32BITS"          % { "32BITS" or "64BITS" }
19 readonly GNU_PLATFORM = "i486--linuxelf"  % "cpu-vendor-os" string for GNU
20 %readonly INSTALL_KEY  = BEGIN_CONFIG
21 %  "What is your installation key?"
22 %    14 %-- user specified key
23 %END_CONFIG
25 readonly NAMING_CONVENTIONS = "0"
26 %                                        object files       libraries
27 %  0=Unix                          =>  .o   .io    .mo       libXX.a
28 %  1=Unix with a grumpy C compiler =>  .o   _i.o   _m.o      libXX.a
29 %  2=Windows NT or Windows 95      =>  .obj .io    .mo       XX.lib
32 %-------------------------------------------------- default compile options ---
33 % "set_config_options" is called before starting the compilation.  It should
34 % be used to provide system-wide default options.
36 proc set_config_options () is
37   m3_option ("-why")   %-- produce a listing that explains what's happening and why
38   m3_debug (TRUE)      %-- produce object code with debugging symbols
39   M3_OPTIONS += "-w1"  %-- produce "level 1" warnings
40 end
42 %--------------------------------------------------------- Reactor defaults ---
43 % The first time a user runs Reactor, it will configure itself to use
44 % the executables defined below.
46 %INITIAL_REACTOR_BROWSER = BEGIN_CONFIG
47 %  "What should be the default World-Wide Web browser for new Reactor users?"
48 %     0  "netscape"
49 %     6 "/usr/local/bin"           "netscape"
50 %     6 "/usr/local/netscape/bin"  "netscape"
51 %     6 "/usr/local/netscape/bin"  "netscape-3"
52 %     6 "/usr/local/netscape/bin"  "netscape-2"
53 %     6 "/usr/local/netscape"      "netscape"
54 %     6 "/usr/local/mosaic"        "mosaic"
55 %     6 "/usr/local/moasic"        "Xmosaic"
56 %END_CONFIG
57 % A World-Wide Web browser.  Reactor passes it an initial URL
58 % its first command-line argument.
60 INITIAL_REACTOR_EDITOR = "/usr/bin/vi"
61 % A text editor.  Reactor passes it "<file> +<line>" on the
62 % command-line when it wants to edit <file> initially positioned
63 % at <line>.
65 %------------------------------------------------------------- export paths ---
66 % During the installation, destination directories that do not exists 
67 % will be created. You need the necessary permissions to do so; otherwise,
68 % the installation will fail, but can be restarted after you have 
69 % fixed the permissions.
71 INSTALL_ROOT = "/opt/cm3"
73 BIN_INSTALL   = INSTALL_ROOT & "/bin"        % executables
74 if M3_PROFILING 
75   LIB_INSTALL   = INSTALL_ROOT & "/libp"       % libraries
76 else
77   LIB_INSTALL   = INSTALL_ROOT & "/lib"        % libraries
78 end
79 PKG_INSTALL   = INSTALL_ROOT & "/pkg"        % packages
80 DOC_INSTALL   = INSTALL_ROOT & "/doc"        % documents
81 EMACS_INSTALL = INSTALL_ROOT & "/elisp"      % emacs lisp code
82 MAN_INSTALL   = INSTALL_ROOT & "/man"        % man pages
83 HTML_INSTALL  = INSTALL_ROOT & "/www"        % public hypertext
85 % On some systems (e.g. AFS) you must install public files in a different
86 % place from where you use them.  If that is the case for your system,
87 % specify the "use" location here, otherwise leave them alone.
89 USE_ROOT  = INSTALL_ROOT
90 BIN_USE   = BIN_INSTALL       % executables
91 LIB_USE   = LIB_INSTALL       % libraries
92 PKG_USE   = PKG_INSTALL       % packages
94 readonly INSTALL_IMPLS = TRUE
95 % TRUE
96 %    => save all source files during the install
97 %    => makes debugging easier and browsing more fruitful
98 % FALSE
99 %    => save only the exported interfaces and templates 
100 %    => makes the installed system slightly smaller.
102 %------------------------------------------------ external system libraries ---
103 % SYSTEM_LIBS provides a mapping from Modula-3 names for the common
104 % external libraries to site-dependent information about how they
105 % are accessed.  If SYSTEM_LIBS{x} is defined it should be a list
106 % of linker arguments that are used when linking against that library.
107 % If SYSTEM_LIBS{x} is not defined, the Modula-3 system will assume
108 % that the library is not available.
110 SYSTEM_LIBS = {
111   "LIBC"       : [ "-lm", "-L/usr/lib", "-lpthread" ],
112   "PTHREAD"    : [ ],
113 %-- not on most Linux platforms
114 % "LEX-YACC"   : [ "-Xlinker", "-Bdynamic", BEGIN_CONFIG
115 %                    "Where are the lex/yacc libraries?"
116 %                      11 "libl.so"
117 %                      12 "/usr/lib"
118 %                      12 "/usr/local/lib"
119 %                      12 "/usr/local/gnu/lib"
120 %                      13 "/usr/lib"
121 %                  END_CONFIG, "-ll" ],
122   "FLEX-BISON" : [  "-L/usr/lib", "-lfl" ],
123   "POSTGRES95" : [ "-Xlinker", "-Bdynamic", "-L/usr/lib", "-lpq" ],
124   "OPENGL"     : [ "-Xlinker", "-Bdynamic", "-L/usr/lib", "-lGLU", "-lGL", "-lXext" ],
125   "ODBC"       : [ "-Xlinker", "-Bdynamic", "-L/usr/lib", "-lodbc" ],
126   "MOTIF"      : [ "-Xlinker", "-Bdynamic", "-L/usr/lib", "-lXm" ],
127   "X11"        : [ "-Xlinker", "-Bdynamic", "-L/usr/lib", "-lXaw", "-lXmu", "-lXext",
128                         "-lXt", "-lSM", "-lICE", "-lX11" ],
129   "TCP"        : [ ]
132 % SYSTEM_LIBORDER defines the order in which SYSTEM_LIBS should be
133 % scanned by the linker.
135 SYSTEM_LIBORDER = [ "OPENGL", "DECPEX", "MOTIF", "X11", "TCP", "ODBC",
136                     "POSTGRES95", "FLEX-BISON", "LEX-YACC", "LIBC" ]
138 %---------------------------------------------------------- system programs ---
140 readonly SYSTEM_CC  = "/usr/bin/gcc" % C compiler
141 readonly SYSTEM_AR  = "/usr/bin/ar" % Archiver
142 readonly SYSTEM_ASM = "/usr/bin/as" % Assembler
144 %--------------------------------------------------------- Modula-3 backend ---
145 % For platforms without an integrated backend, "m3_backend" is called to
146 % translate Modula-3 intermediate code to object code.
148 readonly m3back = "@" & BIN_USE & "/cm3cg"
150 proc m3_backend (source, object, optimize, debug) is
151   local args = [ "-quiet", source, "-o", object, "-fPIC" ]
152   if optimize  args += "-O"  end
153   if debug     args += "-gstabs+"  end
154   if M3_PROFILING args += "-p" end
155   return try_exec (m3back, args)
158 M3_BACKEND_MODE = "3"
159 % -- defines how the frontend, backend, and assembler interact
160 %  "0"  -- don't call m3_backend, M3CG produces object code
161 %  "1"  -- don't call m3_backend, M3CG produces assembly code
162 %  "2"  -- call m3_backend, it produces object code
163 %  "3"  -- call m3_backend, it produces assembly code
165 %--------------------------------------------------------------- C compiler ---
166 % "compile_c" is called to compile C source files.  Note that this function
167 % is only called if your program or library explicitly includes C source
168 % code, the system distributed by Critical Mass does not.
170 proc compile_c (source, object, options, optimize, debug) is
171   local args = [ "-fPIC", options ]
172   if optimize  args += "-O"  end
173   if debug     args += "-gstabs+"  end
174   if M3_PROFILING args += "-pg" end
175   return try_exec ("@" & SYSTEM_CC, args, "-c", source)
178 %---------------------------------------------------------------- assembler ---
179 % "assemble" is called to assemble .s or .asm files.  Note that this function
180 % is only called if your program or library explicitly includes assembly source
181 % code, the system distributed by Critical Mass does not.
183 proc assemble (source, object) is
184   return try_exec ("@" & SYSTEM_ASM, source, "-o", object)
187 %--------------------------------------------------------- library creation ---
188 % "make_lib" is called to combine a collection of object modules into
189 % a library.
191 GCWRAPFLAGS = "-Wl,--wrap,adjtime,--wrap,getdirentries,--wrap,readv,--wrap,utimes,--wrap,wait3"
193 proc make_lib (lib, options, objects, imported_libs, shared) is
194   local ret_code = 0
195   local lib_a    = format ("lib%s.a", lib)
196   local lib_so   = format ("lib%s.so", lib)
197   local lib_sox  = format ("lib%s.so.5", lib)
199   % first, build the non-shared library
200   ret_code = try_exec ("@/usr/bin/ar", "crus", lib_a, objects)
201   if not equal (ret_code, 0) return ret_code end
203   if shared
204     % build the shared library
205     if M3_PROFILING 
206       ret_code = try_exec ("@" & SYSTEM_CC, "-pg -shared " & GCWRAPFLAGS & 
207                            "-Wl,-soname," & lib_sox,
208                            "-o", lib_sox, objects)
209     else
210       ret_code = try_exec ("@" & SYSTEM_CC, "-shared " & GCWRAPFLAGS & 
211                            "-Wl,-soname," & lib_sox,
212                            "-o", lib_sox, objects)
213     end
214     if not equal (ret_code, 0) return ret_code end
216     % create the version aliases
217     link_file(lib_sox, lib_so)
219     % finally, make sure the shared library stuff gets installed properly
220     install_derived (lib_sox)
221     install_derived_link (lib_sox, lib_so)
222     install_link_to_derived (lib_sox, LIB_INSTALL)
223     install_link_to_derived (lib_so, LIB_INSTALL)
224   else
225     delete_file (lib_so)
226     delete_file (lib_sox)
227   end
229   return 0
232 %-------------------------------------------------------------------
233 % "skip_lib" is called when the compiler decides it doesn't need to
234 % call "make_lib", but it wants to discover the names of the derived
235 % files that should be deleted or shipped.
237 proc skip_lib (lib, shared) is
238   local lib_so   = format ("lib%s.so", lib)
239   local lib_sox  = format ("lib%s.so.5", lib)
241   if shared
242     % make sure the shared library stuff gets installed properly
243     install_derived (lib_sox)
244     install_derived (lib_so)
245     install_link_to_derived (lib_sox, LIB_INSTALL)
246     install_link_to_derived (lib_so, LIB_INSTALL)
247   else
248     delete_file (lib_so)
249     delete_file (lib_sox)
250   end
252   return 0
255 %------------------------------------------------------------------- linker ---
256 % "m3_link" is called to produce a final executable.
257 %---  "-pdb:none" enables the use of windbg with the resulting executable.
259 proc m3_link (prog, options, objects, imported_libs, shared) is
260   local args = []
261   if M3_PROFILING args += "-pg" end
262   args += [ "-o", prog, "-fPIC", options, objects, imported_libs ]
263   if shared
264     return try_exec ("@" & SYSTEM_CC, args, GCWRAPFLAGS)
265   else
266     return try_exec ("@" & SYSTEM_CC, "-static", args, GCWRAPFLAGS)
267     %%% -- see M3_NEED_STANDALONE_LINKS  below
268     %%%return try_exec ("@" & SYSTEM_CC, args)
269   end
272 %-------------------------------------------------------------------
273 % "skip_link" is called when the compiler decides it doesn't need to
274 % call "m3_link", but it wants to discover the names of the derived
275 % files that should be deleted or shipped.
277 proc skip_link (prog, shared) is
278   return 0
281 %------------------------------------------------------------ misc. options ---
282 % Note, most of these options can be set from the command line.  Otherwise,
283 % they can be set "permanently" here in the config file or in as needed
284 % in user's m3makefiles.
286 M3_FRONT_FLAGS = [ ]
287 % --- internal configuration options passed directly to the Modula-3 front-end
289 M3_OPTIONS = [ ]
290 % --- user options passed directly to the Modula-3 front-end
292 % M3_KEEP_FILES = TRUE
293 % --- keep intermediate and temporary files
295 % M3_WINDOWS_GUI = TRUE
296 % --- generate a Windows GUI subsystem program instead of a console one.
298 % M3_COVERAGE = TRUE
299 % --- compile & link with coverage options
301 M3_COVERAGE_LIB = LIB_USE & "/report_coverage.o"
302 % --- library linked in programs compiled with "-Z" coverage option
304 M3_SPLIT_LIBNAMES = TRUE
305 % --- split library names and pass -L/-l arguments to the linker
307 M3_SHARED_LIB_ARG = "-Wl,-R"
308 % --- pass "-R" flags to the linker too...
310 % M3_BOOTSTRAP = TRUE
311 % --- generate bootstrap code (assembly) instead of finaly object code
313 % M3_COMPILE_ONCE = TRUE
314 % --- don't recompile code to improve opaque object references
316 % SYS_HAS_LOADER = TRUE
317 % --- generate a loader info file with objects, libraries and timestamps
319 % M3_SKIP_LINK = TRUE
320 % --- skip the final link for programs, presumably to use the loader instead
322 % M3_MAIN_IN_C = TRUE
323 % --- generate the Modula-3 main program as C code
325 X11_WITH_SHARED_MEM = TRUE
326 % --- X11 libraries include the shared memory extensions (XShm...)
328 %M3_NEED_STANDALONE_LINKS = TRUE
329 % --- linker is broken and we need to build a directory of symbolic
330 %     links pointing to the non-shared libraries.
332 %-------------------------------------------------------------------- emacs ---
333 % If you have emacs and want to compile ".el" files to ".elc" files,
334 % fill in the function below.  Otherwise, comment out or delete the
335 % entire function.  Note, the distributed code assumes gnuemacs version 19
336 % or later.
338 readonly proc emacs_compile (el) is
339   exec ("emacs -batch -f batch-byte-compile", el)
342 %------------------------------------------------------------- GNU variants ---
343 % The two large pieces of GNU software used by the Modula-3 system
344 % gcc(=m3cc) and gdb(=m3gdb) often require slightly different C compilers
345 % or flags.  They are specified here.  Note that they may be overridden
346 % from the m3build command line.
348 % To use the GNU defaults for CC and CFLAGS, specify "*".
351 GNU_CC     = "gcc"
352 GNU_CFLAGS = "-O"
353 GNU_MAKE   = "make"