diydrones/ardupilot — pull request #420 by johnboiles (2013-07-04 16:52:57+00:00)
Title: Fix SITL build on OSX

The SITL build was not compiling successfully on OSX and would fail with error. `make sitl` would produce the following error:

FATAL:/usr/bin/../libexec/as/x86_64/as: I don't understand 'a' flag! make: [/var/folders/1z/nrvllnvx6znf1z436jsn_3jw0000gn/T/ArduCopter?.build/ArduCopter?.o] Error 1

It looks like the assembler and linker flags in the SITL makefile are incompatible with OSX's version of as and ld. This change removes those flags when building on OSX.

Additionally, MSG_NOSIGNAL is only defined in Linux and not OSX (or BSD). I removed the MSG_NOSIGNAL flag when compiling on OSX. This doesn't seem to have any adverse effects as SIGPIPE still doesn't seem to be generated on the OSX version of SITL, even when repeatedly connecting then disconnecting to the TCP socket. Perhaps a more equivalent change would be to add the following in the appropriate places when compiling on OSX:

setsockopt(_listen_fd, SOL_SOCKET, SO_NOSIGPIPE, &one, sizeof(one));

However, this simple `#define MSG_NOSIGNAL 0` seems to work, and is minimally invasive.

With this change I am able to `make sitl` on OSX. I tested by running the ArduCopter SITL with sim_multicopter.py and verifying it was working as expected.