The default search dirs were set before the Builder switches were read in the main project files. When the Builder switches included --RTS=, the wrong default search dirs were added. This patch ensures that the default search dirs are added after the Builder switches were read. There is no simple test.
Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-29 Vincent Celier <cel...@adacore.com> * make.adb (Gnatmake): Get the default search dirs, then the target parameters after getting the Builder switches, as the Builder switches may include --RTS= and that could change the default search dirs.
Index: make.adb =================================================================== --- make.adb (revision 178155) +++ make.adb (working copy) @@ -5908,7 +5908,7 @@ -- are not supposed to change. Osint.Source_File_Data (Cache => True); - Osint.Add_Default_Search_Dirs; + Queue_Library_Project_Sources; end if; @@ -5931,17 +5931,6 @@ ("nothing to do for a main project that is externally built"); end if; - -- Get the target parameters, which are only needed for a couple of - -- cases in gnatmake. Protect against an exception, such as the case of - -- system.ads missing from the library, and fail gracefully. - - begin - Targparm.Get_Target_Parameters; - exception - when Unrecoverable_Error => - Make_Failed ("*** make failed."); - end; - -- Special processing for VM targets if Targparm.VM_Target /= No_VM then @@ -6116,7 +6105,28 @@ Compute_Builder => Is_First_Main, Current_Work_Dir => Current_Work_Dir.all); - Is_First_Main := False; + if Is_First_Main then + -- Put the default source dirs in the source path only now, + -- so that we take the correct ones in the case when --RTS= is + -- specified in the Builder switches. + + Osint.Add_Default_Search_Dirs; + + -- Get the target parameters, which are only needed for a couple + -- of cases in gnatmake. Protect against an exception, such as the + -- case of system.ads missing from the library, and fail + -- gracefully. + + begin + Targparm.Get_Target_Parameters; + exception + when Unrecoverable_Error => + Make_Failed ("*** make failed."); + end; + + Is_First_Main := False; + end if; + Executable_Obsolete := False; Compute_Executable