[mercury-users] [OT] Building gcc-4.1 for Mac?

Julien Fischer juliensf at csse.unimelb.edu.au
Sat Oct 7 00:15:46 AEST 2006


On Sat, 7 Oct 2006, Julien Fischer wrote:

> The attached patch (against the main branch) is my best guess at the
> changes that need to be made in order to support Intel based Macs - I don't
> have access to one to test so an (educated) guess is the best I can do
> at the moment.

I should have actually attached the patch as well ...

Julien.
-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.476
diff -u -r1.476 configure.in
--- configure.in	2 Oct 2006 06:30:35 -0000	1.476
+++ configure.in	6 Oct 2006 13:45:21 -0000
@@ -192,7 +192,7 @@
 case "$host" in 
 	i*86-*-solaris2.*)	link_static_opt= ;;
 	*solaris2.10)		link_static_opt= ;;
-	*powerpc*apple*darwin*) link_static_opt= ;;
+	*apple*darwin*) 	link_static_opt= ;;
 	*)			link_static_opt="--linkage static" ;;
 esac
 
@@ -600,7 +600,7 @@
 		# XXX We should probably check that the user isn't
 		# using GNU's hostname on OS X instead.
 		case "$host" in 
-			powerpc*apple*darwin*)
+			*apple*darwin*)
 				HOSTNAMECMD="$HOSTNAMECMD" ;;
 			*)
 				HOSTNAMECMD="$HOSTNAMECMD -f" ;;
@@ -2403,7 +2403,7 @@
 esac
 
 case "$host" in
-    powerpc*apple*darwin*)
+    *apple*darwin*)
         mercury_cv_default_cgi_dir=/Library/WebServer/CGI-Executables
         ;;
     *)
@@ -2541,6 +2541,7 @@
 	# an i386, but since we don't have access to an i386 with darwin 
 	# installed to test this, we currently restrict ourselves to the
 	# powerpc architecture.
+	# XXX check this.
 	*powerpc*apple*darwin*)
 		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_DARWIN_THREADS"
 		THREAD_LIBS=""
@@ -3531,7 +3532,7 @@
 		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
 		DEFAULT_LINKAGE=static
 		;;
-	*powerpc*apple*darwin*)
+	*apple*darwin*)
 		# If the compiler is gcc then use darwin style dynamic linking.
 		# Otherwise use static linking.
 		if test "$GCC_PROG" != ""; then
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.96
diff -u -r1.96 compile_target_code.m
--- compiler/compile_target_code.m	5 Oct 2006 04:45:31 -0000	1.96
+++ compiler/compile_target_code.m	6 Oct 2006 13:48:08 -0000
@@ -711,9 +711,12 @@
 
     globals.io_lookup_string_option(fullarch, FullArch, !IO),
     (
+        % XXX Check if the above bug occurs on x86/darwin.
         HighLevelCode = no,
         GCC_Regs = yes,
-        string.prefix(FullArch, "powerpc-apple-darwin")
+        ( string.prefix(FullArch, "powerpc-apple-darwin")
+        ; string.prefix(FullArch, "i686-apple-darwin")
+        )
     ->
         AppleGCCRegWorkaroundOpt = "-fno-loop-optimize"
     ;
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.117
diff -u -r1.117 mgnuc.in
--- scripts/mgnuc.in	2 Oct 2006 09:06:50 -0000	1.117
+++ scripts/mgnuc.in	6 Oct 2006 13:46:36 -0000
@@ -546,7 +546,8 @@
 # The -floop-optimize option is incompatible with the global register code
 # we generated on Darwin PowerPC. See the hard_coded/ppc_bug test case
 # for an example program which fails with this optimization.
-
+# XXX Is this a PowerPC problem or a Darwin problem?  If the latter then
+# we also need to handle i686-apple-darwin* here.
 case $FULLARCH in powerpc*apple*darwin*)
     case $highlevel_code in false)
         case $global_regs in true)


More information about the users mailing list