That sounds like the starter solenoid. If the known good batteries didn't work, check the connection to starter...the cable under +terminal under hood goes directly to it. Remove nut and look underneath for corrosion. Otherwise, the starter is near the firewall...and those repeat clicks is what I got when my car's battery died on me. Check for tightness, corrosion on all parts of the electric system from battery to starter...ground to body in trunk by the battery...engine ground straps.
Upcoming NYC dates: Jan 8 and 27. See Facebook for other shows and PM me if you can make one...love to see you there!
Mangofy your E46!