From d6ecb969aec5fe6f14b781daeda80aa0d08242e4 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 15 Apr 2014 15:17:40 +0000
Subject: [PATCH] Checking for the availability of snprintf(), fixes bug
 #42070.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4777 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    |  2 ++
 configure.ac | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8ff4f7d3..8b5b3b59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
 	* src/winio.c: Relocate and correct a few comments.
 	* README.SVN: To build nano from svn, ssh is not required.
 	* src/*.c: Normalize whitespace around '==' comparison.
+	* configure.ac: Check for the availability of snprintf(),
+	fixes Savannah bug #42070 reported by David Lawrence Ramsey.
 
 2014-04-14  Benno Schulenberg  <bensberg@justemail.net>
 	* src/{proto.h,cut.c,nano.c,text.c}: Remove the unused parameter
diff --git a/configure.ac b/configure.ac
index f9889e1e..f0bdf7eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -419,18 +419,27 @@ int main(void)
 
 dnl Checks for functions.
 
-AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
+AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
 
 if test "x$enable_utf8" != xno; then
     AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
 fi
 
+if test x$ac_cv_func_snprintf = xno; then
+    AM_PATH_GLIB_2_0(2.0.0,,
+	AC_MSG_ERROR([
+*** snprintf() not found.  GLIB 2.x not found either.
+*** You should install the GLIB 2.x library which can
+*** be found at http://ftp.gtk.org/.]),
+	glib)
+fi
+
 if test x$ac_cv_func_vsnprintf = xno; then
     AM_PATH_GLIB_2_0(2.0.0,,
 	AC_MSG_ERROR([
-*** vsnprintf() not found.  GLIB 2.x not found either.  You should
-*** install the GLIB 2.x library which can be found at
-*** ftp://ftp.gtk.org/.]),
+*** vsnprintf() not found.  GLIB 2.x not found either.
+*** You should install the GLIB 2.x library which can
+*** be found at http://ftp.gtk.org/.]),
 	glib)
 fi
 
-- 
GitLab