diff --git a/externals/loaders/hexloader/hexloader.c b/externals/loaders/hexloader/hexloader.c
index f11e722486dd1571f00e32933995992802dc790a..063dc2377dec75ecf8738c6d6a7f76d2367258a3 100644
--- a/externals/loaders/hexloader/hexloader.c
+++ b/externals/loaders/hexloader/hexloader.c
@@ -36,7 +36,7 @@
 #ifdef DL_OPEN
 # include <dlfcn.h>
 #endif
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
 # include <stdlib.h>
 # include <unistd.h>
 #endif
diff --git a/pd/src/configure.ac b/pd/src/configure.ac
index 77e491283dce6b057c7b0fe707227a28aeef7b90..3f1395ecc2724a59403c47a3a02b095b259f5c42 100644
--- a/pd/src/configure.ac
+++ b/pd/src/configure.ac
@@ -121,7 +121,7 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
       LDFLAGS="$LDFLAGS -static"
     fi 
     EXT=pd_linux
-    CPPFLAGS="-DHAVE_LIBDL -DPA_USE_OSS -DUNIX -DUNISTD -fno-strict-aliasing"
+    CPPFLAGS="-DHAVE_LIBDL -DPA_USE_OSS -DUNIX -DHAVE_UNISTD_H -fno-strict-aliasing"
 dnl No OSS on hurd
     if test `uname -s` = "GNU";
     then
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 86cd504f3cb6ecd04c39016d8c765ddc128c8d31..975e42dc97c9d9ae7c9d5284dc1f932e00163ff2 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #ifdef MSW
@@ -519,7 +519,7 @@ static char *(usagemessage[]) = {
 "-send \"msg...\"   -- send a message at startup, after patches are loaded\n",
 "-noprefs         -- suppress loading preferences on startup\n",
 "-console         -- open the console along with the pd window\n",
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
 "-rt or -realtime -- use real-time priority\n",
 "-nrt             -- don't use real-time priority\n",
 #endif
@@ -996,7 +996,7 @@ int sys_argparse(int argc, char **argv)
             sys_noautopatch = 0;
             argc--; argv++;
         }
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
         else if (!strcmp(*argv, "-rt") || !strcmp(*argv, "-realtime"))
         {
             sys_hipriority = 1;
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index e7ac2b1ecb8c18937772e7c99b408647333cc252..82df1fcce09135a73fa8a7bdebce750287e9f132 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -14,7 +14,7 @@
 #define DEBUG(x)
 
 #include <stdlib.h>
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #include <sys/stat.h>
 #endif
@@ -360,7 +360,7 @@ int sys_trytoopenone(const char *dir, const char *name, const char* ext,
     if ((fd=open(dirresult,O_RDONLY | MSWOPENFLAG(bin))) >= 0)
     {
             /* in unix, further check that it's not a directory */
-#ifdef UNISTD
+#ifdef HAVE_UNISTD_H
         struct stat statbuf;
         int ok =  ((fstat(fd, &statbuf) >= 0) &&
             !S_ISDIR(statbuf.st_mode));