diff --git a/configure.ac b/configure.ac
index f97a93ea6..232fa7ac1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1280,6 +1280,20 @@ else
                 AC_CHECK_LIB([readline], [readline],
                     [LIBS="$LIBS -lreadline"],
                     [AC_MSG_ERROR([Couldn't find readline libraries.])])
+
+PKG_CHECK_MODULES_STATIC([NCURSES], [ncursesw], [
+    AC_SUBST([CURSES_CFLAGS], ["$NCURSES_CFLAGS"])
+    AC_SUBST([CURSES_LIBS], ["$NCURSES_LIBS"])
+    AC_DEFINE([HAVE_CURSES_H], [1], [Define if curses.h is available])
+
+    # Force the compiler to use the ncursesw include path for all subsequent checks
+    CPPFLAGS="$CPPFLAGS $NCURSES_CFLAGS"
+])
+
+AC_CHECK_HEADERS([curses.h], [], [
+    AC_MSG_WARN([curses.h not found, but ncurses/curses.h is available.])
+])
+
             fi
         else
     # Especially defined for macOS (Big Sur), with readline installed from Brew
diff --git a/src/xspice/verilog/Makefile.am b/src/xspice/verilog/Makefile.am
index 262d63384..1a298cff0 100644
--- a/src/xspice/verilog/Makefile.am
+++ b/src/xspice/verilog/Makefile.am
@@ -45,7 +45,9 @@
 install-exec-hook:
 	cd $(DESTDIR)$(pkglibdir); \
 	rm -f ivlng*a libvvp* ; \
-	mv ivlngvpi.* ivlng.vpi
+	if [ -f ivlngvpi.* ]; then \
+            mv ivlngvpi.* ivlng.vpi; \
+        fi
 
 uninstall-hook:
 	rm -f $(DESTDIR)$(pkglibdir)/ivlng.vpi $(DESTDIR)$(pkglibdir)/ivlng.so
