diff --git a/sshpty.c b/sshpty.c
index 50dd29341f20f04d5ebef62587fd15585696fa38..fceb7fd3882bb4bc2ac291a5128349e5953b9498 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -133,7 +133,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
 		close(*ptyfd);
 		return 0;
 	}
-#ifndef HAVE_CYGWIN
+#if !defined(HAVE_CYGWIN) && defined(I_PUSH)
 	/*
 	 * Push the appropriate streams modules, as described in Solaris pts(7).
 	 * HP-UX pts(7) doesn't have ttcompat module.