Removed OS X build error on IPOPT; added IPOPT as an optional build; fixed some bugs in BoxPrimitive::calc_dist