
$FreeBSD: ports/devel/ORBit/files/patch-configure.in,v 1.3 2001/10/29 17:05:04 sobomax Exp $

--- configure.in	2001/10/27 12:08:05	1.1
+++ configure.in	2001/10/27 12:33:26
@@ -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 <fcntl.h>
+#include <sys/types.h>
 #include <sys/uio.h>
-#define NIOVECS 50
-int main(int argc, char *argv[])
+#include <fcntl.h>
+#include <stdio.h>
+int main()
 {
-	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 #
