From 7fab608205e7a29b2a9bcd344e409edbb4cea6e3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 17 Jan 1999 03:22:52 +0000 Subject: [PATCH] Add configure test to see whether vsnprintf() is present, separately from snprintf() --- HPUX, for one, has snprintf but not vsnprintf. Fix a minor typo in snprintf.c, too. --- src/backend/port/snprintf.c | 4 +- src/configure | 254 ++++++++++++++++++++++-------------- src/configure.in | 5 + src/include/c.h | 21 ++- src/include/config.h.in | 3 + src/include/port/hpux.h | 8 ++ 6 files changed, 190 insertions(+), 105 deletions(-) diff --git a/src/backend/port/snprintf.c b/src/backend/port/snprintf.c index 5b541965b5..c49df44942 100644 --- a/src/backend/port/snprintf.c +++ b/src/backend/port/snprintf.c @@ -73,7 +73,7 @@ typedef unsigned long long ulong_long; * causing nast effects. **************************************************************/ -/*static char _id[] = "$Id: snprintf.c,v 1.15 1998/12/24 05:28:50 momjian Exp $";*/ +/*static char _id[] = "$Id: snprintf.c,v 1.16 1999/01/17 03:22:49 tgl Exp $";*/ static char *end; static int SnprfOverflow; @@ -115,7 +115,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args) static void fmtstr __P((char *value, int ljust, int len, int zpad, int maxwidth)); -#ifndef HAVE_LONG_INT_64 +#ifndef HAVE_LONG_LONG_INT_64 static void fmtnum __P((long value, int base, int dosign, int ljust, int len, int zpad)); #else static void fmtnum __P((long_long value, int base, int dosign, int ljust, int len, int zpad)); diff --git a/src/configure b/src/configure index 5b97ae82c7..e4d2d008a8 100755 --- a/src/configure +++ b/src/configure @@ -4496,14 +4496,66 @@ else SNPRINTF='snprintf.o' fi +echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 +echo "configure:4501: checking for vsnprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vsnprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf) +choke me +#else +vsnprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_vsnprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vsnprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vsnprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VSNPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +SNPRINTF='snprintf.o' +fi + echo $ac_n "checking for isinf""... $ac_c" 1>&6 -echo "configure:4502: checking for isinf" >&5 +echo "configure:4554: checking for isinf" >&5 if eval "test \"`echo '$''{'ac_cv_func_isinf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_isinf=yes" else @@ -4551,12 +4603,12 @@ fi echo $ac_n "checking for getrusage""... $ac_c" 1>&6 -echo "configure:4555: checking for getrusage" >&5 +echo "configure:4607: checking for getrusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_getrusage=yes" else @@ -4604,12 +4656,12 @@ fi echo $ac_n "checking for srandom""... $ac_c" 1>&6 -echo "configure:4608: checking for srandom" >&5 +echo "configure:4660: checking for srandom" >&5 if eval "test \"`echo '$''{'ac_cv_func_srandom'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_srandom=yes" else @@ -4657,12 +4709,12 @@ fi echo $ac_n "checking for gethostname""... $ac_c" 1>&6 -echo "configure:4661: checking for gethostname" >&5 +echo "configure:4713: checking for gethostname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostname=yes" else @@ -4710,12 +4762,12 @@ fi echo $ac_n "checking for random""... $ac_c" 1>&6 -echo "configure:4714: checking for random" >&5 +echo "configure:4766: checking for random" >&5 if eval "test \"`echo '$''{'ac_cv_func_random'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_random=yes" else @@ -4763,12 +4815,12 @@ fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:4767: checking for inet_aton" >&5 +echo "configure:4819: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -4816,12 +4868,12 @@ fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:4820: checking for strerror" >&5 +echo "configure:4872: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -4870,12 +4922,12 @@ fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 -echo "configure:4874: checking for strdup" >&5 +echo "configure:4926: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else @@ -4923,12 +4975,12 @@ fi echo $ac_n "checking for strtol""... $ac_c" 1>&6 -echo "configure:4927: checking for strtol" >&5 +echo "configure:4979: checking for strtol" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strtol=yes" else @@ -4976,12 +5028,12 @@ fi echo $ac_n "checking for strtoul""... $ac_c" 1>&6 -echo "configure:4980: checking for strtoul" >&5 +echo "configure:5032: checking for strtoul" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtoul'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strtoul=yes" else @@ -5029,12 +5081,12 @@ fi echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 -echo "configure:5033: checking for strcasecmp" >&5 +echo "configure:5085: checking for strcasecmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strcasecmp=yes" else @@ -5082,12 +5134,12 @@ fi echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:5086: checking for cbrt" >&5 +echo "configure:5138: checking for cbrt" >&5 if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -5131,7 +5183,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:5135: checking for cbrt in -lm" >&5 +echo "configure:5187: checking for cbrt in -lm" >&5 ac_lib_var=`echo m'_'cbrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5139,7 +5191,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5180,12 +5232,12 @@ fi # this hackery with HPUXMATHLIB allows us to cope. HPUXMATHLIB="" echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:5184: checking for rint" >&5 +echo "configure:5236: checking for rint" >&5 if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -5233,7 +5285,7 @@ if [ -r /lib/pa1.1/libm.a ] ; then HPUXMATHLIB="-L /lib/pa1.1 -lm" fi echo $ac_n "checking for rint in -lm""... $ac_c" 1>&6 -echo "configure:5237: checking for rint in -lm" >&5 +echo "configure:5289: checking for rint in -lm" >&5 ac_lib_var=`echo m'_'rint | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5241,7 +5293,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $HPUXMATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5282,9 +5334,9 @@ fi echo $ac_n "checking for POSIX signal interface""... $ac_c" 1>&6 -echo "configure:5286: checking for POSIX signal interface" >&5 +echo "configure:5338: checking for POSIX signal interface" >&5 cat > conftest.$ac_ext < int main() { @@ -5294,7 +5346,7 @@ act.sa_flags = SA_RESTART; sigaction(0, &act, &oact); ; return 0; } EOF -if { (eval echo configure:5298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define USE_POSIX_SIGNALS 1 @@ -5318,7 +5370,7 @@ then # Extract the first word of "tclsh", so it can be a program name with args. set dummy tclsh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5322: checking for $ac_word" >&5 +echo "configure:5374: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5351,7 +5403,7 @@ fi # Extract the first word of "tcl", so it can be a program name with args. set dummy tcl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5355: checking for $ac_word" >&5 +echo "configure:5407: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5390,7 +5442,7 @@ fi if test "$USE_TCL" = true then echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6 -echo "configure:5394: checking for tclConfig.sh" >&5 +echo "configure:5446: checking for tclConfig.sh" >&5 TCL_CONFIG_SH= library_dirs= if test -z "$TCL_DIRS" @@ -5419,7 +5471,7 @@ USE_TK=$USE_TCL # If TCL is disabled, disable TK if test "$USE_TK" = true then echo $ac_n "checking for tkConfig.sh""... $ac_c" 1>&6 -echo "configure:5423: checking for tkConfig.sh" >&5 +echo "configure:5475: checking for tkConfig.sh" >&5 TK_CONFIG_SH= # library_dirs are set in the check for TCL for dir in $library_dirs @@ -5456,7 +5508,7 @@ if test "$USE_X" = true; then # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:5460: checking for X" >&5 +echo "configure:5512: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5518,12 +5570,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5527: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5592,14 +5644,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -5705,17 +5757,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:5709: checking whether -R must be followed by a space" >&5 +echo "configure:5761: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -5731,14 +5783,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -5770,7 +5822,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:5774: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:5826: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5778,7 +5830,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5811,7 +5863,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:5815: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:5867: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5819,7 +5871,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5859,12 +5911,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5863: checking for gethostbyname" >&5 +echo "configure:5915: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5908,7 +5960,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:5912: checking for gethostbyname in -lnsl" >&5 +echo "configure:5964: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5916,7 +5968,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5957,12 +6009,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:5961: checking for connect" >&5 +echo "configure:6013: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -6006,7 +6058,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:6010: checking for connect in -lsocket" >&5 +echo "configure:6062: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6014,7 +6066,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6049,12 +6101,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:6053: checking for remove" >&5 +echo "configure:6105: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -6098,7 +6150,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:6102: checking for remove in -lposix" >&5 +echo "configure:6154: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6106,7 +6158,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6141,12 +6193,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:6145: checking for shmat" >&5 +echo "configure:6197: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -6190,7 +6242,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:6194: checking for shmat in -lipc" >&5 +echo "configure:6246: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6198,7 +6250,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6242,7 +6294,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:6246: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:6298: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6250,7 +6302,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6294,7 +6346,7 @@ fi X11_LIBS="" echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:6298: checking for XOpenDisplay in -lX11" >&5 +echo "configure:6350: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6302,7 +6354,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lX11 ${X_PRE_LIBS} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:6369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6360,17 +6412,17 @@ then PWD_INCDIR=no ac_safe=`echo "pwd.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for pwd.h""... $ac_c" 1>&6 -echo "configure:6364: checking for pwd.h" >&5 +echo "configure:6416: checking for pwd.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* diff --git a/src/configure.in b/src/configure.in index 307e7fe2f2..71c9c4749f 100644 --- a/src/configure.in +++ b/src/configure.in @@ -695,9 +695,14 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS(tzset memmove sigsetjmp kill sysconf fpclass) AC_CHECK_FUNCS(fp_class fp_class_d class) AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt) +dnl We use our snprintf.c emulation if either snprintf() or vsnprintf() +dnl is missing. Yes, there are machines that have only one. AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF), SNPRINTF='snprintf.o') +AC_CHECK_FUNC(vsnprintf, + AC_DEFINE(HAVE_VSNPRINTF), + SNPRINTF='snprintf.o') AC_SUBST(SNPRINTF) AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF), diff --git a/src/include/c.h b/src/include/c.h index cd7ecb9de2..0432d81940 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.47 1998/12/13 03:44:38 momjian Exp $ + * $Id: c.h,v 1.48 1999/01/17 03:22:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,9 +45,13 @@ /* We have to include stdlib.h here because it defines many of these macros on some platforms, and we only want our definitions used if stdlib.h doesn't - have its own. + have its own. The same goes for stddef and stdarg if present. */ #include +#ifdef STDC_HEADERS +#include +#include +#endif /* ---------------------------------------------------------------- * Section 1: bool, true, false, TRUE, FALSE @@ -820,6 +824,19 @@ extern char *form(const char *fmt,...); #define COPY_CMD "cp" #define SEP_CHAR '/' +/* Provide prototypes for routines not present in a particular machine's + * standard C library. It'd be better to put these in config.h, but + * in config.h we haven't yet included anything that defines size_t... + */ + +#ifndef HAVE_SNPRINTF +extern int snprintf(char *str, size_t count, const char *fmt, ...); +#endif + +#ifndef HAVE_VSNPRINTF +extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); +#endif + /* ---------------- * end of c.h * ---------------- diff --git a/src/include/config.h.in b/src/include/config.h.in index 3a54c89c1f..3ab45d0a73 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -118,6 +118,9 @@ /* Set to 1 if you have snprintf() */ #undef HAVE_SNPRINTF +/* Set to 1 if you have vsnprintf() */ +#undef HAVE_VSNPRINTF + /* Set to 1 if you have fp_class() */ #undef HAVE_FP_CLASS diff --git a/src/include/port/hpux.h b/src/include/port/hpux.h index 4ef01af095..0c42e6c4b7 100644 --- a/src/include/port/hpux.h +++ b/src/include/port/hpux.h @@ -6,6 +6,14 @@ typedef struct int sema[4]; } slock_t; +/* HPUX 9 has snprintf in the library, so configure will set HAVE_SNPRINTF; + * but it doesn't provide a prototype for it. To suppress warning messages + * from gcc, do this to make c.h provide the prototype: + */ +#ifndef HAVE_VSNPRINTF +#undef HAVE_SNPRINTF +#endif + #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif -- 2.40.0