diff --git a/configure.ac b/configure.ac
index 9eedb73111c542a0fef61125fb2e0c5da63dc7ff..3298e34058d5079c2200738302555d0700e5dd31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,17 +372,17 @@ int main(void)
 	;;
     esac], [AC_MSG_RESULT(no)])
 
-    if test x$with_slang != xno; then
-	AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
-	AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
-	AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
-	AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
-	AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
-	AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
-	AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
-	AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
-	AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
-    fi
+if test x$CURSES_LIB_NAME = xslang; then
+    AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
+    AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
+    AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
+    AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
+    AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
+    AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
+    AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
+    AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion functions for files and search strings.])
+    AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
+fi
 
 AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
 AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)