version 1.1, 2000/01/22 14:16:18 |
version 1.1.1.2, 2003/09/15 07:09:33 |
Line 5 AC_DEFUN(AC_FUNC_SELECT, |
|
Line 5 AC_DEFUN(AC_FUNC_SELECT, |
|
if test "$ac_cv_func_select" = yes; then |
if test "$ac_cv_func_select" = yes; then |
AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h) |
AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h) |
AC_MSG_CHECKING([argument types of select()]) |
AC_MSG_CHECKING([argument types of select()]) |
AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl |
AC_CACHE_VAL(ac_cv_type_fd_set_size_t, |
[AC_CACHE_VAL(ac_cv_type_fd_set,dnl |
[AC_CACHE_VAL(ac_cv_type_fd_set, |
[for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do |
[for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do |
for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do |
for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do |
for ac_type_timeval in 'struct timeval' 'const struct timeval'; do |
for ac_type_timeval in 'struct timeval' 'const struct timeval'; do |
AC_TRY_COMPILE(dnl |
AC_TRY_COMPILE( |
[#ifdef HAVE_SYS_TIME_H |
[#ifdef HAVE_SYS_TIME_H |
#include <sys/time.h> |
# include <sys/time.h> |
#endif |
#endif |
#ifdef HAVE_SYS_TYPES_H |
#ifdef HAVE_SYS_TYPES_H |
#include <sys/types.h> |
# include <sys/types.h> |
#endif |
#endif |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
#include <unistd.h> |
# include <unistd.h> |
#endif |
#endif |
#ifdef HAVE_SYS_SELECT_H |
#ifdef HAVE_SYS_SELECT_H |
#include <sys/select.h> |
# include <sys/select.h> |
#endif |
#endif |
#ifdef HAVE_SYS_SOCKET_H |
#ifdef HAVE_SYS_SOCKET_H |
#include <sys/socket.h> |
# include <sys/socket.h> |
#endif], |
#endif |
|
], |
[#ifdef __STDC__ |
[#ifdef __STDC__ |
extern int select ($ac_cv_type_fd_set_size_t, |
extern int select ($ac_cv_type_fd_set_size_t, |
$ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, |
$ac_cv_type_fd_set *, $ac_cv_type_fd_set *, $ac_cv_type_fd_set *, |
Line 35 extern int select (); |
|
Line 36 extern int select (); |
|
$ac_cv_type_fd_set_size_t s; |
$ac_cv_type_fd_set_size_t s; |
$ac_cv_type_fd_set *p; |
$ac_cv_type_fd_set *p; |
$ac_type_timeval *t; |
$ac_type_timeval *t; |
#endif], |
#endif |
|
], |
[ac_found=yes ; break 3],ac_found=no) |
[ac_found=yes ; break 3],ac_found=no) |
done |
done |
done |
done |
Line 48 extern int select (); |
|
Line 50 extern int select (); |
|
|
|
AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)]) |
AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)]) |
AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t, |
AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t, |
[ First arg for select(). ]) |
[ First arg for select. ]) |
ac_cast= |
ac_cast= |
if test "$ac_cv_type_fd_set" != fd_set; then |
if test "$ac_cv_type_fd_set" != fd_set; then |
# Arguments 2-4 are not fd_set. Some weirdo systems use fd_set type for |
# Arguments 2-4 are not fd_set. Some weirdo systems use fd_set type for |
# FD_SET macros, but insist that you cast the argument to select. I don't |
# FD_SET macros, but insist that you cast the argument to select. I don't |
# understand why that might be, but it means we cannot define fd_set. |
# understand why that might be, but it means we cannot define fd_set. |
AC_EGREP_CPP(dnl |
AC_EGREP_CPP( |
changequote(<<,>>)dnl |
changequote(<<,>>)dnl |
<<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl |
<<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl |
changequote([,]),dnl |
changequote([,]),dnl |
[#ifdef HAVE_SYS_TIME_H |
[#ifdef HAVE_SYS_TIME_H |
#include <sys/time.h> |
# include <sys/time.h> |
#endif |
#endif |
#ifdef HAVE_SYS_TYPES_H |
#ifdef HAVE_SYS_TYPES_H |
#include <sys/types.h> |
# include <sys/types.h> |
#endif |
#endif |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
#include <unistd.h> |
# include <unistd.h> |
#endif |
#endif |
#ifdef HAVE_SYS_SELECT_H |
#ifdef HAVE_SYS_SELECT_H |
#include <sys/select.h> |
# include <sys/select.h> |
#endif |
#endif |
#ifdef HAVE_SYS_SOCKET_H |
#ifdef HAVE_SYS_SOCKET_H |
#include <sys/socket.h> |
# include <sys/socket.h> |
#endif],dnl |
#endif |
|
], |
# We found fd_set type in a header, need special cast |
# We found fd_set type in a header, need special cast |
ac_cast="($ac_cv_type_fd_set *)",dnl |
ac_cast="($ac_cv_type_fd_set *)",dnl |
# No fd_set type; it is safe to define it |
# No fd_set type; it is safe to define it |
AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set, |
AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set, |
[ Define if the type in arguments 2-4 to select() is fd_set. ])) |
[ Define if the type in arguments 2-4 to select is fd_set. ])) |
fi |
fi |
AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast, |
AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast, |
[ Define if the type in arguments 2-4 to select() is fd_set. ]) |
[ Define if the type in arguments 2-4 to select is fd_set. ]) |
fi |
fi |
]) |
]) |
|
|