$FreeBSD$ --- configure.in 2002/03/12 14:47:33 1.1 +++ configure.in 2002/03/12 14:47:53 @@ -241,33 +241,29 @@ dnl This generates warnings from autoconf... AC_C_BIGENDIAN +AC_MSG_CHECKING(how many vectors writev is capable to handle) AC_TRY_RUN([ -#include +#include #include -#define NIOVECS 50 +#include +#include int main(int argc, char *argv[]) { - char dumbuf[20] = "\n"; - struct iovec iovecs[NIOVECS]; - int i,fd; - - for(i = 0; i < NIOVECS; i++) { - iovecs[i].iov_base = dumbuf; - iovecs[i].iov_len = 1; - } - - fd=open("/dev/null", O_WRONLY); - if(fd==-1) - return(1); - - if(writev(fd, iovecs, NIOVECS) < 0) - return 1; - + FILE *f; + int fd, i; + static struct iovec iovecs[4097]; + if ((f = fopen("conftestval", "w")) == NULL || \ + (fd = open("/dev/null", O_WRONLY)) < 0) + exit(1); + for (i = 1; i < 4098 && writev(fd, iovecs, i) >= 0; i++); + fprintf(f, "%d\n", i - 1); + fclose(f); close(fd); - return 0; + exit(0); } -], , AC_DEFINE(HAVE_LIMITED_WRITEV), AC_DEFINE(HAVE_LIMITED_WRITEV)) -AC_SUBST(HAVE_LIMITED_WRITEV) +], MAXIOV=`cat conftestval`, MAXIOV=16, MAXIOV=16)dnl +AC_MSG_RESULT($MAXIOV) +AC_SUBST(MAXIOV) ####################### # type alignment test #