diff --git a/ChangeLog b/ChangeLog
index 1ddf4fc0e8a003ad97ccb9830569b561b4270f3c..b73eef7840d77c86a6d329db81286b1d952ff068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -269,6 +269,8 @@ CVS code -
 - nano.h:
 	- Reorder the toggle #defines to match their corresponding order
 	  in toggle_init(). (DLR)
+	- Move the #include for sys/param.h here from nano.c, and add an
+	  #ifdef around it. (DLR)
 - prompt.c:
   get_prompt_string()
 	- Include the handling of the help key even when help is
@@ -383,6 +385,10 @@ CVS code -
 	- Update the last copyright notice to include 2006. (DLR)
 - configure.ac:
 	- Remove old warnings about color support. (DLR)
+	- Remove conditional header checks for fcntl.h and termios.h, as
+	  nano won't build without them, and add conditional header
+	  check for sys/param.h, as some systems need only limits.h.
+	  (DLR)
 - doc/faq.html:
 	- Add a new section 4.4, and move all section 4 entries after it
 	  down one number, to explain how to deal with problems typing
diff --git a/configure.ac b/configure.ac
index ce21a5b3084362631a89cdd4b25b87a9209ec28d..f5891bb58eee7cacbb63f918f2fa3695d59ccab2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
 dnl Checks for header files.
 
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h wctype.h)
+AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h)
 
 dnl Checks for options.
 
diff --git a/src/nano.c b/src/nano.c
index dffe8c2f976c4cc3b205c588bcb0dbcd9e463e22..1345b3895f08ddefcd2a28f566bc8ee55e4d9451 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -30,7 +30,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
-#include <sys/param.h>
 #include <errno.h>
 #include <ctype.h>
 #include <locale.h>
diff --git a/src/nano.h b/src/nano.h
index 26d6c4aca5c20e012720bdcf6a7e54fc25ff590f..b228b4c8e0454101f91cb69bd8a305a299925be5 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -40,6 +40,10 @@
 #include <limits.h>
 #endif
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
 /* Macros for flags. */
 #define SET(bit) flags |= bit
 #define UNSET(bit) flags &= ~bit