From c54d02bce6437ae8f0d21f86cbf62392362d35d8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 29 May 2021 15:57:48 -0400 Subject: gnulib: import various network functions Some sim ports use these to provide networking functionality via the dv-sockser module or via direct emulation for a few ports. Gdb seems to build just fine still too. --- gnulib/config.in | 18 + gnulib/configure | 3297 ++++++++++++++++++++------------------ gnulib/import/Makefile.am | 60 + gnulib/import/Makefile.in | 86 +- gnulib/import/accept.c | 52 + gnulib/import/bind.c | 49 + gnulib/import/connect.c | 56 + gnulib/import/listen.c | 49 + gnulib/import/m4/gnulib-cache.m4 | 12 + gnulib/import/m4/gnulib-comp.m4 | 51 + gnulib/import/setsockopt.c | 65 + gnulib/import/socket.c | 53 + gnulib/update-gnulib.sh | 6 + 13 files changed, 2261 insertions(+), 1593 deletions(-) create mode 100644 gnulib/import/accept.c create mode 100644 gnulib/import/bind.c create mode 100644 gnulib/import/connect.c create mode 100644 gnulib/import/listen.c create mode 100644 gnulib/import/setsockopt.c create mode 100644 gnulib/import/socket.c diff --git a/gnulib/config.in b/gnulib/config.in index db04597..dd960bf 100644 --- a/gnulib/config.in +++ b/gnulib/config.in @@ -143,6 +143,12 @@ whether the gnulib module tempname shall be considered present. */ #undef GNULIB_TEMPNAME +/* Define to 1 when the gnulib module accept should be tested. */ +#undef GNULIB_TEST_ACCEPT + +/* Define to 1 when the gnulib module bind should be tested. */ +#undef GNULIB_TEST_BIND + /* Define to 1 when the gnulib module btowc should be tested. */ #undef GNULIB_TEST_BTOWC @@ -165,6 +171,9 @@ /* Define to 1 when the gnulib module closedir should be tested. */ #undef GNULIB_TEST_CLOSEDIR +/* Define to 1 when the gnulib module connect should be tested. */ +#undef GNULIB_TEST_CONNECT + /* Define to 1 when the gnulib module dirfd should be tested. */ #undef GNULIB_TEST_DIRFD @@ -228,6 +237,9 @@ /* Define to 1 when the gnulib module glob should be tested. */ #undef GNULIB_TEST_GLOB +/* Define to 1 when the gnulib module listen should be tested. */ +#undef GNULIB_TEST_LISTEN + /* Define to 1 when the gnulib module lstat should be tested. */ #undef GNULIB_TEST_LSTAT @@ -312,6 +324,12 @@ /* Define to 1 when the gnulib module setlocale_null should be tested. */ #undef GNULIB_TEST_SETLOCALE_NULL +/* Define to 1 when the gnulib module setsockopt should be tested. */ +#undef GNULIB_TEST_SETSOCKOPT + +/* Define to 1 when the gnulib module socket should be tested. */ +#undef GNULIB_TEST_SOCKET + /* Define to 1 when the gnulib module stat should be tested. */ #undef GNULIB_TEST_STAT diff --git a/gnulib/configure b/gnulib/configure index c212281..39555af 100644 --- a/gnulib/configure +++ b/gnulib/configure @@ -979,28 +979,6 @@ GL_GENERATE_LIMITS_H_TRUE LIMITS_H NEXT_AS_FIRST_DIRECTIVE_LIMITS_H NEXT_LIMITS_H -HAVE_SYS_SOCKET_H -NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H -NEXT_SYS_SOCKET_H -HAVE_ACCEPT4 -HAVE_SA_FAMILY_T -HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY -HAVE_STRUCT_SOCKADDR_STORAGE -GNULIB_ACCEPT4 -GNULIB_SHUTDOWN -GNULIB_SETSOCKOPT -GNULIB_SENDTO -GNULIB_RECVFROM -GNULIB_SEND -GNULIB_RECV -GNULIB_LISTEN -GNULIB_GETSOCKOPT -GNULIB_GETSOCKNAME -GNULIB_GETPEERNAME -GNULIB_BIND -GNULIB_ACCEPT -GNULIB_CONNECT -GNULIB_SOCKET INET_NTOP_LIB LIB_HARD_LOCALE LIB_SETLOCALE_NULL @@ -1540,184 +1518,8 @@ GNULIB_CLOSEDIR GNULIB_REWINDDIR GNULIB_READDIR GNULIB_OPENDIR -HAVE_WINSOCK2_H HAVE_MSVC_INVALID_PARAMETER_HANDLER LIB_CLOCK_GETTIME -UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS -UNISTD_H_HAVE_WINSOCK2_H -UNISTD_H_HAVE_SYS_RANDOM_H -REPLACE_WRITE -REPLACE_USLEEP -REPLACE_UNLINKAT -REPLACE_UNLINK -REPLACE_TTYNAME_R -REPLACE_TRUNCATE -REPLACE_SYMLINKAT -REPLACE_SYMLINK -REPLACE_SLEEP -REPLACE_RMDIR -REPLACE_READLINKAT -REPLACE_READLINK -REPLACE_READ -REPLACE_PWRITE -REPLACE_PREAD -REPLACE_LSEEK -REPLACE_LINKAT -REPLACE_LINK -REPLACE_LCHOWN -REPLACE_ISATTY -REPLACE_GETPASS -REPLACE_GETPAGESIZE -REPLACE_GETGROUPS -REPLACE_GETLOGIN_R -REPLACE_GETDTABLESIZE -REPLACE_GETDOMAINNAME -REPLACE_GETCWD -REPLACE_FTRUNCATE -REPLACE_FCHOWNAT -REPLACE_FACCESSAT -REPLACE_EXECVPE -REPLACE_EXECVP -REPLACE_EXECVE -REPLACE_EXECV -REPLACE_EXECLP -REPLACE_EXECLE -REPLACE_EXECL -REPLACE_DUP2 -REPLACE_DUP -REPLACE_CLOSE -REPLACE_CHOWN -REPLACE_ACCESS -HAVE_SYS_PARAM_H -HAVE_OS_H -HAVE_DECL_TTYNAME_R -HAVE_DECL_TRUNCATE -HAVE_DECL_SETHOSTNAME -HAVE_DECL_GETUSERSHELL -HAVE_DECL_GETPAGESIZE -HAVE_DECL_GETLOGIN_R -HAVE_DECL_GETLOGIN -HAVE_DECL_GETDOMAINNAME -HAVE_DECL_FDATASYNC -HAVE_DECL_FCHDIR -HAVE_DECL_EXECVPE -HAVE_DECL_ENVIRON -HAVE_USLEEP -HAVE_UNLINKAT -HAVE_SYMLINKAT -HAVE_SYMLINK -HAVE_SLEEP -HAVE_SETHOSTNAME -HAVE_READLINKAT -HAVE_READLINK -HAVE_PWRITE -HAVE_PREAD -HAVE_PIPE2 -HAVE_PIPE -HAVE_LINKAT -HAVE_LINK -HAVE_LCHOWN -HAVE_GROUP_MEMBER -HAVE_GETPASS -HAVE_GETPAGESIZE -HAVE_GETLOGIN -HAVE_GETHOSTNAME -HAVE_GETGROUPS -HAVE_GETENTROPY -HAVE_GETDTABLESIZE -HAVE_FTRUNCATE -HAVE_FSYNC -HAVE_FDATASYNC -HAVE_FCHOWNAT -HAVE_FCHDIR -HAVE_FACCESSAT -HAVE_EXECVPE -HAVE_EUIDACCESS -HAVE_DUP3 -HAVE_COPY_FILE_RANGE -HAVE_CHOWN -GNULIB_MDA_WRITE -GNULIB_MDA_UNLINK -GNULIB_MDA_SWAB -GNULIB_MDA_RMDIR -GNULIB_MDA_READ -GNULIB_MDA_LSEEK -GNULIB_MDA_ISATTY -GNULIB_MDA_GETPID -GNULIB_MDA_GETCWD -GNULIB_MDA_EXECVPE -GNULIB_MDA_EXECVP -GNULIB_MDA_EXECVE -GNULIB_MDA_EXECV -GNULIB_MDA_EXECLP -GNULIB_MDA_EXECLE -GNULIB_MDA_EXECL -GNULIB_MDA_DUP2 -GNULIB_MDA_DUP -GNULIB_MDA_CLOSE -GNULIB_MDA_CHDIR -GNULIB_MDA_ACCESS -GNULIB_WRITE -GNULIB_USLEEP -GNULIB_UNLINKAT -GNULIB_UNLINK -GNULIB_UNISTD_H_SIGPIPE -GNULIB_UNISTD_H_NONBLOCKING -GNULIB_TTYNAME_R -GNULIB_TRUNCATE -GNULIB_SYMLINKAT -GNULIB_SYMLINK -GNULIB_SLEEP -GNULIB_SETHOSTNAME -GNULIB_RMDIR -GNULIB_READLINKAT -GNULIB_READLINK -GNULIB_READ -GNULIB_PWRITE -GNULIB_PREAD -GNULIB_PIPE2 -GNULIB_PIPE -GNULIB_LSEEK -GNULIB_LINKAT -GNULIB_LINK -GNULIB_LCHOWN -GNULIB_ISATTY -GNULIB_GROUP_MEMBER -GNULIB_GETUSERSHELL -GNULIB_GETPASS -GNULIB_GETPAGESIZE -GNULIB_GETOPT_POSIX -GNULIB_GETLOGIN_R -GNULIB_GETLOGIN -GNULIB_GETHOSTNAME -GNULIB_GETGROUPS -GNULIB_GETENTROPY -GNULIB_GETDTABLESIZE -GNULIB_GETDOMAINNAME -GNULIB_GETCWD -GNULIB_FTRUNCATE -GNULIB_FSYNC -GNULIB_FDATASYNC -GNULIB_FCHOWNAT -GNULIB_FCHDIR -GNULIB_FACCESSAT -GNULIB_EXECVPE -GNULIB_EXECVP -GNULIB_EXECVE -GNULIB_EXECV -GNULIB_EXECLP -GNULIB_EXECLE -GNULIB_EXECL -GNULIB_EUIDACCESS -GNULIB_ENVIRON -GNULIB_DUP3 -GNULIB_DUP2 -GNULIB_DUP -GNULIB_COPY_FILE_RANGE -GNULIB_CLOSE -GNULIB_CHOWN -GNULIB_CHDIR -GNULIB_ACCESS REPLACE_WCTOMB REPLACE_UNSETENV REPLACE_STRTOLD @@ -1927,14 +1729,9 @@ GNULIB_MBSINIT GNULIB_WCTOB GNULIB_BTOWC MKDIR_P -HAVE_WS2TCPIP_H HAVE_FEATURES_H NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H NEXT_ARPA_INET_H -PRAGMA_COLUMNS -PRAGMA_SYSTEM_HEADER -INCLUDE_NEXT_AS_FIRST_DIRECTIVE -INCLUDE_NEXT HAVE_ARPA_INET_H REPLACE_INET_PTON REPLACE_INET_NTOP @@ -1947,59 +1744,262 @@ GL_GENERATE_ALLOCA_H_FALSE GL_GENERATE_ALLOCA_H_TRUE ALLOCA_H ALLOCA -GL_COND_LIBTOOL_FALSE -GL_COND_LIBTOOL_TRUE -RANLIB -ARFLAGS -AR -LARGEFILE_CPPFLAGS -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir +HAVE_WINSOCK2_H +UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS +UNISTD_H_HAVE_WINSOCK2_H +UNISTD_H_HAVE_SYS_RANDOM_H +REPLACE_WRITE +REPLACE_USLEEP +REPLACE_UNLINKAT +REPLACE_UNLINK +REPLACE_TTYNAME_R +REPLACE_TRUNCATE +REPLACE_SYMLINKAT +REPLACE_SYMLINK +REPLACE_SLEEP +REPLACE_RMDIR +REPLACE_READLINKAT +REPLACE_READLINK +REPLACE_READ +REPLACE_PWRITE +REPLACE_PREAD +REPLACE_LSEEK +REPLACE_LINKAT +REPLACE_LINK +REPLACE_LCHOWN +REPLACE_ISATTY +REPLACE_GETPASS +REPLACE_GETPAGESIZE +REPLACE_GETGROUPS +REPLACE_GETLOGIN_R +REPLACE_GETDTABLESIZE +REPLACE_GETDOMAINNAME +REPLACE_GETCWD +REPLACE_FTRUNCATE +REPLACE_FCHOWNAT +REPLACE_FACCESSAT +REPLACE_EXECVPE +REPLACE_EXECVP +REPLACE_EXECVE +REPLACE_EXECV +REPLACE_EXECLP +REPLACE_EXECLE +REPLACE_EXECL +REPLACE_DUP2 +REPLACE_DUP +REPLACE_CLOSE +REPLACE_CHOWN +REPLACE_ACCESS +HAVE_SYS_PARAM_H +HAVE_OS_H +HAVE_DECL_TTYNAME_R +HAVE_DECL_TRUNCATE +HAVE_DECL_SETHOSTNAME +HAVE_DECL_GETUSERSHELL +HAVE_DECL_GETPAGESIZE +HAVE_DECL_GETLOGIN_R +HAVE_DECL_GETLOGIN +HAVE_DECL_GETDOMAINNAME +HAVE_DECL_FDATASYNC +HAVE_DECL_FCHDIR +HAVE_DECL_EXECVPE +HAVE_DECL_ENVIRON +HAVE_USLEEP +HAVE_UNLINKAT +HAVE_SYMLINKAT +HAVE_SYMLINK +HAVE_SLEEP +HAVE_SETHOSTNAME +HAVE_READLINKAT +HAVE_READLINK +HAVE_PWRITE +HAVE_PREAD +HAVE_PIPE2 +HAVE_PIPE +HAVE_LINKAT +HAVE_LINK +HAVE_LCHOWN +HAVE_GROUP_MEMBER +HAVE_GETPASS +HAVE_GETPAGESIZE +HAVE_GETLOGIN +HAVE_GETHOSTNAME +HAVE_GETGROUPS +HAVE_GETENTROPY +HAVE_GETDTABLESIZE +HAVE_FTRUNCATE +HAVE_FSYNC +HAVE_FDATASYNC +HAVE_FCHOWNAT +HAVE_FCHDIR +HAVE_FACCESSAT +HAVE_EXECVPE +HAVE_EUIDACCESS +HAVE_DUP3 +HAVE_COPY_FILE_RANGE +HAVE_CHOWN +GNULIB_MDA_WRITE +GNULIB_MDA_UNLINK +GNULIB_MDA_SWAB +GNULIB_MDA_RMDIR +GNULIB_MDA_READ +GNULIB_MDA_LSEEK +GNULIB_MDA_ISATTY +GNULIB_MDA_GETPID +GNULIB_MDA_GETCWD +GNULIB_MDA_EXECVPE +GNULIB_MDA_EXECVP +GNULIB_MDA_EXECVE +GNULIB_MDA_EXECV +GNULIB_MDA_EXECLP +GNULIB_MDA_EXECLE +GNULIB_MDA_EXECL +GNULIB_MDA_DUP2 +GNULIB_MDA_DUP +GNULIB_MDA_CLOSE +GNULIB_MDA_CHDIR +GNULIB_MDA_ACCESS +GNULIB_WRITE +GNULIB_USLEEP +GNULIB_UNLINKAT +GNULIB_UNLINK +GNULIB_UNISTD_H_SIGPIPE +GNULIB_UNISTD_H_NONBLOCKING +GNULIB_TTYNAME_R +GNULIB_TRUNCATE +GNULIB_SYMLINKAT +GNULIB_SYMLINK +GNULIB_SLEEP +GNULIB_SETHOSTNAME +GNULIB_RMDIR +GNULIB_READLINKAT +GNULIB_READLINK +GNULIB_READ +GNULIB_PWRITE +GNULIB_PREAD +GNULIB_PIPE2 +GNULIB_PIPE +GNULIB_LSEEK +GNULIB_LINKAT +GNULIB_LINK +GNULIB_LCHOWN +GNULIB_ISATTY +GNULIB_GROUP_MEMBER +GNULIB_GETUSERSHELL +GNULIB_GETPASS +GNULIB_GETPAGESIZE +GNULIB_GETOPT_POSIX +GNULIB_GETLOGIN_R +GNULIB_GETLOGIN +GNULIB_GETHOSTNAME +GNULIB_GETGROUPS +GNULIB_GETENTROPY +GNULIB_GETDTABLESIZE +GNULIB_GETDOMAINNAME +GNULIB_GETCWD +GNULIB_FTRUNCATE +GNULIB_FSYNC +GNULIB_FDATASYNC +GNULIB_FCHOWNAT +GNULIB_FCHDIR +GNULIB_FACCESSAT +GNULIB_EXECVPE +GNULIB_EXECVP +GNULIB_EXECVE +GNULIB_EXECV +GNULIB_EXECLP +GNULIB_EXECLE +GNULIB_EXECL +GNULIB_EUIDACCESS +GNULIB_ENVIRON +GNULIB_DUP3 +GNULIB_DUP2 +GNULIB_DUP +GNULIB_COPY_FILE_RANGE +GNULIB_CLOSE +GNULIB_CHOWN +GNULIB_CHDIR +GNULIB_ACCESS +HAVE_WS2TCPIP_H +HAVE_SYS_SOCKET_H +NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H +NEXT_SYS_SOCKET_H +PRAGMA_COLUMNS +PRAGMA_SYSTEM_HEADER +INCLUDE_NEXT_AS_FIRST_DIRECTIVE +INCLUDE_NEXT +HAVE_ACCEPT4 +HAVE_SA_FAMILY_T +HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY +HAVE_STRUCT_SOCKADDR_STORAGE +GNULIB_ACCEPT4 +GNULIB_SHUTDOWN +GNULIB_SETSOCKOPT +GNULIB_SENDTO +GNULIB_RECVFROM +GNULIB_SEND +GNULIB_RECV +GNULIB_LISTEN +GNULIB_GETSOCKOPT +GNULIB_GETSOCKNAME +GNULIB_GETPEERNAME +GNULIB_BIND +GNULIB_ACCEPT +GNULIB_CONNECT +GNULIB_SOCKET +GL_COND_LIBTOOL_FALSE +GL_COND_LIBTOOL_TRUE +RANLIB +ARFLAGS +AR +LARGEFILE_CPPFLAGS +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir datadir datarootdir libexecdir @@ -2956,11 +2956,10 @@ fi } # ac_fn_c_try_link -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -2968,47 +2967,61 @@ $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + int main () { -if (sizeof (($2))) - return 0; +return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else +if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" +else + eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_type +} # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- @@ -3097,10 +3110,11 @@ fi } # ac_fn_c_check_header_mongrel -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -3108,61 +3122,104 @@ $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else + eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : -#undef $2 +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif +} # ac_fn_c_check_type +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 int main () { -return $2 (); +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" else - eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$3 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_func +} # ac_fn_c_check_member # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- @@ -3397,63 +3454,6 @@ rm -f conftest.val as_fn_set_status $ac_retval } # ac_fn_c_compute_int - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -3740,9 +3740,9 @@ fi as_fn_append ac_header_list " wchar.h" as_fn_append ac_header_list " minix/config.h" +as_fn_append ac_header_list " sys/socket.h" as_fn_append ac_header_list " arpa/inet.h" as_fn_append ac_header_list " features.h" -as_fn_append ac_header_list " sys/socket.h" as_fn_append ac_func_list " btowc" as_fn_append ac_func_list " canonicalize_file_name" as_fn_append ac_func_list " faccessat" @@ -6700,6 +6700,7 @@ fi # Code from module absolute-header: + # Code from module accept: # Code from module alloca: # Code from module alloca-opt: # Code from module arpa_inet: @@ -6707,6 +6708,7 @@ fi # Code from module at-internal: # Code from module attribute: # Code from module basename-lgpl: + # Code from module bind: # Code from module btowc: # Code from module builtin-expect: # Code from module c99: @@ -6718,6 +6720,7 @@ fi # Code from module cloexec: # Code from module close: # Code from module closedir: + # Code from module connect: # Code from module count-one-bits: # Code from module ctype: # Code from module d-ino: @@ -6785,6 +6788,7 @@ fi # Code from module libc-config: # Code from module limits-h: + # Code from module listen: # Code from module localcharset: # Code from module locale: # Code from module lock: @@ -6831,11 +6835,13 @@ fi # Code from module select: # Code from module setenv: # Code from module setlocale-null: + # Code from module setsockopt: # Code from module signal-h: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: + # Code from module socket: # Code from module socketlib: # Code from module sockets: # Code from module socklen: @@ -6958,175 +6964,45 @@ fi export LIBC_FATAL_STDERR_ -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -$as_echo_n "checking for working alloca.h... " >&6; } -if ${ac_cv_working_alloca_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -char *p = (char *) alloca (2 * sizeof (int)); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_working_alloca_h=yes -else - ac_cv_working_alloca_h=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -$as_echo "$ac_cv_working_alloca_h" >&6; } -if test $ac_cv_working_alloca_h = yes; then - -$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -$as_echo_n "checking for alloca... " >&6; } -if ${ac_cv_func_alloca_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include -# define alloca _alloca -# else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (size_t); -# endif -# endif -# endif -# endif -#endif - -int -main () -{ -char *p = (char *) alloca (1); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_alloca_works=yes -else - ac_cv_func_alloca_works=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -$as_echo "$ac_cv_func_alloca_works" >&6; } - -if test $ac_cv_func_alloca_works = yes; then - -$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h - -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. - - - - - -ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + GNULIB_SOCKET=0; + GNULIB_CONNECT=0; + GNULIB_ACCEPT=0; + GNULIB_BIND=0; + GNULIB_GETPEERNAME=0; + GNULIB_GETSOCKNAME=0; + GNULIB_GETSOCKOPT=0; + GNULIB_LISTEN=0; + GNULIB_RECV=0; + GNULIB_SEND=0; + GNULIB_RECVFROM=0; + GNULIB_SENDTO=0; + GNULIB_SETSOCKOPT=0; + GNULIB_SHUTDOWN=0; + GNULIB_ACCEPT4=0; + HAVE_STRUCT_SOCKADDR_STORAGE=1; + HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; -$as_echo "#define C_ALLOCA 1" >>confdefs.h + HAVE_SA_FAMILY_T=1; + HAVE_ACCEPT4=1; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -$as_echo_n "checking stack direction for C alloca... " >&6; } -if ${ac_cv_c_stack_direction+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_c_stack_direction=0 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -find_stack_direction (int *addr, int depth) -{ - int dir, dummy = 0; - if (! addr) - addr = &dummy; - *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; - return dir + dummy; -} -int -main (int argc, char **argv) -{ - return find_stack_direction (0, argc + !argv + 20) < 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_stack_direction=1 -else - ac_cv_c_stack_direction=-1 -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -$as_echo "$ac_cv_c_stack_direction" >&6; } -cat >>confdefs.h <<_ACEOF -#define STACK_DIRECTION $ac_cv_c_stack_direction + if test $ac_cv_header_sys_socket_h = no; then + for ac_header in ws2tcpip.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" +if test "x$ac_cv_header_ws2tcpip_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 _ACEOF - fi +done - GNULIB_INET_NTOP=0; - GNULIB_INET_PTON=0; - HAVE_DECL_INET_NTOP=1; - HAVE_DECL_INET_PTON=1; - REPLACE_INET_NTOP=0; - REPLACE_INET_PTON=0; - - + fi @@ -7244,78 +7120,752 @@ $as_echo "$gl_cv_source_line_length_unlimited" >&6; } - - - - if test $ac_cv_header_features_h = yes; then - HAVE_FEATURES_H=1 - else - HAVE_FEATURES_H=0 - fi - - - - - - if test $ac_cv_header_sys_socket_h = no; then - for ac_header in ws2tcpip.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ws2tcpip.h" "ac_cv_header_ws2tcpip_h" "$ac_includes_default" -if test "x$ac_cv_header_ws2tcpip_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WS2TCPIP_H 1 -_ACEOF - -fi - -done - - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - - - GNULIB_BTOWC=0; + GNULIB_ACCESS=0; + GNULIB_CHDIR=0; + GNULIB_CHOWN=0; + GNULIB_CLOSE=0; + GNULIB_COPY_FILE_RANGE=0; + GNULIB_DUP=0; + GNULIB_DUP2=0; + GNULIB_DUP3=0; + GNULIB_ENVIRON=0; + GNULIB_EUIDACCESS=0; + GNULIB_EXECL=0; + GNULIB_EXECLE=0; + GNULIB_EXECLP=0; + GNULIB_EXECV=0; + GNULIB_EXECVE=0; + GNULIB_EXECVP=0; + GNULIB_EXECVPE=0; + GNULIB_FACCESSAT=0; + GNULIB_FCHDIR=0; + GNULIB_FCHOWNAT=0; + GNULIB_FDATASYNC=0; + GNULIB_FSYNC=0; + GNULIB_FTRUNCATE=0; + GNULIB_GETCWD=0; + GNULIB_GETDOMAINNAME=0; + GNULIB_GETDTABLESIZE=0; + GNULIB_GETENTROPY=0; + GNULIB_GETGROUPS=0; + GNULIB_GETHOSTNAME=0; + GNULIB_GETLOGIN=0; + GNULIB_GETLOGIN_R=0; + GNULIB_GETOPT_POSIX=0; + GNULIB_GETPAGESIZE=0; + GNULIB_GETPASS=0; + GNULIB_GETUSERSHELL=0; + GNULIB_GROUP_MEMBER=0; + GNULIB_ISATTY=0; + GNULIB_LCHOWN=0; + GNULIB_LINK=0; + GNULIB_LINKAT=0; + GNULIB_LSEEK=0; + GNULIB_PIPE=0; + GNULIB_PIPE2=0; + GNULIB_PREAD=0; + GNULIB_PWRITE=0; + GNULIB_READ=0; + GNULIB_READLINK=0; + GNULIB_READLINKAT=0; + GNULIB_RMDIR=0; + GNULIB_SETHOSTNAME=0; + GNULIB_SLEEP=0; + GNULIB_SYMLINK=0; + GNULIB_SYMLINKAT=0; + GNULIB_TRUNCATE=0; + GNULIB_TTYNAME_R=0; + GNULIB_UNISTD_H_NONBLOCKING=0; + GNULIB_UNISTD_H_SIGPIPE=0; + GNULIB_UNLINK=0; + GNULIB_UNLINKAT=0; + GNULIB_USLEEP=0; + GNULIB_WRITE=0; + GNULIB_MDA_ACCESS=1; + GNULIB_MDA_CHDIR=1; + GNULIB_MDA_CLOSE=1; + GNULIB_MDA_DUP=1; + GNULIB_MDA_DUP2=1; + GNULIB_MDA_EXECL=1; + GNULIB_MDA_EXECLE=1; + GNULIB_MDA_EXECLP=1; + GNULIB_MDA_EXECV=1; + GNULIB_MDA_EXECVE=1; + GNULIB_MDA_EXECVP=1; + GNULIB_MDA_EXECVPE=1; + GNULIB_MDA_GETCWD=1; + GNULIB_MDA_GETPID=1; + GNULIB_MDA_ISATTY=1; + GNULIB_MDA_LSEEK=1; + GNULIB_MDA_READ=1; + GNULIB_MDA_RMDIR=1; + GNULIB_MDA_SWAB=1; + GNULIB_MDA_UNLINK=1; + GNULIB_MDA_WRITE=1; + HAVE_CHOWN=1; + HAVE_COPY_FILE_RANGE=1; + HAVE_DUP3=1; + HAVE_EUIDACCESS=1; + HAVE_EXECVPE=1; + HAVE_FACCESSAT=1; + HAVE_FCHDIR=1; + HAVE_FCHOWNAT=1; + HAVE_FDATASYNC=1; + HAVE_FSYNC=1; + HAVE_FTRUNCATE=1; + HAVE_GETDTABLESIZE=1; + HAVE_GETENTROPY=1; + HAVE_GETGROUPS=1; + HAVE_GETHOSTNAME=1; + HAVE_GETLOGIN=1; + HAVE_GETPAGESIZE=1; + HAVE_GETPASS=1; + HAVE_GROUP_MEMBER=1; + HAVE_LCHOWN=1; + HAVE_LINK=1; + HAVE_LINKAT=1; + HAVE_PIPE=1; + HAVE_PIPE2=1; + HAVE_PREAD=1; + HAVE_PWRITE=1; + HAVE_READLINK=1; + HAVE_READLINKAT=1; + HAVE_SETHOSTNAME=1; + HAVE_SLEEP=1; + HAVE_SYMLINK=1; + HAVE_SYMLINKAT=1; + HAVE_UNLINKAT=1; + HAVE_USLEEP=1; + HAVE_DECL_ENVIRON=1; + HAVE_DECL_EXECVPE=1; + HAVE_DECL_FCHDIR=1; + HAVE_DECL_FDATASYNC=1; + HAVE_DECL_GETDOMAINNAME=1; + HAVE_DECL_GETLOGIN=1; + HAVE_DECL_GETLOGIN_R=1; + HAVE_DECL_GETPAGESIZE=1; + HAVE_DECL_GETUSERSHELL=1; + HAVE_DECL_SETHOSTNAME=1; + HAVE_DECL_TRUNCATE=1; + HAVE_DECL_TTYNAME_R=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; + REPLACE_ACCESS=0; + REPLACE_CHOWN=0; + REPLACE_CLOSE=0; + REPLACE_DUP=0; + REPLACE_DUP2=0; + REPLACE_EXECL=0; + REPLACE_EXECLE=0; + REPLACE_EXECLP=0; + REPLACE_EXECV=0; + REPLACE_EXECVE=0; + REPLACE_EXECVP=0; + REPLACE_EXECVPE=0; + REPLACE_FACCESSAT=0; + REPLACE_FCHOWNAT=0; + REPLACE_FTRUNCATE=0; + REPLACE_GETCWD=0; + REPLACE_GETDOMAINNAME=0; + REPLACE_GETDTABLESIZE=0; + REPLACE_GETLOGIN_R=0; + REPLACE_GETGROUPS=0; + REPLACE_GETPAGESIZE=0; + REPLACE_GETPASS=0; + REPLACE_ISATTY=0; + REPLACE_LCHOWN=0; + REPLACE_LINK=0; + REPLACE_LINKAT=0; + REPLACE_LSEEK=0; + REPLACE_PREAD=0; + REPLACE_PWRITE=0; + REPLACE_READ=0; + REPLACE_READLINK=0; + REPLACE_READLINKAT=0; + REPLACE_RMDIR=0; + REPLACE_SLEEP=0; + REPLACE_SYMLINK=0; + REPLACE_SYMLINKAT=0; + REPLACE_TRUNCATE=0; + REPLACE_TTYNAME_R=0; + REPLACE_UNLINK=0; + REPLACE_UNLINKAT=0; + REPLACE_USLEEP=0; + REPLACE_WRITE=0; + UNISTD_H_HAVE_SYS_RANDOM_H=0; + UNISTD_H_HAVE_WINSOCK2_H=0; + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if ${ac_cv_c_restrict+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_restrict=no + # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: + # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html + # Put 'restrict' last, because C++ lacks it. + for ac_kw in __restrict__ __restrict _Restrict restrict; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + +int +main () +{ +int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in + restrict) ;; + no) $as_echo "#define restrict /**/" >>confdefs.h + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + + + + + case "$host_os" in + osf*) + +$as_echo "#define _POSIX_PII_SOCKET 1" >>confdefs.h + + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether is self-contained" >&5 +$as_echo_n "checking whether is self-contained... " >&6; } +if ${gl_cv_header_sys_socket_h_selfcontained+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_sys_socket_h_selfcontained=yes +else + gl_cv_header_sys_socket_h_selfcontained=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_selfcontained" >&5 +$as_echo "$gl_cv_header_sys_socket_h_selfcontained" >&6; } + if test $gl_cv_header_sys_socket_h_selfcontained = yes; then + for ac_func in shutdown +do : + ac_fn_c_check_func "$LINENO" "shutdown" "ac_cv_func_shutdown" +if test "x$ac_cv_func_shutdown" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SHUTDOWN 1 +_ACEOF + +fi +done + + if test $ac_cv_func_shutdown = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether defines the SHUT_* macros" >&5 +$as_echo_n "checking whether defines the SHUT_* macros... " >&6; } +if ${gl_cv_header_sys_socket_h_shut+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_sys_socket_h_shut=yes +else + gl_cv_header_sys_socket_h_shut=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_shut" >&5 +$as_echo "$gl_cv_header_sys_socket_h_shut" >&6; } + if test $gl_cv_header_sys_socket_h_shut = no; then + SYS_SOCKET_H='sys/socket.h' + fi + fi + fi + # We need to check for ws2tcpip.h now. + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_socket_h='<'sys/socket.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_sys_socket_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_sys_socket_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/socket.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_socket_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_socket_h + gl_cv_next_sys_socket_h='"'$gl_header'"' + else + gl_cv_next_sys_socket_h='<'sys/socket.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_socket_h" >&5 +$as_echo "$gl_cv_next_sys_socket_h" >&6; } + fi + NEXT_SYS_SOCKET_H=$gl_cv_next_sys_socket_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/socket.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_socket_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_SYS_SOCKET_H=1 + else + HAVE_SYS_SOCKET_H=0 + fi + + + + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + + + + ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +" +if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "sa_family_t" "ac_cv_type_sa_family_t" " + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +" +if test "x$ac_cv_type_sa_family_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SA_FAMILY_T 1 +_ACEOF + + +fi + + if test $ac_cv_type_struct_sockaddr_storage = no; then + HAVE_STRUCT_SOCKADDR_STORAGE=0 + fi + if test $ac_cv_type_sa_family_t = no; then + HAVE_SA_FAMILY_T=0 + fi + if test $ac_cv_type_struct_sockaddr_storage != no; then + ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + #ifdef HAVE_WS2TCPIP_H + #include + #endif + +" +if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 +_ACEOF + + +else + HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0 +fi + + fi + if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ + || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then + SYS_SOCKET_H='sys/socket.h' + fi + + + + + if test $ac_cv_header_sys_socket_h != yes; then + for ac_header in winsock2.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + +fi + +done + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + + + + + + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca (size_t); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes +else + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + + + + + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + + + GNULIB_INET_NTOP=0; + GNULIB_INET_PTON=0; + HAVE_DECL_INET_NTOP=1; + HAVE_DECL_INET_PTON=1; + REPLACE_INET_NTOP=0; + REPLACE_INET_PTON=0; + + + + + + + + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + + + GNULIB_BTOWC=0; GNULIB_WCTOB=0; GNULIB_MBSINIT=0; GNULIB_MBRTOWC=0; @@ -8134,184 +8684,6 @@ done - GNULIB_ACCESS=0; - GNULIB_CHDIR=0; - GNULIB_CHOWN=0; - GNULIB_CLOSE=0; - GNULIB_COPY_FILE_RANGE=0; - GNULIB_DUP=0; - GNULIB_DUP2=0; - GNULIB_DUP3=0; - GNULIB_ENVIRON=0; - GNULIB_EUIDACCESS=0; - GNULIB_EXECL=0; - GNULIB_EXECLE=0; - GNULIB_EXECLP=0; - GNULIB_EXECV=0; - GNULIB_EXECVE=0; - GNULIB_EXECVP=0; - GNULIB_EXECVPE=0; - GNULIB_FACCESSAT=0; - GNULIB_FCHDIR=0; - GNULIB_FCHOWNAT=0; - GNULIB_FDATASYNC=0; - GNULIB_FSYNC=0; - GNULIB_FTRUNCATE=0; - GNULIB_GETCWD=0; - GNULIB_GETDOMAINNAME=0; - GNULIB_GETDTABLESIZE=0; - GNULIB_GETENTROPY=0; - GNULIB_GETGROUPS=0; - GNULIB_GETHOSTNAME=0; - GNULIB_GETLOGIN=0; - GNULIB_GETLOGIN_R=0; - GNULIB_GETOPT_POSIX=0; - GNULIB_GETPAGESIZE=0; - GNULIB_GETPASS=0; - GNULIB_GETUSERSHELL=0; - GNULIB_GROUP_MEMBER=0; - GNULIB_ISATTY=0; - GNULIB_LCHOWN=0; - GNULIB_LINK=0; - GNULIB_LINKAT=0; - GNULIB_LSEEK=0; - GNULIB_PIPE=0; - GNULIB_PIPE2=0; - GNULIB_PREAD=0; - GNULIB_PWRITE=0; - GNULIB_READ=0; - GNULIB_READLINK=0; - GNULIB_READLINKAT=0; - GNULIB_RMDIR=0; - GNULIB_SETHOSTNAME=0; - GNULIB_SLEEP=0; - GNULIB_SYMLINK=0; - GNULIB_SYMLINKAT=0; - GNULIB_TRUNCATE=0; - GNULIB_TTYNAME_R=0; - GNULIB_UNISTD_H_NONBLOCKING=0; - GNULIB_UNISTD_H_SIGPIPE=0; - GNULIB_UNLINK=0; - GNULIB_UNLINKAT=0; - GNULIB_USLEEP=0; - GNULIB_WRITE=0; - GNULIB_MDA_ACCESS=1; - GNULIB_MDA_CHDIR=1; - GNULIB_MDA_CLOSE=1; - GNULIB_MDA_DUP=1; - GNULIB_MDA_DUP2=1; - GNULIB_MDA_EXECL=1; - GNULIB_MDA_EXECLE=1; - GNULIB_MDA_EXECLP=1; - GNULIB_MDA_EXECV=1; - GNULIB_MDA_EXECVE=1; - GNULIB_MDA_EXECVP=1; - GNULIB_MDA_EXECVPE=1; - GNULIB_MDA_GETCWD=1; - GNULIB_MDA_GETPID=1; - GNULIB_MDA_ISATTY=1; - GNULIB_MDA_LSEEK=1; - GNULIB_MDA_READ=1; - GNULIB_MDA_RMDIR=1; - GNULIB_MDA_SWAB=1; - GNULIB_MDA_UNLINK=1; - GNULIB_MDA_WRITE=1; - HAVE_CHOWN=1; - HAVE_COPY_FILE_RANGE=1; - HAVE_DUP3=1; - HAVE_EUIDACCESS=1; - HAVE_EXECVPE=1; - HAVE_FACCESSAT=1; - HAVE_FCHDIR=1; - HAVE_FCHOWNAT=1; - HAVE_FDATASYNC=1; - HAVE_FSYNC=1; - HAVE_FTRUNCATE=1; - HAVE_GETDTABLESIZE=1; - HAVE_GETENTROPY=1; - HAVE_GETGROUPS=1; - HAVE_GETHOSTNAME=1; - HAVE_GETLOGIN=1; - HAVE_GETPAGESIZE=1; - HAVE_GETPASS=1; - HAVE_GROUP_MEMBER=1; - HAVE_LCHOWN=1; - HAVE_LINK=1; - HAVE_LINKAT=1; - HAVE_PIPE=1; - HAVE_PIPE2=1; - HAVE_PREAD=1; - HAVE_PWRITE=1; - HAVE_READLINK=1; - HAVE_READLINKAT=1; - HAVE_SETHOSTNAME=1; - HAVE_SLEEP=1; - HAVE_SYMLINK=1; - HAVE_SYMLINKAT=1; - HAVE_UNLINKAT=1; - HAVE_USLEEP=1; - HAVE_DECL_ENVIRON=1; - HAVE_DECL_EXECVPE=1; - HAVE_DECL_FCHDIR=1; - HAVE_DECL_FDATASYNC=1; - HAVE_DECL_GETDOMAINNAME=1; - HAVE_DECL_GETLOGIN=1; - HAVE_DECL_GETLOGIN_R=1; - HAVE_DECL_GETPAGESIZE=1; - HAVE_DECL_GETUSERSHELL=1; - HAVE_DECL_SETHOSTNAME=1; - HAVE_DECL_TRUNCATE=1; - HAVE_DECL_TTYNAME_R=1; - HAVE_OS_H=0; - HAVE_SYS_PARAM_H=0; - REPLACE_ACCESS=0; - REPLACE_CHOWN=0; - REPLACE_CLOSE=0; - REPLACE_DUP=0; - REPLACE_DUP2=0; - REPLACE_EXECL=0; - REPLACE_EXECLE=0; - REPLACE_EXECLP=0; - REPLACE_EXECV=0; - REPLACE_EXECVE=0; - REPLACE_EXECVP=0; - REPLACE_EXECVPE=0; - REPLACE_FACCESSAT=0; - REPLACE_FCHOWNAT=0; - REPLACE_FTRUNCATE=0; - REPLACE_GETCWD=0; - REPLACE_GETDOMAINNAME=0; - REPLACE_GETDTABLESIZE=0; - REPLACE_GETLOGIN_R=0; - REPLACE_GETGROUPS=0; - REPLACE_GETPAGESIZE=0; - REPLACE_GETPASS=0; - REPLACE_ISATTY=0; - REPLACE_LCHOWN=0; - REPLACE_LINK=0; - REPLACE_LINKAT=0; - REPLACE_LSEEK=0; - REPLACE_PREAD=0; - REPLACE_PWRITE=0; - REPLACE_READ=0; - REPLACE_READLINK=0; - REPLACE_READLINKAT=0; - REPLACE_RMDIR=0; - REPLACE_SLEEP=0; - REPLACE_SYMLINK=0; - REPLACE_SYMLINKAT=0; - REPLACE_TRUNCATE=0; - REPLACE_TTYNAME_R=0; - REPLACE_UNLINK=0; - REPLACE_UNLINKAT=0; - REPLACE_USLEEP=0; - REPLACE_WRITE=0; - UNISTD_H_HAVE_SYS_RANDOM_H=0; - UNISTD_H_HAVE_WINSOCK2_H=0; - UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; - - - @@ -10587,91 +10959,41 @@ $as_echo_n "checking for 64-bit st_size... " >&6; } if ${gl_cv_member_st_size_64+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - struct stat buf; - int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_member_st_size_64=yes -else - gl_cv_member_st_size_64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 -$as_echo "$gl_cv_member_st_size_64" >&6; } - if test $gl_cv_member_st_size_64 = no; then - WINDOWS_64_BIT_ST_SIZE=1 - else - WINDOWS_64_BIT_ST_SIZE=0 - fi - ;; - *) - WINDOWS_64_BIT_OFF_T=0 - WINDOWS_64_BIT_ST_SIZE=0 - ;; - esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 -$as_echo_n "checking for C/C++ restrict keyword... " >&6; } -if ${ac_cv_c_restrict+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_restrict=no - # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: - # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html - # Put 'restrict' last, because C++ lacks it. - for ac_kw in __restrict__ __restrict _Restrict restrict; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -typedef int *int_ptr; - int foo (int_ptr $ac_kw ip) { return ip[0]; } - int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ - int bar (int ip[$ac_kw]) { return ip[0]; } +#include + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; int main () { -int s[1]; - int *$ac_kw t = s; - t[0] = 0; - return foo (t) + bar (t); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_restrict=$ac_kw + gl_cv_member_st_size_64=yes +else + gl_cv_member_st_size_64=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 -$as_echo "$ac_cv_c_restrict" >&6; } - - case $ac_cv_c_restrict in - restrict) ;; - no) $as_echo "#define restrict /**/" >>confdefs.h - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 +$as_echo "$gl_cv_member_st_size_64" >&6; } + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi + ;; + *) + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac @@ -11449,304 +11771,94 @@ $as_echo "$gl_cv_next_glob_h" >&6; } if test -n "$GLOB_H"; then - GL_GENERATE_GLOB_H_TRUE= - GL_GENERATE_GLOB_H_FALSE='#' -else - GL_GENERATE_GLOB_H_TRUE='#' - GL_GENERATE_GLOB_H_FALSE= -fi - - - - - - - - - - - - - - - - - if test -z "$gl_pthreadlib_body_done"; then - gl_pthread_api=no - LIBPTHREAD= - LIBPMULTITHREAD= - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - gl_have_pthread_h=yes -else - gl_have_pthread_h=no -fi - - - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - pthread_mutex_t m; - pthread_mutexattr_t ma; - -int -main () -{ -pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_pthread_api=yes - LIBPTHREAD=$gl_pthread - LIBPMULTITHREAD=$gl_pthread -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test $gl_pthread_api = yes && break - done - - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBPMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) - -$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h - - esac - -fi - - elif test $gl_pthread_api != yes; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes -else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lpthread - LIBPMULTITHREAD=-lpthread -fi - - if test $gl_pthread_api != yes; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 -$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); -int -main () -{ -return pthread_kill (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_pthread_kill=yes + GL_GENERATE_GLOB_H_TRUE= + GL_GENERATE_GLOB_H_FALSE='#' else - ac_cv_lib_c_r_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } -if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_pthread_api=yes - LIBPTHREAD=-lc_r - LIBPMULTITHREAD=-lc_r + GL_GENERATE_GLOB_H_TRUE='#' + GL_GENERATE_GLOB_H_FALSE= fi - fi - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 -$as_echo_n "checking whether POSIX threads API is available... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 -$as_echo "$gl_pthread_api" >&6; } - if test $gl_pthread_api = yes; then -$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h - fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - LIB_SCHED_YIELD= + + + + + + + + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + gl_have_pthread_h=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 -$as_echo_n "checking for sched_yield in -lrt... " >&6; } -if ${ac_cv_lib_rt_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_have_pthread_h=no +fi + + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); int main () { -return sched_yield (); +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sched_yield=yes -else - ac_cv_lib_rt_sched_yield=no + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 -$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } -if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lrt -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 -$as_echo_n "checking for sched_yield in -lposix4... " >&6; } -if ${ac_cv_lib_posix4_sched_yield+:} false; then : + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix4 $LIBS" +LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11756,554 +11868,448 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char sched_yield (); +char pthread_kill (); int main () { -return sched_yield (); +return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_posix4_sched_yield=yes + ac_cv_lib_pthread_pthread_kill=yes else - ac_cv_lib_posix4_sched_yield=no + ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 -$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } -if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : - LIB_SCHED_YIELD=-lposix4 -fi - -fi - - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - - gl_pthreadlib_body_done=done - fi - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. - *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) - gl_cv_func_setlocale_null_all_mtsafe=no ;; - # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. - *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) - gl_cv_func_setlocale_null_all_mtsafe=yes ;; - # If we don't know, obey --enable-cross-guesses. - *) - gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } - case "$host_os" in - mingw*) ;; - *) - if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then - gl_cv_func_setlocale_null_all_mtsafe="trivially yes" - fi - ;; - esac - case "$gl_cv_func_setlocale_null_all_mtsafe" in - *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; - *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; - esac - -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) +$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 -$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } -if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : - $as_echo_n "(cached) " >&6 -else - case "$host_os" in - # Guess no on OpenBSD, AIX. - openbsd* | aix*) - gl_cv_func_setlocale_null_one_mtsafe=no ;; - # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. - *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) - gl_cv_func_setlocale_null_one_mtsafe=yes ;; - # If we don't know, obey --enable-cross-guesses. - *) - gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; - esac + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 -$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } - case "$host_os" in - mingw*) ;; - *) - if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then - gl_cv_func_setlocale_null_one_mtsafe="trivially yes" - fi - ;; - esac - case "$gl_cv_func_setlocale_null_one_mtsafe" in - *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; - *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; - esac -cat >>confdefs.h <<_ACEOF -#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE -_ACEOF - - - if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then - case "$host_os" in - mingw*) LIB_SETLOCALE_NULL= ;; - *) - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void xyzzy (); -#pragma weak xyzzy + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); int main () { -xyzzy(); +return pthread_kill (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - gl_cv_have_weak=maybe + ac_cv_lib_pthread_pthread_kill=yes +else + ac_cv_lib_pthread_pthread_kill=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __ELF__ - Extensible Linking Format - #endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_have_weak="guessing yes" -else - gl_cv_have_weak="guessing no" +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread fi -rm -f conftest* - + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } +if ${ac_cv_lib_c_r_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#pragma weak fputs -int main () +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () { - return (fputs == NULL); +return pthread_kill (); + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_have_weak=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_kill=yes else - gl_cv_have_weak=no + ac_cv_lib_c_r_pthread_kill=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi - - fi - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac - case "$gl_cv_have_weak" in - *yes) - case "$host_os" in - freebsd* | dragonfly*) - : > conftest1.c - $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 - cat < conftest2.c -#include -#pragma weak pthread_mutexattr_gettype -int main () -{ - return (pthread_mutexattr_gettype != NULL); -} -EOF - $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ - || gl_cv_have_weak=no - rm -f conftest1.c libempty.so conftest2.c conftest - ;; - esac - ;; - esac - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } - case "$gl_cv_have_weak" in - *yes) - -$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h - - ;; - esac - - case "$gl_cv_have_weak" in - *yes) LIB_SETLOCALE_NULL= ;; - *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; - esac - ;; - esac - else - LIB_SETLOCALE_NULL= - fi - - - - - - GNULIB_SOCKET=0; - GNULIB_CONNECT=0; - GNULIB_ACCEPT=0; - GNULIB_BIND=0; - GNULIB_GETPEERNAME=0; - GNULIB_GETSOCKNAME=0; - GNULIB_GETSOCKOPT=0; - GNULIB_LISTEN=0; - GNULIB_RECV=0; - GNULIB_SEND=0; - GNULIB_RECVFROM=0; - GNULIB_SENDTO=0; - GNULIB_SETSOCKOPT=0; - GNULIB_SHUTDOWN=0; - GNULIB_ACCEPT4=0; - HAVE_STRUCT_SOCKADDR_STORAGE=1; - HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; - - HAVE_SA_FAMILY_T=1; - HAVE_ACCEPT4=1; - + fi + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +$as_echo_n "checking whether POSIX threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +$as_echo "$gl_pthread_api" >&6; } + if test $gl_pthread_api = yes; then - case "$host_os" in - osf*) +$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h -$as_echo "#define _POSIX_PII_SOCKET 1" >>confdefs.h + fi - ;; - esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIB_SCHED_YIELD= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether is self-contained" >&5 -$as_echo_n "checking whether is self-contained... " >&6; } -if ${gl_cv_header_sys_socket_h_selfcontained+:} false; then : +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if ${ac_cv_lib_rt_sched_yield+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); int main () { - +return sched_yield (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_sys_socket_h_selfcontained=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sched_yield=yes else - gl_cv_header_sys_socket_h_selfcontained=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - + ac_cv_lib_rt_sched_yield=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_selfcontained" >&5 -$as_echo "$gl_cv_header_sys_socket_h_selfcontained" >&6; } - if test $gl_cv_header_sys_socket_h_selfcontained = yes; then - for ac_func in shutdown -do : - ac_fn_c_check_func "$LINENO" "shutdown" "ac_cv_func_shutdown" -if test "x$ac_cv_func_shutdown" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SHUTDOWN 1 -_ACEOF - +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -done - - if test $ac_cv_func_shutdown = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether defines the SHUT_* macros" >&5 -$as_echo_n "checking whether defines the SHUT_* macros... " >&6; } -if ${gl_cv_header_sys_socket_h_shut+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lrt +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +$as_echo_n "checking for sched_yield in -lposix4... " >&6; } +if ${ac_cv_lib_posix4_sched_yield+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); int main () { -int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; +return sched_yield (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_sys_socket_h_shut=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_yield=yes else - gl_cv_header_sys_socket_h_shut=no + ac_cv_lib_posix4_sched_yield=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lposix4 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_socket_h_shut" >&5 -$as_echo "$gl_cv_header_sys_socket_h_shut" >&6; } - if test $gl_cv_header_sys_socket_h_shut = no; then - SYS_SOCKET_H='sys/socket.h' - fi - fi - fi - # We need to check for ws2tcpip.h now. - - - +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + gl_pthreadlib_body_done=done + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_socket_h='<'sys/socket.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_sys_socket_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test $ac_cv_header_sys_socket_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 +else case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. + *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + gl_cv_func_setlocale_null_all_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; *) - gl_dirsep_regex='\/' + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_all_mtsafe="trivially yes" + fi ;; esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'sys/socket.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' + case "$gl_cv_func_setlocale_null_all_mtsafe" in + *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; + *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; + esac - gl_cv_absolute_sys_socket_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +cat >>confdefs.h <<_ACEOF +#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE +_ACEOF - gl_header=$gl_cv_absolute_sys_socket_h - gl_cv_next_sys_socket_h='"'$gl_header'"' - else - gl_cv_next_sys_socket_h='<'sys/socket.h'>' - fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$host_os" in + # Guess no on OpenBSD, AIX. + openbsd* | aix*) + gl_cv_func_setlocale_null_one_mtsafe=no ;; + # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + gl_cv_func_setlocale_null_one_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_socket_h" >&5 -$as_echo "$gl_cv_next_sys_socket_h" >&6; } - fi - NEXT_SYS_SOCKET_H=$gl_cv_next_sys_socket_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/socket.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_socket_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H=$gl_next_as_first_directive - - - - - if test $ac_cv_header_sys_socket_h = yes; then - HAVE_SYS_SOCKET_H=1 - else - HAVE_SYS_SOCKET_H=0 - fi - - - - if test $ac_cv_header_sys_socket_h = yes; then - HAVE_WS2TCPIP_H=0 - else - if test $ac_cv_header_ws2tcpip_h = yes; then - HAVE_WS2TCPIP_H=1 - else - HAVE_WS2TCPIP_H=0 - fi - fi - - - - ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -" -if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_one_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_one_mtsafe" in + *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; + *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; + esac cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE _ACEOF -fi -ac_fn_c_check_type "$LINENO" "sa_family_t" "ac_cv_type_sa_family_t" " - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + case "$host_os" in + mingw*) LIB_SETLOCALE_NULL= ;; + *) -" -if test "x$ac_cv_type_sa_family_t" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_SA_FAMILY_T 1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if ${gl_cv_have_weak+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} _ACEOF - - +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif - if test $ac_cv_type_struct_sockaddr_storage = no; then - HAVE_STRUCT_SOCKADDR_STORAGE=0 - fi - if test $ac_cv_type_sa_family_t = no; then - HAVE_SA_FAMILY_T=0 - fi - if test $ac_cv_type_struct_sockaddr_storage != no; then - ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_WS2TCPIP_H - #include - #endif - -" -if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 _ACEOF - - +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" else - HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0 + gl_cv_have_weak="guessing no" fi - - fi - if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ - || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then - SYS_SOCKET_H='sys/socket.h' - fi - +rm -f conftest* +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test $ac_cv_header_sys_socket_h != yes; then - for ac_header in winsock2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" -if test "x$ac_cv_header_winsock2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} _ACEOF - +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_have_weak=yes +else + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -done - - fi - if test "$ac_cv_header_winsock2_h" = yes; then - HAVE_WINSOCK2_H=1 - UNISTD_H_HAVE_WINSOCK2_H=1 - SYS_IOCTL_H_HAVE_WINSOCK2_H=1 - else - HAVE_WINSOCK2_H=0 - fi - + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + ;; + esac + case "$gl_cv_have_weak" in + *yes) LIB_SETLOCALE_NULL= ;; + *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_SETLOCALE_NULL= + fi @@ -18130,6 +18136,34 @@ fi gl_source_base='import' + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS accept.$ac_objext" + + fi + + + + + + GNULIB_ACCEPT=1 + + + + + +$as_echo "#define GNULIB_TEST_ACCEPT 1" >>confdefs.h + + + + if test $ac_cv_func_alloca_works = no; then : @@ -18303,6 +18337,34 @@ $as_echo "$gl_cv_next_arpa_inet_h" >&6; } + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS bind.$ac_objext" + + fi + + + + + + GNULIB_BIND=1 + + + + + +$as_echo "#define GNULIB_TEST_BIND 1" >>confdefs.h + + + + @@ -18920,6 +18982,34 @@ $as_echo "#define GNULIB_TEST_CLOSEDIR 1" >>confdefs.h + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS connect.$ac_objext" + + fi + + + + + + GNULIB_CONNECT=1 + + + + + +$as_echo "#define GNULIB_TEST_CONNECT 1" >>confdefs.h + + + + @@ -23662,6 +23752,34 @@ $as_echo "#define HAVE___INLINE 1" >>confdefs.h + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS listen.$ac_objext" + + fi + + + + + + GNULIB_LISTEN=1 + + + + + +$as_echo "#define GNULIB_TEST_LISTEN 1" >>confdefs.h + + + + LOCALCHARSET_TESTS_ENVIRONMENT= @@ -28614,6 +28732,34 @@ $as_echo "#define GNULIB_TEST_SETLOCALE_NULL 1" >>confdefs.h + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS setsockopt.$ac_objext" + + fi + + + + + + GNULIB_SETSOCKOPT=1 + + + + + +$as_echo "#define GNULIB_TEST_SETSOCKOPT 1" >>confdefs.h + + + + @@ -28724,6 +28870,43 @@ fi + if test "$ac_cv_header_winsock2_h" = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS socket.$ac_objext" + + fi + # When this module is used, sockets may actually occur as file descriptors, + # hence it is worth warning if the modules 'close' and 'ioctl' are not used. + + + + if test "$ac_cv_header_winsock2_h" = yes; then + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + fi + + + + + + GNULIB_SOCKET=1 + + + + + +$as_echo "#define GNULIB_TEST_SOCKET 1" >>confdefs.h + + + + ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " /* is not needed according to POSIX, but the diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am index dafe63d..5a405cf 100644 --- a/gnulib/import/Makefile.am +++ b/gnulib/import/Makefile.am @@ -33,9 +33,12 @@ # --no-libtool \ # --macro-prefix=gl \ # --no-vc-files \ +# accept \ # alloca \ +# bind \ # canonicalize-lgpl \ # chown \ +# connect \ # count-one-bits \ # dirent \ # dirfd \ @@ -52,6 +55,7 @@ # inet_ntop \ # inttypes \ # limits-h \ +# listen \ # lstat \ # memchr \ # memmem \ @@ -65,7 +69,9 @@ # rename \ # select \ # setenv \ +# setsockopt \ # signal-h \ +# socket \ # strchrnul \ # strerror_r-posix \ # strstr \ @@ -115,6 +121,15 @@ HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER) ## end gnulib module absolute-header +## begin gnulib module accept + + +EXTRA_DIST += accept.c w32sock.h + +EXTRA_libgnu_a_SOURCES += accept.c + +## end gnulib module accept + ## begin gnulib module alloca @@ -214,6 +229,15 @@ EXTRA_DIST += basename-lgpl.h ## end gnulib module basename-lgpl +## begin gnulib module bind + + +EXTRA_DIST += bind.c w32sock.h + +EXTRA_libgnu_a_SOURCES += bind.c + +## end gnulib module bind + ## begin gnulib module btowc @@ -276,6 +300,15 @@ EXTRA_libgnu_a_SOURCES += closedir.c ## end gnulib module closedir +## begin gnulib module connect + + +EXTRA_DIST += connect.c w32sock.h + +EXTRA_libgnu_a_SOURCES += connect.c + +## end gnulib module connect + ## begin gnulib module count-one-bits libgnu_a_SOURCES += count-one-bits.c @@ -976,6 +1009,15 @@ EXTRA_DIST += limits.in.h ## end gnulib module limits-h +## begin gnulib module listen + + +EXTRA_DIST += listen.c w32sock.h + +EXTRA_libgnu_a_SOURCES += listen.c + +## end gnulib module listen + ## begin gnulib module localcharset libgnu_a_SOURCES += localcharset.c @@ -1731,6 +1773,15 @@ EXTRA_libgnu_a_SOURCES += setlocale-lock.c ## end gnulib module setlocale-null +## begin gnulib module setsockopt + + +EXTRA_DIST += setsockopt.c w32sock.h + +EXTRA_libgnu_a_SOURCES += setsockopt.c + +## end gnulib module setsockopt + ## begin gnulib module signal-h BUILT_SOURCES += signal.h @@ -1821,6 +1872,15 @@ EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use +## begin gnulib module socket + + +EXTRA_DIST += socket.c w32sock.h + +EXTRA_libgnu_a_SOURCES += socket.c + +## end gnulib module socket + ## begin gnulib module sockets libgnu_a_SOURCES += sockets.h sockets.c diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in index aae9711..3393458 100644 --- a/gnulib/import/Makefile.in +++ b/gnulib/import/Makefile.in @@ -47,9 +47,12 @@ # --no-libtool \ # --macro-prefix=gl \ # --no-vc-files \ +# accept \ # alloca \ +# bind \ # canonicalize-lgpl \ # chown \ +# connect \ # count-one-bits \ # dirent \ # dirfd \ @@ -66,6 +69,7 @@ # inet_ntop \ # inttypes \ # limits-h \ +# listen \ # lstat \ # memchr \ # memmem \ @@ -79,7 +83,9 @@ # rename \ # select \ # setenv \ +# setsockopt \ # signal-h \ +# socket \ # strchrnul \ # strerror_r-posix \ # strstr \ @@ -1820,10 +1826,11 @@ noinst_HEADERS = noinst_LIBRARIES = libgnu.a noinst_LTLIBRARIES = # No GNU Make output. -EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ - assure.h attribute.h basename-lgpl.h btowc.c \ - canonicalize-lgpl.c chdir-long.c chdir-long.h chown.c \ - fchown-stub.c cloexec.h close.c closedir.c dirent-private.h \ +EXTRA_DIST = m4/gnulib-cache.m4 accept.c w32sock.h alloca.c \ + alloca.in.h arpa_inet.in.h assure.h attribute.h \ + basename-lgpl.h bind.c w32sock.h btowc.c canonicalize-lgpl.c \ + chdir-long.c chdir-long.h chown.c fchown-stub.c cloexec.h \ + close.c closedir.c dirent-private.h connect.c w32sock.h \ count-one-bits.h ctype.in.h dirent.in.h dirfd.c dirname.h \ dup.c dup2.c eloop-threshold.h errno.in.h error.c error.h \ exitfail.h fchdir.c fcntl.c fcntl.in.h fd-hook.h fdopendir.c \ @@ -1838,8 +1845,8 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ glob.in.h hard-locale.h inet_ntop.c intprops.h inttypes.in.h \ isblank.c float+.h isnan.c isnand-nolibm.h isnand.c float+.h \ isnan.c isnanl-nolibm.h isnanl.c cdefs.h libc-config.h \ - limits.in.h localcharset.h locale.in.h lstat.c malloc.c \ - malloca.h math.in.h lc-charset-dispatch.c \ + limits.in.h listen.c w32sock.h localcharset.h locale.in.h \ + lstat.c malloc.c malloca.h math.in.h lc-charset-dispatch.c \ lc-charset-dispatch.h mbrtowc-impl-utf8.h mbrtowc-impl.h \ mbrtowc.c mbtowc-lock.c mbtowc-lock.h windows-initguard.h \ mbsinit.c mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c \ @@ -1852,17 +1859,17 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ readlink.c realloc.c rename.c dirent-private.h rewinddir.c \ rmdir.c same-inode.h save-cwd.h malloc/scratch_buffer.h \ scratch_buffer.h select.c setenv.c setlocale-lock.c \ - setlocale_null.h windows-initguard.h signal.in.h _Noreturn.h \ - arg-nonnull.h c++defs.h warn-on-use.h w32sock.h stat-w32.c \ - stat-w32.h stat.c stat-time.h stdalign.in.h stdbool.in.h \ - stddef.in.h stdint.in.h stdio.in.h stdlib.in.h strchrnul.c \ - strchrnul.valgrind strdup.c streq.h strerror.c \ - strerror-override.c strerror-override.h strerror_r.c \ - string.in.h strings.in.h strnlen.c strstr.c str-two-way.h \ - strstr.c strtok_r.c sys_random.in.h sys_select.in.h \ - sys_socket.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \ - sys_uio.in.h sys_wait.in.h tempname.h time.in.h time_r.c \ - unistd.in.h unistd--.h unistd-safer.h unsetenv.c \ + setlocale_null.h windows-initguard.h setsockopt.c w32sock.h \ + signal.in.h _Noreturn.h arg-nonnull.h c++defs.h warn-on-use.h \ + socket.c w32sock.h w32sock.h stat-w32.c stat-w32.h stat.c \ + stat-time.h stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h \ + stdio.in.h stdlib.in.h strchrnul.c strchrnul.valgrind strdup.c \ + streq.h strerror.c strerror-override.c strerror-override.h \ + strerror_r.c string.in.h strings.in.h strnlen.c strstr.c \ + str-two-way.h strstr.c strtok_r.c sys_random.in.h \ + sys_select.in.h sys_socket.in.h sys_stat.in.h sys_time.in.h \ + sys_types.in.h sys_uio.in.h sys_wait.in.h tempname.h time.in.h \ + time_r.c unistd.in.h unistd--.h unistd-safer.h unsetenv.c \ $(top_srcdir)/import/extra/update-copyright verify.h \ wchar.in.h wctype.in.h windows-initguard.h windows-mutex.c \ windows-mutex.h windows-once.c windows-once.h \ @@ -1912,25 +1919,26 @@ libgnu_a_SOURCES = openat-priv.h openat-proc.c basename-lgpl.c \ dup-safer.c fd-safer.c pipe-safer.c wctype-h.c libgnu_a_LIBADD = $(gl_LIBOBJS) @ALLOCA@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@ -EXTRA_libgnu_a_SOURCES = alloca.c btowc.c canonicalize-lgpl.c \ - chdir-long.c chown.c fchown-stub.c close.c closedir.c dirfd.c \ - dup.c dup2.c error.c fchdir.c fcntl.c fdopendir.c ffs.c \ - float.c itold.c fnmatch.c fnmatch_loop.c fnmatch.c free.c \ - frexp.c frexp.c frexpl.c fstat.c stat-w32.c at-func.c \ - fstatat.c getcwd.c getcwd-lgpl.c getdelim.c getdtablesize.c \ - getline.c getlogin_r.c getrandom.c gettimeofday.c glob.c \ - glob_pattern_p.c globfree.c inet_ntop.c isblank.c isnan.c \ - isnand.c isnan.c isnanl.c lstat.c malloc.c \ - lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c mbsinit.c \ - mbsrtowcs-state.c mbsrtowcs.c mbtowc.c memchr.c memmem.c \ - memmem.c mempcpy.c memrchr.c mkdir.c mkdtemp.c mkostemp.c \ - msvc-inval.c msvc-nothrow.c open.c openat.c opendir.c pipe.c \ - rawmemchr.c readdir.c readlink.c realloc.c rename.c \ - rewinddir.c rmdir.c select.c setenv.c setlocale-lock.c \ - stat-w32.c stat.c strchrnul.c strdup.c strerror.c \ - strerror-override.c strerror_r.c strnlen.c strstr.c strstr.c \ - strtok_r.c time_r.c unsetenv.c windows-mutex.c windows-once.c \ - windows-recmutex.c windows-rwlock.c wmemchr.c wmempcpy.c +EXTRA_libgnu_a_SOURCES = accept.c alloca.c bind.c btowc.c \ + canonicalize-lgpl.c chdir-long.c chown.c fchown-stub.c close.c \ + closedir.c connect.c dirfd.c dup.c dup2.c error.c fchdir.c \ + fcntl.c fdopendir.c ffs.c float.c itold.c fnmatch.c \ + fnmatch_loop.c fnmatch.c free.c frexp.c frexp.c frexpl.c \ + fstat.c stat-w32.c at-func.c fstatat.c getcwd.c getcwd-lgpl.c \ + getdelim.c getdtablesize.c getline.c getlogin_r.c getrandom.c \ + gettimeofday.c glob.c glob_pattern_p.c globfree.c inet_ntop.c \ + isblank.c isnan.c isnand.c isnan.c isnanl.c listen.c lstat.c \ + malloc.c lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c \ + mbsinit.c mbsrtowcs-state.c mbsrtowcs.c mbtowc.c memchr.c \ + memmem.c memmem.c mempcpy.c memrchr.c mkdir.c mkdtemp.c \ + mkostemp.c msvc-inval.c msvc-nothrow.c open.c openat.c \ + opendir.c pipe.c rawmemchr.c readdir.c readlink.c realloc.c \ + rename.c rewinddir.c rmdir.c select.c setenv.c \ + setlocale-lock.c setsockopt.c socket.c stat-w32.c stat.c \ + strchrnul.c strdup.c strerror.c strerror-override.c \ + strerror_r.c strnlen.c strstr.c strstr.c strtok_r.c time_r.c \ + unsetenv.c windows-mutex.c windows-once.c windows-recmutex.c \ + windows-rwlock.c wmemchr.c wmempcpy.c # Use this preprocessor expression to decide whether #include_next works. # Do not rely on a 'configure'-time test for this, since the expression @@ -2042,9 +2050,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accept.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bind.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btowc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize-lgpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@ @@ -2052,6 +2062,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closedir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/count-one-bits.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname-lgpl.Po@am__quote@ @@ -2098,6 +2109,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lc-charset-dispatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ @@ -2137,6 +2149,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setlocale-lock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setlocale_null.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setsockopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-w32.Po@am__quote@ diff --git a/gnulib/import/accept.c b/gnulib/import/accept.c new file mode 100644 index 0000000..a7d5743 --- /dev/null +++ b/gnulib/import/accept.c @@ -0,0 +1,52 @@ +/* accept.c --- wrappers for Windows accept function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef accept + +int +rpl_accept (int fd, struct sockaddr *addr, socklen_t *addrlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + + if (sock == INVALID_SOCKET) + { + errno = EBADF; + return -1; + } + else + { + SOCKET fh = accept (sock, addr, addrlen); + if (fh == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + else + return SOCKET_TO_FD (fh); + } +} diff --git a/gnulib/import/bind.c b/gnulib/import/bind.c new file mode 100644 index 0000000..467da95 --- /dev/null +++ b/gnulib/import/bind.c @@ -0,0 +1,49 @@ +/* bind.c --- wrappers for Windows bind function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef bind + +int +rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len) +{ + SOCKET sock = FD_TO_SOCKET (fd); + + if (sock == INVALID_SOCKET) + { + errno = EBADF; + return -1; + } + else + { + int r = bind (sock, sockaddr, len); + if (r < 0) + set_winsock_errno (); + + return r; + } +} diff --git a/gnulib/import/connect.c b/gnulib/import/connect.c new file mode 100644 index 0000000..6dc1107 --- /dev/null +++ b/gnulib/import/connect.c @@ -0,0 +1,56 @@ +/* connect.c --- wrappers for Windows connect function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef connect + +int +rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len) +{ + SOCKET sock = FD_TO_SOCKET (fd); + + if (sock == INVALID_SOCKET) + { + errno = EBADF; + return -1; + } + else + { + int r = connect (sock, sockaddr, len); + if (r < 0) + { + /* EINPROGRESS is not returned by WinSock 2.0; for backwards + compatibility, connect(2) uses EWOULDBLOCK. */ + if (WSAGetLastError () == WSAEWOULDBLOCK) + WSASetLastError (WSAEINPROGRESS); + + set_winsock_errno (); + } + + return r; + } +} diff --git a/gnulib/import/listen.c b/gnulib/import/listen.c new file mode 100644 index 0000000..0645e2e --- /dev/null +++ b/gnulib/import/listen.c @@ -0,0 +1,49 @@ +/* listen.c --- wrappers for Windows listen function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef listen + +int +rpl_listen (int fd, int backlog) +{ + SOCKET sock = FD_TO_SOCKET (fd); + + if (sock == INVALID_SOCKET) + { + errno = EBADF; + return -1; + } + else + { + int r = listen (sock, backlog); + if (r < 0) + set_winsock_errno (); + + return r; + } +} diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 5396840..381cdde 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -38,9 +38,12 @@ # --no-libtool \ # --macro-prefix=gl \ # --no-vc-files \ +# accept \ # alloca \ +# bind \ # canonicalize-lgpl \ # chown \ +# connect \ # count-one-bits \ # dirent \ # dirfd \ @@ -57,6 +60,7 @@ # inet_ntop \ # inttypes \ # limits-h \ +# listen \ # lstat \ # memchr \ # memmem \ @@ -70,7 +74,9 @@ # rename \ # select \ # setenv \ +# setsockopt \ # signal-h \ +# socket \ # strchrnul \ # strerror_r-posix \ # strstr \ @@ -87,9 +93,12 @@ # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ + accept alloca + bind canonicalize-lgpl chown + connect count-one-bits dirent dirfd @@ -106,6 +115,7 @@ gl_MODULES([ inet_ntop inttypes limits-h + listen lstat memchr memmem @@ -119,7 +129,9 @@ gl_MODULES([ rename select setenv + setsockopt signal-h + socket strchrnul strerror_r-posix strstr diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index 54ae5bb..5376a93 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -44,6 +44,7 @@ AC_DEFUN([gl_EARLY], AC_REQUIRE([AM_PROG_CC_C_O]) # Code from module absolute-header: + # Code from module accept: # Code from module alloca: # Code from module alloca-opt: # Code from module arpa_inet: @@ -51,6 +52,7 @@ AC_DEFUN([gl_EARLY], # Code from module at-internal: # Code from module attribute: # Code from module basename-lgpl: + # Code from module bind: # Code from module btowc: # Code from module builtin-expect: # Code from module c99: @@ -62,6 +64,7 @@ AC_DEFUN([gl_EARLY], # Code from module cloexec: # Code from module close: # Code from module closedir: + # Code from module connect: # Code from module count-one-bits: # Code from module ctype: # Code from module d-ino: @@ -129,6 +132,7 @@ AC_DEFUN([gl_EARLY], AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module libc-config: # Code from module limits-h: + # Code from module listen: # Code from module localcharset: # Code from module locale: # Code from module lock: @@ -175,11 +179,13 @@ AC_DEFUN([gl_EARLY], # Code from module select: # Code from module setenv: # Code from module setlocale-null: + # Code from module setsockopt: # Code from module signal-h: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: + # Code from module socket: # Code from module socketlib: # Code from module sockets: # Code from module socklen: @@ -251,10 +257,20 @@ AC_DEFUN([gl_INIT], m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='import' + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([accept]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([accept]) gl_FUNC_ALLOCA gl_HEADER_ARPA_INET AC_PROG_MKDIR_P AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([bind]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([bind]) gl_FUNC_BTOWC if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then AC_LIBOBJ([btowc]) @@ -295,6 +311,11 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([closedir]) fi gl_DIRENT_MODULE_INDICATOR([closedir]) + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([connect]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([connect]) gl_CTYPE_H gl_CHECK_TYPE_STRUCT_DIRENT_D_INO gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE @@ -498,6 +519,11 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([gl_LARGEFILE]) gl___INLINE gl_LIMITS_H + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([listen]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([listen]) gl_LOCALCHARSET dnl For backward compatibility. Some packages still use this. LOCALCHARSET_TESTS_ENVIRONMENT= @@ -685,7 +711,26 @@ AC_DEFUN([gl_INIT], gl_PREREQ_SETLOCALE_LOCK fi gl_LOCALE_MODULE_INDICATOR([setlocale_null]) + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([setsockopt]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) gl_SIGNAL_H + AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([socket]) + fi + # When this module is used, sockets may actually occur as file descriptors, + # hence it is worth warning if the modules 'close' and 'ioctl' are not used. + m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) + m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) + AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2]) + if test "$ac_cv_header_winsock2_h" = yes; then + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + fi + gl_SYS_SOCKET_MODULE_INDICATOR([socket]) AC_REQUIRE([gl_SOCKETLIB]) AC_REQUIRE([gl_SOCKETS]) gl_TYPE_SOCKLEN_T @@ -980,6 +1025,7 @@ AC_DEFUN([gl_FILE_LIST], [ doc/gendocs_template doc/gendocs_template_min lib/_Noreturn.h + lib/accept.c lib/alloca.c lib/alloca.in.h lib/arg-nonnull.h @@ -989,6 +1035,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/attribute.h lib/basename-lgpl.c lib/basename-lgpl.h + lib/bind.c lib/btowc.c lib/c++defs.h lib/canonicalize-lgpl.c @@ -1000,6 +1047,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/cloexec.h lib/close.c lib/closedir.c + lib/connect.c lib/count-one-bits.c lib/count-one-bits.h lib/ctype.in.h @@ -1081,6 +1129,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/lc-charset-dispatch.h lib/libc-config.h lib/limits.in.h + lib/listen.c lib/localcharset.c lib/localcharset.h lib/locale.in.h @@ -1148,7 +1197,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/setlocale-lock.c lib/setlocale_null.c lib/setlocale_null.h + lib/setsockopt.c lib/signal.in.h + lib/socket.c lib/sockets.c lib/sockets.h lib/stat-time.c diff --git a/gnulib/import/setsockopt.c b/gnulib/import/setsockopt.c new file mode 100644 index 0000000..b6f5dfc --- /dev/null +++ b/gnulib/import/setsockopt.c @@ -0,0 +1,65 @@ +/* setsockopt.c --- wrappers for Windows setsockopt function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get struct timeval. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef setsockopt + +int +rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) +{ + SOCKET sock = FD_TO_SOCKET (fd); + int r; + + if (sock == INVALID_SOCKET) + { + errno = EBADF; + return -1; + } + else + { + if (level == SOL_SOCKET + && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)) + { + const struct timeval *tv = optval; + int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000; + optval = &milliseconds; + r = setsockopt (sock, level, optname, optval, sizeof (int)); + } + else + { + r = setsockopt (sock, level, optname, optval, optlen); + } + + if (r < 0) + set_winsock_errno (); + + return r; + } +} diff --git a/gnulib/import/socket.c b/gnulib/import/socket.c new file mode 100644 index 0000000..f5086ad --- /dev/null +++ b/gnulib/import/socket.c @@ -0,0 +1,53 @@ +/* socket.c --- wrappers for Windows socket function + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#include "sockets.h" + +/* Don't assume that UNICODE is defined. */ +#undef WSASocket +#define WSASocket WSASocketW + +int +rpl_socket (int domain, int type, int protocol) +{ + SOCKET fh; + + gl_sockets_startup (SOCKETS_1_1); + + /* We have to use WSASocket() to create non-overlapped IO sockets. + Overlapped IO sockets cannot be used with read/write. */ + fh = WSASocket (domain, type, protocol, NULL, 0, 0); + + if (fh == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + else + return SOCKET_TO_FD (fh); +} diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh index e5c6fd9..f0f8343 100755 --- a/gnulib/update-gnulib.sh +++ b/gnulib/update-gnulib.sh @@ -30,9 +30,12 @@ # The list of gnulib modules we are importing in GDB. IMPORTED_GNULIB_MODULES="\ + accept \ alloca \ + bind \ canonicalize-lgpl \ chown \ + connect \ count-one-bits \ dirent \ dirfd \ @@ -50,6 +53,7 @@ IMPORTED_GNULIB_MODULES="\ inttypes \ lstat \ limits-h \ + listen \ memchr \ memmem \ mkdir \ @@ -62,7 +66,9 @@ IMPORTED_GNULIB_MODULES="\ rename \ select \ setenv \ + setsockopt \ signal-h \ + socket \ strchrnul \ strerror_r-posix \ strstr \ -- cgit v1.1