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

Simon Taylor stayl at cs.mu.OZ.AU
Sat Nov 10 21:29:47 AEDT 2001


On 10-Nov-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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.

Done.
 
> > 	* `--mercury-library'
> > 		Link with the specified library (passing it's
> > 		`.init' file to c2init).
> 
> Likewise something like `--ml' would be helpful here.

Done.

> > 	* `--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?)

That can't be done until the installed compiler accepts the option.
 
> > Index: compiler/handle_options.m
> > +	%
> > +	% 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) },
> 
> It's probably worth optimizing the case when MercuryLibDirs = [].

Done.

Simon.


Estimated hours taken: 0.25
Branches: main

Address Fergus's review comments for my last change. 

compiler/options.m:
doc/user_guide.texi:
	Add `--mld' as an alias for `--mercury-library-directory'.
	Add `--ml' as an alias for `--mercury-library'.
		Determined by configure.

compiler/handle_options.m:
	Improve efficiency where there are no Mercury library directories.


Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.121
diff -u -u -r1.121 handle_options.m
--- compiler/handle_options.m	9 Nov 2001 18:20:47 -0000	1.121
+++ compiler/handle_options.m	10 Nov 2001 10:27:13 -0000
@@ -727,20 +727,25 @@
 	%
 	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)),
+	(
+		{ 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))
+	;
+		{ MercuryLibDirs = [] }
+	),
 	
 	% If --use-search-directories-for-intermod is true, append the
 	% search directories to the list of directories to search for
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.341
diff -u -u -r1.341 options.m
--- compiler/options.m	9 Nov 2001 18:20:51 -0000	1.341
+++ compiler/options.m	10 Nov 2001 09:57:49 -0000
@@ -1423,7 +1423,9 @@
 long_option("library",			link_libraries).
 long_option("link-object",		link_objects).
 long_option("mercury-library",		mercury_library_special).
+long_option("ml",			mercury_library_special).
 long_option("mercury-library-directory", mercury_library_directory_special).
+long_option("mld",			mercury_library_directory_special).
 long_option("init-file-directory",	init_file_directories).
 long_option("init-file",		init_files).
 
@@ -2986,13 +2988,13 @@
 		"\tLink with the specified library.",
 		"--link-object <object-file>",
 		"\tLink with the specified object file.",
-		"--mercury-library-directory <directory>",
+		"--mld <directory>, --mercury-library-directory <directory>",
 		"\tAppend <directory> to the list of directories to",
 		"\tbe searched for Mercury libraries. This will add",
 		"\t`--search-directory', `--library-directory',",
 		"\t`--init-file-directory' and `--c-include-directory'",
 		"\toptions as needed.",
-		"--mercury-library <library>",
+		"--ml <library>, --mercury-library <library>",
 		"\tLink with the specified Mercury library.",
 		"--init-file-directory <directory>",
 		"\tAppend <directory> to the list of directories to",
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.276
diff -u -u -r1.276 user_guide.texi
--- doc/user_guide.texi	9 Nov 2001 18:20:56 -0000	1.276
+++ doc/user_guide.texi	10 Nov 2001 10:23:03 -0000
@@ -5609,7 +5609,9 @@
 @cindex Object files, linking with
 Link with the specified object file.
 
- at item --mercury-library-directory @var{directory}
+ at item --mld @var{directory}
+ at itemx --mercury-library-directory @var{directory}
+ at findex --mld
 @findex --mercury-library-directory
 @cindex Directories for libraries
 @cindex Search path for libraries
@@ -5619,7 +5621,9 @@
 @samp{--init-file-directory} and @samp{--c-include-directory}
 options as needed.
 
- at item --mercury-library @var{library}
+ at item --ml @var{library}
+ at itemx --mercury-library @var{library}
+ at findex --ml
 @findex --mercury-library
 @cindex Libraries, linking with
 Link with the specified Mercury library.
--------------------------------------------------------------------------
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