Lots of custom work required. Exhaust, engine mounts, Tranny mounts, Odo drive...
Nothing slots right in. Sure, anything is doable, but:
What´s the point?
The E36 M3 engine is not a nice unit for the E9. The E9 with it´s laid back nature (really fast driving is no fun due to the wind noise, really sporty driving will just go to show how bad the body flexes...)
is a great cruiser. With the stock engine, fuel injected if you want muscle, plenty of torque, great sound and wonderfull ride is a very comfortable and rapid GT
An M3 engine will not improve on that. If you want something more speedy, the E9 is the wrong car to begin with.
Of course, the E9 can be turned into one hell of a racecar but to do so you need to start with an empty shell and the first step is a roll cage. And even then, there are better engines for a racing E9. Anything M30 based (even up to an M5 engine) is better suited. Easier to mount and far more logical.
I don´t want to be all negative, but the E9 is a great car and so is the M3 (though the E36 is probably the weakest version, esp. the US version).
Both are great if let alone. But I don´t think they mix very well.
Think a very expensive Wiener Schnitzel with Mustard. Not an attractive proposition.