[m-rev.] diff: add --with-llds-base-grade option to configure

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jan 24 17:06:33 AEDT 2008


Estimated hours taken: 1
Branches: main

Add a new option to configure, --with-llds-base-grade=..., that overrides the
configure script's choice of LLDS base grade.  This is useful when the
configure script detects the presence of some gcc extensions, e.g. global
registers, but Mercury cannot be compiled because of a buggy version of gcc.
Unlike specifying the grade in an Mmake.params file, specifying the base grade
to configure allows the set of library grades to be picked appropriately.
It's also easier to tell users who have buggy versions of gcc to just do,
e.g.  --with-llds-base-grade=none, rather than work out what all the required
workarounds for their particular system may be.

configure.in:
 	Add the new option.

Julien.

Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.515
diff -u -r1.515 configure.in
--- configure.in	23 Jan 2008 13:12:14 -0000	1.515
+++ configure.in	24 Jan 2008 05:56:23 -0000
@@ -2702,27 +2702,70 @@
  # In particular, choose the default grade for compiling applications.
  #

-# BEST_LLDS_BASE_GRADE is the most efficient of the LLDS->C base grades.
+# BEST_LLDS_BASE_GRADE is the most efficient of the LLDS->C base grades
+# that can be supported.  If the user explicitly chooses a base grade
+# using --with-llds-base-grade then we use that instead.
+
+AC_ARG_WITH([llds-base-grade],
+   AC_HELP_STRING([--with-llds-base-grade=<base_grade>],
+   		  [Force the use of <base_grade> as the base LLDS grade.
+                   This is mainly useful for forcing the source distribution to
+                   compile in a grade other than the one which is chosen
+		   automatically.
+                   <base_grade> must be one of asm_fast, asm_jump, fast, jump,
+                   reg or none]),
+   [user_llds_base_grade="$withval";mercury_cv_user_base_grade=yes],
+   [mercury_cv_user_base_grade=no]
+)

-if test $mercury_cv_asm_labels = yes; then
-	if test $mercury_cv_gcc_model_fast = yes; then
-		BEST_LLDS_BASE_GRADE=asm_fast
-	else
-		BEST_LLDS_BASE_GRADE=asm_jump
-	fi
-elif test $mercury_cv_gcc_labels = yes; then
-	if test $mercury_cv_gcc_model_fast = yes; then
-		BEST_LLDS_BASE_GRADE=fast
-	else
-		BEST_LLDS_BASE_GRADE=jump
-	fi
-else
-	if test $mercury_cv_gcc_model_reg = yes; then
-		BEST_LLDS_BASE_GRADE=reg
-	else
-		BEST_LLDS_BASE_GRADE=none
-	fi
-fi
+case "$mercury_cv_user_base_grade" in
+
+    yes)
+        case "$user_llds_base_grade" in
+	    asm_fast|asm_jump|fast|jump|reg|none)
+	        BEST_LLDS_BASE_GRADE="$user_llds_base_grade"
+            ;;
+ 
+            yes)
+	        AC_MSG_ERROR(
+[missing argument to --with-llds-base-grade=... option])
+            ;;
+
+            no)
+	       AC_MSG_ERROR(
+[invalid option --without-llds-base-grade])
+            ;;
+
+            *)
+                AC_MSG_ERROR(
+[invalid argument to --with-llds-base-grade: $user_llds_base_grade])
+	    ;;
+        esac
+    ;;
+
+    no)
+
+        if test $mercury_cv_asm_labels = yes; then
+            if test $mercury_cv_gcc_model_fast = yes; then
+                BEST_LLDS_BASE_GRADE=asm_fast
+	    else
+                BEST_LLDS_BASE_GRADE=asm_jump
+            fi
+        elif test $mercury_cv_gcc_labels = yes; then
+            if test $mercury_cv_gcc_model_fast = yes; then
+                BEST_LLDS_BASE_GRADE=fast
+            else
+                BEST_LLDS_BASE_GRADE=jump
+            fi
+        else
+            if test $mercury_cv_gcc_model_reg = yes; then
+                BEST_LLDS_BASE_GRADE=reg
+            else
+                BEST_LLDS_BASE_GRADE=none
+            fi
+        fi
+     ;;
+esac

  # Force the use of the none grade on Apple x86/Darwin 9 (Leopard)
  # systems, since the default gcc supplied with that system doesn't
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list