tests: be careful when using a broken socket

Result of writing to a broken socket is platform specific.

There are platforms(POSIX.1-2008) which supports MSG_NOSIGNAL flag which
disabling SIGPIPE.

There are platforms which supports SO_NOSIGPIPE which is a socket option
(and can be set with setsockopt; FreeBSD) and which also disables SIGPIPE.

On other platforms(like Solaris, even Oracle Solaris 11) you will get a SIGPIPE
when you try to write to a broken socket. On those platforms we should ignore
SIGPIPE.

some techinal details:
  In configure.ac we check whether MSG_NOSIGNAL is supported or not on our
  plaform. If yes, HAVE_MSG_NOSIGNAL is defined.
  A new test_main_setup() function added to ignore SIGPIPE if
  HAVE_MSG_NOSIGNAL not defined. That function is called in the generated
  main().

Signed-off-by: Laszlo Budai <lbudai@balabit.hu>