summaryrefslogtreecommitdiff
path: root/gcc/ada/mlib-utl.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 18:02:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 18:02:17 +0000
commitd91fe4b1acbf7cff48d7e500e83bda2b9b28c4ac (patch)
tree55ae9179b7d51cddc2f0c5d1b12fb1c8ed02bf2f /gcc/ada/mlib-utl.adb
parent6a74eb6248052dfcc88e1dc86e1a042566dbefeb (diff)
downloadgcc-d91fe4b1acbf7cff48d7e500e83bda2b9b28c4ac.tar.gz
2006-10-31 Vincent Celier <celier@adacore.com>
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118286 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/mlib-utl.adb')
-rw-r--r--gcc/ada/mlib-utl.adb110
1 files 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 --
-------------------