From 2e6fb7b833c90ddd940683ca1a5ab5c22f20923f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 22 Jul 2014 23:57:16 +0200
Subject: [PATCH 1/3] Fix SIGWINCH test to include <signal.h>

Instead of <sys/signal.h> which is not part of POSIX.
---
 aclocal.m4 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 6d9d274..909cacb 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4826,7 +4826,7 @@ AC_DEFUN([CF_SIGWINCH],
 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
 	AC_TRY_COMPILE([
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 ],[int x = SIGWINCH],
 	[cf_cv_define_sigwinch=yes],
 	[AC_TRY_COMPILE([
@@ -4834,7 +4834,7 @@ AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
 #undef _POSIX_SOURCE
 #undef _POSIX_C_SOURCE
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 ],[int x = SIGWINCH],
 	[cf_cv_define_sigwinch=maybe],
 	[cf_cv_define_sigwinch=no])
@@ -4852,7 +4852,7 @@ do
 #undef _POSIX_SOURCE
 #undef _POSIX_C_SOURCE
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 ],[
 #if SIGWINCH != $cf_sigwinch
 make an error
-- 
1.8.3.4


From 728ce504b6deb51caa3ef36ea384f5803c7c350a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Wed, 23 Jul 2014 00:15:05 +0200
Subject: [PATCH 2/3] Fix calling getpwdnam without including the header

pwd.h is only included on HAVE_UTMP,
but Haiku has pwd.h but no utmp.
---
 config.hin    | 1 +
 configure.in  | 1 +
 src/LYUtils.c | 5 ++++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/config.hin b/config.hin
index 2644f5b..96930d7 100644
--- a/config.hin
+++ b/config.hin
@@ -119,6 +119,7 @@
 #undef HAVE_READDIR
 #undef HAVE_RESIZETERM
 #undef HAVE_RESOLV_H
+#undef HAVE_PWD_H
 #undef HAVE_SETENV		/* AM_GNU_GETTEXT */
 #undef HAVE_SETLOCALE
 #undef HAVE_SETUID
diff --git a/configure.in b/configure.in
index 6eee4d1..d2bb819 100644
--- a/configure.in
+++ b/configure.in
@@ -752,6 +752,7 @@ AC_CHECK_HEADERS( \
 	arpa/inet.h \
 	fcntl.h \
 	limits.h \
+	pwd.h \
 	stdlib.h \
 	string.h \
 	sys/fcntl.h \
diff --git a/src/LYUtils.c b/src/LYUtils.c
index f4f97b7..e7ddc7c 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -99,8 +99,11 @@ extern int kbhit(void);		/* FIXME: use conio.h */
 #include <lib$routines.h>
 #endif /* VMS */
 
-#ifdef HAVE_UTMP
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif
+
+#ifdef HAVE_UTMP
 #ifdef UTMPX_FOR_UTMP
 #include <utmpx.h>
 #define utmp utmpx
-- 
1.8.3.4


From 7325373c7c9bd8bf88bd6dbe3b59d87e72b3dd72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Wed, 23 Jul 2014 00:18:13 +0200
Subject: [PATCH 3/3] Force patching configure itself

It seems lynx requires its own flavor of autoconf,
with things like AC_DIVERT_HELP.

We try to avoid having to patch autoconf just for this.
---
 configure | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 3efcee3..aba5f06 100755
--- a/configure
+++ b/configure
@@ -10226,7 +10226,7 @@ else
 #include "confdefs.h"
 
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 int
 main ()
@@ -10260,7 +10260,7 @@ cat >conftest.$ac_ext <<_ACEOF
 #undef _POSIX_SOURCE
 #undef _POSIX_C_SOURCE
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 int
 main ()
@@ -10316,7 +10316,7 @@ do
 #undef _POSIX_SOURCE
 #undef _POSIX_C_SOURCE
 #include <sys/types.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 int
 main ()
@@ -26246,6 +26246,7 @@ for ac_header in \
 	arpa/inet.h \
 	fcntl.h \
 	limits.h \
+	pwd.h \
 	stdlib.h \
 	string.h \
 	sys/fcntl.h \
-- 
1.8.3.4

