Cannot compile Tor for 64-bit architectures with Xcode 7.3

Not sure exactly why this appeared after the release of Xcode 7.3, but we are no longer able to finish the configure phase due to a missing stdlib.h include in the conftests for OpenSSL and zlib.

For example:

conftest.c:69:25: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
RAND_add((void*)0,0,0); exit(0);
                        ^
conftest.c:69:25: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'

| void RAND_add(const void *buf, int num, double entropy);
| int
| main ()
| {
| RAND_add((void*)0,0,0); exit(0);
|   ;
|   return 0;
| }

When I edited configure.ac to add the include for both OpenSSL and zlib and re-ran autoconf, I was able to make the tests pass and finish configure.

TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI],
    [#include <openssl/rand.h>],
    [#include <stdlib.h>],
    [void RAND_add(const void *buf, int num, double entropy);],
    [RAND_add((void*)0,0,0); exit(0);], [],
    [/usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /opt/openssl])

TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
    [#include <zlib.h>],
    [#include <stdlib.h>],
    [const char * zlibVersion(void);],
    [zlibVersion(); exit(0);], [--with-zlib-dir],
    [/opt/zlib])

We are also tracking this issue on GitHub here: https://github.com/ursachec/CPAProxy/issues/40

Trac:
Username: chrisballinger