From: Tom Lane Date: Sun, 7 Mar 1999 21:32:06 +0000 (+0000) Subject: Cleaner autoconf tests for int8 support. X-Git-Tag: REL9_0_0~25777 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dffb88b024e4f87342ce1bbb4010eae47833f94a;p=pg-rex%2Fsyncrep.git Cleaner autoconf tests for int8 support. --- diff --git a/src/configure b/src/configure index fea71c37cb..f090b3544c 100755 --- a/src/configure +++ b/src/configure @@ -4350,13 +4350,14 @@ else fi done +SNPRINTF='' echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:4355: checking for snprintf" >&5 +echo "configure:4356: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+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:4384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -4403,12 +4404,12 @@ SNPRINTF='snprintf.o' fi echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:4407: checking for vsnprintf" >&5 +echo "configure:4408: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vsnprintf=yes" else @@ -4456,12 +4457,12 @@ fi echo $ac_n "checking for isinf""... $ac_c" 1>&6 -echo "configure:4460: checking for isinf" >&5 +echo "configure:4461: 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:4489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_isinf=yes" else @@ -4509,12 +4510,12 @@ fi echo $ac_n "checking for getrusage""... $ac_c" 1>&6 -echo "configure:4513: checking for getrusage" >&5 +echo "configure:4514: 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:4542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_getrusage=yes" else @@ -4562,12 +4563,12 @@ fi echo $ac_n "checking for srandom""... $ac_c" 1>&6 -echo "configure:4566: checking for srandom" >&5 +echo "configure:4567: 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:4595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_srandom=yes" else @@ -4615,12 +4616,12 @@ fi echo $ac_n "checking for gethostname""... $ac_c" 1>&6 -echo "configure:4619: checking for gethostname" >&5 +echo "configure:4620: 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:4648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostname=yes" else @@ -4668,12 +4669,12 @@ fi echo $ac_n "checking for random""... $ac_c" 1>&6 -echo "configure:4672: checking for random" >&5 +echo "configure:4673: 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:4701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_random=yes" else @@ -4721,12 +4722,12 @@ fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:4725: checking for inet_aton" >&5 +echo "configure:4726: 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:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -4774,12 +4775,12 @@ fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:4778: checking for strerror" >&5 +echo "configure:4779: 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:4807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -4828,12 +4829,12 @@ fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 -echo "configure:4832: checking for strdup" >&5 +echo "configure:4833: 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:4861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else @@ -4881,12 +4882,12 @@ fi echo $ac_n "checking for strtol""... $ac_c" 1>&6 -echo "configure:4885: checking for strtol" >&5 +echo "configure:4886: 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:4914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strtol=yes" else @@ -4934,12 +4935,12 @@ fi echo $ac_n "checking for strtoul""... $ac_c" 1>&6 -echo "configure:4938: checking for strtoul" >&5 +echo "configure:4939: 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:4967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strtoul=yes" else @@ -4987,12 +4988,12 @@ fi echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 -echo "configure:4991: checking for strcasecmp" >&5 +echo "configure:4992: 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:5020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strcasecmp=yes" else @@ -5040,12 +5041,12 @@ fi echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:5044: checking for cbrt" >&5 +echo "configure:5045: 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:5073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -5089,7 +5090,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:5093: checking for cbrt in -lm" >&5 +echo "configure:5094: 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 @@ -5097,7 +5098,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:5113: \"$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 @@ -5138,12 +5139,12 @@ fi # this hackery with HPUXMATHLIB allows us to cope. HPUXMATHLIB="" echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:5142: checking for rint" >&5 +echo "configure:5143: 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:5171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -5191,7 +5192,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:5195: checking for rint in -lm" >&5 +echo "configure:5196: 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 @@ -5199,7 +5200,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:5215: \"$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 @@ -5239,38 +5240,32 @@ fi +HAVE_LONG_INT_64=0 echo $ac_n "checking whether 'long int' is 64 bits""... $ac_c" 1>&6 -echo "configure:5244: checking whether 'long int' is 64 bits" >&5 +echo "configure:5246: checking whether 'long int' is 64 bits" >&5 if test "$cross_compiling" = yes; then echo "$ac_t""assuming not on target machine" 1>&6 else cat > conftest.$ac_ext < typedef long int int64; -#define INT64_FORMAT "%ld" +/* These are globals to discourage the compiler from folding all the + * arithmetic tests down to compile-time constants. + */ int64 a = 20000001; int64 b = 40000005; int does_int64_work() { int64 c,d; - char buf[100]; if (sizeof(int64) != 8) return 0; /* doesn't look like the right size */ - /* we do perfunctory checks on multiply and divide, - * and also test snprintf if the platform provides snprintf. - */ + /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ c = a * b; -#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) - snprintf(buf, 100, INT64_FORMAT, c); - if (strcmp(buf, "800000140000005") != 0) - return 0; /* either multiply or snprintf is busted */ -#endif d = (c + b) / b; if (d != a+1) return 0; @@ -5280,12 +5275,14 @@ main() { exit(! does_int64_work()); } EOF -if { (eval echo configure:5284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then - cat >> confdefs.h <<\EOF + HAVE_LONG_INT_64=1 + cat >> confdefs.h <<\EOF #define HAVE_LONG_INT_64 1 EOF - echo "$ac_t""yes" 1>&6 + + echo "$ac_t""yes" 1>&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5296,38 +5293,33 @@ rm -fr conftest* fi +HAVE_LONG_LONG_INT_64=0 +if [ $HAVE_LONG_INT_64 -eq 0 ] ; then echo $ac_n "checking whether 'long long int' is 64 bits""... $ac_c" 1>&6 -echo "configure:5301: checking whether 'long long int' is 64 bits" >&5 +echo "configure:5300: checking whether 'long long int' is 64 bits" >&5 if test "$cross_compiling" = yes; then echo "$ac_t""assuming not on target machine" 1>&6 else cat > conftest.$ac_ext < typedef long long int int64; -#define INT64_FORMAT "%lld" +/* These are globals to discourage the compiler from folding all the + * arithmetic tests down to compile-time constants. + */ int64 a = 20000001; int64 b = 40000005; int does_int64_work() { int64 c,d; - char buf[100]; if (sizeof(int64) != 8) return 0; /* doesn't look like the right size */ - /* we do perfunctory checks on multiply and divide, - * and also test snprintf if the platform provides snprintf. - */ + /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ c = a * b; -#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) - snprintf(buf, 100, INT64_FORMAT, c); - if (strcmp(buf, "800000140000005") != 0) - return 0; /* either multiply or snprintf is busted */ -#endif d = (c + b) / b; if (d != a+1) return 0; @@ -5337,12 +5329,14 @@ main() { exit(! does_int64_work()); } EOF -if { (eval echo configure:5341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then - cat >> confdefs.h <<\EOF + HAVE_LONG_LONG_INT_64=1 + cat >> confdefs.h <<\EOF #define HAVE_LONG_LONG_INT_64 1 EOF - echo "$ac_t""yes" 1>&6 + + echo "$ac_t""yes" 1>&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5352,12 +5346,65 @@ fi rm -fr conftest* fi +fi + + +if [ x$SNPRINTF = x -a $HAVE_LONG_LONG_INT_64 -eq 1 ] ; then + echo $ac_n "checking whether snprintf handles 'long long int'""... $ac_c" 1>&6 +echo "configure:5355: checking whether snprintf handles 'long long int'" >&5 + if test "$cross_compiling" = yes; then + SNPRINTF='snprintf.o' + echo "$ac_t""assuming not on target machine" 1>&6 +else + cat > conftest.$ac_ext < +typedef long long int int64; +#define INT64_FORMAT "%lld" + +int64 a = 20000001; +int64 b = 40000005; + +int does_int64_snprintf_work() +{ + int64 c; + char buf[100]; + + if (sizeof(int64) != 8) + return 0; /* doesn't look like the right size */ + + c = a * b; + snprintf(buf, 100, INT64_FORMAT, c); + if (strcmp(buf, "800000140000005") != 0) + return 0; /* either multiply or snprintf is busted */ + return 1; +} +main() { + exit(! does_int64_snprintf_work()); +} +EOF +if { (eval echo configure:5388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + SNPRINTF='snprintf.o' + echo "$ac_t""no" 1>&6 +fi +rm -fr conftest* +fi + +fi + echo $ac_n "checking for POSIX signal interface""... $ac_c" 1>&6 -echo "configure:5359: checking for POSIX signal interface" >&5 +echo "configure:5406: checking for POSIX signal interface" >&5 cat > conftest.$ac_ext < int main() { @@ -5367,7 +5414,7 @@ act.sa_flags = SA_RESTART; sigaction(0, &act, &oact); ; return 0; } EOF -if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5418: \"$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 @@ -5391,7 +5438,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:5395: checking for $ac_word" >&5 +echo "configure:5442: 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 @@ -5424,7 +5471,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:5428: checking for $ac_word" >&5 +echo "configure:5475: 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 @@ -5463,7 +5510,7 @@ fi if test "$USE_TCL" = true then echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6 -echo "configure:5467: checking for tclConfig.sh" >&5 +echo "configure:5514: checking for tclConfig.sh" >&5 TCL_CONFIG_SH= library_dirs= if test -z "$TCL_DIRS" @@ -5492,7 +5539,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:5496: checking for tkConfig.sh" >&5 +echo "configure:5543: checking for tkConfig.sh" >&5 TK_CONFIG_SH= # library_dirs are set in the check for TCL for dir in $library_dirs @@ -5529,7 +5576,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:5533: checking for X" >&5 +echo "configure:5580: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5591,12 +5638,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:5600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5647: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -5665,14 +5712,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:5723: \"$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. @@ -5778,17 +5825,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:5782: checking whether -R must be followed by a space" >&5 +echo "configure:5829: 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:5839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -5804,14 +5851,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:5862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -5843,7 +5890,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:5847: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:5894: 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 @@ -5851,7 +5898,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:5913: \"$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 @@ -5884,7 +5931,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:5888: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:5935: 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 @@ -5892,7 +5939,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:5954: \"$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 @@ -5932,12 +5979,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:5936: checking for gethostbyname" >&5 +echo "configure:5983: 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:6011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5981,7 +6028,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:5985: checking for gethostbyname in -lnsl" >&5 +echo "configure:6032: 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 @@ -5989,7 +6036,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:6051: \"$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 @@ -6030,12 +6077,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:6034: checking for connect" >&5 +echo "configure:6081: 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:6109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -6079,7 +6126,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:6083: checking for connect in -lsocket" >&5 +echo "configure:6130: 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 @@ -6087,7 +6134,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:6149: \"$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 @@ -6122,12 +6169,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:6126: checking for remove" >&5 +echo "configure:6173: 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:6201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -6171,7 +6218,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:6175: checking for remove in -lposix" >&5 +echo "configure:6222: 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 @@ -6179,7 +6226,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:6241: \"$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 @@ -6214,12 +6261,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:6218: checking for shmat" >&5 +echo "configure:6265: 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:6293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -6263,7 +6310,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:6267: checking for shmat in -lipc" >&5 +echo "configure:6314: 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 @@ -6271,7 +6318,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:6333: \"$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 @@ -6315,7 +6362,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:6319: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:6366: 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 @@ -6323,7 +6370,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:6385: \"$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 @@ -6367,7 +6414,7 @@ fi X11_LIBS="" echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:6371: checking for XOpenDisplay in -lX11" >&5 +echo "configure:6418: 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 @@ -6375,7 +6422,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:6437: \"$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 @@ -6433,17 +6480,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:6437: checking for pwd.h" >&5 +echo "configure:6484: 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:6447: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6494: \"$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 dfafbd44d6..4bb74ca845 100644 --- a/src/configure.in +++ b/src/configure.in @@ -631,6 +631,9 @@ 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. +dnl We may also decide to use snprintf.c if snprintf() is present but does +dnl not have working "long long int" support -- see below. +SNPRINTF='' AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF), SNPRINTF='snprintf.o') @@ -701,38 +704,37 @@ fi AC_SUBST(HPUXMATHLIB) dnl Check to see if we have a working 64-bit integer type. -dnl This has to be done after checking for snprintf, because -dnl if the platform has snprintf then we need to know if snprintf -dnl works with 64-bit ints. However, if we are supplying our own -dnl snprintf then we expect that it will work as long as the basic -dnl 64-bit math operations work. NOTE that we will supply our own -dnl snprintf if either snprintf or vsnprintf is missing. - +dnl This breaks down into two steps: +dnl (1) figure out if the compiler has a 64-bit int type with working +dnl arithmetic, and if so +dnl (2) see whether snprintf() can format the type correctly. (Currently, +dnl snprintf is the only library routine we really need for int8 support.) +dnl It's entirely possible to have a compiler that handles a 64-bit type +dnl when the C library doesn't; this is fairly likely when using gcc on +dnl an older platform, for example. +dnl If there is no native snprintf() or it does not handle the 64-bit type, +dnl we force our own version of snprintf() to be used instead. +dnl Note this test must be run after our initial check for snprintf/vsnprintf. + +HAVE_LONG_INT_64=0 AC_MSG_CHECKING(whether 'long int' is 64 bits) -AC_TRY_RUN([#include -typedef long int int64; -#define INT64_FORMAT "%ld" +AC_TRY_RUN([typedef long int int64; +/* These are globals to discourage the compiler from folding all the + * arithmetic tests down to compile-time constants. + */ int64 a = 20000001; int64 b = 40000005; int does_int64_work() { int64 c,d; - char buf[100]; if (sizeof(int64) != 8) return 0; /* doesn't look like the right size */ - /* we do perfunctory checks on multiply and divide, - * and also test snprintf if the platform provides snprintf. - */ + /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ c = a * b; -#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) - snprintf(buf, 100, INT64_FORMAT, c); - if (strcmp(buf, "800000140000005") != 0) - return 0; /* either multiply or snprintf is busted */ -#endif d = (c + b) / b; if (d != a+1) return 0; @@ -741,35 +743,32 @@ int does_int64_work() main() { exit(! does_int64_work()); }], - [AC_DEFINE(HAVE_LONG_INT_64) AC_MSG_RESULT(yes)], + [HAVE_LONG_INT_64=1 + AC_DEFINE(HAVE_LONG_INT_64) + AC_MSG_RESULT(yes)], AC_MSG_RESULT(no), AC_MSG_RESULT(assuming not on target machine)) +HAVE_LONG_LONG_INT_64=0 +if [[ $HAVE_LONG_INT_64 -eq 0 ]] ; then AC_MSG_CHECKING(whether 'long long int' is 64 bits) -AC_TRY_RUN([#include -typedef long long int int64; -#define INT64_FORMAT "%lld" +AC_TRY_RUN([typedef long long int int64; +/* These are globals to discourage the compiler from folding all the + * arithmetic tests down to compile-time constants. + */ int64 a = 20000001; int64 b = 40000005; int does_int64_work() { int64 c,d; - char buf[100]; if (sizeof(int64) != 8) return 0; /* doesn't look like the right size */ - /* we do perfunctory checks on multiply and divide, - * and also test snprintf if the platform provides snprintf. - */ + /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ c = a * b; -#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) - snprintf(buf, 100, INT64_FORMAT, c); - if (strcmp(buf, "800000140000005") != 0) - return 0; /* either multiply or snprintf is busted */ -#endif d = (c + b) / b; if (d != a+1) return 0; @@ -778,9 +777,49 @@ int does_int64_work() main() { exit(! does_int64_work()); }], - [AC_DEFINE(HAVE_LONG_LONG_INT_64) AC_MSG_RESULT(yes)], + [HAVE_LONG_LONG_INT_64=1 + AC_DEFINE(HAVE_LONG_LONG_INT_64) + AC_MSG_RESULT(yes)], AC_MSG_RESULT(no), AC_MSG_RESULT(assuming not on target machine)) +fi + +dnl If we found "long int" is 64 bits, assume snprintf handles it. +dnl If we found we need to use "long long int", better check. + +if [[ x$SNPRINTF = x -a $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then + AC_MSG_CHECKING(whether snprintf handles 'long long int') + AC_TRY_RUN([#include +typedef long long int int64; +#define INT64_FORMAT "%lld" + +int64 a = 20000001; +int64 b = 40000005; + +int does_int64_snprintf_work() +{ + int64 c; + char buf[100]; + + if (sizeof(int64) != 8) + return 0; /* doesn't look like the right size */ + + c = a * b; + snprintf(buf, 100, INT64_FORMAT, c); + if (strcmp(buf, "800000140000005") != 0) + return 0; /* either multiply or snprintf is busted */ + return 1; +} +main() { + exit(! does_int64_snprintf_work()); +}], + AC_MSG_RESULT(yes), + [SNPRINTF='snprintf.o' + AC_MSG_RESULT(no)], + [SNPRINTF='snprintf.o' + AC_MSG_RESULT(assuming not on target machine)]) +fi + dnl Check to see if platform has POSIX signal interface. dnl NOTE: if this test fails then POSIX signals definitely don't work.