--- gpm-1.20.1/configure.in	2003-08-19 22:55:19.000000000 -0500
+++ gpm/configure.in	2003-08-19 23:12:05.000000000 -0500
@@ -113,7 +113,7 @@
             AC_CHECK_LIB($i, wgetch,,,$TERMLIBS)
         else :; fi
     done
-    SHARED_LIBS="$LIBS $TERMLIBS -lc"
+    SHARED_LIBS="-lc"
     LIBS=$SAVELIBS ;;
 esac    
 
--- gpm-1.20.1/configure	2002-12-24 17:57:16.000000000 -0500
+++ gpm/configure	2003-08-19 23:15:01.000000000 -0500
@@ -1926,7 +1926,7 @@
 
         else :; fi
     done
-    SHARED_LIBS="$LIBS $TERMLIBS -lc"
+    SHARED_LIBS="-lc"
     LIBS=$SAVELIBS ;;
 esac    
 
--- gpm-1.20.1/src/lib/libcurses.c	2002-12-24 17:57:16.000000000 -0500
+++ gpm/src/lib/libcurses.c	2003-08-19 23:12:05.000000000 -0500
@@ -41,7 +41,12 @@
 #endif /* HAVE_NCURSES_CURSES_H */
 #endif /* HAVE_NCURSES_H */
 
-#define GET(win) ((win) ? wgetch(win) : getch())
+/* If win != NULL, it must have been created by ncurses anyway.
+   Avoid circular library dependencies.  */
+#pragma weak wgetch
+#pragma weak stdscr
+
+#define GET(win) ((win && wgetch) ? wgetch(win) : getch())
 
 int Gpm_Wgetch(WINDOW *win)
 {
