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