Index: configure.ac
--- configure.ac.orig	2024-06-29 19:16:10.000000000 +0200
+++ configure.ac	2024-07-01 22:38:40.263471000 +0200
@@ -75,10 +75,10 @@
   fi
 fi
 
-# -- Try tinfo.
+# -- Try termcap.
 if test "x$TERMLIBS" = x; then
-  if test $have_tinfo = yes; then
-    TERMLIBS="-ltinfo"
+  if test $have_termcap = yes; then
+    TERMLIBS="-ltermcap"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -87,10 +87,10 @@
   fi
 fi
 
-# -- Try xcurses.
+# -- Try termlib.
 if test "x$TERMLIBS" = x; then
-  if test $have_xcurses = yes; then
-    TERMLIBS="-lxcurses"
+  if test $have_termlib = yes; then
+    TERMLIBS="-lcurses -ltermlib"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -99,10 +99,10 @@
   fi
 fi
 
-# -- Try ncursesw.
+# -- Try tinfo.
 if test "x$TERMLIBS" = x; then
-  if test $have_ncursesw = yes; then
-    TERMLIBS="-lncursesw"
+  if test $have_tinfo = yes; then
+    TERMLIBS="-ltinfo"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -111,10 +111,10 @@
   fi
 fi
 
-# -- Try ncurses.
+# -- Try ncursesw.
 if test "x$TERMLIBS" = x; then
-  if test $have_ncurses = yes; then
-    TERMLIBS="-lncurses"
+  if test $have_ncursesw = yes; then
+    TERMLIBS="-lncursesw"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -123,10 +123,10 @@
   fi
 fi
 
-# -- Try curses.
+# -- Try ncurses.
 if test "x$TERMLIBS" = x; then
-  if test $have_curses = yes; then
-    TERMLIBS="-lcurses"
+  if test $have_ncurses = yes; then
+    TERMLIBS="-lncurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -148,12 +148,11 @@
   fi
   fi
 fi
-fi
 
-# -- Try termcap.
+# -- Try curses.
 if test "x$TERMLIBS" = x; then
-  if test $have_termcap = yes; then
-    TERMLIBS="-ltermcap"
+  if test $have_curses = yes; then
+    TERMLIBS="-lcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -162,10 +161,10 @@
   fi
 fi
 
-# -- Try termlib.
+# -- Try xcurses.
 if test "x$TERMLIBS" = x; then
-  if test $have_termlib = yes; then
-    TERMLIBS="-lcurses -ltermlib"
+  if test $have_xcurses = yes; then
+    TERMLIBS="-lxcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
@@ -174,6 +173,8 @@
   fi
 fi
 
+fi
+
 if test "x$TERMLIBS" = x; then
   AC_MSG_RESULT(Cannot find terminal libraries - configure failed)
   exit 1
Index: configure
--- configure.orig	2024-06-29 19:16:20.000000000 +0200
+++ configure	2024-07-01 22:38:40.264273000 +0200
@@ -4642,10 +4642,10 @@
   fi
 fi
 
-# -- Try tinfo.
+# -- Try termcap.
 if test "x$TERMLIBS" = x; then
-  if test $have_tinfo = yes; then
-    TERMLIBS="-ltinfo"
+  if test $have_termcap = yes; then
+    TERMLIBS="-ltermcap"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4673,10 +4673,10 @@
   fi
 fi
 
-# -- Try xcurses.
+# -- Try termlib.
 if test "x$TERMLIBS" = x; then
-  if test $have_xcurses = yes; then
-    TERMLIBS="-lxcurses"
+  if test $have_termlib = yes; then
+    TERMLIBS="-lcurses -ltermlib"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4704,10 +4704,10 @@
   fi
 fi
 
-# -- Try ncursesw.
+# -- Try tinfo.
 if test "x$TERMLIBS" = x; then
-  if test $have_ncursesw = yes; then
-    TERMLIBS="-lncursesw"
+  if test $have_tinfo = yes; then
+    TERMLIBS="-ltinfo"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4735,10 +4735,10 @@
   fi
 fi
 
-# -- Try ncurses.
+# -- Try ncursesw.
 if test "x$TERMLIBS" = x; then
-  if test $have_ncurses = yes; then
-    TERMLIBS="-lncurses"
+  if test $have_ncursesw = yes; then
+    TERMLIBS="-lncursesw"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4766,10 +4766,10 @@
   fi
 fi
 
-# -- Try curses.
+# -- Try ncurses.
 if test "x$TERMLIBS" = x; then
-  if test $have_curses = yes; then
-    TERMLIBS="-lcurses"
+  if test $have_ncurses = yes; then
+    TERMLIBS="-lncurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4829,12 +4829,11 @@
   fi
   fi
 fi
-fi
 
-# -- Try termcap.
+# -- Try curses.
 if test "x$TERMLIBS" = x; then
-  if test $have_termcap = yes; then
-    TERMLIBS="-ltermcap"
+  if test $have_curses = yes; then
+    TERMLIBS="-lcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4862,10 +4861,10 @@
   fi
 fi
 
-# -- Try termlib.
+# -- Try xcurses.
 if test "x$TERMLIBS" = x; then
-  if test $have_termlib = yes; then
-    TERMLIBS="-lcurses -ltermlib"
+  if test $have_xcurses = yes; then
+    TERMLIBS="-lxcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4893,6 +4892,8 @@
   fi
 fi
 
+fi
+
 if test "x$TERMLIBS" = x; then
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cannot find terminal libraries - configure failed" >&5
 printf "%s\n" "Cannot find terminal libraries - configure failed" >&6; }
Index: edit.c
--- edit.c.orig	2024-07-01 22:38:40.264460000 +0200
+++ edit.c	2024-07-01 22:41:22.531995000 +0200
@@ -16,9 +16,7 @@
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
-#if OS2 || __MVS__ || (defined WIFSIGNALED && defined WTERMSIG)
 #include <signal.h>
-#endif
 
 public int fd0 = 0;
 
