Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX

In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
This commit is contained in:
Dan Winship
2013-10-19 13:04:00 -04:00
parent 3981cddbf8
commit 158dde0507
48 changed files with 66 additions and 152 deletions

View File

@@ -779,7 +779,7 @@ AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
AC_CHECK_HEADERS([linux/magic.h sys/prctl.h])
# Some versions of MSC lack these
AC_CHECK_HEADERS([dirent.h sys/time.h unistd.h])
AC_CHECK_HEADERS([dirent.h sys/time.h])
# We don't care about this, but we need to keep including it in
# glibconfig.h for backward compatibility
@@ -799,7 +799,9 @@ AC_CHECK_HEADERS([xlocale.h])
AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include <sys/types.h>
#include <sys/stat.h>
#ifdef G_OS_UNIX
#include <unistd.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
@@ -922,9 +924,6 @@ AS_IF([test $ac_cv_sizeof_ssize_t = $ac_cv_sizeof_int &&
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
int main ()
{
@@ -944,9 +943,6 @@ int main ()
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
int main ()
{