Moved AC_CHECK_HEADERS near top. Added unistd.h in check