[m-rev.] diff: add support for using libraries to mmc

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 10 17:27:52 AEDT 2001


On 10-Nov-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Add support for using libraries installed by
> `mmake liblibrary.install' directly from mmc.
> This is needed for `mmc --make'.
> 
> compiler/options.m:
> 	Add options:
> 	* `--mercury-library-directory'
> 		Adds `--search-directory', `--c-include-directory',
> 		`--init-file-directory' and `--link-library-directory'
> 		options for the specified Mercury installation directory.

s/link-//

IMHO there should also be a shorter alias for that option name,
for interactive use.  I guess we're probably running out of
single-character option names at this point, but something
like `--mld' would be nice.

> 	* `--mercury-library'
> 		Link with the specified library (passing it's
> 		`.init' file to c2init).

Likewise something like `--ml' would be helpful here.

(I think it is reasonably likely that both of these
options might be used interactively, in conjunction
with `--make')

> 	* `--init-file'
> 		Add a `.init' file to pass to c2init.
> 	* `--fullarch'
> 		Determined by configure.

You should modify scripts/mmc.in to pass the appropriate
value for `--fullarch' to mmc automatically.
(Maybe you already did so, but forgot to post the diff for
that file?)

> Index: compiler/handle_options.m
...
> @@ -721,6 +721,27 @@
>  		[]
>  	),
>  
> +	%
> +	% Handle library search directories. These couldn't be handled
> +	% by options.m because they are grade dependent.
> +	%
> +	globals__io_lookup_accumulating_option(mercury_library_directories,
> +		MercuryLibDirs),
> +	globals__io_lookup_string_option(fullarch, FullArch),
> +	globals__io_get_globals(Globals),
> +	{ compute_grade(Globals, GradeString) },
> +	{ ExtraLinkLibDirs = list__map(
> +			(func(MercuryLibDir) =
> +				dir__make_path_name(MercuryLibDir,
> +				dir__make_path_name("lib",
> +				dir__make_path_name(GradeString,
> +				FullArch)))
> +			), MercuryLibDirs) },
> +	globals__io_lookup_accumulating_option(link_library_directories,
> +		LinkLibDirs),
> +	globals__io_set_option(link_library_directories,
> +		accumulating(LinkLibDirs ++ ExtraLinkLibDirs)),

It's probably worth optimizing the case when MercuryLibDirs = [].

Otherwise that looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list