24451
GNULIB_NANOSLEEP=0;
24455
HAVE_DECL_LOCALTIME_R=1;
24459
REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;
24460
REPLACE_MKTIME=GNULIB_PORTCHECK;
24461
REPLACE_NANOSLEEP=GNULIB_PORTCHECK;
24462
REPLACE_TIMEGM=GNULIB_PORTCHECK;
24464
: ${GNULIB_GETTIMEOFDAY=0};
24466
REPLACE_LOCALTIME=0;
24483
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
24484
$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
24485
if ${gl_cv_header_sys_select_h_selfcontained+:} false; then :
24486
$as_echo_n "(cached) " >&6
24489
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24490
/* end confdefs.h. */
24491
#include <sys/select.h>
24500
if ac_fn_c_try_compile "$LINENO"; then :
24501
gl_cv_header_sys_select_h_selfcontained=yes
24503
gl_cv_header_sys_select_h_selfcontained=no
24505
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24506
if test $gl_cv_header_sys_select_h_selfcontained = yes; then
24507
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24508
/* end confdefs.h. */
24509
#include <sys/select.h>
24513
int memset; int bzero;
24519
if ac_fn_c_try_compile "$LINENO"; then :
24520
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24521
/* end confdefs.h. */
24522
#include <sys/select.h>
24528
#define memset nonexistent_memset
24533
void *memset (void *, int, unsigned long);
24535
#define bzero nonexistent_bzero
24540
void bzero (void *, unsigned long);
24549
if ac_fn_c_try_link "$LINENO"; then :
24552
gl_cv_header_sys_select_h_selfcontained=no
24554
rm -f core conftest.err conftest.$ac_objext \
24555
conftest$ac_exeext conftest.$ac_ext
24558
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24562
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
24563
$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
24579
if test $gl_cv_have_include_next = yes; then
24580
gl_cv_next_sys_select_h='<'sys/select.h'>'
24582
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
24583
$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
24584
if ${gl_cv_next_sys_select_h+:} false; then :
24585
$as_echo_n "(cached) " >&6
24588
if test $ac_cv_header_sys_select_h = yes; then
24593
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24594
/* end confdefs.h. */
24595
#include <sys/select.h>
24598
aix*) gl_absname_cpp="$ac_cpp -C" ;;
24599
*) gl_absname_cpp="$ac_cpp" ;;
24604
gl_dirsep_regex='[/\\]'
24607
gl_dirsep_regex='\/'
24610
gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
24611
gl_header_literal_regex=`echo 'sys/select.h' \
24612
| sed -e "$gl_make_literal_regex_sed"`
24613
gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
24614
s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
24620
gl_cv_absolute_sys_select_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
24621
sed -n "$gl_absolute_header_sed"`
24623
gl_header=$gl_cv_absolute_sys_select_h
24624
gl_cv_next_sys_select_h='"'$gl_header'"'
24626
gl_cv_next_sys_select_h='<'sys/select.h'>'
24631
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
24632
$as_echo "$gl_cv_next_sys_select_h" >&6; }
24634
NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
24636
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
24637
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
24638
gl_next_as_first_directive='<'sys/select.h'>'
24640
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
24641
gl_next_as_first_directive=$gl_cv_next_sys_select_h
24643
NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
24648
if test $ac_cv_header_sys_select_h = yes; then
24649
HAVE_SYS_SELECT_H=1
24651
HAVE_SYS_SELECT_H=0
24664
if test $ac_cv_header_sys_socket_h != yes; then
24665
for ac_header in winsock2.h
24667
ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
24668
if test "x$ac_cv_header_winsock2_h" = xyes; then :
24669
cat >>confdefs.h <<_ACEOF
24670
#define HAVE_WINSOCK2_H 1
24678
if test "$ac_cv_header_winsock2_h" = yes; then
24680
UNISTD_H_HAVE_WINSOCK2_H=1
24681
SYS_IOCTL_H_HAVE_WINSOCK2_H=1
24689
for gl_func in pselect select; do
24690
as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh`
24691
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5
24692
$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; }
24693
if eval \${$as_gl_Symbol+:} false; then :
24694
$as_echo_n "(cached) " >&6
24696
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24697
/* end confdefs.h. */
24699
/* Some systems require prerequisite headers. */
24700
#include <sys/types.h>
24701
#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
24702
# include <sys/time.h>
24704
#include <sys/select.h>
24715
if ac_fn_c_try_compile "$LINENO"; then :
24716
eval "$as_gl_Symbol=yes"
24718
eval "$as_gl_Symbol=no"
24720
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
24722
eval ac_res=\$$as_gl_Symbol
24723
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
24724
$as_echo "$ac_res" >&6; }
24725
if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then :
24726
cat >>confdefs.h <<_ACEOF
24727
#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1
24730
eval ac_cv_have_decl_$gl_func=yes
24746
if test $ac_cv_header_sys_socket_h != yes; then
24747
for ac_header in winsock2.h
24749
ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
24750
if test "x$ac_cv_header_winsock2_h" = xyes; then :
24751
cat >>confdefs.h <<_ACEOF
24752
#define HAVE_WINSOCK2_H 1
24760
if test "$ac_cv_header_winsock2_h" = yes; then
24762
UNISTD_H_HAVE_WINSOCK2_H=1
24763
SYS_IOCTL_H_HAVE_WINSOCK2_H=1
24769
if test $HAVE_WINSOCK2_H = 1; then
24770
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to call WSAStartup in winsock2.h and -lws2_32" >&5
24771
$as_echo_n "checking if we need to call WSAStartup in winsock2.h and -lws2_32... " >&6; }
24772
if ${gl_cv_func_wsastartup+:} false; then :
24773
$as_echo_n "(cached) " >&6
24776
gl_save_LIBS="$LIBS"
24777
LIBS="$LIBS -lws2_32"
24778
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24779
/* end confdefs.h. */
24781
#ifdef HAVE_WINSOCK2_H
24782
# include <winsock2.h>
24788
WORD wVersionRequested = MAKEWORD(1, 1);
24790
int err = WSAStartup(wVersionRequested, &wsaData);
24796
if ac_fn_c_try_link "$LINENO"; then :
24797
gl_cv_func_wsastartup=yes
24799
gl_cv_func_wsastartup=no
24801
rm -f core conftest.err conftest.$ac_objext \
24802
conftest$ac_exeext conftest.$ac_ext
24803
LIBS="$gl_save_LIBS"
24806
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wsastartup" >&5
24807
$as_echo "$gl_cv_func_wsastartup" >&6; }
24808
if test "$gl_cv_func_wsastartup" = "yes"; then
24810
$as_echo "#define WINDOWS_SOCKETS 1" >>confdefs.h
24812
LIBSOCKET='-lws2_32'
24815
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5
24816
$as_echo_n "checking for library containing setsockopt... " >&6; }
24817
if ${gl_cv_lib_socket+:} false; then :
24818
$as_echo_n "(cached) " >&6
24822
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24823
/* end confdefs.h. */
24837
if ac_fn_c_try_link "$LINENO"; then :
24840
gl_save_LIBS="$LIBS"
24841
LIBS="$gl_save_LIBS -lsocket"
24842
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24843
/* end confdefs.h. */
24857
if ac_fn_c_try_link "$LINENO"; then :
24858
gl_cv_lib_socket="-lsocket"
24860
rm -f core conftest.err conftest.$ac_objext \
24861
conftest$ac_exeext conftest.$ac_ext
24862
if test -z "$gl_cv_lib_socket"; then
24863
LIBS="$gl_save_LIBS -lnetwork"
24864
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24865
/* end confdefs.h. */
24879
if ac_fn_c_try_link "$LINENO"; then :
24880
gl_cv_lib_socket="-lnetwork"
24882
rm -f core conftest.err conftest.$ac_objext \
24883
conftest$ac_exeext conftest.$ac_ext
24884
if test -z "$gl_cv_lib_socket"; then
24885
LIBS="$gl_save_LIBS -lnet"
24886
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24887
/* end confdefs.h. */
24901
if ac_fn_c_try_link "$LINENO"; then :
24902
gl_cv_lib_socket="-lnet"
24904
rm -f core conftest.err conftest.$ac_objext \
24905
conftest$ac_exeext conftest.$ac_ext
24908
LIBS="$gl_save_LIBS"
24911
rm -f core conftest.err conftest.$ac_objext \
24912
conftest$ac_exeext conftest.$ac_ext
24913
if test -z "$gl_cv_lib_socket"; then
24914
gl_cv_lib_socket="none needed"
24918
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_lib_socket" >&5
24919
$as_echo "$gl_cv_lib_socket" >&6; }
24920
if test "$gl_cv_lib_socket" != "none needed"; then
24921
LIBSOCKET="$gl_cv_lib_socket"
24936
if test "$ac_cv_header_winsock2_h" = yes; then
24946
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether select supports a 0 argument" >&5
24947
$as_echo_n "checking whether select supports a 0 argument... " >&6; }
24948
if ${gl_cv_func_select_supports0+:} false; then :
24949
$as_echo_n "(cached) " >&6
24952
if test "$cross_compiling" = yes; then :
24955
# Guess no on Interix.
24956
interix*) gl_cv_func_select_supports0="guessing no";;
24957
# Guess yes otherwise.
24958
*) gl_cv_func_select_supports0="guessing yes";;
24962
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
24963
/* end confdefs.h. */
24965
#include <sys/types.h>
24966
#include <sys/time.h>
24967
#if HAVE_SYS_SELECT_H
24968
#include <sys/select.h>
24972
struct timeval timeout;
24973
timeout.tv_sec = 0;
24974
timeout.tv_usec = 5;
24975
return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
24978
if ac_fn_c_try_run "$LINENO"; then :
24979
gl_cv_func_select_supports0=yes
24981
gl_cv_func_select_supports0=no
24983
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
24984
conftest.$ac_objext conftest.beam conftest.$ac_ext
24989
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_supports0" >&5
24990
$as_echo "$gl_cv_func_select_supports0" >&6; }
24991
case "$gl_cv_func_select_supports0" in
24993
*) REPLACE_SELECT=1 ;;
24996
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether select detects invalid fds" >&5
24997
$as_echo_n "checking whether select detects invalid fds... " >&6; }
24998
if ${gl_cv_func_select_detects_ebadf+:} false; then :
24999
$as_echo_n "(cached) " >&6
25002
if test "$cross_compiling" = yes; then :
25005
# Guess yes on glibc systems.
25006
*-gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;;
25007
# If we don't know, assume the worst.
25008
*) gl_cv_func_select_detects_ebadf="guessing no" ;;
25012
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
25013
/* end confdefs.h. */
25015
#include <sys/types.h>
25016
#include <sys/time.h>
25017
#if HAVE_SYS_SELECT_H
25018
# include <sys/select.h>
25020
#include <unistd.h>
25032
struct timeval timeout;
25033
timeout.tv_sec = 0;
25034
timeout.tv_usec = 5;
25035
return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF;
25041
if ac_fn_c_try_run "$LINENO"; then :
25042
gl_cv_func_select_detects_ebadf=yes
25044
gl_cv_func_select_detects_ebadf=no
25046
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
25047
conftest.$ac_objext conftest.beam conftest.$ac_ext
25052
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_detects_ebadf" >&5
25053
$as_echo "$gl_cv_func_select_detects_ebadf" >&6; }
25054
case $gl_cv_func_select_detects_ebadf in
25056
*) REPLACE_SELECT=1 ;;
25060
LIB_SELECT="$LIBSOCKET"
25061
if test $REPLACE_SELECT = 1; then
25064
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
25065
/* end confdefs.h. */
25067
#define WIN32_LEAN_AND_MEAN
25068
#include <windows.h>
25072
MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
25076
if ac_fn_c_try_link "$LINENO"; then :
25079
LIB_SELECT="$LIB_SELECT -luser32"
25081
rm -f core conftest.err conftest.$ac_objext \
25082
conftest$ac_exeext conftest.$ac_ext
35138
nanosleep_save_libs=$LIBS
35140
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
35141
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
35144
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5
35145
$as_echo_n "checking for library containing nanosleep... " >&6; }
35146
if ${ac_cv_search_nanosleep+:} false; then :
35147
$as_echo_n "(cached) " >&6
35149
ac_func_search_save_LIBS=$LIBS
35150
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
35151
/* end confdefs.h. */
35153
/* Override any GCC internal prototype to avoid an error.
35154
Use char because int might match the return type of a GCC
35155
builtin and then its argument prototype would still apply. */
35163
return nanosleep ();
35168
for ac_lib in '' rt posix4; do
35169
if test -z "$ac_lib"; then
35170
ac_res="none required"
35173
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
35175
if ac_fn_c_try_link "$LINENO"; then :
35176
ac_cv_search_nanosleep=$ac_res
35178
rm -f core conftest.err conftest.$ac_objext \
35180
if ${ac_cv_search_nanosleep+:} false; then :
35184
if ${ac_cv_search_nanosleep+:} false; then :
35187
ac_cv_search_nanosleep=no
35189
rm conftest.$ac_ext
35190
LIBS=$ac_func_search_save_LIBS
35192
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5
35193
$as_echo "$ac_cv_search_nanosleep" >&6; }
35194
ac_res=$ac_cv_search_nanosleep
35195
if test "$ac_res" != no; then :
35196
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
35197
test "$ac_cv_search_nanosleep" = "none required" ||
35198
LIB_NANOSLEEP=$ac_cv_search_nanosleep
35201
if test "x$ac_cv_search_nanosleep" != xno; then
35204
if test $APPLE_UNIVERSAL_BUILD = 1; then
35205
# A universal build on Apple Mac OS X platforms.
35206
# The test result would be 'no (mishandles large arguments)' in 64-bit
35207
# mode but 'yes' in 32-bit mode. But we need a configuration result that
35208
# is valid in both modes.
35209
gl_cv_func_nanosleep='no (mishandles large arguments)'
35212
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working nanosleep" >&5
35213
$as_echo_n "checking for working nanosleep... " >&6; }
35214
if ${gl_cv_func_nanosleep+:} false; then :
35215
$as_echo_n "(cached) " >&6
35218
if test "$cross_compiling" = yes; then :
35219
case "$host_os" in linux*) # Guess it halfway works when the kernel is Linux.
35220
gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;;
35221
*) # If we don't know, assume the worst.
35222
gl_cv_func_nanosleep='guessing no' ;;
35226
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
35227
/* end confdefs.h. */
35230
#include <limits.h>
35231
#include <signal.h>
35232
#if HAVE_SYS_TIME_H
35233
#include <sys/time.h>
35236
#include <unistd.h>
35237
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
35238
#define TYPE_MAXIMUM(t) \
35239
((t) (! TYPE_SIGNED (t) \
35241
: ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
35244
check_for_SIGALRM (int sig)
35246
if (sig != SIGALRM)
35253
static struct timespec ts_sleep;
35254
static struct timespec ts_remaining;
35255
static struct sigaction act;
35256
/* Test for major problems first. */
35259
act.sa_handler = check_for_SIGALRM;
35260
sigemptyset (&act.sa_mask);
35261
sigaction (SIGALRM, &act, NULL);
35262
ts_sleep.tv_sec = 0;
35263
ts_sleep.tv_nsec = 1;
35265
if (nanosleep (&ts_sleep, NULL) != 0)
35267
/* Test for a minor problem: the handling of large arguments. */
35268
ts_sleep.tv_sec = TYPE_MAXIMUM (time_t);
35269
ts_sleep.tv_nsec = 999999999;
35271
if (nanosleep (&ts_sleep, &ts_remaining) != -1)
35273
if (errno != EINTR)
35275
if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10)
35280
if ac_fn_c_try_run "$LINENO"; then :
35281
gl_cv_func_nanosleep=yes
35283
case $? in 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; *) gl_cv_func_nanosleep=no;;
35286
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
35287
conftest.$ac_objext conftest.beam conftest.$ac_ext
35292
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_nanosleep" >&5
35293
$as_echo "$gl_cv_func_nanosleep" >&6; }
35294
case "$gl_cv_func_nanosleep" in
35296
REPLACE_NANOSLEEP=0
35299
REPLACE_NANOSLEEP=1
35300
case "$gl_cv_func_nanosleep" in
35301
*"mishandles large arguments"*)
35303
$as_echo "#define HAVE_BUG_BIG_NANOSLEEP 1" >>confdefs.h
35307
# The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP.
35308
for ac_lib in $LIBSOCKET; do
35309
case " $LIB_NANOSLEEP " in
35311
*) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";;
35321
LIBS=$nanosleep_save_libs
35323
if test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1; then
35332
gl_LIBOBJS="$gl_LIBOBJS nanosleep.$ac_objext"
35356
$as_echo "#define GNULIB_TEST_NANOSLEEP 1" >>confdefs.h
37010
if test "$ac_cv_header_winsock2_h" = yes; then
37020
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether select supports a 0 argument" >&5
37021
$as_echo_n "checking whether select supports a 0 argument... " >&6; }
37022
if ${gl_cv_func_select_supports0+:} false; then :
37023
$as_echo_n "(cached) " >&6
37026
if test "$cross_compiling" = yes; then :
37029
# Guess no on Interix.
37030
interix*) gl_cv_func_select_supports0="guessing no";;
37031
# Guess yes otherwise.
37032
*) gl_cv_func_select_supports0="guessing yes";;
37036
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37037
/* end confdefs.h. */
37039
#include <sys/types.h>
37040
#include <sys/time.h>
37041
#if HAVE_SYS_SELECT_H
37042
#include <sys/select.h>
37046
struct timeval timeout;
37047
timeout.tv_sec = 0;
37048
timeout.tv_usec = 5;
37049
return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0;
37052
if ac_fn_c_try_run "$LINENO"; then :
37053
gl_cv_func_select_supports0=yes
37055
gl_cv_func_select_supports0=no
37057
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
37058
conftest.$ac_objext conftest.beam conftest.$ac_ext
37063
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_supports0" >&5
37064
$as_echo "$gl_cv_func_select_supports0" >&6; }
37065
case "$gl_cv_func_select_supports0" in
37067
*) REPLACE_SELECT=1 ;;
37070
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether select detects invalid fds" >&5
37071
$as_echo_n "checking whether select detects invalid fds... " >&6; }
37072
if ${gl_cv_func_select_detects_ebadf+:} false; then :
37073
$as_echo_n "(cached) " >&6
37076
if test "$cross_compiling" = yes; then :
37079
# Guess yes on glibc systems.
37080
*-gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;;
37081
# If we don't know, assume the worst.
37082
*) gl_cv_func_select_detects_ebadf="guessing no" ;;
37086
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37087
/* end confdefs.h. */
37089
#include <sys/types.h>
37090
#include <sys/time.h>
37091
#if HAVE_SYS_SELECT_H
37092
# include <sys/select.h>
37094
#include <unistd.h>
37106
struct timeval timeout;
37107
timeout.tv_sec = 0;
37108
timeout.tv_usec = 5;
37109
return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF;
37115
if ac_fn_c_try_run "$LINENO"; then :
37116
gl_cv_func_select_detects_ebadf=yes
37118
gl_cv_func_select_detects_ebadf=no
37120
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
37121
conftest.$ac_objext conftest.beam conftest.$ac_ext
37126
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_select_detects_ebadf" >&5
37127
$as_echo "$gl_cv_func_select_detects_ebadf" >&6; }
37128
case $gl_cv_func_select_detects_ebadf in
37130
*) REPLACE_SELECT=1 ;;
37134
LIB_SELECT="$LIBSOCKET"
37135
if test $REPLACE_SELECT = 1; then
37138
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37139
/* end confdefs.h. */
37141
#define WIN32_LEAN_AND_MEAN
37142
#include <windows.h>
37146
MsgWaitForMultipleObjects (0, NULL, 0, 0, 0);
37150
if ac_fn_c_try_link "$LINENO"; then :
37153
LIB_SELECT="$LIB_SELECT -luser32"
37155
rm -f core conftest.err conftest.$ac_objext \
37156
conftest$ac_exeext conftest.$ac_ext
37162
if test $REPLACE_SELECT = 1; then
37171
gl_LIBOBJS="$gl_LIBOBJS select.$ac_objext"
37185
$as_echo "#define GNULIB_TEST_SELECT 1" >>confdefs.h
36138
37191
if test $ac_cv_func_setenv = no; then
36139
37192
HAVE_SETENV=0
37784
if test $ac_cv_header_sys_socket_h != yes; then
37785
for ac_header in winsock2.h
37787
ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
37788
if test "x$ac_cv_header_winsock2_h" = xyes; then :
37789
cat >>confdefs.h <<_ACEOF
37790
#define HAVE_WINSOCK2_H 1
37798
if test "$ac_cv_header_winsock2_h" = yes; then
37800
UNISTD_H_HAVE_WINSOCK2_H=1
37801
SYS_IOCTL_H_HAVE_WINSOCK2_H=1
37807
if test $HAVE_WINSOCK2_H = 1; then
37808
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to call WSAStartup in winsock2.h and -lws2_32" >&5
37809
$as_echo_n "checking if we need to call WSAStartup in winsock2.h and -lws2_32... " >&6; }
37810
if ${gl_cv_func_wsastartup+:} false; then :
37811
$as_echo_n "(cached) " >&6
37814
gl_save_LIBS="$LIBS"
37815
LIBS="$LIBS -lws2_32"
37816
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37817
/* end confdefs.h. */
37819
#ifdef HAVE_WINSOCK2_H
37820
# include <winsock2.h>
37826
WORD wVersionRequested = MAKEWORD(1, 1);
37828
int err = WSAStartup(wVersionRequested, &wsaData);
37834
if ac_fn_c_try_link "$LINENO"; then :
37835
gl_cv_func_wsastartup=yes
37837
gl_cv_func_wsastartup=no
37839
rm -f core conftest.err conftest.$ac_objext \
37840
conftest$ac_exeext conftest.$ac_ext
37841
LIBS="$gl_save_LIBS"
37844
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_wsastartup" >&5
37845
$as_echo "$gl_cv_func_wsastartup" >&6; }
37846
if test "$gl_cv_func_wsastartup" = "yes"; then
37848
$as_echo "#define WINDOWS_SOCKETS 1" >>confdefs.h
37850
LIBSOCKET='-lws2_32'
37853
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5
37854
$as_echo_n "checking for library containing setsockopt... " >&6; }
37855
if ${gl_cv_lib_socket+:} false; then :
37856
$as_echo_n "(cached) " >&6
37860
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37861
/* end confdefs.h. */
37875
if ac_fn_c_try_link "$LINENO"; then :
37878
gl_save_LIBS="$LIBS"
37879
LIBS="$gl_save_LIBS -lsocket"
37880
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37881
/* end confdefs.h. */
37895
if ac_fn_c_try_link "$LINENO"; then :
37896
gl_cv_lib_socket="-lsocket"
37898
rm -f core conftest.err conftest.$ac_objext \
37899
conftest$ac_exeext conftest.$ac_ext
37900
if test -z "$gl_cv_lib_socket"; then
37901
LIBS="$gl_save_LIBS -lnetwork"
37902
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37903
/* end confdefs.h. */
37917
if ac_fn_c_try_link "$LINENO"; then :
37918
gl_cv_lib_socket="-lnetwork"
37920
rm -f core conftest.err conftest.$ac_objext \
37921
conftest$ac_exeext conftest.$ac_ext
37922
if test -z "$gl_cv_lib_socket"; then
37923
LIBS="$gl_save_LIBS -lnet"
37924
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
37925
/* end confdefs.h. */
37939
if ac_fn_c_try_link "$LINENO"; then :
37940
gl_cv_lib_socket="-lnet"
37942
rm -f core conftest.err conftest.$ac_objext \
37943
conftest$ac_exeext conftest.$ac_ext
37946
LIBS="$gl_save_LIBS"
37949
rm -f core conftest.err conftest.$ac_objext \
37950
conftest$ac_exeext conftest.$ac_ext
37951
if test -z "$gl_cv_lib_socket"; then
37952
gl_cv_lib_socket="none needed"
37956
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_lib_socket" >&5
37957
$as_echo "$gl_cv_lib_socket" >&6; }
37958
if test "$gl_cv_lib_socket" != "none needed"; then
37959
LIBSOCKET="$gl_cv_lib_socket"
36720
37971
ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "
36721
37972
/* <sys/types.h> is not needed according to POSIX, but the
36722
37973
<sys/socket.h> in i386-unknown-freebsd4.10 and
40024
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
40025
$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
40026
if ${gl_cv_header_sys_select_h_selfcontained+:} false; then :
40027
$as_echo_n "(cached) " >&6
40030
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40031
/* end confdefs.h. */
40032
#include <sys/select.h>
40041
if ac_fn_c_try_compile "$LINENO"; then :
40042
gl_cv_header_sys_select_h_selfcontained=yes
40044
gl_cv_header_sys_select_h_selfcontained=no
40046
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
40047
if test $gl_cv_header_sys_select_h_selfcontained = yes; then
40048
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40049
/* end confdefs.h. */
40050
#include <sys/select.h>
40054
int memset; int bzero;
40060
if ac_fn_c_try_compile "$LINENO"; then :
40061
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40062
/* end confdefs.h. */
40063
#include <sys/select.h>
40069
#define memset nonexistent_memset
40074
void *memset (void *, int, unsigned long);
40076
#define bzero nonexistent_bzero
40081
void bzero (void *, unsigned long);
40090
if ac_fn_c_try_link "$LINENO"; then :
40093
gl_cv_header_sys_select_h_selfcontained=no
40095
rm -f core conftest.err conftest.$ac_objext \
40096
conftest$ac_exeext conftest.$ac_ext
40099
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
40103
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
40104
$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
40120
if test $gl_cv_have_include_next = yes; then
40121
gl_cv_next_sys_select_h='<'sys/select.h'>'
40123
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
40124
$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
40125
if ${gl_cv_next_sys_select_h+:} false; then :
40126
$as_echo_n "(cached) " >&6
40129
if test $ac_cv_header_sys_select_h = yes; then
40134
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40135
/* end confdefs.h. */
40136
#include <sys/select.h>
40139
aix*) gl_absname_cpp="$ac_cpp -C" ;;
40140
*) gl_absname_cpp="$ac_cpp" ;;
40145
gl_dirsep_regex='[/\\]'
40148
gl_dirsep_regex='\/'
40151
gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
40152
gl_header_literal_regex=`echo 'sys/select.h' \
40153
| sed -e "$gl_make_literal_regex_sed"`
40154
gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
40155
s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
40161
gl_cv_absolute_sys_select_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
40162
sed -n "$gl_absolute_header_sed"`
40164
gl_header=$gl_cv_absolute_sys_select_h
40165
gl_cv_next_sys_select_h='"'$gl_header'"'
40167
gl_cv_next_sys_select_h='<'sys/select.h'>'
40172
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
40173
$as_echo "$gl_cv_next_sys_select_h" >&6; }
40175
NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
40177
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
40178
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
40179
gl_next_as_first_directive='<'sys/select.h'>'
40181
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
40182
gl_next_as_first_directive=$gl_cv_next_sys_select_h
40184
NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
40189
if test $ac_cv_header_sys_select_h = yes; then
40190
HAVE_SYS_SELECT_H=1
40192
HAVE_SYS_SELECT_H=0
40205
if test $ac_cv_header_sys_socket_h != yes; then
40206
for ac_header in winsock2.h
40208
ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
40209
if test "x$ac_cv_header_winsock2_h" = xyes; then :
40210
cat >>confdefs.h <<_ACEOF
40211
#define HAVE_WINSOCK2_H 1
40219
if test "$ac_cv_header_winsock2_h" = yes; then
40221
UNISTD_H_HAVE_WINSOCK2_H=1
40222
SYS_IOCTL_H_HAVE_WINSOCK2_H=1
40230
for gl_func in pselect select; do
40231
as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh`
40232
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5
40233
$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; }
40234
if eval \${$as_gl_Symbol+:} false; then :
40235
$as_echo_n "(cached) " >&6
40237
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40238
/* end confdefs.h. */
40240
/* Some systems require prerequisite headers. */
40241
#include <sys/types.h>
40242
#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
40243
# include <sys/time.h>
40245
#include <sys/select.h>
40256
if ac_fn_c_try_compile "$LINENO"; then :
40257
eval "$as_gl_Symbol=yes"
40259
eval "$as_gl_Symbol=no"
40261
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
40263
eval ac_res=\$$as_gl_Symbol
40264
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
40265
$as_echo "$ac_res" >&6; }
40266
if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then :
40267
cat >>confdefs.h <<_ACEOF
40268
#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1
40271
eval ac_cv_have_decl_$gl_func=yes
38774
40281
case "$host_os" in