summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-04-23 07:21:09 +0000
committerwlemb <wlemb>2003-04-23 07:21:09 +0000
commite34cfef0396b013b443f092a2c99e70ab3cb5e1d (patch)
treeb931ccce48a3dd19feced3f1675b61d9fbf84585
parentf25a24025f4043e3450050cc87aa111be854fbea (diff)
downloadgroff-e34cfef0396b013b443f092a2c99e70ab3cb5e1d.tar.gz
HP-UX 10.20 has `snprintf' but it isn't declared.
* configure.ac: Add declaration test for snprintf. * configure: Regenerated. * src/include/lib.h: Handle `NEED_DECLARATION_SNPRINTF'. * src/include/config.hin: Regenerated.
-rw-r--r--ChangeLog9
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure80
-rw-r--r--configure.ac1
-rw-r--r--src/include/config.hin3
-rw-r--r--src/include/lib.h3
6 files changed, 96 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c766d1d..9dc84c65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-04-21 Werner LEMBERG <wl@gnu.org>
+
+ HP-UX 10.20 has `snprintf' but it isn't declared.
+
+ * configure.ac: Add declaration test for snprintf.
+ * configure: Regenerated.
+ * src/include/lib.h: Handle `NEED_DECLARATION_SNPRINTF'.
+ * src/include/config.hin: Regenerated.
+
2003-04-19 Werner LEMBERG <wl@gnu.org>
Add keyword `figname' to pic, specifying the name of the picture
diff --git a/Makefile.in b/Makefile.in
index 14c525e6..765eee56 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -252,6 +252,7 @@ make_install_html=@make_install_html@
# -DNEED_DECLARATION_POPEN if your C++ <stdio.h> doesn't declare popen()
# -DNEED_DECLARATION_PUTENV if your C++ <stdlib.h> doesn't declare putenv()
# -DNEED_DECLARATION_RAND if your C++ <stdlib.h> doesn't declare rand()
+# -DNEED_DECLARATION_SNPRINTF if your C++ <stdio.h> doesn't declare snprintf()
# -DNEED_DECLARATION_SRAND if your C++ <stdlib.h> doesn't declare srand()
# -DNEED_DECLARATION_STRCASECMP if your C++ <string.h> doesn't declare
# strcasecmp()
diff --git a/configure b/configure
index 3d114139..b6ad057e 100755
--- a/configure
+++ b/configure
@@ -4172,6 +4172,86 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking whether snprintf must be declared" >&5
+echo $ECHO_N "checking whether snprintf must be declared... $ECHO_C" >&6
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+if test "${groff_cv_decl_needed_snprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+int
+main ()
+{
+#ifndef snprintf
+ char *p = (char *) snprintf;
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ groff_cv_decl_needed_snprintf=no
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+groff_cv_decl_needed_snprintf=yes
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
+echo "$as_me:$LINENO: result: $groff_cv_decl_needed_snprintf" >&5
+echo "${ECHO_T}$groff_cv_decl_needed_snprintf" >&6
+if test $groff_cv_decl_needed_snprintf = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define NEED_DECLARATION_SNPRINTF 1
+_ACEOF
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
echo "$as_me:$LINENO: checking whether srand must be declared" >&5
echo $ECHO_N "checking whether srand must be declared... $ECHO_C" >&6
ac_ext=cc
diff --git a/configure.ac b/configure.ac
index d86a3e64..c5079633 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ GROFF_NEED_DECLARATION(popen)
GROFF_NEED_DECLARATION(pclose)
GROFF_NEED_DECLARATION(putenv)
GROFF_NEED_DECLARATION(rand)
+GROFF_NEED_DECLARATION(snprintf)
GROFF_NEED_DECLARATION(srand)
GROFF_NEED_DECLARATION(strcasecmp)
GROFF_NEED_DECLARATION(strncasecmp)
diff --git a/src/include/config.hin b/src/include/config.hin
index 98441243..13a3630d 100644
--- a/src/include/config.hin
+++ b/src/include/config.hin
@@ -135,6 +135,9 @@
/* Define if your C++ doesn't declare rand(). */
#undef NEED_DECLARATION_RAND
+/* Define if your C++ doesn't declare snprintf(). */
+#undef NEED_DECLARATION_SNPRINTF
+
/* Define if your C++ doesn't declare srand(). */
#undef NEED_DECLARATION_SRAND
diff --git a/src/include/lib.h b/src/include/lib.h
index 3e6cb231..bebad98e 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -59,7 +59,8 @@ int is_prime(unsigned);
#include <strings.h>
#endif
-#ifndef HAVE_SNPRINTF
+/* HP-UX 10.20 doesn't declare snprintf() */
+#if !defined(HAVE_SNPRINTF) || defined(NEED_DECLARATION_SNPRINTF)
#include <stdarg.h>
extern "C" {
int snprintf(char *, size_t, const char *, /*args*/ ...);