Yes the 617 turbo engine and 240D manual trans will work together.
Installing a 5 cylinder in a 240 will move everything back some.
the manual flywheel will have to be matched balanced to the auto FW.
the 240 front driveline section will have to be cut and rebalanced.
will have to shorten the shift rods.
use the 240D automatic trans X mount
there is a thread running right now on this subject.
www.peachparts.com/shopforum/showthread.php?t=263717
I just put a 4-spd in my 85 300D this past April, I have little over 10,000 miles on it. It is a totaly different car.
charlie