Annotation of OpenXM_contrib/gnuplot/m4/select.m4, Revision 1.1.1.1
1.1 maekawa 1: dnl testing new version of FUNC_SELECT
2:
3: AC_DEFUN(AC_FUNC_SELECT,
4: [AC_CHECK_FUNCS(select)
5: if test "$ac_cv_func_select" = yes; then
6: AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h)
7: AC_MSG_CHECKING([argument types of select()])
8: AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl
9: [AC_CACHE_VAL(ac_cv_type_fd_set,dnl
10: [for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do
11: for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do
12: for ac_type_timeval in 'struct timeval' 'const struct timeval'; do
13: AC_TRY_COMPILE(dnl
14: [#ifdef HAVE_SYS_TIME_H
15: #include <sys/time.h>
16: #endif
17: #ifdef HAVE_SYS_TYPES_H
18: #include <sys/types.h>
19: #endif
20: #ifdef HAVE_UNISTD_H
21: #include <unistd.h>
22: #endif
23: #ifdef HAVE_SYS_SELECT_H
24: #include <sys/select.h>
25: #endif
26: #ifdef HAVE_SYS_SOCKET_H
27: #include <sys/socket.h>
28: #endif],
29: [#ifdef __STDC__
30: extern int select ($ac_cv_type_fd_set_size_t,
31: $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *,
32: $ac_type_timeval *);
33: #else
34: extern int select ();
35: $ac_cv_type_fd_set_size_t s;
36: $ac_cv_type_fd_set *p;
37: $ac_type_timeval *t;
38: #endif],
39: [ac_found=yes ; break 3],ac_found=no)
40: done
41: done
42: done
43: ])dnl AC_CACHE_VAL
44: ])dnl AC_CACHE_VAL
45: if test "$ac_found" = no; then
46: AC_MSG_ERROR([can't determine argument types])
47: fi
48:
49: AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)])
50: AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t,
51: [ First arg for select(). ])
52: ac_cast=
53: if test "$ac_cv_type_fd_set" != fd_set; then
54: # Arguments 2-4 are not fd_set. Some weirdo systems use fd_set type for
55: # FD_SET macros, but insist that you cast the argument to select. I don't
56: # understand why that might be, but it means we cannot define fd_set.
57: AC_EGREP_CPP(dnl
58: changequote(<<,>>)dnl
59: <<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl
60: changequote([,]),dnl
61: [#ifdef HAVE_SYS_TIME_H
62: #include <sys/time.h>
63: #endif
64: #ifdef HAVE_SYS_TYPES_H
65: #include <sys/types.h>
66: #endif
67: #ifdef HAVE_UNISTD_H
68: #include <unistd.h>
69: #endif
70: #ifdef HAVE_SYS_SELECT_H
71: #include <sys/select.h>
72: #endif
73: #ifdef HAVE_SYS_SOCKET_H
74: #include <sys/socket.h>
75: #endif],dnl
76: # We found fd_set type in a header, need special cast
77: ac_cast="($ac_cv_type_fd_set *)",dnl
78: # No fd_set type; it is safe to define it
79: AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set,
80: [ Define if the type in arguments 2-4 to select() is fd_set. ]))
81: fi
82: AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast,
83: [ Define if the type in arguments 2-4 to select() is fd_set. ])
84: fi
85: ])
86:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>