From a4ef52c124ce5431844555c068768e2b10e2d1b8 Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Thu, 13 Nov 2003 08:34:58 +0000 Subject: [PATCH] LynxOS 4.0.0 doesn't declare vfprintf. * configure.ac: Check for vfprintf. * configure: Regenerated. * src/include/lib.h: Handle `NEED_DECLARATION_VFPRINTF'. * src/include/config.hin: Regenerated. --- ChangeLog | 10 +++++ Makefile.in | 2 + configure | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + src/include/config.hin | 3 ++ src/include/lib.h | 36 +++++++---------- 6 files changed, 134 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c5bdcd..5ad3569f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,18 @@ +2003-11-11 Werner LEMBERG + + LynxOS 4.0.0 doesn't declare vfprintf. + + * configure.ac: Check for vfprintf. + * configure: Regenerated. + * src/include/lib.h: Handle `NEED_DECLARATION_VFPRINTF'. + * src/include/config.hin: Regenerated. + 2003-11-10 Werner LEMBERG LynxOS 4.0.0 has snprintf (without declaration) but no vsnprintf. * configure.ac: Check for vsnprintf. + * configure: Regenerated. * src/include/lib.h: Handle `NEED_DECLARATION_VSNPRINTF' and `HAVE_VSNPRINTF'. * src/include/config.hin: Regenerated. diff --git a/Makefile.in b/Makefile.in index cf5bfdef..57c891d2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -265,6 +265,8 @@ make_install_html=@make_install_html@ # -DNEED_DECLARATION_STRNCASECMP # if your C++ doesn't declare # strncasecmp() +# -DNEED_DECLARATION_VFPRINTF if your C++ doesn't declare +# vfprintf() # -DNEED_DECLARATION_VSNPRINTF if your C++ doesn't declare # vsnprintf() # diff --git a/configure b/configure index acf42347..76f51d78 100755 --- a/configure +++ b/configure @@ -5207,6 +5207,109 @@ 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 vfprintf must be declared" >&5 +echo $ECHO_N "checking whether vfprintf 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_vfprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +#include +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif + + +int +main () +{ + + +#ifndef vfprintf + char *p = (char *) vfprintf; +#endif + + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_vfprintf=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +groff_cv_decl_needed_vfprintf=yes +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: result: $groff_cv_decl_needed_vfprintf" >&5 +echo "${ECHO_T}$groff_cv_decl_needed_vfprintf" >&6 + if test $groff_cv_decl_needed_vfprintf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_VFPRINTF 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 vsnprintf must be declared" >&5 echo $ECHO_N "checking whether vsnprintf must be declared... $ECHO_C" >&6 ac_ext=cc diff --git a/configure.ac b/configure.ac index 4ddbe7f9..0fda78cc 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,7 @@ GROFF_NEED_DECLARATION([snprintf]) GROFF_NEED_DECLARATION([srand]) GROFF_NEED_DECLARATION([strcasecmp]) GROFF_NEED_DECLARATION([strncasecmp]) +GROFF_NEED_DECLARATION([vfprintf]) GROFF_NEED_DECLARATION([vsnprintf]) GROFF_SYS_NERR GROFF_SYS_ERRLIST diff --git a/src/include/config.hin b/src/include/config.hin index 97797801..dff8af90 100644 --- a/src/include/config.hin +++ b/src/include/config.hin @@ -157,6 +157,9 @@ /* Define if your C++ doesn't declare strncasecmp(). */ #undef NEED_DECLARATION_STRNCASECMP +/* Define if your C++ doesn't declare vfprintf(). */ +#undef NEED_DECLARATION_VFPRINTF + /* Define if your C++ doesn't declare vsnprintf(). */ #undef NEED_DECLARATION_VSNPRINTF diff --git a/src/include/lib.h b/src/include/lib.h index ba590e46..fd7d6fec 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -60,19 +60,21 @@ int is_prime(unsigned); #include #endif +#include + /* HP-UX 10.20 and LynxOS 4.0.0 don't declare snprintf() */ #if !defined(HAVE_SNPRINTF) || defined(NEED_DECLARATION_SNPRINTF) -extern "C" { - int snprintf(char *, size_t, const char *, /*args*/ ...); -} +extern "C" { int snprintf(char *, size_t, const char *, /*args*/ ...); } #endif /* LynxOS 4.0.0 has snprintf() but no vsnprintf() */ #if !defined(HAVE_VSNPRINTF) || defined(NEED_DECLARATION_VSNPRINTF) -#include -extern "C" { - int vsnprintf(char *, size_t, const char *, va_list); -} +extern "C" { int vsnprintf(char *, size_t, const char *, va_list); } +#endif + +/* LynxOS 4.0.0 doesn't declare vfprintf() */ +#ifdef NEED_DECLARATION_VFPRINTF +extern "C" { int vfprintf(FILE *, const char *, va_list); } #endif #ifndef HAVE_MKSTEMP @@ -109,29 +111,21 @@ inline int invalid_input_char(int c) #ifdef HAVE_STRCASECMP #ifdef NEED_DECLARATION_STRCASECMP -extern "C" { - // Ultrix4.3's string.h fails to declare this. - int strcasecmp(const char *, const char *); -} +// Ultrix4.3's string.h fails to declare this. +extern "C" { int strcasecmp(const char *, const char *); } #endif /* NEED_DECLARATION_STRCASECMP */ #else /* not HAVE_STRCASECMP */ -extern "C" { - int strcasecmp(const char *, const char *); -} +extern "C" { int strcasecmp(const char *, const char *); } #endif /* HAVE_STRCASECMP */ #if !defined(_AIX) && !defined(sinix) && !defined(__sinix__) #ifdef HAVE_STRNCASECMP #ifdef NEED_DECLARATION_STRNCASECMP -extern "C" { - // SunOS's string.h fails to declare this. - int strncasecmp(const char *, const char *, int); -} +// SunOS's string.h fails to declare this. +extern "C" { int strncasecmp(const char *, const char *, int); } #endif /* NEED_DECLARATION_STRNCASECMP */ #else /* not HAVE_STRNCASECMP */ -extern "C" { - int strncasecmp(const char *, const char *, size_t); -} +extern "C" { int strncasecmp(const char *, const char *, size_t); } #endif /* HAVE_STRNCASECMP */ #endif /* !_AIX && !sinix && !__sinix__ */ -- 2.11.4.GIT