From f6cf2af4c766a8dbb0e52b94867e10cdd2a20cf1 Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Tue, 31 Oct 2006 19:02:17 +0100 Subject: [PATCH] mlib-utl.adb (Initialized): Remove, no longer used 2006-10-31 Vincent Celier * mlib-utl.adb (Initialized): Remove, no longer used (Initialize): Remove, no longer used (Ar): If Ar_Exec is null, get the location of the archive builder and, if there is one, the archive indexer. Fail if the archive builder cannot be found. (Gcc): If the driver path is unknown, get it. Fail if the driver cannot be found. From-SVN: r118286 --- gcc/ada/mlib-utl.adb | 110 +++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 61 deletions(-) diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb index b6dc7c2fbe5..821bfa981fb 100644 --- a/gcc/ada/mlib-utl.adb +++ b/gcc/ada/mlib-utl.adb @@ -36,8 +36,6 @@ with GNAT; use GNAT; package body MLib.Utl is - Initialized : Boolean := False; - Gcc_Name : constant String := Osint.Program_Name ("gcc").all; Gcc_Exec : OS_Lib.String_Access; @@ -49,9 +47,6 @@ package body MLib.Utl is Ranlib_Exec : OS_Lib.String_Access := null; Ranlib_Options : OS_Lib.String_List_Access := null; - procedure Initialize; - -- Look for the tools in the path and record the full path for each one - -------- -- Ar -- -------- @@ -65,7 +60,47 @@ package body MLib.Utl is Line_Length : Natural := 0; begin - Utl.Initialize; + if Ar_Exec = null then + Ar_Name := Osint.Program_Name (Archive_Builder); + Ar_Exec := OS_Lib.Locate_Exec_On_Path (Ar_Name.all); + + if Ar_Exec = null then + Free (Ar_Name); + Ar_Name := new String'(Archive_Builder); + Ar_Exec := OS_Lib.Locate_Exec_On_Path (Ar_Name.all); + end if; + + if Ar_Exec = null then + Fail (Ar_Name.all, " not found in path"); + + elsif Opt.Verbose_Mode then + Write_Str ("found "); + Write_Line (Ar_Exec.all); + end if; + + Ar_Options := Archive_Builder_Options; + + -- ranlib + + Ranlib_Name := Osint.Program_Name (Archive_Indexer); + + if Ranlib_Name'Length > 0 then + Ranlib_Exec := OS_Lib.Locate_Exec_On_Path (Ranlib_Name.all); + + if Ranlib_Exec = null then + Free (Ranlib_Name); + Ranlib_Name := new String'(Archive_Indexer); + Ranlib_Exec := OS_Lib.Locate_Exec_On_Path (Ranlib_Name.all); + end if; + + if Ranlib_Exec /= null and then Opt.Verbose_Mode then + Write_Str ("found "); + Write_Line (Ranlib_Exec.all); + end if; + end if; + + Ranlib_Options := Archive_Indexer_Options; + end if; Arguments := new String_List (1 .. 1 + Ar_Options'Length + Objects'Length); @@ -175,9 +210,15 @@ package body MLib.Utl is Driver : String_Access; begin - Utl.Initialize; - if Driver_Name = No_Name then + if Gcc_Exec = null then + Gcc_Exec := OS_Lib.Locate_Exec_On_Path (Gcc_Name); + + if Gcc_Exec = null then + Fail (Gcc_Name, " not found in path"); + end if; + end if; + Driver := Gcc_Exec; else @@ -234,59 +275,6 @@ package body MLib.Utl is end if; end Gcc; - ---------------- - -- Initialize -- - ---------------- - - procedure Initialize is - begin - if not Initialized then - Initialized := True; - - -- gcc - - Gcc_Exec := OS_Lib.Locate_Exec_On_Path (Gcc_Name); - - if Gcc_Exec = null then - Fail (Gcc_Name, " not found in path"); - - elsif Opt.Verbose_Mode then - Write_Str ("found "); - Write_Line (Gcc_Exec.all); - end if; - - -- ar - - Ar_Name := Osint.Program_Name (Archive_Builder); - Ar_Exec := OS_Lib.Locate_Exec_On_Path (Ar_Name.all); - - if Ar_Exec = null then - Fail (Ar_Name.all, " not found in path"); - - elsif Opt.Verbose_Mode then - Write_Str ("found "); - Write_Line (Ar_Exec.all); - end if; - - Ar_Options := Archive_Builder_Options; - - -- ranlib - - Ranlib_Name := Osint.Program_Name (Archive_Indexer); - - if Ranlib_Name'Length > 0 then - Ranlib_Exec := OS_Lib.Locate_Exec_On_Path (Ranlib_Name.all); - - if Ranlib_Exec /= null and then Opt.Verbose_Mode then - Write_Str ("found "); - Write_Line (Ranlib_Exec.all); - end if; - end if; - - Ranlib_Options := Archive_Indexer_Options; - end if; - end Initialize; - ------------------- -- Lib_Directory -- ------------------- -- 2.30.2