#if defined(__WATCOMC__)
# undef HAVE_DPRINTF
+# undef HAVE_GETLINE
# undef HAVE_MEMRCHR
# undef HAVE_MKDTEMP
# undef HAVE_SETBIT
# undef HAVE_NET_ETHERNET_H
#endif
-#if defined(__FreeBSD__)
-# undef HAVE_STRCHRNUL
-#endif
-
+/* These BSD-derived OSes share many similarities */
#if (defined __digital__ && defined __unix__) \
|| defined __APPLE__ \
|| defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
# undef HAVE_CLEARENV
# undef HAVE_FDATASYNC
+# undef HAVE_GETLINE
# undef HAVE_MNTENT_H
# undef HAVE_PTSNAME_R
# undef HAVE_SYS_STATFS_H
# undef HAVE_DPRINTF
#endif
+#if defined(__FreeBSD__)
+# undef HAVE_STRCHRNUL
+#endif
+
+#if defined(__NetBSD__)
+# define HAVE_GETLINE 1 /* Recent NetBSD versions have getline() */
+#endif
+
#if defined(__digital__) && defined(__unix__)
# undef HAVE_STPCPY
-# undef HAVE_STRVERSCMP
#endif
#if defined(ANDROID)
# undef HAVE_DPRINTF
+# undef HAVE_GETLINE
# undef HAVE_STPCPY
# undef HAVE_STRCHRNUL
# undef HAVE_STRVERSCMP
#endif
#ifndef HAVE_GETLINE
+#include <stdio.h> /* for FILE */
extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC;
#endif