From 4fd76bab73271a1b43b1d3393a4a30a1cc4ed1af Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 24 Dec 2004 18:11:53 +0000
Subject: [PATCH] configure.ac and related cleanups

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2200 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 13 ++++++++++---
 configure.ac | 10 +++++-----
 src/nano.c   |  4 ----
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 166ba782..8137dd21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -146,9 +146,16 @@ CVS code -
 - configure.ac:
 	- Remove specific references to control key shortcuts. (DLR)
 	- Check for the wide version of ncurses, without which multibyte
-	  strings don't seem to be displayed properly. (DLR)
-	- Check for stddef.h and wchar.h, for those systems that need
-	  one of the two for the wcwidth() prototype. (DLR)
+	  strings don't seem to be displayed properly, and associated
+	  wide character functions. (DLR)
+	- Check for wchar.h, for those systems that need it for the
+	  wcwidth() prototype. (DLR)
+	- Remove checks for all include files that we include
+	  unconditionally. (DLR)
+	- Remove references to termio.h here and elsewhere, since it's
+	  obsolete and it defines a struct termio that we don't use
+	  anywhere. (DLR)
+	- Typo fixes. (DLR)
 - doc/nanorc.sample:
 	- Add return to the "c-file" regexes. (DLR)
 
diff --git a/configure.ac b/configure.ac
index d9db2881..fcbfb6af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AM_GNU_GETTEXT([external], [need-ngettext])
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h stddef.h termio.h termios.h unistd.h wchar.h)
+AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h)
 AC_CHECK_HEADER(regex.h,
     AC_MSG_CHECKING([for broken regexec])
     AC_TRY_RUN([
@@ -291,8 +291,8 @@ AC_MSG_WARN([*** Can not use slang when cross-compiling])),
     esac], [AC_MSG_RESULT(no)])
 
 dnl Checks for functions
-AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
-if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
+AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim mbtowc wctomb wcwidth)
+if test "x$ac_cv_func_snprintf" = "xno" -o "x$ac_cv_func_vsnprintf" = "xno"
 then
 	AM_PATH_GLIB_2_0(2.0.0,,
 	    AC_MSG_ERROR([
@@ -357,9 +357,9 @@ then
 	LDFLAGS="$LDFLAGS $GLIB_LIBS"
 fi
 
-if test "x$CURSES_LIB_WIDE" == "xyes"
+if test "x$CURSES_LIB_WIDE" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes" -a "x$ac_cv_func_wctomb" = "xyes" -a "x$ac_cv_func_wcwidth" = "xyes"
 then
-	AC_DEFINE(NANO_WIDE, 1, [Define this if your system has wide character support.])
+	AC_DEFINE(NANO_WIDE, 1, [Define this if your system has wide character support (a wide curses library, mbtowc(), wctomb(), and wcwidth()).])
 else
 	AC_MSG_WARN([No wide character support found.  nano will not be able to support UTF-8.])
 fi
diff --git a/src/nano.c b/src/nano.c
index 7f9b4215..d474fe9b 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -44,10 +44,6 @@
 #include <termios.h>
 #endif
 
-#ifdef HAVE_TERMIO_H
-#include <termio.h>
-#endif
-
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif