if not exists gcc:
  echo "Gcc-2.2.2 distribution not properly configured!"
  quit 20
endif

if not exists gcc:unix/dev
  ask "Create directory gcc:unix/dev? [yN]"
  if warn
    makedir gcc:unix/dev
  endif
endif


echo "Ar and ranlib had a bug handling long filenames."
ask "Replace them with fixed versions? [yN]"
if warn
  copy ar     gcc:unix/usr/bin/ar     clone
  copy ranlib gcc:unix/usr/bin/ranlib clone
endif


echo "Resulting from this buggy behavior, gcc:lib/libamy.a and"
ask "gcc:blib/libamy.a are corrupt. Should they be fixed? [yN]"
if warn
  echo "Fixing gcc:lib/libamy.a ..."
  ranlib gcc:lib/libamy.a
  echo "Fixing gcc:blib/libamy.a ..."
  ranlib gcc:blib/libamy.a
endif


ask "Install libm.a into gcc:lib ? [yN]"
if warn
  copy libm.a gcc:lib/libm.a clone
endif


echo "Less includes a help file. This should be located in"
echo "/usr/local/lib/less.hlp"
if not exists gcc:unix/local/lib
  ask "Create directory gcc:unix/local/lib? [yN]"
  if warn
    if not exists gcc:unix/local
      makedir gcc:unix/local
    endif
    makedir gcc:unix/local/lib
  endif
endif
if exists gcc:unix/local
  ask "Install less.hlp in /usr/local/lib/less.hlp? [yN]"
  if warn
    copy less.hlp gcc:unix/local/lib clone
  endif
endif


echo "LZ discarded all pure protection bits from executables."
ask "Should I add them back to the programs that originally had them? [yN]"
if warn
  ; raise the failure level, since it's possible that the user didn't keep
  ; all programs to save disk space
  failat 30
  protect gcc:compilers/amiga/2.2.2/cc1     +p
  protect gcc:compilers/amiga/2.2.2/cc1plus +p
  protect gcc:compilers/amiga/2.2.2/cc1obj  +p
  protect gcc:compilers/amiga/2.2.2/cpp     +p
  protect gcc:compilers/amiga/2.2.2/as      +p
  protect gcc:compilers/amiga/2.2.2/ld      +p
  protect gcc:unix/usr/bin/sh      +p
  protect gcc:unix/usr/bin/man     +p
  protect gcc:unix/usr/bin/apropos +p
  protect gcc:unix/usr/bin/whatis  +p
  protect gcc:unix/usr/bin/gcc     +p
  protect gcc:unix/usr/bin/gccv    +p
  protect gcc:unix/usr/bin/ar      +p
  protect gcc:unix/usr/bin/ranlib  +p
  failat 10
endif


echo "Due to a name collision, an important object file in libgcc.a was"
ask "missing. Should it be added back? [yN]"
if warn
  ar r gcc:lib/libgcc.a _caps_New.o
  ranlib gcc:lib/libgcc.a
  ar r gcc:blib/libgcc.a _caps_New.bo
  ranlib gcc:blib/libgcc.a
endif


echo "The two AREXX scripts were not updated to the new file hierarchy."
ask "Install updated scripts? [yN]"
if warn
  copy gcc.rexx gcc:rexx clone
  copy gpp.rexx gcc:rexx clone
endif


echo "The README file included with the hunk2gcc distribution was missing in the"
echo "gcc-2.2.2 distribution (it's the manual for hunk2gcc)."
ask "Install it as manual for hunk2gcc? [yN]"
if warn
  copy hunk2gcc.0 gcc:unix/usr/share/man/cat1 clone
endif


echo "This completes installation of this fix. Please keep on reporting those bugs!"
