~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to m4/reorganization/code_checks/select.m4

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Check if <sys/select.h> needs to be included for fd_set
 
2
AC_MSG_CHECKING([for fd_set])
 
3
AC_HEADER_EGREP([fd_mask], [sys/select.h], [have_fd_set=yes])
 
4
if test "$have_fd_set" = yes; then
 
5
        AC_DEFINE([HAVE_SYS_SELECT_H], 1, "have <sys/select.h>")
 
6
        AC_MSG_RESULT([yes, found in sys/select.h])
 
7
else
 
8
        AC_TRY_COMPILE([#include <sys/time.h>
 
9
                        #include <sys/types.h>
 
10
                        #ifdef HAVE_UNISTD_H
 
11
                        #include <unistd.h>
 
12
                        #endif],
 
13
                [fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
 
14
        if test "$have_fd_set" = yes; then
 
15
                AC_MSG_RESULT([yes, found in sys/types.h])
 
16
        else
 
17
                AC_DEFINE([NO_FD_SET], 1, "no fd_set")
 
18
                AC_MSG_RESULT(no)
 
19
        fi
 
20
fi
 
21
 
 
22
AC_MSG_CHECKING([default FD_SETSIZE value])
 
23
AC_TRY_RUN([
 
24
#include <stdio.h>
 
25
#include <unistd.h>
 
26
#include <sys/time.h>
 
27
#ifdef HAVE_SYS_SELECT_H
 
28
#include <sys/select.h>
 
29
#endif
 
30
#ifdef HAVE_SYS_TYPES_H
 
31
#include <sys/types.h>
 
32
#endif
 
33
#include <errno.h>
 
34
int main(void) {
 
35
        FILE *fp = fopen("conftestval", "w");
 
36
        if(fp) {
 
37
                if(fprintf (fp, "%d\n", FD_SETSIZE) < 1)  {
 
38
                        perror("fprintf failed");
 
39
                        return errno;
 
40
                }
 
41
        } else {
 
42
                perror("fopen failed");
 
43
                return errno;
 
44
        }
 
45
        return 0;
 
46
}
 
47
],
 
48
DEFAULT_FD_SETSIZE=`cat conftestval`,
 
49
DEFAULT_FD_SETSIZE=256,
 
50
DEFAULT_FD_SETSIZE=256)
 
51
AC_MSG_RESULT([$DEFAULT_FD_SETSIZE])
 
52
AC_DEFINE_UNQUOTED([DEFAULT_FD_SETSIZE], $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")