[m-rev.] for post-commit review: configure.in improvements

Zoltan Somogyi zs at csse.unimelb.edu.au
Tue Dec 7 14:42:31 AEDT 2010


configure.in:
	When --enable-trail-grades is specified, ensure that the best
	LLDS debug grade with .trseg is also installed.

	Add the new option --disable-old-prof-grades, which disables
	the non-deep profiling grades (such as .prof and .memprof).

	Sort the list of installed libgrades, to make it easier to see
	how far an installation has gotten. Since this also allows the removal
	of any duplicate grades, the code that adds grades to the list doesn't
	have to be constructed specifically to rule out such duplicates.

Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.569
diff -u -b -r1.569 configure.in
--- configure.in	6 Dec 2010 03:56:17 -0000	1.569
+++ configure.in	7 Dec 2010 03:38:49 -0000
@@ -3294,6 +3294,11 @@
                    [do not install profiling versions of the library]),
     enable_prof_grades="$enableval",enable_prof_grades=yes)
 
+AC_ARG_ENABLE(old-prof-grades,
+    AC_HELP_STRING([--disable-old-prof-grades],
+                   [do not install non-deep profiling versions of the library]),
+    enable_old_prof_grades="$enableval",enable_old_prof_grades=yes)
+
 AC_ARG_ENABLE(trail-grades,
     AC_HELP_STRING([--disable-trail-grades],
                    [do not install trailing versions of the library]),
@@ -3380,6 +3385,7 @@
     enable_nogc_grades=no
     enable_agc_grades=no
     enable_prof_grades=no
+    enable_old_prof_grades=no
     enable_trail_grades=no
     enable_mm_grades=no
     enable_mmos_grades=no
@@ -3460,6 +3466,7 @@
 
 # Add grades for profiling.
 if test "$enable_prof_grades" = yes; then
+    if test "$enable_old_prof_grades" = yes; then
     # Add `.prof' (--profiling) grades, if time profiling is supported.
     # We want to allow profiling of any installed grade which is likely
     # to be the most efficient grade for some application.
@@ -3467,17 +3474,18 @@
     #   - both GC and non-GC grades
     #     since non-GC grades might be best for some applications.
     #   - both LLDS and hlc grades
-    # It's also convenient if we support a time profiling variant of
-    # the default grade, if this is not the same as the most efficient grade.
-    if test $mercury_cv_profiling = yes; then
-        # Start with profiling versions of the default grade
+        # It is also convenient if we support a time profiling variant of
+        # the default grade, if this is not the same as the most efficient
+        # grade.
+        if test "$mercury_cv_profiling" = yes; then
+            # Start with profiling versions of the default grade.
         LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.prof"
         if test "$enable_nogc_grades" = yes; then
             LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.prof"
         fi
         # Add profiling versions of the best LLDS grade,
-        # if this is different than the default grade
-        if test $BEST_LLDS_BASE_GRADE != $DEFAULT_BASE_GRADE; then
+            # if this is different than the default grade.
+            if test "$BEST_LLDS_BASE_GRADE" != "$DEFAULT_BASE_GRADE"; then
             LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.prof"
             if test "$enable_nogc_grades" = yes; then
                 LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.prof"
@@ -3485,9 +3493,9 @@
         fi
         # Add profiling versions of the hlc grade,
         # if this is different than the ones added above.
-        if test $enable_hlc_prof_grades = "yes" &&
-           test hlc != $DEFAULT_BASE_GRADE &&
-           test hlc != $BEST_LLDS_BASE_GRADE
+            if test "$enable_hlc_prof_grades" = "yes" &&
+               test hlc != "$DEFAULT_BASE_GRADE" &&
+               test hlc != "$BEST_LLDS_BASE_GRADE"
         then
             LIBGRADES="$LIBGRADES hlc.gc.prof"
             if test "$enable_nogc_grades" = yes; then
@@ -3501,6 +3509,7 @@
     # independent of the grade, so we don't need to support
     # both GC and non-GC versions, or both LLDS and MLDS versions.
     LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.memprof"
+    fi
 
     # Add a `.profdeep' (--deep-profiling) grade,
     # if deep profiling is enabled.
@@ -3514,11 +3523,15 @@
     # We don't install the fixed size trail `.tr' grades by
     # default as they are less useful.
     LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.trseg"
+    if test $DEFAULT_BASE_GRADE = hlc; then
+        LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.debug.gc"
+    else
+        # $DEFAULT_BASE_GRADE must be an LLDS grade
+        LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.debug.trseg hlc.gc.trseg"
+    fi
     if test "$enable_inefficient_grades" = yes; then
         if test "$enable_nogc_grades" = yes; then
             LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.trseg"
-        else
-            LIBGRADES="$LIBGRADES"
         fi
         if test $mercury_cv_profiling = yes &&
            test "$enable_prof_grades" = yes
@@ -3675,23 +3688,24 @@
     else
         # Generate only the grades specified by the user.
         raw_grades=`echo $enable_libgrades | sed 's/,/ /g'`
-        canonical_grades=""
+        cat /dev/null > .canonical_grades
         grade_error=false
         for raw_grade in $raw_grades
         do
             if ! test -x scripts/canonical_grade
             then
-                canonical_grades="$canonical_grades $raw_grade"
+                echo $raw_grade >> .canonical_grades
             elif scripts/canonical_grade --grade $raw_grade > .confgrade
             then
-                canonical_grades="$canonical_grades `cat .confgrade`"
+                cat .confgrade >> .canonical_grades
             else
                 MERCURY_MSG("--enable-libgrades: $raw_grade is not a grade")
                 grade_error=true
             fi
         done
 
-        rm -f .confgrade > /dev/null 2>&1
+        canonical_grades=`sort -u .canonical_grades`
+        rm -f .confgrade .canonical_grades > /dev/null 2>&1
 
         if $grade_error
         then
@@ -3701,6 +3715,32 @@
 
         LIBGRADES=$canonical_grades
     fi
+else
+    cat /dev/null > .canonical_grades
+    grade_error=false
+    for raw_grade in $LIBGRADES
+    do
+        if ! test -x scripts/canonical_grade
+        then
+            echo $raw_grade >> .canonical_grades
+        elif scripts/canonical_grade --grade $raw_grade > .confgrade
+        then
+            cat .confgrade >> .canonical_grades
+        else
+            grade_error=true
+        fi
+    done
+
+    canonical_grades=`sort -u .canonical_grades`
+    rm -f .confgrade .canonical_grades > /dev/null 2>&1
+
+    if $grade_error
+    then
+        AC_MSG_ERROR(
+[internal error: configure script generates invalid grade(s)])
+    fi
+
+    LIBGRADES=$canonical_grades
 fi
 
 # The echo deletes the initial space character.
--------------------------------------------------------------------------
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