Yes, I admit I am being necromantic but because this thread appears to be the last word on M&G detection, I do believe it is important to update it.
Mansions and Gardens detection is actually quite easy, even if
Apartment Life is not available. Simply do a dummy load of any object that is unique to M&G. If Create New Object Instance succeeds then M&G is available, but otherwise the primitive simply returns False rather than producing an error. For example, lets look for some magic mushrooms! (Mushroom Mania, i.e. Sculpture - Rock Mushrooms)
[prim 0x002A] Create New Object Instance (GUID 0x35823918,
place: out of world (put new object id in Stack Object),
Create object normally,
fail if tile is non-empty: False,
pass Temp 0 to main: False,
move in a new Sim: False,
copying design mode materials from object in Temp 5: False)
[prim 0x0012] Remove Object Instance (Stack Object,
return immediately: True,
cleanup all: True)
A similar technique can be used for Holiday Edition/Holiday Pack detection.