#! /bin/sh -e

# DP: use gcc-3.3 instead of gcc and gnatXXX-3.15 instead of gnatXXX
# DP: as the command names.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- gcc/ada/make.adb~	Fri Apr  5 09:31:14 2002
+++ gcc/ada/make.adb	Sun Apr 14 18:38:17 2002
@@ -412,9 +412,9 @@
    -- Compiler, Binder & Linker Data and Subprograms --
    ----------------------------------------------------
 
-   Gcc             : String_Access := Program_Name ("gcc");
-   Gnatbind        : String_Access := Program_Name ("gnatbind");
-   Gnatlink        : String_Access := Program_Name ("gnatlink");
+   Gcc             : String_Access := Program_Name ("gcc-3.3");
+   Gnatbind        : String_Access := Program_Name ("gnatbind-3.3");
+   Gnatlink        : String_Access := Program_Name ("gnatlink-3.3");
    --  Default compiler, binder, linker programs
 
    Saved_Gcc       : String_Access := null;
--- gcc/ada/gnatcmd.adb~	Mon Jan  7 06:58:54 2002
+++ gcc/ada/gnatcmd.adb	Sun Apr 14 18:33:30 2002
@@ -2080,28 +2080,28 @@
 
       (Cname    => new S'("BIND"),
        Usage    => new S'("GNAT BIND file[.ali] /qualifiers"),
-       Unixcmd  => new S'("gnatbind"),
+       Unixcmd  => new S'("gnatbind-3.3"),
        Switches => Bind_Switches'Access,
        Params   => new Parameter_Array'(1 => File),
        Defext   => "ali"),
 
       (Cname    => new S'("CHOP"),
        Usage    => new S'("GNAT CHOP file [directory] /qualifiers"),
-       Unixcmd  => new S'("gnatchop"),
+       Unixcmd  => new S'("gnatchop-3.3"),
        Switches => Chop_Switches'Access,
        Params   => new Parameter_Array'(1 => File, 2 => Optional_File),
        Defext   => "   "),
 
       (Cname    => new S'("COMPILE"),
        Usage    => new S'("GNAT COMPILE filespec[,...] /qualifiers"),
-       Unixcmd  => new S'("gcc -c -x ada"),
+       Unixcmd  => new S'("gcc-3.3 -c -x ada"),
        Switches => GCC_Switches'Access,
        Params   => new Parameter_Array'(1 => Files_Or_Wildcard),
        Defext   => "   "),
 
       (Cname    => new S'("ELIM"),
        Usage    => new S'("GNAT ELIM name /qualifiers"),
-       Unixcmd  => new S'("gnatelim"),
+       Unixcmd  => new S'("gnatelim-3.3"),
        Switches => Elim_Switches'Access,
        Params   => new Parameter_Array'(1 => Other_As_Is),
        Defext   => "ali"),
@@ -2109,7 +2109,7 @@
       (Cname    => new S'("FIND"),
        Usage    => new S'("GNAT FIND pattern[:sourcefile[:line[:column]]]" &
                           " filespec[,...] /qualifiers"),
-       Unixcmd  => new S'("gnatfind"),
+       Unixcmd  => new S'("gnatfind-3.3"),
        Switches => Find_Switches'Access,
        Params   => new Parameter_Array'(1 => Other_As_Is,
                                         2 => Files_Or_Wildcard),
@@ -2117,7 +2117,7 @@
 
       (Cname    => new S'("KRUNCH"),
        Usage    => new S'("GNAT KRUNCH file [/COUNT=nnn]"),
-       Unixcmd  => new S'("gnatkr"),
+       Unixcmd  => new S'("gnatkr-3.3"),
        Switches => Krunch_Switches'Access,
        Params   => new Parameter_Array'(1 => File),
        Defext   => "   "),
@@ -2125,7 +2125,7 @@
       (Cname    => new S'("LIBRARY"),
        Usage    => new S'("GNAT LIBRARY /[CREATE | SET | DELETE]=directory"
                           & " [/CONFIG=file]"),
-       Unixcmd  => new S'("gnatlbr"),
+       Unixcmd  => new S'("gnatlbr-3.3"),
        Switches => Lbr_Switches'Access,
        Params   => new Parameter_Array'(1 .. 0 => File),
        Defext   => "   "),
@@ -2134,14 +2134,14 @@
        Usage    => new S'("GNAT LINK file[.ali]"
                    & " [extra obj_&_lib_&_exe_&_opt files]"
                    & " /qualifiers"),
-       Unixcmd  => new S'("gnatlink"),
+       Unixcmd  => new S'("gnatlink-3.3"),
        Switches => Link_Switches'Access,
        Params   => new Parameter_Array'(1 => Unlimited_Files),
        Defext   => "ali"),
 
       (Cname    => new S'("LIST"),
        Usage    => new S'("GNAT LIST /qualifiers object_or_ali_file"),
-       Unixcmd  => new S'("gnatls"),
+       Unixcmd  => new S'("gnatls-3.3"),
        Switches => List_Switches'Access,
        Params   => new Parameter_Array'(1 => File),
        Defext   => "ali"),
@@ -2149,14 +2149,14 @@
       (Cname    => new S'("MAKE"),
        Usage    =>
          new S'("GNAT MAKE file /qualifiers (includes COMPILE /qualifiers)"),
-       Unixcmd  => new S'("gnatmake"),
+       Unixcmd  => new S'("gnatmake-3.3"),
        Switches => Make_Switches'Access,
        Params   => new Parameter_Array'(1 => File),
        Defext   => "   "),
 
       (Cname    => new S'("PREPROCESS"),
        Usage    => new S'("GNAT PREPROCESS ifile ofile dfile /qualifiers"),
-       Unixcmd  => new S'("gnatprep"),
+       Unixcmd  => new S'("gnatprep-3.3"),
        Switches => Prep_Switches'Access,
        Params   => new Parameter_Array'(1 .. 3 => File),
        Defext   => "   "),
@@ -2164,35 +2164,35 @@
       (Cname    => new S'("SHARED"),
        Usage    => new S'("GNAT SHARED [obj_&_lib_&_exe_&_opt files]"
                    & " /qualifiers"),
-       Unixcmd  => new S'("gcc -shared " & Init_Object_Dirs.all),
+       Unixcmd  => new S'("gcc-3.3 -shared " & Init_Object_Dirs.all),
        Switches => Shared_Switches'Access,
        Params   => new Parameter_Array'(1 => Unlimited_Files),
        Defext   => "   "),
 
       (Cname    => new S'("STANDARD"),
        Usage    => new S'("GNAT STANDARD"),
-       Unixcmd  => new S'("gnatpsta"),
+       Unixcmd  => new S'("gnatpsta-3.3"),
        Switches => Standard_Switches'Access,
        Params   => new Parameter_Array'(1 .. 0 => File),
        Defext   => "   "),
 
       (Cname    => new S'("STUB"),
        Usage    => new S'("GNAT STUB file [directory] /qualifiers"),
-       Unixcmd  => new S'("gnatstub"),
+       Unixcmd  => new S'("gnatstub-3.3"),
        Switches => Stub_Switches'Access,
        Params   => new Parameter_Array'(1 => File, 2 => Optional_File),
        Defext   => "   "),
 
       (Cname    => new S'("SYSTEM"),
        Usage    => new S'("GNAT SYSTEM"),
-       Unixcmd  => new S'("gnatpsys"),
+       Unixcmd  => new S'("gnatpsys-3.3"),
        Switches => System_Switches'Access,
        Params   => new Parameter_Array'(1 .. 0 => File),
        Defext   => "   "),
 
       (Cname    => new S'("XREF"),
        Usage    => new S'("GNAT XREF filespec[,...] /qualifiers"),
-       Unixcmd  => new S'("gnatxref"),
+       Unixcmd  => new S'("gnatxref-3.3"),
        Switches => Xref_Switches'Access,
        Params   => new Parameter_Array'(1 => Files_Or_Wildcard),
        Defext   => "ali")
--- gcc/ada/par-ch10.adb~	Tue Oct  2 16:23:51 2001
+++ gcc/ada/par-ch10.adb	Sun Apr 14 18:34:59 2002
@@ -226,7 +226,7 @@
             else
                Item := First (Config_Pragmas);
                Error_Msg_N
-                 ("cannot compile configuration pragmas with gcc", Item);
+                 ("cannot compile configuration pragmas with gcc-3.3", Item);
                Error_Msg_N
                  ("use gnatchop -c to process configuration pragmas!", Item);
                raise Unrecoverable_Error;
--- gcc/ada/gnatlink.adb~	Mon Jan  7 06:58:54 2002
+++ gcc/ada/gnatlink.adb	Sun Apr 14 18:37:12 2002
@@ -109,7 +109,7 @@
 
    subtype chars_ptr is System.Address;
 
-   Gcc : String_Access := Program_Name ("gcc");
+   Gcc : String_Access := Program_Name ("gcc-3.3");
 
    Read_Mode  : constant String := "r" & ASCII.Nul;
 
@@ -957,7 +957,8 @@
       Write_Line ("  -b target  Compile the binder source to run on target");
       Write_Line ("  -Bdir      Load compiler executables from dir");
       Write_Line ("  --GCC=comp Use comp as the compiler");
-      Write_Line ("  --LINK=nam Use 'nam' for the linking rather than 'gcc'");
+      Write_Line ("  --LINK=nam Use 'nam' for the linking rather " &
+                  "than 'gcc-3.3'");
       Write_Eol;
       Write_Line ("  [non-Ada-objects]  list of non Ada object files");
       Write_Line ("  [linker-options]   other options for the linker");
--- gcc/ada/gnatchop.adb~	Mon Jan  7 06:58:54 2002
+++ gcc/ada/gnatchop.adb	Sun Apr 14 18:39:39 2002
@@ -1640,7 +1640,7 @@
 begin
    --  Check presence of required executables
 
-   Gnat_Cmd := Locate_Executable ("gcc");
+   Gnat_Cmd := Locate_Executable ("gcc-3.3");
 
    if Gnat_Cmd = null then
       goto No_Files_Written;
