[Lunar-commits] r14604 - in lunar/trunk/var/lib/lunar: functions menu

Auke Kok sofar at lunar-linux.org
Fri May 6 16:05:39 UTC 2005


Author: sofar
Date: 2005-05-06 16:05:37 +0000 (Fri, 06 May 2005)
New Revision: 14604

Modified:
   lunar/trunk/var/lib/lunar/functions/optimize.lunar
   lunar/trunk/var/lib/lunar/menu/optimize.menu
Log:
Adding SAFETY switch to the lunar optimizations. This will prohibit setting of non-safe optimizations (very restrictive). Also in non-restricted mode, you STILL cannot choose sse2 if /proc/cpuinfo doesn't list that Feature ;^). There is a very very serious warning when people turn off the safety switch. (schweet!).


Modified: lunar/trunk/var/lib/lunar/functions/optimize.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/optimize.lunar	2005-05-06 15:42:55 UTC (rev 14603)
+++ lunar/trunk/var/lib/lunar/functions/optimize.lunar	2005-05-06 16:05:37 UTC (rev 14604)
@@ -558,11 +558,10 @@
   debug_msg "optimize_stack ($@)"
   if [[ $STACK > 0 ]] ; then
     if [ $PLATFORM == "x86" ] ; then
-      STACK="-mpreferred-stack-boundary=$STACK" 
+      CFLAGS="$CFLAGS -mpreferred-stack-boundary=$STACK"
+      CXXFLAGS="$CXXFLAGS -mpreferred-stack-boundary=$STACK"
+      CPPFLAGS="$CPPFLAGS -mpreferred-stack-boundary=$STACK"
     fi
-      CFLAGS="$CFLAGS $STACK"
-      CXXFLAGS="$CXXFLAGS $STACK"
-      CPPFLAGS="$CPPFLAGS $STACK"
   fi
 }
 

Modified: lunar/trunk/var/lib/lunar/menu/optimize.menu
===================================================================
--- lunar/trunk/var/lib/lunar/menu/optimize.menu	2005-05-06 15:42:55 UTC (rev 14603)
+++ lunar/trunk/var/lib/lunar/menu/optimize.menu	2005-05-06 16:05:37 UTC (rev 14604)
@@ -1,365 +1,411 @@
 #Copyrighted Jason Johnston  2002 under GPLv2
 
-set_optimize() {
+save_optimizations() {
 
   GCCVER=${GCCVER:=3}
   set_local_config "GCCVER" "$GCCVER"
 
-  echo -e PLATFORM=$PLATFORM            '\n'\
-          BUILD=$BUILD                  '\n'\
-	  MAKES=$MAKES                  '\n'\
-          BOPT=$BOPT                    '\n'\
-          CPU=$CPU                      '\n'\
-          SPD=( ${SPD[@]} )             '\n'\
-	  STACK=$STACK                  '\n'\
-          XTRA=( ${XTRA[@]} )           '\n'\
-          FPM=$FPM                      '\n'\
-	  CC_OPTS=( ${CC_OPTS[@]} )     '\n'\
-          LDF=( ${LDF[@]} )             '\n'\
-          ADDON=( ${ADDON[@]} ) > /etc/lunar/local/optimizations
+  cat > /etc/lunar/local/optimizations <<EOF
+PLATFORM=$PLATFORM
+BUILD=$BUILD
+CPU=$CPU
+BOPT=$BOPT
+XTRA=( $(echo ${XTRA[@]}) )
+SPD=( $(echo ${SPD[@]} ) )
+FPM=$FPM
+CC_OPTS=( $(echo ${CC_OPTS[@]} ) )
+LDF=( $(echo ${LDF[@]} ) )
+ADDON=( $(echo ${ADDON[@]} ) )
+MAKES=$MAKES
+STACK=$STACK
+EOF
 }
 
 # Setup the help to be used for descriptions
 optimizations_help() {
-   case $1 in
+ case $1 in
 
    # Help for selecting preferred compiler.
    compiler)
-                MENU="Preferred Compiler"
-           GCC2_HELP="Sets GCC 2x as the preferred compiler."
-           GCC3_HELP="Sets GCC 3x as the preferred compiler."
-                 ;;
+     MENU="Lunar allows you to use gcc version 2 (deprecated) or 3.x (standard). If you have both installed then you need to select the one that lunar uses here."
+     GCC2_HELP="Sets GCC 2x as the preferred compiler."
+     GCC3_HELP="Sets GCC 3x as the preferred compiler."
+     ;;
                  
    # Help for the platform selections.
    platform)
-                MENU="Platform"
-            x86_HELP="Intel and AMD hardware"
-          Alpha_HELP="Compaq Alpha hardware"
-        PowerPC_HELP="IBM and Apple hardware (Power and PowerPC)"
-          SPARC_HELP="SUN Hardware"
-                 ;;
+     MENU="The so-called platform is the name of the hardware architecture. Most people will use 'x86'"
+     x86_HELP="Intel and AMD hardware"
+     Alpha_HELP="Compaq Alpha hardware"
+     PowerPC_HELP="IBM and Apple hardware (Power and PowerPC)"
+     SPARC_HELP="SUN Hardware"
+     ;;
 
    # Help for the basic optimizations.
-     bopt)
-             MENU="Basic Optimization"
-        None_HELP="-O0"
-        Fast_HELP="-O1"
-      Faster_HELP="-O2"
+   bopt)
+     MENU="Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level."
+     None_HELP="-O0"
+     Fast_HELP="-O1"
+     Faster_HELP="-O2"
      Fastest_HELP="-O3"
-       Small_HELP="-Os"
-               ;;
+     Small_HELP="-Os"
+     ;;
 
    # Help for the cpu selections.
-      cpu)
-          MENU="$2 CPUs, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1)"
-         case $2 in
-            x86)
-          I386_HELP="I386 processors"
-          I486_HELP="I486 processors"
-          I586_HELP="I586 processors, identical to 'pentium'"
-    PentiumMMX_HELP="Pentium processors with mmx"
-          I686_HELP="I686 processors, identical to 'pentiumpro'"
-            P2_HELP="Pentium II processors"
-            P3_HELP="Pentium III processors"
-            P4_HELP="Pentium 4 processors"
-            K6_HELP="AMD K6 processors"
-           K62_HELP="AMD K6-2 processors"
-           K63_HELP="AMD K6-3 processors"
-        Athlon_HELP="AMD Athlon processors"
-   AthlonTBird_HELP="AMD Athlon Thunderbird processors"
-       Athlon4_HELP="AMD Athlon 4 processors"
-      AthlonXP_HELP="AMD Athlon XP processors"
-      AthlonMP_HELP="AMD Athlon MP processors"
-                 ;;
-           Alpha)
-              ev4_HELP="Alpha EV4 (21064)"
-             ev45_HELP="Alpha EV45 (21064a)"
-              ev5_HELP="Alpha EV5 (21164)"
-             ev56_HELP="Alpha EV56 (21164a)"
-            pca56_HELP="Alpha pca56 (21164PC)"
-              ev6_HELP="Alpha EV6 (21264)"
-             ev67_HELP="Alpha EV67 (21264a)"
-	     ev68_HELP="Alpha EV68 (21264b)"
-                 ;;
-         PowerPC)
-           common_HELP="Common PowerPC"
-             rios_HELP="Rios PowerPC"
-            rios1_HELP="Rios1 PowerPC"
-              rsc_HELP="RSC PowerPC"
-            rios2_HELP="Rios2 PowerPC"
-            rs64a_HELP="RS64a PowerPC"
-             p403_HELP="403 PowerPC"
-             p505_HELP="505 PowerPC"
-             p601_HELP="601 PowerPC"
-             p602_HELP="602 PowerPC"
-             p603_HELP="603 PowerPC"
-            p603a_HELP="603a PowerPC"
-             p604_HELP="604 PowerPC"
-            p604e_HELP="604e PowerPC"
-             p620_HELP="620 PowerPC"
-             p630_HELP="630 PowerPC"
-             p740_HELP="740 PowerPC"
-            p7400_HELP="7400 PowerPC"
-            p7450_HELP="7450 PowerPC"
-             p750_HELP="750 PowerPC"
-             p801_HELP="801 PowerPC"
-             p821_HELP="821 PowerPC"
-             p823_HELP="823 PowerPC"
-             p860_HELP="860 PowerPC"
-            Power_HELP="Power PowerPC"
-           Power2_HELP="Power2 PowerPC"
-          PowerPC_HELP="PowerPC"
-                 ;;
-           SPARC)
-              v7_HELP="V7 SPARC"
+   cpu)
+     MENU="$2 CPUs, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1)"
+     case $2 in
+       x86)
+         I386_HELP="I386 processors"
+         I486_HELP="I486 processors"
+         I586_HELP="I586 processors, identical to 'pentium'"
+         PentiumMMX_HELP="Pentium processors with mmx"
+         I686_HELP="I686 processors, identical to 'pentiumpro'"
+         P2_HELP="Pentium II processors"
+         P3_HELP="Pentium III processors"
+         P4_HELP="Pentium 4 processors"
+         K6_HELP="AMD K6 processors"
+         K62_HELP="AMD K6-2 processors"
+         K63_HELP="AMD K6-3 processors"
+         Athlon_HELP="AMD Athlon processors"
+         AthlonTBird_HELP="AMD Athlon Thunderbird processors"
+         Athlon4_HELP="AMD Athlon 4 processors"
+         AthlonXP_HELP="AMD Athlon XP processors"
+         AthlonMP_HELP="AMD Athlon MP processors"
+         ;;
+       Alpha)
+         ev4_HELP="Alpha EV4 (21064)"
+         ev45_HELP="Alpha EV45 (21064a)"
+         ev5_HELP="Alpha EV5 (21164)"
+         ev56_HELP="Alpha EV56 (21164a)"
+         pca56_HELP="Alpha pca56 (21164PC)"
+         ev6_HELP="Alpha EV6 (21264)"
+         ev67_HELP="Alpha EV67 (21264a)"
+	 ev68_HELP="Alpha EV68 (21264b)"
+         ;;
+       PowerPC)
+         common_HELP="Common PowerPC"
+         rios_HELP="Rios PowerPC"
+         rios1_HELP="Rios1 PowerPC"
+         rsc_HELP="RSC PowerPC"
+         rios2_HELP="Rios2 PowerPC"
+         rs64a_HELP="RS64a PowerPC"
+         p403_HELP="403 PowerPC"
+         p505_HELP="505 PowerPC"
+         p601_HELP="601 PowerPC"
+         p602_HELP="602 PowerPC"
+         p603_HELP="603 PowerPC"
+         p603a_HELP="603a PowerPC"
+         p604_HELP="604 PowerPC"
+         p604e_HELP="604e PowerPC"
+         p620_HELP="620 PowerPC"
+         p630_HELP="630 PowerPC"
+         p740_HELP="740 PowerPC"
+         p7400_HELP="7400 PowerPC"
+         p7450_HELP="7450 PowerPC"
+         p750_HELP="750 PowerPC"
+         p801_HELP="801 PowerPC"
+         p821_HELP="821 PowerPC"
+         p823_HELP="823 PowerPC"
+         p860_HELP="860 PowerPC"
+         Power_HELP="Power PowerPC"
+         Power2_HELP="Power2 PowerPC"
+         PowerPC_HELP="PowerPC"
+         ;;
+       SPARC)
+         v7_HELP="V7 SPARC"
          cypress_HELP="Cypress SPARC"
-              v8_HELP="V8 SPARC"
-      supersparc_HELP="SuperSPARC"
-       sparclite_HELP="SPARCLite"
-      hypersparc_HELP="HyperSPARC"
-      sparclite86x_HELP="SPARCLite86x"
-            f930_HELP="f930 SPARC"
-            f934_HELP="f934 SPARC"
-        sparclet_HELP="SPARCLet"
-          tsc701_HELP="tsc701 SPARC"
-              v9_HELP="V9 SPARC"
-      ultrasparc_HELP="ULTRASPARC"
-                 ;;
-           esac
+         v8_HELP="V8 SPARC"
+         supersparc_HELP="SuperSPARC"
+         sparclite_HELP="SPARCLite"
+         hypersparc_HELP="HyperSPARC"
+         sparclite86x_HELP="SPARCLite86x"
+         f930_HELP="f930 SPARC"
+         f934_HELP="f934 SPARC"
+         sparclet_HELP="SPARCLet"
+         tsc701_HELP="tsc701 SPARC"
+         v9_HELP="V9 SPARC"
+         ultrasparc_HELP="ULTRASPARC"
          ;;
+     esac
+     ;;
 
    # Help for speed options.
-      spd)
-              MENU="Speed optimizations"
-       Speedy_HELP="Optimize to increase performance of generated code"
-        Risky_HELP="Optimize to increase performance ... by violating ANSI and IEEE FP rules"
+   spd)
+     MENU="Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information"
+     Speedy_HELP="Optimize to increase performance of generated code"
+     Risky_HELP="Optimize to increase performance ... by violating ANSI and IEEE FP rules"
      Pointers_HELP="Optimize by omitting frame pointers"
      Siblings_HELP="Optimize sibling calls"
-    Profiling_HELP="Generate profiles (For later use with Branching)"
-    Branching_HELP="Predict branching (For using profiled sources)"
+     Profiling_HELP="Generate profiles (For later use with Branching)"
+     Branching_HELP="Predict branching (For using profiled sources)"
      Aliasing_HELP="Enable strict aliasing (enabled by default -O1 and above)"
-        Cprop_HELP="Reduce scheduling dependencies and remove copies"
-        Float_HELP="Enable float store"
-      Address_HELP="Force memory address"
-        Align_HELP="Align functions, loops, and jumps"
-    Expensive_HELP="Perform expensive optimizations"
-      Doubles_HELP="Align double, long double, and long long on two word boundaries"
-       Tracer_HELP="Perform tail duplication to enlarge superblock size."
-       Blocks_HELP="Reorder basic blocks in order to reduce number of taken branches."
-               ;;
+     Cprop_HELP="Reduce scheduling dependencies and remove copies"
+     Float_HELP="Enable float store"
+     Address_HELP="Force memory address"
+     Align_HELP="Align functions, loops, and jumps"
+     Expensive_HELP="Perform expensive optimizations"
+     Doubles_HELP="Align double, long double, and long long on two word boundaries"
+     Tracer_HELP="Perform tail duplication to enlarge superblock size."
+     Blocks_HELP="Reorder basic blocks in order to reduce number of taken branches."
+     ;;
 
    # Help for extra options
-     xtra)
-                  # do NOT change the next line unless you too smart
-                  CPUINFO=$(echo "`grep flags /proc/cpuinfo` ")
-		  for EXT in mmx sse sse2 3dnow altivec ; do
-		    if echo $CPUINFO | grep -q " $EXT " ; then
-		      FLAGS="$FLAGS $EXT"
-		    fi
-		  done
+   xtra)
+     # do NOT change the next line unless you too smart
+     CPUINFO=$(echo "`grep flags /proc/cpuinfo` ")
+     for EXT in mmx sse sse2 3dnow altivec ; do
+       if echo $CPUINFO | grep -q " $EXT " ; then
+         FLAGS="$FLAGS $EXT"
+       fi
+     done
 
-             MENU="Extra Features, the kernel reports to have:$FLAGS"
-         MMX_HELP="Enable MMX"
-         SSE_HELP="Enable SSE"
-        SSE2_HELP="Enable SSE2"
-        dnow_HELP="3dnow"
+     MENU="Select compiler use of extra instruction sets. The kernel reports that this system has: $FLAGS"
+     MMX_HELP="Multi-Media instruction code eXtensions"
+     SSE_HELP="Streaming SIMD (Single Instruction, Multiple Data) Extensions"
+     SSE2_HELP="Streaming SIMD (Single Instruction, Multiple Data) Extensions v2"
+     dnow_HELP="3dnow"
      Altivec_HELP="Enables Altivec"
-                  unset CPUINFO EXT FLAGS
-               ;;
+     unset CPUINFO EXT FLAGS
+     ;;
 
    # Help for floating point math
-      fpm)
-                  # do NOT change the next line unless you too smart
-                  CPUINFO=$(echo "`grep flags /proc/cpuinfo` ")
-		  for EXT in fpu sse altivec ; do
-		    if echo $CPUINFO | grep -q " $EXT " ; then
-		      FLAGS="$FLAGS $EXT"
-		    fi
-		  done
-		  FLAGS=${FLAGS/fpu/387}
+   fpm)
+     # do NOT change the next line unless you too smart
+     CPUINFO=$(echo "`grep flags /proc/cpuinfo` ")
+     for EXT in fpu sse altivec ; do
+       if echo $CPUINFO | grep -q " $EXT " ; then
+         FLAGS="$FLAGS $EXT"
+       fi
+     done
+     FLAGS=${FLAGS/fpu/387}
+     FLAGS=${FLAGS/387 sse/387 and sse (both)}
 
-          MENU="Floating Point Math, the kernel reports to have: $FLAGS"
+     MENU="Select available Floating Point Math compile extenstions. The kernel reports that this sytem has: $FLAGS"
      None_HELP="Do not enable any extra features."
-     x387_HELP="387"
-      SSE_HELP="SSE"
-     Both_HELP="SSE and 387"
-  Altivec_HELP="Altivec"
-                  unset CPUINFO EXT FLAGS
-               ;;
-   # Warn help
- cc_opt)
-          MENU="General C/C++ compiler settings"
-Deprecated_HELP="Disable warnings of deprecated symbols in C++"
+     x387_HELP="Classic 387 or higher Floating Point Co-Processor"
+     SSE_HELP="Streaming SIMD (Single Instruction, Multiple Data) Extensions"
+     Both_HELP="Both SSE and 387"
+     Altivec_HELP="Altivec"
+     unset CPUINFO EXT FLAGS
+     ;;
+     
+   # General C/C++ options
+   cc_opt)
+     MENU="General C/C++ compiler settings"
+     Deprecated_HELP="Disable warnings of deprecated symbols in C++"
      CPipe_HELP="Enable cc to use named pipes."
-    CCPipe_HELP="Enable c++ to use named pipes."
-              ;;
+     CCPipe_HELP="Enable c++ to use named pipes."
+     ;;
           
    # Help for linker options
-      ldf)
-            MENU="Linker options"
-      Strip_HELP="Strip all symbols"
-   Optimize_HELP="Optimize hash tables during linking"
+   ldf)
+     MENU="Select linker optimizations. These options only apply to the link stage of binaries."
+     Strip_HELP="Strip all symbols"
+     Optimize_HELP="Optimize hash tables during linking"
      Reduce_HELP="Reduce the amount of linked libraries if possible"
-  Combreloc_HELP="Combreloc"
-#     Debug_HELP="Strip debug symbols only"
-               ;;
+     Combreloc_HELP="Combreloc"
+     Debug_HELP="Strip debug symbols only"
+     ;;
 
    # Addon help for extra programs
-    addon)
-            MENU="Addon program support"
-       None_HELP="No compiler addons"
+   addon)
+     MENU="Lunar can automatically use certain compiler wrapper programs that perform certain tasks. You might need to install additions packages before you can use these."
+     None_HELP="No compiler addons"
      DistCC_HELP="Distributed compiler support"
      CCache_HELP="Compiler output caching"
-              ;;
+     ;;
   esac
 }
 
 
 optimizations_options() {
+  unset OPTIONS
   case $1 in
-   compiler)
-   OPTIONS=( "2" "GCC version 2x"  $( [ "$GCCVER" == "2" ] && echo "on" || echo "off" )  "$GCC2_HELP"
-             "3" "GCC version 3x"  $( [ "$GCCVER" == "3" ] && echo "on" || echo "off" )  "$GCC3_HELP" )
-   ;;
-   platform)
-   OPTIONS=( "x86"     "Intel, AMD, and clones"  $( [ "$PLATFORM" == "x86" ] && echo "on" || echo "off" )      "$x86_HELP"
-             "Alpha"   "Compaq Alpha"            $( [ "$PLATFORM" == "Alpha" ] && echo "on" || echo "off" )    "$Alpha_HELP"
-             "PowerPC" "PowerPC"                 $( [ "$PLATFORM" == "PowerPC" ] && echo "on" || echo "off" )  "$PowerPC_HELP"
-             "SPARC"   "Sun SPARC"               $( [ "$PLATFORM" == "SPARC" ] && echo "on" || echo "off" )    "$SPARC_HELP" )
-   ;;
-   bopt)
-   OPTIONS=( "None"     "-O0"   $( [ "$BOPT" == "None" ] && echo "on" || echo "off" )    "$None_HELP"
-             "Fast"     "-O1"   $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" )    "$Fast_HELP"
-             "Faster"   "-O2"   $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" )  "$Fasert_HELP"
-             "Fastest"  "-O3"   $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "$Fastest_HELP"
-             "Small"    "-Os"   $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" )   "$Small_HELP" )
-  ;;
-  cpu)
-   case $2 in
-      x86) OPTIONS=( "I386"        "I386"         $( [ "$CPU" == "I386" ] && echo "on" || echo "off" )        "$I386_HELP"
-                     "I486"        "I486"         $( [ "$CPU" == "I486" ] && echo "on" || echo "off" )        "$I486_HELP"
-                     "I586"        "I586 (Pentium)"         $( [ "$CPU" == "I586" ] && echo "on" || echo "off" )        "$I586_HELP"
-                     "PentiumMMX"  "PentiumMMX"   $( [ "$CPU" == "PentiumMMX" ] && echo "on" || echo "off" )  "$PentiumMMX_HELP"
-                     "I686"        "I686 (PentiumPro)"         $( [ "$CPU" == "I686" ] && echo "on" || echo "off" )        "$I686_HELP"
-                     "Pentium2"    "P2"           $( [ "$CPU" == "Pentium2" ] && echo "on" || echo "off" )    "$P2_HELP"
-                     "Pentium3"    "P3 (Celeron)"           $( [ "$CPU" == "Pentium3" ] && echo "on" || echo "off" )    "$P3_HELP"
-                     "Pentium4"    "P4 (Xeon)"           $( [ "$CPU" == "Pentium4" ] && echo "on" || echo "off" )    "$P4_HELP"
-                     "K6"          "K6"           $( [ "$CPU" == "K6" ] && echo "on" || echo "off" )          "$K6_HELP"
-                     "K62"         "K62"          $( [ "$CPU" == "K62" ] && echo "on" || echo "off" )         "$K62_HELP"
-                     "K63"         "K63"          $( [ "$CPU" == "K63" ] && echo "on" || echo "off" )         "$K63_HELP"
-                     "Athlon"      "Athlon"       $( [ "$CPU" == "Athlon" ] && echo "on" || echo "off" )      "$Athlon_HELP"
-                     "AthlonTBird" "AthlonTBird"  $( [ "$CPU" == "AthlonTBird" ] && echo "on" || echo "off" ) "$AthlonTBird_HELP"
-                     "Athlon4"     "Athlon4"      $( [ "$CPU" == "Athlon4" ] && echo "on" || echo "off" )     "$Athlon4_HELP"
-                     "AthlonXP"    "AthlonXP"     $( [ "$CPU" == "AthlonXP" ] && echo "on" || echo "off" )    "$AthlonXP_HELP"
-                     "AthlonMP"    "AthlonMP"     $( [ "$CPU" == "AthlonMP" ] && echo "on" || echo "off" )    "$AthlonMP_HELP" )
-                     ;;
+    compiler)
+      OPTIONS=( "2" "GCC version 2x"  $( [ "$GCCVER" == "2" ] && echo "on" || echo "off" )  "$GCC2_HELP"
+                "3" "GCC version 3x"  $( [ "$GCCVER" == "3" ] && echo "on" || echo "off" )  "$GCC3_HELP" )
+      ;;
+    platform)
+      OPTIONS=( "x86"     "Intel, AMD, and clones"  $( [ "$PLATFORM" == "x86" ] && echo "on" || echo "off" )      "$x86_HELP"
+                "Alpha"   "Compaq Alpha"            $( [ "$PLATFORM" == "Alpha" ] && echo "on" || echo "off" )    "$Alpha_HELP"
+                "PowerPC" "PowerPC"                 $( [ "$PLATFORM" == "PowerPC" ] && echo "on" || echo "off" )  "$PowerPC_HELP"
+                "SPARC"   "Sun SPARC"               $( [ "$PLATFORM" == "SPARC" ] && echo "on" || echo "off" )    "$SPARC_HELP" )
+      ;;
+    bopt)
+      OPTIONS=( "None"     "-O0"   $( [ "$BOPT" == "None" ] && echo "on" || echo "off" )    "$None_HELP"
+                "Fast"     "-O1"   $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" )    "$Fast_HELP"
+                "Faster"   "-O2"   $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" )  "$Fasert_HELP"
+                "Fastest"  "-O3"   $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "$Fastest_HELP"
+                "Small"    "-Os"   $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" )   "$Small_HELP" )
+      ;;
+   cpu)
+     case $2 in
+       x86)
+         OPTIONS=( "I386"        "I386"         $( [ "$CPU" == "I386" ] && echo "on" || echo "off" )        "$I386_HELP"
+                   "I486"        "I486"         $( [ "$CPU" == "I486" ] && echo "on" || echo "off" )        "$I486_HELP"
+                   "I586"        "I586 (Pentium)"    $( [ "$CPU" == "I586" ] && echo "on" || echo "off" )   "$I586_HELP"
+                   "PentiumMMX"  "PentiumMMX"   $( [ "$CPU" == "PentiumMMX" ] && echo "on" || echo "off" )  "$PentiumMMX_HELP"
+                   "I686"        "I686 (PentiumPro)" $( [ "$CPU" == "I686" ] && echo "on" || echo "off" )   "$I686_HELP"
+                   "Pentium2"    "P2"           $( [ "$CPU" == "Pentium2" ] && echo "on" || echo "off" )    "$P2_HELP"
+                   "Pentium3"    "P3 (Celeron)" $( [ "$CPU" == "Pentium3" ] && echo "on" || echo "off" )    "$P3_HELP"
+                   "Pentium4"    "P4 (Xeon)"    $( [ "$CPU" == "Pentium4" ] && echo "on" || echo "off" )    "$P4_HELP"
+                   "K6"          "K6"           $( [ "$CPU" == "K6" ] && echo "on" || echo "off" )          "$K6_HELP"
+                   "K62"         "K62"          $( [ "$CPU" == "K62" ] && echo "on" || echo "off" )         "$K62_HELP"
+                   "K63"         "K63"          $( [ "$CPU" == "K63" ] && echo "on" || echo "off" )         "$K63_HELP"
+                   "Athlon"      "Athlon"       $( [ "$CPU" == "Athlon" ] && echo "on" || echo "off" )      "$Athlon_HELP"
+                   "AthlonTBird" "AthlonTBird"  $( [ "$CPU" == "AthlonTBird" ] && echo "on" || echo "off" ) "$AthlonTBird_HELP"
+                   "Athlon4"     "Athlon4"      $( [ "$CPU" == "Athlon4" ] && echo "on" || echo "off" )     "$Athlon4_HELP"
+                   "AthlonXP"    "AthlonXP"     $( [ "$CPU" == "AthlonXP" ] && echo "on" || echo "off" )    "$AthlonXP_HELP"
+                   "AthlonMP"    "AthlonMP"     $( [ "$CPU" == "AthlonMP" ] && echo "on" || echo "off" )    "$AthlonMP_HELP" )
+         ;;
 
-    Alpha) OPTIONS=( "ev4"         "ev4"          $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" )         "$ev4_HELP"
-                     "ev45"        "ev45"         $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" )        "$ev45_HELP"
-                     "ev5"         "ev5"          $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" )         "$ev5_HELP"
-                     "ev56"        "ev56"         $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" )         "$ev56_HELP"
-                     "pca56"       "pca56"        $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" )         "$pca56_HELP"
-                     "ev6"         "ev6"          $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" )         "$ev6_HELP"
-                     "ev67"        "ev67"         $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" )         "$ev67_HELP"
-		     "ev68"        "ev68"         $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" )         "$ev68_HELP" )
-                     ;;
+       Alpha)
+         OPTIONS=( "ev4"         "ev4"          $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" )         "$ev4_HELP"
+                   "ev45"        "ev45"         $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" )        "$ev45_HELP"
+                   "ev5"         "ev5"          $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" )         "$ev5_HELP"
+                   "ev56"        "ev56"         $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" )        "$ev56_HELP"
+                   "pca56"       "pca56"        $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" )       "$pca56_HELP"
+                   "ev6"         "ev6"          $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" )         "$ev6_HELP"
+                   "ev67"        "ev67"         $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" )        "$ev67_HELP"
+		   "ev68"        "ev68"         $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" )        "$ev68_HELP" )
+         ;;
 
-  PowerPC) OPTIONS=( "common" "common"	$( [ "$CPU" == "common" ] && echo "on" || echo "off" )   "$common_HELP"
-                     "rios"    "rios" 	$( [ "$CPU" == "rios" ] && echo "on" || echo "off" )   "$rios_HELP"
-                     "rios1"   "rios1" 	$( [ "$CPU" == "rios1" ] && echo "on" || echo "off" )  "$rios1_HELP"
-                     "rsc"     "rsc" 	$( [ "$CPU" == "rsc" ] && echo "on" || echo "off" )    "$rsc_HELP"
-                     "rios2"   "rios2" 	$( [ "$CPU" == "rios2" ] && echo "on" || echo "off" )  "$rios2_HELP"
-                     "rs64a"   "rs64a" 	$( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" )  "$rs64a_HELP"
-                     "403"     "403" 	$( [ "$CPU" == "403" ] && echo "on" || echo "off" )    "$p403_HELP"
-                     "505"     "505" 	$( [ "$CPU" == "505" ] && echo "on" || echo "off" )    "$p505_HELP"
-                     "601"     "601" 	$( [ "$CPU" == "601" ] && echo "on" || echo "off" )    "$p601_HELP"
-                     "602"     "602" 	$( [ "$CPU" == "602" ] && echo "on" || echo "off" )    "$p602_HELP"
-                     "603"     "603" 	$( [ "$CPU" == "603" ] && echo "on" || echo "off" )    "$p603_HELP"
-                     "603a"    "603a" 	$( [ "$CPU" == "603a" ] && echo "on" || echo "off" )   "$p603a_HELP"
-                     "604"     "604" 	$( [ "$CPU" == "604" ] && echo "on" || echo "off" )    "$p604_HELP"
-                     "604e"    "604e" 	$( [ "$CPU" == "604e" ] && echo "on" || echo "off" )   "$p604e_HELP"
-                     "620"     "620" 	$( [ "$CPU" == "620" ] && echo "on" || echo "off" )    "$p620_HELP"
-                     "630"     "630" 	$( [ "$CPU" == "630" ] && echo "on" || echo "off" )    "$p630_HELP"
-                     "740"     "740" 	$( [ "$CPU" == "740" ] && echo "on" || echo "off" )    "$p740_HELP"
-                     "7400"    "7400" 	$( [ "$CPU" == "7400" ] && echo "on" || echo "off" )   "$p7400_HELP"
-                     "7450"    "7450" 	$( [ "$CPU" == "7450" ] && echo "on" || echo "off" )   "$p7450_HELP"
-                     "750"     "750" 	$( [ "$CPU" == "750" ] && echo "on" || echo "off" )    "$p750_HELP"
-                     "801"     "801" 	$( [ "$CPU" == "801" ] && echo "on" || echo "off" )    "$p801_HELP"
-                     "821"     "821" 	$( [ "$CPU" == "821" ] && echo "on" || echo "off" )    "$p821_HELP"
-                     "823"     "823" 	$( [ "$CPU" == "823" ] && echo "on" || echo "off" )    "$p823_HELP"
-                     "Power"   "Power" 	$( [ "$CPU" == "Power" ] && echo "on" || echo "off" )  "$Power_HELP"
-                     "Power2"  "Power2" $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" ) "$Power2_HELP"
-                     "PowerPC" "PowerPC" $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "$PowerPC_HELP" )
-                     ;;
+       PowerPC)
+         OPTIONS=( "common"  "common"	 $( [ "$CPU" == "common" ] && echo "on" || echo "off" )  "$common_HELP"
+                   "rios"    "rios" 	 $( [ "$CPU" == "rios" ] && echo "on" || echo "off" )    "$rios_HELP"
+                   "rios1"   "rios1" 	 $( [ "$CPU" == "rios1" ] && echo "on" || echo "off" )   "$rios1_HELP"
+                   "rsc"     "rsc" 	 $( [ "$CPU" == "rsc" ] && echo "on" || echo "off" )     "$rsc_HELP"
+                   "rios2"   "rios2" 	 $( [ "$CPU" == "rios2" ] && echo "on" || echo "off" )   "$rios2_HELP"
+                   "rs64a"   "rs64a" 	 $( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" )   "$rs64a_HELP"
+                   "403"     "403" 	 $( [ "$CPU" == "403" ] && echo "on" || echo "off" )     "$p403_HELP"
+                   "505"     "505" 	 $( [ "$CPU" == "505" ] && echo "on" || echo "off" )     "$p505_HELP"
+                   "601"     "601" 	 $( [ "$CPU" == "601" ] && echo "on" || echo "off" )     "$p601_HELP"
+                   "602"     "602" 	 $( [ "$CPU" == "602" ] && echo "on" || echo "off" )     "$p602_HELP"
+                   "603"     "603" 	 $( [ "$CPU" == "603" ] && echo "on" || echo "off" )     "$p603_HELP"
+                   "603a"    "603a" 	 $( [ "$CPU" == "603a" ] && echo "on" || echo "off" )    "$p603a_HELP"
+                   "604"     "604" 	 $( [ "$CPU" == "604" ] && echo "on" || echo "off" )     "$p604_HELP"
+                   "604e"    "604e" 	 $( [ "$CPU" == "604e" ] && echo "on" || echo "off" )    "$p604e_HELP"
+                   "620"     "620" 	 $( [ "$CPU" == "620" ] && echo "on" || echo "off" )     "$p620_HELP"
+                   "630"     "630" 	 $( [ "$CPU" == "630" ] && echo "on" || echo "off" )     "$p630_HELP"
+                   "740"     "740" 	 $( [ "$CPU" == "740" ] && echo "on" || echo "off" )     "$p740_HELP"
+                   "7400"    "7400" 	 $( [ "$CPU" == "7400" ] && echo "on" || echo "off" )    "$p7400_HELP"
+                   "7450"    "7450" 	 $( [ "$CPU" == "7450" ] && echo "on" || echo "off" )    "$p7450_HELP"
+                   "750"     "750" 	 $( [ "$CPU" == "750" ] && echo "on" || echo "off" )     "$p750_HELP"
+                   "801"     "801" 	 $( [ "$CPU" == "801" ] && echo "on" || echo "off" )     "$p801_HELP"
+                   "821"     "821" 	 $( [ "$CPU" == "821" ] && echo "on" || echo "off" )     "$p821_HELP"
+                   "823"     "823" 	 $( [ "$CPU" == "823" ] && echo "on" || echo "off" )     "$p823_HELP"
+                   "Power"   "Power" 	 $( [ "$CPU" == "Power" ] && echo "on" || echo "off" )   "$Power_HELP"
+                   "Power2"  "Power2"    $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" )  "$Power2_HELP"
+                   "PowerPC" "PowerPC"   $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "$PowerPC_HELP" )
+         ;;
   
-    SPARC) OPTIONS=( "v7"         "v7"         $( [ "$CPU" == "v7" ] && echo "on" || echo "off" ) "$v7_HELP"
-                     "cypress"    "cypress"    $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" ) "$cypress_HELP"
-                     "v8"         "v8"         $( [ "$CPU" == "v8" ] && echo "on" || echo "off" ) "$v8_HELP"
-                     "supersparc" "supersparc" $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" ) "$supersparc_HELP"
-                     "sparclite"  "sparclite"  $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" ) "$sparclite_HELP"
-                     "hypersparc" "hypersparc" $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" ) "$hypersparc_HELP"
-                     "sparclite86x" "sparclite86x"  $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "$sparclite86x_HELP"
-                     "f930"       "f930"       $( [ "$CPU" == "f930" ] && echo "on" || echo "off" ) "$f930_HELP"
-                     "f934"       "f934"       $( [ "$CPU" == "f934" ] && echo "on" || echo "off" ) "$f934_HELP"
-                     "sparclet"   "sparclet"   $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" ) "$sparclet_HELP"
-                     "tsc701"     "tsc701"     $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" ) "$ts701_HELP"
-                     "v9"         "v9"         $( [ "$CPU" == "v9" ] && echo "on" || echo "off" ) "$v9_HELP"
-                     "ultrasparc" "ultrasparc" $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" ) "$ultrasparc_HELP" )
-                     ;;
-   esac
-  ;;
-  spd)
-   OPTIONS=( "Speedy"    "-funroll-loops"            $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" )    "$Speedy_HELP"
-             "Risky"     "-ffast-math"               $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" )     "$Risky_HELP" 
-             "Pointers"  "-fomit-frame-pointer"      $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" )  "$Pointer_HELP"
-             "Siblings"  "-foptimize-sibling-calls"  $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" )  "$Siblings_HELP"
-             "Profiling" "-fprofile-arcs"            $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "$Profiling_HELP"
-	     "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "$Branching_HELP"
-             "Aliasing"  "-fstrict-aliasing"         $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" )  "$Aliasing_HELP"
-             "Cprop"     "-fno-cprop-registers"      $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" )     "$Cprop_HELP"
-	     "Float"     "-ffloat-store"             $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" )     "$Float_HELP"
-             "Address"   "-fforce-addr"              $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" )   "$Address_HELP"
-             "Align"     "-falign-functions"        $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" )     "$Align_HELP" 
-             "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "$Expensive_HELP" 
-             "Doubles"   "-malign-double"            $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" )   "$Doubles_HELP"
-             "Tracer"   "-ftracer"                   $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" )   "$Tracer_HELP"
-	     "Blocks"   "-freorder-blocks"           $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" )   "$Blocks_HELP" )
-   ;;
-  xtra)
-   OPTIONS=( "MMX"       "MMX"     $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" )      "$MMX_HELP"
-             "SSE"       "SSE"     $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" )      "$SSE_HELP"
-             "SSE2"      "SSE2"    $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" )     "$SSE2_HELP"
-             "dnow"      "3dnow"   $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" )     "$dnow_HELP"
-             "Altivec"   "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" )  "$Altivec_HELP" )
-   ;;
-  fpm)
-   OPTIONS=( "None"      ""   $([ "$FPM" == "None" ] && echo "on" || echo "off" )     "$None_HELP"
-             "x387"      ""   $([ "$FPM" == "x387" ] && echo "on" || echo "off" )     "$x387_HELP"
-             "SSE"       ""   $([ "$FPM" == "SSE" ] && echo "on" || echo "off" )      "$SSE_HELP"
-             "Both"      ""   $([ "$FPM" == "Both" ] && echo "on" || echo "off" )     "$Both_HELP"
-             "Altivec"   ""   $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" )  "$Altivec_HELP" )
-   ;;
-  cc_opt)
-  OPTIONS=( "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -q "Deprecated" && echo "on" || echo "off" )  "$Deprecated_HELP" 
-            'ccpipe'   "-pipe for C"  $( echo ${CC_OPTS[@]} | grep -q "ccpipe" && echo "on" || echo "off" )   "$CPipe_HELP"
-            'cxxpipe'   "-pipe for C++"  $( echo ${CC_OPTS[@]} | grep -q "cxxpipe" && echo "on" || echo "off" )   "$CCPipe_HELP" )
-   ;;
-  ldf)
-   OPTIONS=( "Strip"      "-s"            $( echo ${LDF[@]} | grep -q "Strip" && echo "on" || echo "off" )     "$Strip_HELP"
-            "Optimize"      "-Wl,-O1"     $( echo ${LDF[@]} | grep -q "Optimize" && echo "on" || echo "off" )     "$Optimize_HELP"
-            "Reduce"      "-Wl,--as-needed"     $( echo ${LDF[@]} | grep -q "Reduce" && echo "on" || echo "off" )     "$Reduce_HELP"
-#            "Debug"      "-S"            $( echo ${LDF[@]} | grep -q "Debug" && echo "on" || echo "off" )     "$Debug_HELP"
-             "Combreloc"  "-z combreloc"  $( echo ${LDF[@]} | grep -q "Combreloc" && echo "on" || echo "off" ) "$Combreloc_HELP" )
-   ;;
+       SPARC)
+         OPTIONS=( "v7"           "v7"           $( [ "$CPU" == "v7" ] && echo "on" || echo "off" )           "$v7_HELP"
+                   "cypress"      "cypress"      $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" )      "$cypress_HELP"
+                   "v8"           "v8"           $( [ "$CPU" == "v8" ] && echo "on" || echo "off" )           "$v8_HELP"
+                   "supersparc"   "supersparc"   $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" )   "$supersparc_HELP"
+                   "sparclite"    "sparclite"    $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" )    "$sparclite_HELP"
+                   "hypersparc"   "hypersparc"   $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" )   "$hypersparc_HELP"
+                   "sparclite86x" "sparclite86x" $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "$sparclite86x_HELP"
+                   "f930"         "f930"         $( [ "$CPU" == "f930" ] && echo "on" || echo "off" )         "$f930_HELP"
+                   "f934"         "f934"         $( [ "$CPU" == "f934" ] && echo "on" || echo "off" )         "$f934_HELP"
+                   "sparclet"     "sparclet"     $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" )     "$sparclet_HELP"
+                   "tsc701"       "tsc701"       $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" )       "$ts701_HELP"
+                   "v9"           "v9"           $( [ "$CPU" == "v9" ] && echo "on" || echo "off" )           "$v9_HELP"
+                   "ultrasparc"   "ultrasparc"   $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" )   "$ultrasparc_HELP" )
+         ;;
+     esac
+     ;;
+   spd)
+     OPTIONS=( "Speedy"    "-funroll-loops"            $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" )    "$Speedy_HELP"
+               "Risky"     "-ffast-math"               $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" )     "$Risky_HELP" 
+               "Pointers"  "-fomit-frame-pointer"      $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" )  "$Pointer_HELP"
+               "Siblings"  "-foptimize-sibling-calls"  $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" )  "$Siblings_HELP"
+               "Profiling" "-fprofile-arcs"            $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "$Profiling_HELP"
+	       "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "$Branching_HELP"
+               "Aliasing"  "-fstrict-aliasing"         $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" )  "$Aliasing_HELP"
+               "Cprop"     "-fno-cprop-registers"      $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" )     "$Cprop_HELP"
+	       "Float"     "-ffloat-store"             $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" )     "$Float_HELP"
+               "Address"   "-fforce-addr"              $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" )   "$Address_HELP"
+               "Align"     "-falign-functions"         $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" )     "$Align_HELP" 
+               "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "$Expensive_HELP" 
+               "Doubles"   "-malign-double"            $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" )   "$Doubles_HELP"
+               "Tracer"    "-ftracer"                  $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" )    "$Tracer_HELP"
+	       "Blocks"    "-freorder-blocks"          $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" )    "$Blocks_HELP" )
+     ;;
+   xtra)
+     case $2 in
+       x86)
+         if grep -qw mmx /proc/cpuinfo ; then
+	   OPTIONS=( ${OPTIONS[@]} "MMX"     "MMX"     $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" )      "$MMX_HELP" )
+	 fi
+	 if grep -qw sse /proc/cpuinfo ; then
+	   OPTIONS=( ${OPTIONS[@]} "SSE"     "SSE"     $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" )      "$SSE_HELP" )
+	 fi
+	 if grep -qw sse2 /proc/cpuinfo ; then
+           OPTIONS=( ${OPTIONS[@]} "SSE2"    "SSE2"    $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" )     "$SSE2_HELP" )
+	 fi
+	 if grep -qw 3dnow /proc/cpuinfo ; then
+           OPTIONS=( ${OPTIONS[@]} "dnow"    "3dnow"   $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" )     "$dnow_HELP" )
+	 fi
+         ;;
+       PowerPC)
+         if grep -qw altivec /proc/cpuinfo ; then
+           OPTIONS=( "Altivec" "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" )  "$Altivec_HELP" )
+	 fi
+         ;;
+     esac
+     ;;
+   fpm)
+     case $2 in
+       x86)
+         OPTIONS=( "None"    "Use compiler default"                    $([ "$FPM" == "None" ] && echo "on" || echo "off" )     "$None_HELP" )
+         if grep '^fpu' /proc/cpuinfo | grep -qw yes ; then
+	   OPTIONS=( ${OPTIONS[@]} "x387" "Floating point coprocessor" $([ "$FPM" == "x387" ] && echo "on" || echo "off" ) "$x387_HELP" )
+	 fi
+	 if grep -qw sse /proc/cpuinfo ; then
+	   OPTIONS=( ${OPTIONS[@]} "SSE"  "Streaming SIMD Extensions"  $([ "$FPM" == "SSE" ] && echo "on" || echo "off" )  "$SSE_HELP" )
+	   if grep '^fpu' /proc/cpuinfo | grep -qw yes ; then
+	     OPTIONS=( ${OPTIONS[@]} "Both" "x387 and SSE"             $([ "$FPM" == "Both" ] && echo "on" || echo "off" ) "$Both_HELP" )
+	   fi
+	 fi
+         ;;
+       PowerPC)
+         if grep -qw altivec /proc/cpuinfo ; then
+           OPTIONS=( "Altivec" "PowerPC only"               $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" )  "$Altivec_HELP" )
+	 fi
+         ;;
+     esac
+     ;;
+   cc_opt)
+     OPTIONS=( "Deprecated" "-Wno-deprecated for C++"     $( echo ${CC_OPTS[@]} | grep -q "Deprecated" && echo "on" || echo "off" ) "$Deprecated_HELP" 
+               "ccpipe"     "-pipe for C (RECOMMENDED)"   $( echo ${CC_OPTS[@]} | grep -q "ccpipe" && echo "on" || echo "off" )     "$CPipe_HELP"
+               "cxxpipe"    "-pipe for C++ (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -q "cxxpipe" && echo "on" || echo "off" )    "$CCPipe_HELP" )
+     ;;
+   ldf)
+     case $SAFE_OPTIMIZATIONS in
+       on)
+         OPTIONS=( "Strip"      "-s (RECOMMENDED)" $( echo ${LDF[@]} | grep -q "Strip" && echo "on" || echo "off" )     "$Strip_HELP" )
+         ;;
+       off)
+         OPTIONS=( "Strip"      "-s (RECOMMENDED)" $( echo ${LDF[@]} | grep -q "Strip" && echo "on" || echo "off" )     "$Strip_HELP"
+                   "Optimize"   "-Wl,-O1"          $( echo ${LDF[@]} | grep -q "Optimize" && echo "on" || echo "off" )  "$Optimize_HELP"
+                   "Reduce"     "-Wl,--as-needed"  $( echo ${LDF[@]} | grep -q "Reduce" && echo "on" || echo "off" )    "$Reduce_HELP"
+                   "Debug"      "-S"               $( echo ${LDF[@]} | grep -q "Debug" && echo "on" || echo "off" )     "$Debug_HELP"
+                   "Combreloc"  "-z combreloc"     $( echo ${LDF[@]} | grep -q "Combreloc" && echo "on" || echo "off" ) "$Combreloc_HELP" )
+         ;;
+     esac
+     ;;
   addon)
-  OPTIONS=( "CCache" "ccache" $( echo ${ADDON[@]} | grep -q "CCache" && echo "on" || echo "off" ) "$CCache_HELP"
-            "DistCC" "distcc" $( echo ${ADDON[@]} | grep -q "DistCC" && echo "on" || echo "off" ) "$DistCC_HELP" )
-   ;;
+    OPTIONS=( "CCache" "ccache" $( echo ${ADDON[@]} | grep -q "CCache" && echo "on" || echo "off" ) "$CCache_HELP"
+              "DistCC" "distcc" $( echo ${ADDON[@]} | grep -q "DistCC" && echo "on" || echo "off" ) "$DistCC_HELP" )
+    ;;
   esac
 }
 
 menu() {
-   if [[ $1 == "checklist" ]]; then
+   if [ "$1" == "checklist" ] ; then
        RESULT=`dialog --title "$TITLE"          \
                       --stdout                  \
                       --no-cancel               \
@@ -368,7 +414,7 @@
                       --checklist  "$MENU"      \
                         0 0 0                   \
                       "${OPTIONS[@]}"`
-   elif [[ $1 == "radiolist" ]]; then
+   elif [ "$1" == "radiolist" ] ; then
      unset RESULT
      while [ -z "$RESULT" ]; do
        RESULT=`dialog --title "$TITLE"          \
@@ -389,7 +435,6 @@
                       "${OPTIONS[@]}"`
    fi
    RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
-
 }
 
 
@@ -404,15 +449,18 @@
 
   # Flow control for the menus. This will also check for gcc3,
   # if it exists it will allow more options.
-  TITLE="Lunar Optimizations"
+  TITLE="Lunar Compiler Optimizations"
 
+  # by default, turn on safety
+  SAFE_OPTIMIZATIONS=${SAFE_OPTIMIZATIONS:-on}
+
+  export IFS="$TAB_ENTER_IFS"
+
   # loop until escape or exited
   while true; do
-  DEFAULT=${CHOICE:-V}
- 
-  export IFS="$TAB_ENTER_IFS"
+    DEFAULT=${CHOICE:-safe}
 
-  CHOICE=`$DIALOG --title "$TITLE" \
+    CHOICE=`$DIALOG --title "$TITLE" \
                   --ok-label "Select" \
                   --cancel-label "Close" \
 		  --default-item "$DEFAULT" \
@@ -420,87 +468,145 @@
 		  --menu \
 		  "" \
 		  0 0 0 \
-		  "compiler" "Compiler version               [$GCCVER]" "Select the default gcc version to be used" \
-		  "platform" "Platform choice                [$PLATFORM]" "Select the specific architecture like x86, ppc" \
-		  "bopt"     "Base speed optimization        [$BOPT]" "Select the base optimization from -Os, -O0, -O1 etc" \
-		  "cpu"      "CPU selection                  [$CPU]" "Select the target CPU type" \
-		  "xtra"     "CPU extensions                 [$XTRA]" "Select CPU extensions" \
-		  "spd"      "Specialized optimizations" "Select specific compiler flags for expensive and risky optimizations" \
-		  "cc_opt"   "General C/C++ options" "Select named pipes, warnings on deprecated symbols" \
-		  "fpm"      "Floating point optimizations   [$FPM]" "enable specific floating point optimizations" \
-		  "ldf"      "Linker optimizations           [$LDF]" "Enable linker specific optimizations" \
-		  "addon"    "Compiler addons                [$ADDON]" "Enable compiler addons like ccache, distcc" \
-		  "parallel" "parallelization" "Enable multiple parallel compiles" \
-		  "stack"    "Stack" "Set the stack size"`
-  if [ $? != 0 ] ; then
-    verbose_msg "Saving optimizations"
-    set_optimize
-    return
-  fi
+		  $(if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+		      echo "safe"
+		      echo "Turn on optimization safety   [$SAFE_OPTIMIZATIONS]"
+		      echo "Only allow safe optimizations (removes dangerous settings!)"
+		    else
+		      echo "safe"
+		      echo "Turn off optimization safety  [$SAFE_OPTIMIZATIONS]"
+		      echo "Allow potentially unsafe optimizations (DANGEROUS!)"
+		    fi
+		    echo "compiler"
+		    echo "Compiler version              [$GCCVER]"
+		    echo "Select the default gcc version to be used"
+		    echo "platform"
+		    echo "Platform choice               [$PLATFORM]"
+		    echo "Select the specific architecture like x87, ppc"
+		    echo "bopt"
+		    echo "Base speed optimization       [$BOPT]"
+		    echo "Select the base optimization from -Os, -O0, -O1 etc"
+		    echo "cpu"
+		    echo "CPU selection                 [$CPU]"
+		    echo "Select the target CPU type"
+		    if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+		      echo "xtra"
+		      echo "CPU extensions                [${XTRA[@]}]"
+		      echo "Select CPU extensions"
+		      echo "spd"
+		      echo "Specialized optimizations     [${SPD[@]}]"
+		      echo "Select specific compiler flags for expensive and risky optimizations"
+		      echo "fpm"
+		      echo "Floating point optimizations  [$FPM]"
+		      echo "enable specific floating point optimizations"
+		    fi
+                    echo "cc_opt"
+		    echo "General C/C++ options         [${CC_OPT[@]}]"
+		    echo "Select named pipes, warnings on deprecated symbols"
+                    echo "ldf"
+		    echo "Linker optimizations          [${LDF[@]}]"
+		    echo "Enable linker specific optimizations"
+                    echo "addon"
+		    echo "Compiler addons               [${ADDON[@]}]"
+		    echo "Enable compiler addons like ccache, distcc"
+		    if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+		      echo "makes"
+		      echo "parallelization               [$MAKES]"
+		      echo "Enable multiple parallel compiles"
+		      echo "stack"
+		      echo "Stack                         [$STACK]"
+		      echo "Set the stack size"
+		   fi) `
+    if [ $? != 0 ] ; then
+      verbose_msg "Saving optimizations"
+      save_optimizations
+      set_local_config SAFE_OPTIMIZATIONS $SAFE_OPTIMIZATIONS
+      return
+    fi
 
-  optimizations_help $CHOICE $PLATFORM
-  optimizations_options $CHOICE $PLATFORM
+    optimizations_help $CHOICE $PLATFORM
+    optimizations_options $CHOICE $PLATFORM
 
-  case $CHOICE in
-    compiler)
-      menu radiolist
-      GCCVER=$RESULT
-      ;;
-    platform)
-      menu radiolist
-      PLATFORM=$RESULT
-      ;;
-    bopt)
-      menu radiolist
-      BOPT=$RESULT
-      ;;
-    cpu)
-      menu radiolist
-      CPU=$RESULT
-      optimize_cpu $CPU
-      BUILD=$BUILD
-      ;;
-    spd)
-      menu checklist
-      SPD=( $RESULT )
-      ;;
-    xtra)
-      menu checklist
-      XTRA=( $RESULT )
-      ;;
-    fpm)
-      menu radiolist
-      FPM=$RESULT
-      ;;
-    cc_opt)
-      menu checklist
-      CC_OPTS=( $RESULT )
-      ;;
-    ldf)
-      menu checklist
-      LDF=( $RESULT )
-      ;;
-    addon)
-      menu checklist
-      ADDON=( $RESULT )
-      ;;
-    parallel)
-      MAKES=`dialog --title "Make - parallellizing" \
-             --nocancel --stdout --inputbox         \
-		"Enter the number of concurrent makes ( a value > 1 ) or leave this field empty."  \
-		0 55 $MAKES`
-      # people WILL fill in 1... so, we knock them down and take their money:
-      if [[ $MAKES -lt 2 ]] ; then
-        unset MAKES
-      fi
-      ;;
-    stack)
-      STACK=`dialog --title "Set stack parameters. (WARNING! Best left empty!)" \
-             --nocancel --stdout --inputbox \
-		"Enter the number to set the stack to, leave empty for default."  \
-		0 55 $STACK`
-      ;;
-  esac
+    case $CHOICE in
+      safe)
+        if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+          SAFE_OPTIMIZATIONS=on
+	  # remove dangerous optimizations immediately
+	  unset SPD XTRA MAKES STACK
+	  FPM=( "None" )
+	  if echo ${LDF[@]} | grep -q Strip ; then
+	    LDF=( "Strip" )
+	  else
+	    unset LDF
+	  fi
+	else
+	  # annoy the user and make sure he reads this warning message
+	  $DIALOG --defaultno --colors --yesno "                    \Z1*** WARNING ***\n\n\ZnPlease read this carefully. You are about to turn off the optimization safety. This means that you can possibly turn on compiler or linker optimizations that can and will break your box. Not only will the problem most likely occur only days, weeks or months after you turn this switch, but also it can corrupt all your personal data, make your machine unbootable, and cause serious personal distress, headache, loss of vision, heart failure, loss of income, or otherwise very bad things. Before you turn off this option, please think for yourself for a minute and ask yourself:\n\n                    Is it worth it?" 20 70
+	  if [ $? == 0 ]; then
+	    # oookay, he must be knowing what he's doing!
+            SAFE_OPTIMIZATIONS=off
+	  fi
+	fi
+        ;;
+      compiler)
+        menu radiolist
+        GCCVER=$RESULT
+        ;;
+      platform)
+        menu radiolist
+        PLATFORM=$RESULT
+        ;;
+      bopt)
+        menu radiolist
+        BOPT=$RESULT
+        ;;
+      cpu)
+        menu radiolist
+        CPU=$RESULT
+        optimize_cpu $CPU
+        BUILD=$BUILD
+        ;;
+      spd)
+        menu checklist
+        SPD=( $RESULT )
+        ;;
+      fpm)
+        menu radiolist
+        FPM=$RESULT
+        ;;
+      xtra)
+        menu checklist
+        XTRA=( $RESULT )
+        ;;
+      cc_opt)
+        menu checklist
+        CC_OPTS=( $RESULT )
+        ;;
+      ldf)
+        menu checklist
+        LDF=( $RESULT )
+        ;;
+      addon)
+        menu checklist
+        ADDON=( $RESULT )
+        ;;
+      makes)
+        MAKES=`dialog --title "Make - parallellizing" \
+               --nocancel --stdout --inputbox         \
+               "Enter the number of concurrent makes ( a value > 1 ) or leave this field empty."  \
+               0 55 $MAKES`
+        # people WILL fill in 1... so, we knock them down and take their money:
+        if [[ $MAKES -lt 2 ]] ; then
+          unset MAKES
+        fi
+        ;;
+      stack)
+        STACK=`dialog --title "Set stack parameters. (WARNING! Best left empty!)" \
+               --nocancel --stdout --inputbox \
+               "Enter the number to set the stack to, leave empty for default. Only used on x86 platform."  \
+               0 55 $STACK`
+        ;;
+    esac
   done
 }
 



More information about the Lunar-commits mailing list