make_locales_checklist()  {
  cat  $SCRIPT_DIRECTORY/locales |
  while read -r ONE REST ; do
    echo -n "\"$ONE\" \"$REST\" \"off\" "
  done 
}

#make_abi_checklist()  {
#  cat  $SCRIPT_DIRECTORY/abi |
#  while read -r ONE REST ; do
#    echo -n "\"$ONE\" \"$REST\" "
#  done
#}

select_locales()  {
  BACKTITLE="Glibc Configuration"
      TITLE="Locale Selection"
       HELP="Translated messages are automatically installed, but the locale database that controls other behavior is not.  Please select desired locale or locales.  If none are selected then all will be installed."

  make_locales_checklist | xargs \
  dialog  --backtitle  "$BACKTITLE"  \
          --title      "$TITLE"      \
          --stdout                   \
          --separate-output          \
          --checklist  "$HELP"       \
          0 0 0
}

#select_abi() {
#   BACKTITLE="Glibc Configuration"
#       TITLE="ABI Selection"
#        HELP="Select the last ABI you want to be compatible with."
#
#  make_abi_checklist | xargs \
#  dialog  --backtitle  "$BACKTITLE"  \
#          --title      "$TITLE"      \
#          --stdout                   \
#          --menu  "$HELP"            \
#          0 0 0
#}

#check to see if already configured
if  !  grep  -q  CONFIGURED  $MODULE_CONFIG;  then

   if    grep  -q  "GLIBC_LOCALES="  $MODULE_CONFIG
      then  message  "Selecting locales is optional"
   fi

   if  query  "Would you like to select locales? (if not selected, all locales will be installed)" n ; then
     GLIBC_LOCALES=`select_locales`
     TEMP=`grep  -v  "GLIBC_LOCALES="             $MODULE_CONFIG`
     echo  "$TEMP"                             >  $MODULE_CONFIG
     echo  "GLIBC_LOCALES=\"$GLIBC_LOCALES\""  >> $MODULE_CONFIG
   fi

#   GLIBC_ABI=2.0
#   if  query  "Would you like to select the oldest glibc ABI to be supported (Default 2.0)?" n ; then
#     GLIBC_ABI=`select_abi`
#   fi
#   OPTS="$OPTS --enable-oldest-abi=$GLIBC_ABI"

   if  query  "Would you like to disable building of profiling libs?" y
   then
     OPTS="$OPTS --disable-profile"
   fi

   echo "OPTS=\"\$OPTS $OPTS\""                >> $MODULE_CONFIG
   echo "CONFIGURED=y"                         >> $MODULE_CONFIG
fi
