Now use autoconf to find if we have sigaction() (POSIX signal handler)

or not.
buffered-read-3-0-BETA
Stephane Bortzmeyer 24 years ago
parent 9f8d324d34
commit c05d2143f5

@ -16,12 +16,6 @@ TTCP
T/TCP support if your system supports it (FreeBSD does). See
<http://www.noao.edu/~rstevens/ttcp.html>
USE_SIGACTION
Use sigaction instead of signal. On purely BSD systems, such as SunOS or
FreeBSD, this is necessary because we need to change the semantics of
signals. On some systems (Irix, Solaris), do not use this option, because
it will prevent echoping to compile (this is a bug).
If 'echoping -h' fails with "tcp_open: unknown service: http/tcp", add
"http" to the services database (typically /etc/services or a NIS map).

@ -6,4 +6,3 @@ echoping_LDADD =

@ -1,4 +1,8 @@
@BOTTOM@
/* Do we have POSIX signals? */
#undef HAVE_SIGACTION
/* Is sys_errlist declared? */
#undef DECL_SYS_ERRLIST

@ -1,3 +1,6 @@
dnl Macros beginning with CF_ stolen from Lynx
dnl Thanks to "T.E.Dickey" <dickey@clark.net>
dnl ---------------------------------------------------------------------------
dnl Make an uppercase version of a variable
dnl $1=uppercase($2)

@ -21,6 +21,9 @@
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the socket function. */
#undef HAVE_SOCKET
@ -36,6 +39,10 @@
/* Version number of package */
#undef VERSION
/* Do we have POSIX signals? */
#undef HAVE_SIGACTION
/* Is sys_errlist declared? */
#undef DECL_SYS_ERRLIST

89
SRC/configure vendored

@ -1031,6 +1031,9 @@ else
fi
fi
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall"
fi
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@ -1043,7 +1046,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1047: checking for a BSD compatible install" >&5
echo "configure:1050: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1098,7 +1101,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1102: checking how to run the C preprocessor" >&5
echo "configure:1105: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1113,13 +1116,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1117 "configure"
#line 1120 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1130,13 +1133,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1134 "configure"
#line 1137 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1147,13 +1150,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1151 "configure"
#line 1154 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1178,12 +1181,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1182: checking for ANSI C header files" >&5
echo "configure:1185: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1187 "configure"
#line 1190 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1191,7 +1194,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1208,7 +1211,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1212 "configure"
#line 1215 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1226,7 +1229,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1230 "configure"
#line 1233 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1247,7 +1250,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1251 "configure"
#line 1254 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1258,7 +1261,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1285,17 +1288,17 @@ for ac_hdr in sys/time.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1289: checking for $ac_hdr" >&5
echo "configure:1292: checking for $ac_hdr" >&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
#line 1294 "configure"
#line 1297 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1326,13 +1329,13 @@ for cf_name in sys_nerr sys_errlist
do
echo $ac_n "checking if external $cf_name is declared""... $ac_c" 1>&6
echo "configure:1330: checking if external $cf_name is declared" >&5
echo "configure:1333: checking if external $cf_name is declared" >&5
if eval "test \"`echo '$''{'cf_cv_dcl_$cf_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1336 "configure"
#line 1339 "configure"
#include "confdefs.h"
#ifdef HAVE_STDLIB_H
@ -1345,7 +1348,7 @@ int main() {
long x = (long) $cf_name
; return 0; }
EOF
if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval 'cf_cv_dcl_'$cf_name'=yes'
else
@ -1375,13 +1378,13 @@ fi
# It's possible (for near-UNIX clones) that the data doesn't exist
echo $ac_n "checking if external $cf_name exists""... $ac_c" 1>&6
echo "configure:1379: checking if external $cf_name exists" >&5
echo "configure:1382: checking if external $cf_name exists" >&5
if eval "test \"`echo '$''{'cf_cv_have_$cf_name'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1385 "configure"
#line 1388 "configure"
#include "confdefs.h"
#undef $cf_name
@ -1391,7 +1394,7 @@ int main() {
$cf_name = 2
; return 0; }
EOF
if { (eval echo configure:1395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval 'cf_cv_have_'$cf_name'=yes'
else
@ -1424,12 +1427,12 @@ done
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1428: checking for working const" >&5
echo "configure:1431: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1433 "configure"
#line 1436 "configure"
#include "confdefs.h"
int main() {
@ -1478,7 +1481,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -1499,12 +1502,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
echo "configure:1503: checking whether time.h and sys/time.h may both be included" >&5
echo "configure:1506: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1508 "configure"
#line 1511 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@ -1513,7 +1516,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
if { (eval echo configure:1517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@ -1535,12 +1538,12 @@ fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:1539: checking return type of signal handlers" >&5
echo "configure:1542: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1544 "configure"
#line 1547 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -1557,7 +1560,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:1561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -1576,12 +1579,12 @@ EOF
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:1580: checking for vprintf" >&5
echo "configure:1583: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1585 "configure"
#line 1588 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
@ -1604,7 +1607,7 @@ vprintf();
; return 0; }
EOF
if { (eval echo configure:1608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
@ -1628,12 +1631,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:1632: checking for _doprnt" >&5
echo "configure:1635: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1637 "configure"
#line 1640 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
@ -1656,7 +1659,7 @@ _doprnt();
; return 0; }
EOF
if { (eval echo configure:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
@ -1680,15 +1683,15 @@ fi
fi
for ac_func in gettimeofday socket
for ac_func in gettimeofday socket sigaction
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1687: checking for $ac_func" >&5
echo "configure:1690: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1692 "configure"
#line 1695 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1711,7 +1714,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else

@ -21,6 +21,9 @@ AC_ARG_ENABLE(icp,
dnl Checks for programs.
AC_PROG_CC
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall"
fi
AC_PROG_INSTALL
dnl Checks for libraries.
@ -37,6 +40,6 @@ AC_HEADER_TIME
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday socket)
AC_CHECK_FUNCS(gettimeofday socket sigaction)
AC_OUTPUT(Makefile)

@ -1,6 +1,14 @@
/*
* Definitions for TCP and UDP client/server programs.
*/
/* Settings you can change */
#define DEFLINE 256
#define MAXLINE 65535
#define UDPMAX 65535
#ifdef HTTP
#define MAXTOREAD 150000
#endif
#define MAXNUMBER 20
/* Settings you should not change */
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -48,6 +56,11 @@ extern char *sys_errlist[];
extern int sys_nerr;
#endif
/* If we have it, use it */
#ifdef HAVE_SIGACTION
#define USE_SIGACTION 1
#endif
struct timeval null_timeval;
struct timeval max_timeval;
@ -105,14 +118,6 @@ int read_from_server ();
#endif
#define DEFLINE 256
#define MAXLINE 65535
#define UDPMAX 65535
#ifdef HTTP
#define MAXTOREAD 150000
#endif
#define MAXNUMBER 20
extern char *progname;
extern unsigned short timeout_flag;

Loading…
Cancel
Save