[m-rev.] For review: Shared Mercury libs on Mac OS X.

Ian MacLarty maclarty at cs.mu.OZ.AU
Fri Oct 8 20:59:00 AEST 2004


Changes to get shared versions of the Mercury libraries working on Mac OS X.

This diff needs to be applied in 2 stages:  first the handling of the extra
options in the compiler(compiler/options.m, compiler/compile_target_code.m and
compiler/modules.m), then the changes to the configuration scripts and make
files that use these extra options.  I am posting the diffs together so the
changes can be reviewed as a whole.

Also the following issues still need clarification:

	1. The -undefined_suppress linker option doesn't work with two level
		namespaces which is the default on Darwin.  Is the
		--allow-undefined ml option used?  If so should shared libs
		rather use flat namespaces.  Alternatively the ALLOW_UNDEFINED
		configuration variable can be set to "-undefined
		dynamic_lookup", but that'll only work for Mac OS >= 10.3.  I
		didn't get any undefined symbols when compiling the compiler.

	2. Does the shared library built in the analysis directory currently
		get installed anywhere?  If so where?  

Ian.

For review by anyone.

Estimated hours taken: 20
Branches: main

Changes to get shared libraries to work on Mac OS X (Darwin).

Darwin shared libraries have the extension `dylib' instead of `so'.  Also 
objects that link to a shared library on Darwin don't need to be told the 
runtime path in which they should look for the libraries, instead the 
shared libraries themselves remember where they will be eventually installed
(called the install-name) and any object which links in the shared library will
get the install-name from the shared library at link time.  When a shared 
library is built it has to be told where it will be installed which is what
the libtool -install_name option is used for on Darwin.

Added three new compiler options :

--shlib-linker-use-install-name : 
	A boolean flag to tell the compiler to use the -install_name option
	when building shared libraries.  When this flag is set the following
	options have no effect: --linker-rpath-flag, --linker-rpath-separator,
	--shlib-linker-rpath-flag, --shlib-linker-rpath-separator.

--shlib-linker-install-name-flag :
	The flag name to use ("-install_name" for Darwin).

--shlib-linker-install-name-path :
	The path where the shared library will eventually end up, excluding the
	file name.  The file name is appended to the end before the option
	is passed on to the linker.

Mmake.common.in
	Added variables used for install-name on/off switch and flag name.

configure.in
	Make shared libs the default when on Darwin and the compiler is gcc.

boehm_gc/Makefile
boehm_gc/Makefile.direct
	Added rule to make libgc.dylib and set the install-name correctly.

boehm_gc/Mmakefile
	Set variable used in boehm_gc/Makefile to get the final install path
	of the gc shared lib.

browser/Mercury.options
	Added mer_mdbcomp library for target libmer_browser.dylib.

browser/Mmakefile
	Added --shlib-linker-install-name-path option to MC options.
	
compiler/compile_target_code.m
	Updated module qualifiers to `.'.  Passed the install-name options to
	the linker and made RpathsOpts empty if the
	--shlib-linker-use-install-name flag is set.

compiler/modules.m
	Added get_install_name_option/4 predicate to get the option string to
	set the install-name for a shared library.

compiler/options.m
	Added --shlib-linker-install-name-path,
	--shlib-linker-install-name-flag and --shlib-linker-use-install-name
	options.

doc/user_guide.texi
	Documented the --shlib-linker-install-name-path option.  The other
	options will be automatically set by the configure script and 
	should never need to be set by the user, so they're not documented in
	the user guide.

library/Mmakefile
	Added --shlib-linker-install-name-path option to MC flags.

runtime/Mmakefile
	Added rule to make the Darwin shared library.

scripts/Mercury.config.bootstrap.in
	Added default values for --shlib-linker-use-install-name and
	--shlib-linker-install-name-flag.

scripts/Mercury.config.in
	Added default values for --shlib-linker-use-install-name and
	--shlib-linker-install-name-flag.

trace/Mmakefile
	Added rule to make the Darwin shared library.

Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.78
diff -r1.78 Mmake.common.in
107a108,112
> # These variables can be used to set the install-name for the mercury
> # shared libraries.
> SHLIB_USE_INSTALL_NAME = @SHLIB_USE_INSTALL_NAME@
> SHLIB_INSTALL_NAME_FLAG = @SHLIB_INSTALL_NAME_FLAG@''
> 
Index: README.MacOS
===================================================================
RCS file: /home/mercury1/repository/mercury/README.MacOS,v
retrieving revision 1.5
diff -r1.5 README.MacOS
5c5
< with gcc 2.95.2 on MacOS 10.3.3, however it does with gcc 3.4.0.
---
> with gcc 2.95.2 on MacOS 10.3.3, however it does with gcc >= 3.3.
26a27,32
> If you are building a shared library you need to pass the 
> --shlib-linker-install-name-path to the Mercury compiler.  This will set the
> install-name of the shared library.  Anything that links to the shared library
> will look for the shared library in the location specified by the library's
> install-name.
> 
28d33
< 	- shared libraries
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.401
diff -r1.401 configure.in
230,233c230,235
< 		# Test for the --record-term-sizes-as-words option.
< 		# Note that we need to set --grade to an LLDS grade
< 		# when doing this test because term size profiling
< 		# requires an LLDS grade.
---
>  		# Test for the --record-term-sizes-as-words option.
>  		# Note that we need to set --grade to an LLDS grade
>  		# when doing this test because term size profiling
>  		# requires an LLDS grade.
> 		# This also tests for the --shlib-linker-intall-name-flag
> 		# option.
237a240
> 			--shlib-linker-install-name-flag "-dummy_flag" \
2949a2953,2956
> 
> SHLIB_USE_INSTALL_NAME=""
> SHLIB_INSTALL_NAME_FLAG="-install_name "
> 
3179a3187,3208
> 	*powerpc*apple*darwin*)
> 		# If the compiler is gcc then use darwin style dynamic linking.
> 		# Otherwise use static linking.
> 		if test "$GCC_PROG" != ""; then
> 		    SHLIB_USE_INSTALL_NAME="--shlib-linker-use-install-name"
> 		    SHLIB_INSTALL_NAME_FLAG="-install_name "
> 		    LINK_SHARED_OBJ="$GCC_PROG -dynamiclib -single_module"
> 		    LINK_SHARED_OBJ_SH="$GCC_PROG -dynamiclib -single_module"
> 		    EXT_FOR_SHARED_LIB=dylib
> 		    EXT_FOR_LINK_WITH_PIC_OBJECTS=o
> 		    CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
> 		    ERROR_UNDEFINED="-undefined error"
> 		    ALLOW_UNDEFINED="-undefined suppress"
> 		    AC_MSG_RESULT(yes)
> 		else
> 		    CFLAGS_FOR_PIC=
> 		    EXT_FOR_PIC_OBJECTS=o
> 		    EXT_FOR_LINK_WITH_PIC_OBJECTS=o
> 		    DEFAULT_LINKAGE=static
> 		    AC_MSG_RESULT(no)
> 		fi
> 		;;
3348a3378,3379
> AC_SUBST(SHLIB_USE_INSTALL_NAME)
> AC_SUBST(SHLIB_INSTALL_NAME_FLAG)
3872a3904,3906
> 	rm -f runtime/libmer_rt.dylib library/libmer_std.dylib 
> 	rm -f boehm_gc/libgc.dylib bytecode/libmbi.dylib
> 	rm -f trace/libmer_trace.dylib browser/libmer_browser.dylib
Index: boehm_gc/Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile,v
retrieving revision 1.57
diff -r1.57 Makefile
523a524,528
> # Darwin shared library version of the gc.
> lib$(GC_GRADE).dylib: $(OBJS) $(UTILS)
> 	$(LINK_SHARED_OBJ) -install_name \
> 		$(FINAL_INSTALL_MERC_GC_LIB_DIR)/lib$(GC_GRADE).dylib \
> 		-o lib$(GC_GRADE).dylib $(OBJS) dyn_load.o -lc
736a742,744
> 
> .PHONY: dylib
> dylib: lib$(GC_GRADE).dylib
Index: boehm_gc/Makefile.direct
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile.direct,v
retrieving revision 1.6
diff -r1.6 Makefile.direct
523a524,528
> # Darwin shared library version of the gc.
> lib$(GC_GRADE).dylib: $(OBJS) $(UTILS)
> 	$(LINK_SHARED_OBJ) -install_name \
> 		$(FINAL_INSTALL_MERC_GC_LIB_DIR)/lib$(GC_GRADE).dylib \
> 		-o lib$(GC_GRADE).dylib $(OBJS) dyn_load.o -lc
736a742,744
> 
> .PHONY: dylib
> dylib: lib$(GC_GRADE).dylib
Index: boehm_gc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Mmakefile,v
retrieving revision 1.27
diff -r1.27 Mmakefile
18d17
< 
40a40,41
> lib$(GC_GRADE).dylib: submake
> 
77a79
> 		FINAL_INSTALL_MERC_GC_LIB_DIR=$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
Index: browser/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mercury.options,v
retrieving revision 1.3
diff -r1.3 Mercury.options
12a13
> EXTRA_LIBRARIES-libmer_browser.dylib = mer_mdbcomp
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.40
diff -r1.40 Mmakefile
57c57,58
< 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
---
> 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
> 		--shlib-linker-install-name-path $(FINAL_INSTALL_MERC_LIB_DIR)
139a141
> lib$(BROWSER_LIB_NAME).dylib: lib$(MDBCOMP_LIB_NAME).dylib
207,208c209,210
< # XXX This is a hack.  We ought to change the Mercury compiler so that it generates
< # the Java files with the right names in the first place.
---
> # XXX This is a hack.  We ought to change the Mercury compiler so that it
> # generates the Java files with the right names in the first place.
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.62
diff -r1.62 compile_target_code.m
13c13
< :- module backend_libs__compile_target_code.
---
> :- module backend_libs.compile_target_code.
17,20c17,20
< :- import_module parse_tree__prog_data.
< :- import_module parse_tree__prog_io.
< :- import_module parse_tree__modules.
< :- import_module libs__globals.
---
> :- import_module parse_tree.prog_data.
> :- import_module parse_tree.prog_io.
> :- import_module parse_tree.modules.
> :- import_module libs.globals.
34c34
< :- pred compile_c_file(io__output_stream::in, pic::in, string::in, string::in,
---
> :- pred compile_c_file(io.output_stream::in, pic::in, string::in, string::in,
38c38
< :- pred compile_c_file(io__output_stream::in, pic::in, module_name::in,
---
> :- pred compile_c_file(io.output_stream::in, pic::in, module_name::in,
42c42
< :- pred assemble(io__output_stream::in, pic::in, module_name::in,
---
> :- pred assemble(io.output_stream::in, pic::in, module_name::in,
46c46
< :- pred compile_java_file(io__output_stream::in, string::in, bool::out,
---
> :- pred compile_java_file(io.output_stream::in, string::in, bool::out,
50c50
< :- pred il_assemble(io__output_stream::in, module_name::in, has_main::in,
---
> :- pred il_assemble(io.output_stream::in, module_name::in, has_main::in,
54c54
< :- pred il_assemble(io__output_stream::in, file_name::in, file_name::in,
---
> :- pred il_assemble(io.output_stream::in, file_name::in, file_name::in,
59c59
< :- pred compile_managed_cplusplus_file(io__output_stream::in,
---
> :- pred compile_managed_cplusplus_file(io.output_stream::in,
63c63
< :- pred compile_csharp_file(io__output_stream::in, module_imports::in,
---
> :- pred compile_csharp_file(io.output_stream::in, module_imports::in,
69c69
< :- pred make_init_file(io__output_stream::in, module_name::in,
---
> :- pred make_init_file(io.output_stream::in, module_name::in,
74c74
< :- pred make_init_obj_file(io__output_stream::in, module_name::in,
---
> :- pred make_init_obj_file(io.output_stream::in, module_name::in,
84c84
< :- pred link(io__output_stream::in, linked_target_type::in, module_name::in,
---
> :- pred link(io.output_stream::in, linked_target_type::in, module_name::in,
107c107
< :- pred split_c_to_obj(io__output_stream::in, module_name::in,
---
> :- pred split_c_to_obj(io.output_stream::in, module_name::in,
151c151
< 	% Same as above except the globals are obtained from the io__state.
---
> 	% Same as above except the globals are obtained from the io.state.
159,167c159,167
< :- import_module backend_libs__foreign.
< :- import_module backend_libs__name_mangle.
< :- import_module hlds__passes_aux.
< :- import_module libs__globals.
< :- import_module libs__handle_options.
< :- import_module libs__options.
< :- import_module libs__trace_params.
< :- import_module parse_tree__error_util.
< :- import_module parse_tree__prog_out.
---
> :- import_module backend_libs.foreign.
> :- import_module backend_libs.name_mangle.
> :- import_module hlds.passes_aux.
> :- import_module libs.globals.
> :- import_module libs.handle_options.
> :- import_module libs.options.
> :- import_module libs.trace_params.
> :- import_module parse_tree.error_util.
> :- import_module parse_tree.prog_out.
191,192c191,192
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
< 	globals__io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
> 	globals.io_lookup_bool_option(sign_assembly, SignAssembly, !IO),
196,197c196,197
< 	globals__io_lookup_string_option(il_assembler, ILASM, !IO),
< 	globals__io_lookup_accumulating_option(ilasm_flags, ILASMFlagsList, !IO),
---
> 	globals.io_lookup_string_option(il_assembler, ILASM, !IO),
> 	globals.io_lookup_accumulating_option(ilasm_flags, ILASMFlagsList, !IO),
209c209
< 	globals__io_lookup_bool_option(target_debug, Debug, !IO),
---
> 	globals.io_lookup_bool_option(target_debug, Debug, !IO),
220c220
< 	string__append_list([ILASM, " ", SignOpt, VerboseOpt, DebugOpt,
---
> 	string.append_list([ILASM, " ", SignOpt, VerboseOpt, DebugOpt,
228c228
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
232,233c232,233
< 	globals__io_lookup_string_option(mcpp_compiler, MCPP, !IO),
< 	globals__io_lookup_accumulating_option(mcpp_flags, MCPPFlagsList, !IO),
---
> 	globals.io_lookup_string_option(mcpp_compiler, MCPP, !IO),
> 	globals.io_lookup_accumulating_option(mcpp_flags, MCPPFlagsList, !IO),
235c235
< 	globals__io_lookup_bool_option(target_debug, Debug, !IO),
---
> 	globals.io_lookup_bool_option(target_debug, Debug, !IO),
245c245
< 	globals__io_lookup_accumulating_option(c_include_directory,
---
> 	globals.io_lookup_accumulating_option(c_include_directory,
247c247
< 	InclOpts = string__append_list(list__condense(list__map(
---
> 	InclOpts = string.append_list(list.condense(list.map(
251c251
< 	globals__io_lookup_accumulating_option(link_library_directories,
---
> 	globals.io_lookup_accumulating_option(link_library_directories,
254c254
< 		string__append_list(list__condense(list__map(
---
> 		string.append_list(list.condense(list.map(
257c257
< 	string__append_list([MCPP, " -CLR ", DebugOpt, InclOpts,
---
> 	string.append_list([MCPP, " -CLR ", DebugOpt, InclOpts,
266c266
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
270,271c270,271
< 	globals__io_lookup_string_option(csharp_compiler, CSC, !IO),
< 	globals__io_lookup_accumulating_option(csharp_flags, CSCFlagsList,
---
> 	globals.io_lookup_string_option(csharp_compiler, CSC, !IO),
> 	globals.io_lookup_accumulating_option(csharp_flags, CSCFlagsList,
277c277
< 	CSharpFileName = string__replace_all(CSharpFileName0, "/", "\\\\"),
---
> 	CSharpFileName = string.replace_all(CSharpFileName0, "/", "\\\\"),
279c279
< 	globals__io_lookup_bool_option(target_debug, Debug, !IO),
---
> 	globals.io_lookup_bool_option(target_debug, Debug, !IO),
293c293
< 	globals__io_lookup_accumulating_option(link_library_directories,
---
> 	globals.io_lookup_accumulating_option(link_library_directories,
296c296
< 		string__append_list(list__condense(list__map(
---
> 		string.append_list(list.condense(list.map(
304c304
< 	ForeignDeps = list__map(
---
> 	ForeignDeps = list.map(
310c310
< 	list__map_foldl(
---
> 	list.map_foldl(
316,317c316,317
< 	ReferencedDllsStr = string__append_list(
< 		list__condense(ReferencedDllsList)),
---
> 	ReferencedDllsStr = string.append_list(
> 		list.condense(ReferencedDllsList)),
319c319
< 	string__append_list([CSC, DebugOpt,
---
> 	string.append_list([CSC, DebugOpt,
331c331
< :- pred split_c_to_obj(io__output_stream::in, module_name::in,
---
> :- pred split_c_to_obj(io.output_stream::in, module_name::in,
339c339
< 		globals__io_lookup_string_option(object_file_extension, Obj,
---
> 		globals.io_lookup_string_option(object_file_extension, Obj,
368,369c368,369
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
< 	globals__io_lookup_string_option(c_flag_to_name_object_file,
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
> 	globals.io_lookup_string_option(c_flag_to_name_object_file,
374,375c374,375
< 	globals__io_lookup_string_option(cc, CC, !IO),
< 	globals__io_lookup_accumulating_option(cflags, C_Flags_List, !IO),
---
> 	globals.io_lookup_string_option(cc, CC, !IO),
> 	globals.io_lookup_accumulating_option(cflags, C_Flags_List, !IO),
378,379c378,379
< 	globals__io_lookup_bool_option(use_subdirs, UseSubdirs, !IO),
< 	globals__io_lookup_bool_option(split_c_files, SplitCFiles, !IO),
---
> 	globals.io_lookup_bool_option(use_subdirs, UseSubdirs, !IO),
> 	globals.io_lookup_bool_option(split_c_files, SplitCFiles, !IO),
390c390
< 	globals__io_lookup_accumulating_option(c_include_directory,
---
> 	globals.io_lookup_accumulating_option(c_include_directory,
392c392
< 	InclOpt = string__append_list(list__condense(list__map(
---
> 	InclOpt = string.append_list(list.condense(list.map(
394c394
< 	globals__io_lookup_bool_option(split_c_files, Split_C_Files, !IO),
---
> 	globals.io_lookup_bool_option(split_c_files, Split_C_Files, !IO),
400c400
< 	globals__io_lookup_bool_option(highlevel_code, HighLevelCode, !IO),
---
> 	globals.io_lookup_bool_option(highlevel_code, HighLevelCode, !IO),
406c406
< 	globals__io_lookup_bool_option(gcc_nested_functions,
---
> 	globals.io_lookup_bool_option(gcc_nested_functions,
413c413
< 	globals__io_lookup_bool_option(highlevel_data, HighLevelData, !IO),
---
> 	globals.io_lookup_bool_option(highlevel_data, HighLevelData, !IO),
419c419
< 	globals__io_lookup_bool_option(gcc_global_registers, GCC_Regs, !IO),
---
> 	globals.io_lookup_bool_option(gcc_global_registers, GCC_Regs, !IO),
421c421
< 		globals__io_lookup_string_option(cflags_for_regs,
---
> 		globals.io_lookup_string_option(cflags_for_regs,
428c428
< 	globals__io_lookup_bool_option(gcc_non_local_gotos, GCC_Gotos, !IO),
---
> 	globals.io_lookup_bool_option(gcc_non_local_gotos, GCC_Gotos, !IO),
431c431
< 		globals__io_lookup_string_option(cflags_for_gotos,
---
> 		globals.io_lookup_string_option(cflags_for_gotos,
437c437
< 	globals__io_lookup_bool_option(asm_labels, ASM_Labels, !IO),
---
> 	globals.io_lookup_bool_option(asm_labels, ASM_Labels, !IO),
443c443
< 	globals__io_lookup_bool_option(parallel, Parallel, !IO),
---
> 	globals.io_lookup_bool_option(parallel, Parallel, !IO),
445c445
< 		globals__io_lookup_string_option(cflags_for_threads,
---
> 		globals.io_lookup_string_option(cflags_for_threads,
450c450
< 	globals__io_get_gc_method(GC_Method, !IO),
---
> 	globals.io_get_gc_method(GC_Method, !IO),
467c467
< 	globals__io_lookup_bool_option(profile_calls, ProfileCalls, !IO),
---
> 	globals.io_lookup_bool_option(profile_calls, ProfileCalls, !IO),
473c473
< 	globals__io_lookup_bool_option(profile_time, ProfileTime, !IO),
---
> 	globals.io_lookup_bool_option(profile_time, ProfileTime, !IO),
479c479
< 	globals__io_lookup_bool_option(profile_memory, ProfileMemory, !IO),
---
> 	globals.io_lookup_bool_option(profile_memory, ProfileMemory, !IO),
485c485
< 	globals__io_lookup_bool_option(profile_deep, ProfileDeep, !IO),
---
> 	globals.io_lookup_bool_option(profile_deep, ProfileDeep, !IO),
491c491
< 	globals__io_lookup_bool_option(record_term_sizes_as_words,
---
> 	globals.io_lookup_bool_option(record_term_sizes_as_words,
493c493
< 	globals__io_lookup_bool_option(record_term_sizes_as_cells,
---
> 	globals.io_lookup_bool_option(record_term_sizes_as_cells,
516c516
< 		globals__io_lookup_string_option(cflags_for_pic,
---
> 		globals.io_lookup_string_option(cflags_for_pic,
526c526
< 		globals__io_lookup_bool_option(pic_reg, PIC_Reg, !IO)
---
> 		globals.io_lookup_bool_option(pic_reg, PIC_Reg, !IO)
537c537
< 	globals__io_get_tags_method(Tags_Method, !IO),
---
> 	globals.io_get_tags_method(Tags_Method, !IO),
543,545c543,545
< 	globals__io_lookup_int_option(num_tag_bits, NumTagBits, !IO),
< 	string__int_to_string(NumTagBits, NumTagBitsString),
< 	string__append_list(
---
> 	globals.io_lookup_int_option(num_tag_bits, NumTagBits, !IO),
> 	string.int_to_string(NumTagBits, NumTagBitsString),
> 	string.append_list(
547c547
< 	globals__io_lookup_bool_option(decl_debug, DeclDebug, !IO),
---
> 	globals.io_lookup_bool_option(decl_debug, DeclDebug, !IO),
553c553
< 	globals__io_lookup_bool_option(exec_trace, ExecTrace, !IO),
---
> 	globals.io_lookup_bool_option(exec_trace, ExecTrace, !IO),
559c559
< 	globals__io_lookup_bool_option(target_debug, Target_Debug, !IO),
---
> 	globals.io_lookup_bool_option(target_debug, Target_Debug, !IO),
561c561
< 		globals__io_lookup_string_option(cflags_for_debug,
---
> 		globals.io_lookup_string_option(cflags_for_debug,
563c563
< 		string__append(Target_DebugOpt0, " ", Target_DebugOpt)
---
> 		string.append(Target_DebugOpt0, " ", Target_DebugOpt)
567c567
< 	globals__io_lookup_bool_option(low_level_debug, LL_Debug, !IO),
---
> 	globals.io_lookup_bool_option(low_level_debug, LL_Debug, !IO),
573c573
< 	globals__io_lookup_bool_option(use_trail, UseTrail, !IO),
---
> 	globals.io_lookup_bool_option(use_trail, UseTrail, !IO),
579c579
< 	globals__io_lookup_bool_option(reserve_tag, ReserveTag, !IO),
---
> 	globals.io_lookup_bool_option(reserve_tag, ReserveTag, !IO),
585c585
< 	globals__io_lookup_bool_option(use_minimal_model_stack_copy,
---
> 	globals.io_lookup_bool_option(use_minimal_model_stack_copy,
587c587
< 	globals__io_lookup_bool_option(use_minimal_model_own_stacks,
---
> 	globals.io_lookup_bool_option(use_minimal_model_own_stacks,
607c607
< 	globals__io_lookup_bool_option(minimal_model_debug, MinimalModelDebug,
---
> 	globals.io_lookup_bool_option(minimal_model_debug, MinimalModelDebug,
623c623
< 	globals__io_lookup_bool_option(type_layout, TypeLayoutOption, !IO),
---
> 	globals.io_lookup_bool_option(type_layout, TypeLayoutOption, !IO),
629c629
< 	globals__io_lookup_bool_option(c_optimize, C_optimize, !IO),
---
> 	globals.io_lookup_bool_option(c_optimize, C_optimize, !IO),
631c631
< 		globals__io_lookup_string_option(cflags_for_optimization,
---
> 		globals.io_lookup_string_option(cflags_for_optimization,
636c636
< 	globals__io_lookup_bool_option(ansi_c, Ansi, !IO),
---
> 	globals.io_lookup_bool_option(ansi_c, Ansi, !IO),
638c638
< 		globals__io_lookup_string_option(cflags_for_ansi, AnsiOpt, !IO)
---
> 		globals.io_lookup_string_option(cflags_for_ansi, AnsiOpt, !IO)
642c642
< 	globals__io_lookup_bool_option(inline_alloc, InlineAlloc, !IO),
---
> 	globals.io_lookup_bool_option(inline_alloc, InlineAlloc, !IO),
648c648
< 	globals__io_lookup_bool_option(warn_target_code, Warn, !IO),
---
> 	globals.io_lookup_bool_option(warn_target_code, Warn, !IO),
650c650
< 		globals__io_lookup_string_option(cflags_for_warnings,
---
> 		globals.io_lookup_string_option(cflags_for_warnings,
660c660
< 	string__append_list([CC, " ", SubDirInclOpt, InclOpt,
---
> 	string.append_list([CC, " ", SubDirInclOpt, InclOpt,
679c679
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
683,684c683,684
< 	globals__io_lookup_string_option(java_compiler, JavaCompiler, !IO),
< 	globals__io_lookup_accumulating_option(java_flags, JavaFlagsList, !IO),
---
> 	globals.io_lookup_string_option(java_compiler, JavaCompiler, !IO),
> 	globals.io_lookup_accumulating_option(java_flags, JavaFlagsList, !IO),
687c687
< 	globals__io_lookup_accumulating_option(java_classpath,
---
> 	globals.io_lookup_accumulating_option(java_classpath,
699c699
< 		InclOpt = string__append_list([
---
> 		InclOpt = string.append_list([
703c703
< 	globals__io_lookup_bool_option(target_debug, Target_Debug, !IO),
---
> 	globals.io_lookup_bool_option(target_debug, Target_Debug, !IO),
710,713c710,713
< 	globals__io_lookup_bool_option(use_subdirs, UseSubdirs, !IO),
< 	globals__io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs, !IO),
< 	globals__io_lookup_string_option(fullarch, FullArch, !IO),
< 	globals__io_get_globals(Globals, !IO),
---
> 	globals.io_lookup_bool_option(use_subdirs, UseSubdirs, !IO),
> 	globals.io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs, !IO),
> 	globals.io_lookup_string_option(fullarch, FullArch, !IO),
> 	globals.io_get_globals(Globals, !IO),
723c723
< 		dir__make_directory(DirName, _, !IO),
---
> 		dir.make_directory(DirName, _, !IO),
732c732
< 	string__append_list([JavaCompiler, " ", InclOpt, DestDir,
---
> 	string.append_list([JavaCompiler, " ", InclOpt, DestDir,
749c749
< 		error("compile_target_code__assemble: link_with_pic")
---
> 		error("compile_target_code.assemble: link_with_pic")
760c760
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
766,767c766,767
< 	globals__io_lookup_string_option(cc, CC, !IO),
< 	globals__io_lookup_string_option(c_flag_to_name_object_file,
---
> 	globals.io_lookup_string_option(cc, CC, !IO),
> 	globals.io_lookup_string_option(c_flag_to_name_object_file,
769c769
< 	globals__io_lookup_accumulating_option(cflags, C_Flags_List, !IO),
---
> 	globals.io_lookup_accumulating_option(cflags, C_Flags_List, !IO),
773c773
< 	string__append_list([CC, " ", CFLAGS, " ", GCCFLAGS_FOR_PIC,
---
> 	string.append_list([CC, " ", CFLAGS, " ", GCCFLAGS_FOR_PIC,
784c784
< 	io__open_output(TmpInitFileName, InitFileRes, !IO),
---
> 	io.open_output(TmpInitFileName, InitFileRes, !IO),
787,788c787,788
< 		globals__io_lookup_bool_option(aditi, Aditi, !IO),
< 		list__foldl(make_init_file_aditi(InitFileStream, Aditi),
---
> 		globals.io_lookup_bool_option(aditi, Aditi, !IO),
> 		list.foldl(make_init_file_aditi(InitFileStream, Aditi),
790c790
< 		globals__io_lookup_maybe_string_option(extra_init_command,
---
> 		globals.io_lookup_maybe_string_option(extra_init_command,
804c804
< 		io__close_output(InitFileStream, !IO),
---
> 		io.close_output(InitFileStream, !IO),
811,818c811,818
< 		io__progname_base("mercury_compile", ProgName, !IO),
< 		io__write_string(ErrorStream, ProgName, !IO),
< 		io__write_string(ErrorStream, ": can't open `", !IO),
< 		io__write_string(ErrorStream, TmpInitFileName, !IO),
< 		io__write_string(ErrorStream, "' for output:\n", !IO),
< 		io__nl(ErrorStream, !IO),
< 		io__write_string(ErrorStream, io__error_message(Error), !IO),
< 		io__nl(ErrorStream, !IO),
---
> 		io.progname_base("mercury_compile", ProgName, !IO),
> 		io.write_string(ErrorStream, ProgName, !IO),
> 		io.write_string(ErrorStream, ": can't open `", !IO),
> 		io.write_string(ErrorStream, TmpInitFileName, !IO),
> 		io.write_string(ErrorStream, "' for output:\n", !IO),
> 		io.nl(ErrorStream, !IO),
> 		io.write_string(ErrorStream, io.error_message(Error), !IO),
> 		io.nl(ErrorStream, !IO),
822c822
< :- pred make_init_file_aditi(io__output_stream::in, bool::in, module_name::in,
---
> :- pred make_init_file_aditi(io.output_stream::in, bool::in, module_name::in,
828,830c828,830
< 	io__write_string(InitFileStream, "INIT ", !IO),
< 	io__write_string(InitFileStream, InitFuncName, !IO),
< 	io__nl(InitFileStream, !IO),
---
> 	io.write_string(InitFileStream, "INIT ", !IO),
> 	io.write_string(InitFileStream, InitFuncName, !IO),
> 	io.nl(InitFileStream, !IO),
833,835c833,835
< 		io__write_string(InitFileStream, "ADITI_DATA ", !IO),
< 		io__write_string(InitFileStream, RLName, !IO),
< 		io__nl(InitFileStream, !IO)
---
> 		io.write_string(InitFileStream, "ADITI_DATA ", !IO),
> 		io.write_string(InitFileStream, RLName, !IO),
> 		io.nl(InitFileStream, !IO)
843c843
< 	globals__io_lookup_string_option(output_file_name, OutputFileName0,
---
> 	globals.io_lookup_string_option(output_file_name, OutputFileName0,
857c857
< 	globals__io_lookup_bool_option(compile_to_shared_lib,
---
> 	globals.io_lookup_bool_option(compile_to_shared_lib,
864,866c864,866
< 	globals__io_get_target(Target, !IO),
< 	globals__io_lookup_bool_option(split_c_files, SplitFiles, !IO),
< 	io__output_stream(OutputStream, !IO),
---
> 	globals.io_get_target(Target, !IO),
> 	globals.io_lookup_bool_option(split_c_files, SplitFiles, !IO),
> 	io.output_stream(OutputStream, !IO),
877c877
< 		globals__io_lookup_string_option(library_extension, LibExt,
---
> 		globals.io_lookup_string_option(library_extension, LibExt,
881c881
< 		string__append(".dir/*", Obj, DirObj),
---
> 		string.append(".dir/*", Obj, DirObj),
894c894
< 			list__map(
---
> 			list.map(
897c897
< 						dir__basename_det(ModuleStr),
---
> 						dir.basename_det(ModuleStr),
909c909
< 			globals__io_lookup_accumulating_option(link_objects,
---
> 			globals.io_lookup_accumulating_option(link_objects,
928c928
< 	globals__io_lookup_bool_option(rebuild, MustCompile, !IO),
---
> 	globals.io_lookup_bool_option(rebuild, MustCompile, !IO),
935c935
< :- pred make_init_obj_file(io__output_stream::in, bool::in,
---
> :- pred make_init_obj_file(io.output_stream::in, bool::in,
941,942c941,942
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
< 	globals__io_lookup_bool_option(statistics, Stats, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
> 	globals.io_lookup_bool_option(statistics, Stats, !IO),
946c946
< 	globals__io_get_globals(Globals, !IO),
---
> 	globals.io_get_globals(Globals, !IO),
958c958
< 	list__map_foldl(
---
> 	list.map_foldl(
965c965
< 	globals__io_lookup_accumulating_option(init_file_directories,
---
> 	globals.io_lookup_accumulating_option(init_file_directories,
970c970
< 	globals__io_lookup_accumulating_option(init_files, InitFileNamesList0,
---
> 	globals.io_lookup_accumulating_option(init_files, InitFileNamesList0,
972c972
< 	globals__io_lookup_accumulating_option(trace_init_files,
---
> 	globals.io_lookup_accumulating_option(trace_init_files,
974c974
< 	globals__io_lookup_maybe_string_option(
---
> 	globals.io_lookup_maybe_string_option(
991c991
< 	globals__io_get_trace_level(TraceLevel, !IO),
---
> 	globals.io_get_trace_level(TraceLevel, !IO),
1002c1002
< 	globals__io_lookup_accumulating_option(runtime_flags, RuntimeFlagsList,
---
> 	globals.io_lookup_accumulating_option(runtime_flags, RuntimeFlagsList,
1007c1007
< 	globals__io_lookup_bool_option(extra_initialization_functions,
---
> 	globals.io_lookup_bool_option(extra_initialization_functions,
1011c1011
< 	globals__io_lookup_bool_option(main, Main, !IO),
---
> 	globals.io_lookup_bool_option(main, Main, !IO),
1014c1014
< 	globals__io_lookup_bool_option(aditi, Aditi, !IO),
---
> 	globals.io_lookup_bool_option(aditi, Aditi, !IO),
1017c1017
< 	globals__io_lookup_string_option(mkinit_command, Mkinit, !IO),
---
> 	globals.io_lookup_string_option(mkinit_command, Mkinit, !IO),
1019c1019
< 	MkInitCmd = string__append_list(
---
> 	MkInitCmd = string.append_list(
1035c1035
< 				io__file_modification_time(InitCFileName,
---
> 				io.file_modification_time(InitCFileName,
1037c1037
< 				io__file_modification_time(InitObjFileName,
---
> 				io.file_modification_time(InitObjFileName,
1083,1084c1083,1084
< 	globals__io_lookup_bool_option(verbose, Verbose, !IO),
< 	globals__io_lookup_bool_option(statistics, Stats, !IO),
---
> 	globals.io_lookup_bool_option(verbose, Verbose, !IO),
> 	globals.io_lookup_bool_option(statistics, Stats, !IO),
1087,1088c1087,1088
< 	globals__io_lookup_string_option(library_extension, LibExt, !IO),
< 	globals__io_lookup_string_option(shared_library_extension,
---
> 	globals.io_lookup_string_option(library_extension, LibExt, !IO),
> 	globals.io_lookup_string_option(shared_library_extension,
1090c1090
< 	globals__io_lookup_string_option(executable_file_extension, ExeExt,
---
> 	globals.io_lookup_string_option(executable_file_extension, ExeExt,
1114c1114
< 			globals__io_lookup_bool_option(allow_undefined,
---
> 			globals.io_lookup_bool_option(allow_undefined,
1117c1117
< 				globals__io_lookup_string_option(
---
> 				globals.io_lookup_string_option(
1121c1121
< 				globals__io_lookup_string_option(
---
> 				globals.io_lookup_string_option(
1130c1130
< 			error("compile_target_code__link")
---
> 			error("compile_target_code.link")
1133c1133
< 			error("compile_target_code__link")
---
> 			error("compile_target_code.link")
1152c1152
< 		globals__io_lookup_bool_option(strip, Strip, !IO),
---
> 		globals.io_lookup_bool_option(strip, Strip, !IO),
1154c1154
< 			globals__io_lookup_string_option(linker_strip_flag,
---
> 			globals.io_lookup_string_option(linker_strip_flag,
1160c1160
< 		globals__io_lookup_bool_option(target_debug, TargetDebug, !IO),
---
> 		globals.io_lookup_bool_option(target_debug, TargetDebug, !IO),
1162c1162
< 			globals__io_lookup_string_option(DebugFlagsOpt,
---
> 			globals.io_lookup_string_option(DebugFlagsOpt,
1171c1171
< 		globals__io_lookup_string_option(linkage, Linkage, !IO),
---
> 		globals.io_lookup_string_option(linkage, Linkage, !IO),
1173c1173
< 			globals__io_lookup_string_option(linker_static_flags,
---
> 			globals.io_lookup_string_option(linker_static_flags,
1184c1184
< 			globals__io_lookup_string_option(ThreadFlagsOpt,
---
> 			globals.io_lookup_string_option(ThreadFlagsOpt,
1193c1193
< 		globals__io_lookup_maybe_string_option(
---
> 		globals.io_lookup_maybe_string_option(
1211c1211
< 		globals__io_lookup_accumulating_option(LDFlagsOpt,
---
> 		globals.io_lookup_accumulating_option(LDFlagsOpt,
1214c1214
< 		globals__io_lookup_accumulating_option(
---
> 		globals.io_lookup_accumulating_option(
1217c1217
< 		globals__io_lookup_string_option(linker_path_flag,
---
> 		globals.io_lookup_string_option(linker_path_flag,
1224a1225,1226
> 		globals.io_lookup_bool_option(shlib_linker_use_install_name,
> 			UseInstallName, !IO),
1225a1228
> 			UseInstallName = no,
1231c1234
< 			globals__io_lookup_accumulating_option(
---
> 			globals.io_lookup_accumulating_option(
1237,1242c1240,1245
< 				globals__io_lookup_string_option(RpathSepOpt,
< 					RpathSep, !IO),
< 				globals__io_lookup_string_option(RpathFlagOpt,
< 					RpathFlag, !IO),
< 				RpathOpts0 = string__join_list(RpathSep,
< 					RpathDirs),
---
> 				globals.io_lookup_string_option(
> 					RpathSepOpt, RpathSep, !IO),
> 				globals.io_lookup_string_option(
> 					RpathFlagOpt, RpathFlag, !IO),
> 				RpathOpts0 = string.join_list(
> 					RpathSep, RpathDirs),
1247a1251,1263
> 				
> 		%
> 		% Set up the installed name for shared libraries.
> 		%
> 		(
> 			UseInstallName = yes,
> 			LinkTargetType = shared_library
> 		->
> 			get_install_name_option(OutputFileName, InstallNameOpt,
> 				!IO)
> 		;
> 			InstallNameOpt = ""
> 		),
1249c1265
< 		globals__io_get_trace_level(TraceLevel, !IO),
---
> 		globals.io_get_trace_level(TraceLevel, !IO),
1253c1269
< 			globals__io_lookup_string_option(TraceFlagsOpt,
---
> 			globals.io_lookup_string_option(TraceFlagsOpt,
1262c1278
< 		globals__io_lookup_accumulating_option(
---
> 		globals.io_lookup_accumulating_option(
1264,1265c1280,1281
< 		globals__io_lookup_string_option(fullarch, FullArch, !IO),
< 		globals__io_get_globals(Globals, !IO),
---
> 		globals.io_lookup_string_option(fullarch, FullArch, !IO),
> 		globals.io_get_globals(Globals, !IO),
1267c1283
< 		MercuryLibDirs = list__map(
---
> 		MercuryLibDirs = list.map(
1270c1286
< 		globals__io_lookup_accumulating_option(link_libraries,
---
> 		globals.io_lookup_accumulating_option(link_libraries,
1272c1288
< 		list__map_foldl2(process_link_library(MercuryLibDirs),
---
> 		list.map_foldl2(process_link_library(MercuryLibDirs),
1276c1292
< 		globals__io_lookup_string_option(linker_opt_separator,
---
> 		globals.io_lookup_string_option(linker_opt_separator,
1285c1301
< 			globals__io_lookup_string_option(CommandOpt, Command,
---
> 			globals.io_lookup_string_option(CommandOpt, Command,
1287c1303
< 			string__append_list(
---
> 			string.append_list(
1293,1295c1309,1311
< 				RpathOpts, " ", DebugOpts, " ", LDFlags, " ",
< 				LinkLibraries, " ", MercuryStdLibs, " ",
< 				SystemLibs],
---
> 				RpathOpts, " ", InstallNameOpt, " ", DebugOpts,
> 				" ", LDFlags, " ", LinkLibraries, " ",
> 				MercuryStdLibs, " ", SystemLibs],
1298c1314
< 			globals__io_lookup_bool_option(demangle, Demangle,
---
> 			globals.io_lookup_bool_option(demangle, Demangle,
1301c1317
< 				globals__io_lookup_string_option(
---
> 				globals.io_lookup_string_option(
1316c1332
< 	globals__io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs,
---
> 	globals.io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs,
1323,1324c1339,1340
< 		globals__io_set_option(use_subdirs, bool(no), !IO),
< 		globals__io_set_option(use_grade_subdirs, bool(no), !IO),
---
> 		globals.io_set_option(use_subdirs, bool(no), !IO),
> 		globals.io_set_option(use_grade_subdirs, bool(no), !IO),
1332,1333c1348,1349
< 		globals__io_set_option(use_subdirs, bool(yes), !IO),
< 		globals__io_set_option(use_grade_subdirs, bool(yes), !IO),
---
> 		globals.io_set_option(use_subdirs, bool(yes), !IO),
> 		globals.io_set_option(use_grade_subdirs, bool(yes), !IO),
1335c1351
< 		io__set_output_stream(ErrorStream, OutputStream, !IO),
---
> 		io.set_output_stream(ErrorStream, OutputStream, !IO),
1338c1354
< 		io__set_output_stream(OutputStream, _, !IO)
---
> 		io.set_output_stream(OutputStream, _, !IO)
1349,1352c1365,1368
< 	globals__io_lookup_string_option(fullarch, FullArch, !IO),
< 	globals__io_get_gc_method(GCMethod, !IO),
< 	globals__io_lookup_string_option(library_extension, LibExt, !IO),
< 	globals__io_get_globals(Globals, !IO),
---
> 	globals.io_lookup_string_option(fullarch, FullArch, !IO),
> 	globals.io_get_gc_method(GCMethod, !IO),
> 	globals.io_lookup_string_option(library_extension, LibExt, !IO),
> 	globals.io_get_globals(Globals, !IO),
1368,1369c1384,1385
< 		globals__io_lookup_bool_option(profile_time, ProfTime, !IO),
< 		globals__io_lookup_bool_option(profile_deep, ProfDeep, !IO),
---
> 		globals.io_lookup_bool_option(profile_time, ProfTime, !IO),
> 		globals.io_lookup_bool_option(profile_deep, ProfDeep, !IO),
1375c1391
< 		globals__io_lookup_bool_option(parallel, Parallel, !IO),
---
> 		globals.io_lookup_bool_option(parallel, Parallel, !IO),
1398c1414
< 	globals__io_get_trace_level(TraceLevel, !IO),
---
> 	globals.io_get_trace_level(TraceLevel, !IO),
1415c1431
< 		SharedTraceLibs = string__join_list(" ",
---
> 		SharedTraceLibs = string.join_list(" ",
1419c1435
< 	globals__io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
---
> 	globals.io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
1421c1437
< 		StdLibs = string__join_list(" ",
---
> 		StdLibs = string.join_list(" ",
1431c1447
< 		StdLibs = string__join_list(" ",
---
> 		StdLibs = string.join_list(" ",
1456,1457c1472,1473
< 	globals__io_lookup_string_option(LinkLibFlag, LinkLibOpt, !IO),
< 	globals__io_lookup_string_option(LinkLibSuffix, Suffix, !IO),
---
> 	globals.io_lookup_string_option(LinkLibFlag, LinkLibOpt, !IO),
> 	globals.io_lookup_string_option(LinkLibSuffix, Suffix, !IO),
1467c1483
< 	globals__io_get_trace_level(TraceLevel, !IO),
---
> 	globals.io_get_trace_level(TraceLevel, !IO),
1471c1487
< 		globals__io_lookup_string_option(trace_libs, SystemTraceLibs0,
---
> 		globals.io_lookup_string_option(trace_libs, SystemTraceLibs0,
1473c1489
< 		globals__io_lookup_bool_option(use_readline, UseReadline, !IO),
---
> 		globals.io_lookup_bool_option(use_readline, UseReadline, !IO),
1475c1491
< 			globals__io_lookup_string_option(readline_libs,
---
> 			globals.io_lookup_string_option(readline_libs,
1489c1505
< 		globals__io_lookup_string_option(thread_libs, ThreadLibs, !IO)
---
> 		globals.io_lookup_string_option(thread_libs, ThreadLibs, !IO)
1499c1515
< 		globals__io_lookup_string_option(shared_libs, OtherSystemLibs,
---
> 		globals.io_lookup_string_option(shared_libs, OtherSystemLibs,
1503c1519
< 		error("compile_target_code__get_std_libs: static library")
---
> 		error("compile_target_code.get_std_libs: static library")
1506c1522
< 		error("compile_target_code__get_std_libs: java archive")
---
> 		error("compile_target_code.get_std_libs: java archive")
1509c1525
< 		globals__io_lookup_string_option(math_lib, OtherSystemLibs,
---
> 		globals.io_lookup_string_option(math_lib, OtherSystemLibs,
1513c1529
< 	SystemLibs = string__join_list(" ",
---
> 	SystemLibs = string.join_list(" ",
1519,1520c1535,1536
< 	globals__io_lookup_bool_option(parallel, Parallel, !IO),
< 	globals__io_get_gc_method(GCMethod, !IO),
---
> 	globals.io_lookup_bool_option(parallel, Parallel, !IO),
> 	globals.io_get_gc_method(GCMethod, !IO),
1529,1530c1545,1546
< 	globals__io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
< 	globals__io_lookup_accumulating_option(mercury_libraries, MercuryLibs,
---
> 	globals.io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
> 	globals.io_lookup_accumulating_option(mercury_libraries, MercuryLibs,
1534c1550
< 		list__member(LibName, MercuryLibs)
---
> 		list.member(LibName, MercuryLibs)
1539c1555
< 		globals__io_lookup_bool_option(use_grade_subdirs,
---
> 		globals.io_lookup_bool_option(use_grade_subdirs,
1543c1559
< 		globals__io_lookup_string_option(library_extension, LibExt,
---
> 		globals.io_lookup_string_option(library_extension, LibExt,
1546c1562
< 		globals__io_set_option(use_grade_subdirs, bool(no), !IO),
---
> 		globals.io_set_option(use_grade_subdirs, bool(no), !IO),
1549c1565
< 		globals__io_set_option(use_grade_subdirs,
---
> 		globals.io_set_option(use_grade_subdirs,
1552c1568
< 		io__input_stream(InputStream, !IO),
---
> 		io.input_stream(InputStream, !IO),
1558,1559c1574,1575
< 			io__set_input_stream(InputStream, LibInputStream, !IO),
< 			io__close_input(LibInputStream, !IO)
---
> 			io.set_input_stream(InputStream, LibInputStream, !IO),
> 			io.close_input(LibInputStream, !IO)
1571c1587
< :- pred create_archive(io__output_stream::in, file_name::in, bool::in,
---
> :- pred create_archive(io.output_stream::in, file_name::in, bool::in,
1575,1576c1591,1592
< 	globals__io_lookup_string_option(create_archive_command, ArCmd, !IO),
< 	globals__io_lookup_accumulating_option(
---
> 	globals.io_lookup_string_option(create_archive_command, ArCmd, !IO),
> 	globals.io_lookup_accumulating_option(
1579c1595
< 	globals__io_lookup_string_option(
---
> 	globals.io_lookup_string_option(
1581c1597
< 	globals__io_lookup_string_option(ranlib_command, RanLib, !IO),
---
> 	globals.io_lookup_string_option(ranlib_command, RanLib, !IO),
1592c1608
< 	MakeLibCmd = string__append_list([
---
> 	MakeLibCmd = string.append_list([
1604c1620
< 		RanLibCmd = string__append_list([RanLib, " ", LibFileName]),
---
> 		RanLibCmd = string.append_list([RanLib, " ", LibFileName]),
1609c1625
< :- pred create_java_archive(io__output_stream::in, module_name::in,
---
> :- pred create_java_archive(io.output_stream::in, module_name::in,
1620c1636
< 	Cmd = string__append_list([
---
> 	Cmd = string.append_list([
1628c1644
< 	globals__io_lookup_string_option(pic_object_file_extension, PicObjExt,
---
> 	globals.io_lookup_string_option(pic_object_file_extension, PicObjExt,
1630c1646
< 	globals__io_lookup_string_option(link_with_pic_object_file_extension,
---
> 	globals.io_lookup_string_option(link_with_pic_object_file_extension,
1632,1637c1648,1653
< 	globals__io_lookup_string_option(object_file_extension, ObjExt, !IO),
< 	globals__io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
< 	globals__io_lookup_bool_option(gcc_global_registers, GCCGlobals, !IO),
< 	globals__io_lookup_bool_option(highlevel_code, HighLevelCode, !IO),
< 	globals__io_lookup_bool_option(pic, PIC, !IO),
< 	globals__io_get_target(Target, !IO),
---
> 	globals.io_lookup_string_option(object_file_extension, ObjExt, !IO),
> 	globals.io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
> 	globals.io_lookup_bool_option(gcc_global_registers, GCCGlobals, !IO),
> 	globals.io_lookup_bool_option(highlevel_code, HighLevelCode, !IO),
> 	globals.io_lookup_bool_option(pic, PIC, !IO),
> 	globals.io_get_target(Target, !IO),
1691c1707
< 	globals__io_lookup_maybe_string_option(
---
> 	globals.io_lookup_maybe_string_option(
1693c1709
< 	globals__io_lookup_maybe_string_option(
---
> 	globals.io_lookup_maybe_string_option(
1724c1740
< 		string__append_list([Prefix, String, Suffix], Result)
---
> 		string.append_list([Prefix, String, Suffix], Result)
1727c1743
< 		string__append_list([Prefix, String, Suffix, Separator,
---
> 		string.append_list([Prefix, String, Suffix, Separator,
1754c1770
< 	file_name_to_module_name(dir__basename_det(Module), ModuleName),
---
> 	file_name_to_module_name(dir.basename_det(Module), ModuleName),
1763c1779
< 	io__open_output(NumChunksFileName, Res, !IO),
---
> 	io.open_output(NumChunksFileName, Res, !IO),
1765,1767c1781,1783
< 		io__write_int(OutputStream, NumChunks, !IO),
< 		io__nl(OutputStream, !IO),
< 		io__close_output(OutputStream, !IO),
---
> 		io.write_int(OutputStream, NumChunks, !IO),
> 		io.nl(OutputStream, !IO),
> 		io.close_output(OutputStream, !IO),
1771,1775c1787,1791
< 		io__progname_base("mercury_compile", ProgName, !IO),
< 		io__write_string(ProgName, !IO),
< 		io__write_string(": can't open `", !IO),
< 		io__write_string(NumChunksFileName, !IO),
< 		io__write_string("' for output\n", !IO)
---
> 		io.progname_base("mercury_compile", ProgName, !IO),
> 		io.write_string(ProgName, !IO),
> 		io.write_string(": can't open `", !IO),
> 		io.write_string(NumChunksFileName, !IO),
> 		io.write_string("' for output\n", !IO)
1781c1797
< 	io__open_input(NumChunksFileName, Res, !IO),
---
> 	io.open_input(NumChunksFileName, Res, !IO),
1784,1785c1800,1801
< 		io__read_word(FileStream, MaybeNumChunksString, !IO),
< 		io__close_input(FileStream, !IO),
---
> 		io.read_word(FileStream, MaybeNumChunksString, !IO),
> 		io.close_input(FileStream, !IO),
1789,1790c1805,1806
< 				string__to_int(
< 					string__from_char_list(NumChunksString),
---
> 				string.to_int(
> 					string.from_char_list(NumChunksString),
1815c1831
< 		MaybeNumChunks = error(io__error_message(Error))
---
> 		MaybeNumChunks = error(io.error_message(Error))
1826c1842
< 		globals__io_lookup_string_option(object_file_extension, Obj,
---
> 		globals.io_lookup_string_option(object_file_extension, Obj,
1832,1833c1848,1849
< 		io__remove_file(CFileName, _, !IO),
< 		io__remove_file(ObjFileName, _, !IO),
---
> 		io.remove_file(CFileName, _, !IO),
> 		io.remove_file(ObjFileName, _, !IO),
1844c1860
< 	list__map_foldl(
---
> 	list.map_foldl(
1849c1865
< 		[MainModule | list__delete_all(AllModules, MainModule)],
---
> 		[MainModule | list.delete_all(AllModules, MainModule)],
1851,1852c1867,1868
< 	Command = string__join_list(" ",
< 		list__map(quote_arg, [Command0 | ModuleNameStrings])).
---
> 	Command = string.join_list(" ",
> 		list.map(quote_arg, [Command0 | ModuleNameStrings])).
1861c1877
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1865c1881
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1869c1885
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1877c1893
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1882c1898
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1887c1903
< 		globals__lookup_string_option(Globals,
---
> 		globals.lookup_string_option(Globals,
1896c1912
< 	globals__io_get_globals(Globals, !IO),
---
> 	globals.io_get_globals(Globals, !IO),
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.306
diff -r1.306 modules.m
761a762,770
> 	% get_install_name_option(FileName, Option, !IO):
> 	%	Get the option string for setting the install-name of the
> 	%	shared library FileName.
> 	%	This is only used for systems which support the install-name
> 	%	option for shared libraries (such as Darwin).
> 	
> :- pred get_install_name_option(string::in, string::out, io::di, io::uo) 
> 	is det.
> 
958a968
> 			; Ext = ".dylib"
963a974
> 			; Ext = ".split.dylib"
4759,4760c4770,4771
< 	module_name_to_lib_file_name("lib", ModuleName, ".so", yes,
< 		SharedLibFileName),
---
> 	module_name_to_lib_file_name("lib", ModuleName, 
> 		".$(EXT_FOR_SHARED_LIB)", yes, SharedLibFileName),
4764a4776,4788
> 	%
> 	% Set up the installed name for shared libraries.
> 	%
> 	globals.io_lookup_bool_option(shlib_linker_use_install_name,
> 		UseInstallName),
> 	(
> 		{ UseInstallName = yes }
> 	->
> 		get_install_name_option(SharedLibFileName, InstallNameOpt)
> 	;
> 		{ InstallNameOpt = "" }
> 	),
> 
4808c4832,4833
< 			"-- $(ALL_LD_LIBFLAGS) -o ", SharedLibFileName, " \\\n",
---
> 			"-- ", InstallNameOpt, " $(ALL_LD_LIBFLAGS) -o ", 
> 			SharedLibFileName, " \\\n",
7221a7247,7257
> get_install_name_option(OutputFileName, InstallNameOpt, !IO) :-
> 	globals.io_lookup_string_option(
> 		shlib_linker_install_name_flag, 
> 		InstallNameFlag, !IO),
> 	globals.io_lookup_string_option(
> 		shlib_linker_install_name_path, 
> 		InstallNamePath, !IO),
> 		dir.directory_separator(Slash),
> 	InstallNameOpt = InstallNameFlag++InstallNamePath++
> 		char_to_string(Slash)++OutputFileName.
> 		
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.430
diff -r1.430 options.m
650a651,653
> 		;	shlib_linker_use_install_name
> 		;	shlib_linker_install_name_flag
> 		;	shlib_linker_install_name_path
1273c1276,1279
< 	linker_error_undefined_flag -	string("-Wl,-no-undefined")
---
> 	linker_error_undefined_flag -	string("-Wl,-no-undefined"),
> 	shlib_linker_use_install_name - bool(no),
> 	shlib_linker_install_name_flag - string("-install_name "),
> 	shlib_linker_install_name_path - string(".")
1941a1948,1950
> long_option("shlib-linker-use-install-name", shlib_linker_use_install_name).
> long_option("shlib-linker-install-name-flag", shlib_linker_install_name_flag).
> long_option("shlib-linker-install-name-path", shlib_linker_install_name_path).
3934a3944,3948
> 		"--shlib-linker-install-name-path <directory>",
> 		"\tSpecify the path where a shared library will be installed.",
> 		"\tThis option is useful on systems where the runtime search",
> 		"\tpath is obtained from the shared library and not via the",
> 		"\t-R option above (such as Mac OS X).",
4016a4031,4032
> 		% --shlib-linker-install-name-flag,
> 		% --shlib-linker-use-install-name,
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.391
diff -r1.391 user_guide.texi
6923a6924,6933
> @sp 1
> @item --shlib-linker-install-name-path @var{directory}
> @findex --shlib-linker-install-name-path
> @cindex Mac OS X, Darwin, Install name
> Specify the path where a shared library will be installed.
> This option is useful on systems where the runtime search
> path is obtained from the shared library and not via the
> -R option (such as Mac OS X).
> 
> @sp 1
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.135
diff -r1.135 Mmakefile
109c109,110
< 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
---
> 		-R$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
> 		--shlib-linker-install-name-path $(FINAL_INSTALL_MERC_LIB_DIR)
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.113
diff -r1.113 Mmakefile
333a334,341
> # For Darwin we should pass the -install_name option.
> lib$(RT_LIB_NAME).dylib: $(PIC_OBJS)
> 	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) 				\
> 		-o lib$(RT_LIB_NAME).dylib $(PIC_OBJS)			\
> 		-install_name $(FINAL_INSTALL_MERC_LIB_DIR)/lib$(RT_LIB_NAME).dylib \
> 		$(LDFLAGS) $(LDLIBS) $(THREADLIBS)			\
> 		$(SHARED_LIBS)
> 
Index: scripts/Mercury.config.bootstrap.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mercury.config.bootstrap.in,v
retrieving revision 1.4
diff -r1.4 Mercury.config.bootstrap.in
93a94,95
> 		@SHLIB_USE_INSTALL_NAME@ \
> 		--shlib-linker-install-name-flag "@SHLIB_INSTALL_NAME_FLAG@" \
Index: scripts/Mercury.config.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mercury.config.in,v
retrieving revision 1.9
diff -r1.9 Mercury.config.in
96a97,98
> 		@SHLIB_USE_INSTALL_NAME@ \
> 		--shlib-linker-install-name-flag "@SHLIB_INSTALL_NAME_FLAG@" \
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.105
diff -r1.105 mgnuc.in
504a505,509
> 	*powerpc*apple*darwin*)
> 		# This environment variable needs to be set on Darwin so the
> 		# executable knows where to find the mercury shared libraries.
> 		DYLD_LIBRARY_PATH=@LIBDIR@
> 		;;
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.39
diff -r1.39 Mmakefile
151a152,159
> 		
> # For Darwin:
> lib$(TRACE_LIB_NAME).dylib: $(PIC_OBJS)
> 	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED)				\
> 		-o lib$(TRACE_LIB_NAME).dylib $(PIC_OBJS)		\
> 		-install_name $(FINAL_INSTALL_MERC_LIB_DIR)/lib$(TRACE_LIB_NAME).dylib		\
> 		$(LDFLAGS) $(LDLIBS) $(THREADLIBS)			\
> 		$(SHARED_LIBS)
--------------------------------------------------------------------------
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