2d995f2020-05-11Henrik Grubbström (Grubba) AC_INIT(file.cmod)
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_CONFIG_HEADER(file_machine.h)
e269811998-09-20Fredrik Hübinette (Hubbe) AC_MODULE_INIT()
5267b71995-08-09Fredrik Hübinette (Hubbe) 
bd051b1998-12-17Mirar (Pontus Hagland) AC_DEFINE(WITH_TERMIOS)
1c510f2020-01-20Henrik Grubbström (Grubba) AC_HAVE_HEADERS(sys/types.h sys/socket.h arpa/inet.h sys/socketvar.h pty.h \
5a65e42005-06-08Henrik Grubbström (Grubba)  netinet/in.h poll.h sys/poll.h sys/uio.h sys/mman.h linux/mman.h sys/time.h \
d275e52005-12-19Henrik Grubbström (Grubba)  sys/param.h sys/mount.h ustat.h sys/statfs.h sys/statvfs.h sys/vfs.h \
072be62009-05-27Henrik Grubbström (Grubba)  sys/stream.h sys/protosw.h netdb.h sys/sysproto.h winsock2.h ws2tcpip.h \
6abd862017-08-27Henrik Grubbström (Grubba)  direct.h sys/wait.h process.h sys/file.h net/netdb.h unistd.h sys/termios.h \
5a65e42005-06-08Henrik Grubbström (Grubba)  termios.h poll.h sys/poll.h sys/select.h sys/un.h netinet/tcp.h \
aad7642017-06-19Henrik Grubbström (Grubba)  sys/sendfile.h sys/ioctl.h linux/if.h linux/magic.h sys/xattr.h libzfs.h \
1c510f2020-01-20Henrik Grubbström (Grubba)  AvailabilityMacros.h sys/stropts.h,,,[
a3a2682005-06-18Henrik Grubbström (Grubba) /* Needed for <sys/socket.h> on FreeBSD 4.9. */ #include <sys/types.h>
5a65e42005-06-08Henrik Grubbström (Grubba) /* Needed for <sys/socketvar.h> on Solaris 10. */ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif
d275e52005-12-19Henrik Grubbström (Grubba) /* Needed for <sys/mount.h> on OpenBSD */ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif
5a65e42005-06-08Henrik Grubbström (Grubba) ])
5df5b42004-04-15Henrik Grubbström (Grubba) 
072be62009-05-27Henrik Grubbström (Grubba) if test "$ac_cv_header_winsock2_h" = "yes"; then :; else # Note: This header file interferes with winsock2.h. AC_CHECK_HEADERS(winsock.h) fi
b900da2008-02-18Henrik Grubbström (Grubba) # FIXME: Detect broken <sys/socketvar.h> on Solaris 10? # <sys/socketvar.h> includes <sys/zone.h>, which attempts to include # <sys/tsol/label.h>, which is only available if patch 120050 (sparc) # or patch 120051 (x86) has been applied.
5df5b42004-04-15Henrik Grubbström (Grubba) if test "x$ac_cv_header_sys_sendfile_h" = "xyes"; then AC_MSG_CHECKING([if <sys/sendfile.h> supports _FILE_OFFSET_BITS=64]) AC_CACHE_VAL(pike_cv_header_sys_sendfile_h, [ AC_TRY_CPP([ #define _FILE_OFFSET_BITS 64 #include <sys/sendfile.h> ], [ pike_cv_header_sys_sendfile_h=yes ], [ pike_cv_header_sys_sendfile_h=no ]) ]) AC_MSG_RESULT($pike_cv_header_sys_sendfile_h) if test "x$pike_cv_header_sys_sendfile_h" = "xno"; then AC_DEFINE(HAVE_BROKEN_SYS_SENDFILE_H) fi fi
1e8e5b2009-03-21Martin Stjernholm 
5df5b42004-04-15Henrik Grubbström (Grubba) 
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_HEADER_DIRENT AC_CHECK_LIB(socket, socket)
cae06e2003-04-22Marcus Comstedt AC_CHECK_LIB(nsl, gethostbyname)
5f0a822003-12-07Marcus Comstedt AC_CHECK_LIB(net, __get_socket_descriptor)
a38c6e2009-08-10Henrik Grubbström (Grubba) dnl AC_CHECK_LIB(zfs, libzfs_init)
6c61a91996-09-23Fredrik Hübinette (Hubbe) 
9cc1c32014-10-28Henrik Grubbström (Grubba) dnl GMP is required and tested for in Gmp module. We just want LIBS dnl updated here. This is needed in case the gmp library is not a dnl shared library. AC_CHECK_LIB(gmp, main)
c8f55e2020-02-18Henrik Grubbström (Grubba) AC_CHECK_LIB(util, openpty)
70f06d2018-04-23Henrik Grubbström (Grubba) AC_HAVE_FUNCS(readdir_r statvfs statfs ustat lseek64 lstat fsync \
0e49202003-05-15Marcus Comstedt  grantpt unlockpt ptsname posix_openpt socketpair writev sendfile munmap \
9811c42020-02-28Henrik Grubbström (Grubba)  openpty tcgetattr \
64e6d22018-04-25Henrik Grubbström (Grubba)  madvise poll setsockopt getprotobyname inet_ntoa \
81413e2005-10-05Ben Hutchings  inet_ntop execve listxattr flistxattr getxattr fgetxattr setxattr fsetxattr \
d9fe5e2013-11-05Per Hedbor  fdopendir pathconf fpathconf dirfd fstatat openat unlinkat kqueue access)
a38c6e2009-08-10Henrik Grubbström (Grubba) 
f171a72013-10-16Henrik Grubbström (Grubba) AC_MSG_CHECKING([whether IPPROTO_IPV6 exists]) AC_CACHE_VAL(pike_cv_have_IPPROTO_IPV6, [ AC_TRY_COMPILE([ // The WIN32 SDK hides the symbol if the API level is not at least 5.2. #define WIN32 100 #define _WIN32_WINDOWS 0x05ff #define _WIN32_WINNT 0x05ff #define NTDDI_VERSION 0x05ffffff #define WIN32_LEAN_AND_MEAN #define _GNU_SOURCE #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif ], [ int val = IPPROTO_IPV6; ], [ pike_cv_have_IPPROTO_IPV6=yes ], [ pike_cv_have_IPPROTO_IPV6=no ]) ]) if test "x$pike_cv_have_IPPROTO_IPV6" = "xyes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_IPPROTO_IPV6) else AC_MSG_RESULT(no) fi
a38c6e2009-08-10Henrik Grubbström (Grubba) dnl AC_HAVE_FUNCS(libzfs_init zfs_path_to_zhandle)
fe96de2008-07-10Henrik Grubbström (Grubba)  define(PIKE_CHECK_ZFS_ENUM, [ AC_MSG_CHECKING([if the $1 value $2 exists]) AC_CACHE_VAL(pike_cv_have_$2, [ AC_TRY_COMPILE([ #ifdef HAVE_LIBZFS_H #include <libzfs.h> #endif /* HAVE_LIBZFS_H */ ], [ $1 val = $2; ], [ pike_cv_have_$2=yes ], [ pike_cv_have_$2=no ]) ]) if test "x$pike_cv_have_$2" = "xyes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_$2) else AC_MSG_RESULT(no) fi ]) # Solaris 10 127112-05 doesn't have this value.
a38c6e2009-08-10Henrik Grubbström (Grubba) dnl PIKE_CHECK_ZFS_ENUM(zfs_prop_t, ZFS_PROP_UTF8ONLY)
7e72671999-04-20Henrik Grubbström (Grubba)  AC_FUNC_MMAP
a6cba12014-10-28Henrik Grubbström (Grubba) if test "x$ac_cv_func_dirfd" = "xyes"; then :; else # DIR.dd_fd is POSIX and X/OPEN. # DIR.d_fd is old Solaris. AC_MSG_CHECKING(if DIR has a dd_fd member) AC_CACHE_VAL(pike_cv_DIR_dd_fd, [ AC_TRY_COMPILE([ #include <sys/types.h> #include <dirent.h> ], [ DIR dir; dir.dd_fd = 0; ], [pike_cv_DIR_dd_fd=yes],[pike_cv_DIR_dd_fd=no]) ]) if test "$pike_cv_DIR_dd_fd" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DIR_DD_FD) else AC_MSG_RESULT(no) AC_MSG_CHECKING(if DIR has a d_fd member) AC_CACHE_VAL(pike_cv_DIR_d_fd, [ AC_TRY_COMPILE([ #include <sys/types.h> #include <dirent.h> ], [ DIR dir; dir.d_fd = 0; ], [pike_cv_DIR_d_fd=yes],[pike_cv_DIR_d_fd=no]) ]) if test "$pike_cv_DIR_d_fd" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DIR_D_FD) else AC_MSG_RESULT(no) fi fi fi
e60b072005-04-30Per Hedbor AC_MSG_CHECKING(if struct stat has a blocks member) AC_CACHE_VAL(pike_cv_struct_stat_blocks, [ AC_TRY_COMPILE([ #include <sys/stat.h> ], [ struct stat s; s.st_blocks = 10; s.st_blksize = 1024; ], [pike_cv_struct_stat_blocks=yes],[pike_cv_struct_stat_blocks=no]) ]) if test "$pike_cv_struct_stat_blocks" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRUCT_STAT_BLOCKS) else AC_MSG_RESULT(no) fi
75826e2014-07-29Per Hedbor AC_MSG_CHECKING(if struct stat has a st_atim member) AC_CACHE_VAL(pike_cv_struct_stat_atim, [ AC_TRY_COMPILE([ #include <sys/stat.h> ], [ struct stat s; s.st_atim.tv_sec = 10; s.st_atim.tv_nsec = 1000; ], [pike_cv_struct_stat_atim=yes],[pike_cv_struct_stat_atim=no]) ]) if test "$pike_cv_struct_stat_atim" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRUCT_STAT_NSEC) else AC_MSG_RESULT(no) fi
10db882009-07-23Henrik Grubbström (Grubba) AC_MSG_CHECKING([if struct sockaddr_un has a sun_len member (BSD)]) AC_CACHE_VAL(pike_cv_struct_sockaddr_un_sun_len, [ AC_TRY_COMPILE([ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif /* HAVE_SYS_SOCKET_H */ ], [ struct sockaddr_un addr; addr.sun_len = 10; ], [pike_cv_struct_sockaddr_un_sun_len=yes], [pike_cv_struct_sockaddr_un_sun_len=no]) ]) if test "$pike_cv_struct_sockaddr_un_sun_len" = "yes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN_SUN_LEN) else AC_MSG_RESULT(no) fi
7e72671999-04-20Henrik Grubbström (Grubba) if test "$ac_cv_func_sendfile" = "yes"; then
fe96de2008-07-10Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if sendfile takes 4(Linux) or 6(HP/UX or MacOS X) or 7(FreeBSD) arguments)
f6721f1999-06-23Henrik Grubbström (Grubba)  AC_CACHE_VAL(pike_cv_sendfile_args, [
7e72671999-04-20Henrik Grubbström (Grubba)  AC_TRY_COMPILE([ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif /* HAVE_SYS_UIO_H */ ], [ return sendfile(0,0,0,0,(void *)0,(void *)0,0); ], [ # Probably FreeBSD-style, but we need to check that # we indeed have a prototype... AC_TRY_COMPILE([ #include <sys/types.h>
0a00832000-04-11Henrik Grubbström (Grubba) #ifdef HAVE_SYS_SOCKET_H
7e72671999-04-20Henrik Grubbström (Grubba) #include <sys/socket.h>
0a00832000-04-11Henrik Grubbström (Grubba) #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_SYS_UIO_H
7e72671999-04-20Henrik Grubbström (Grubba) #include <sys/uio.h>
0a00832000-04-11Henrik Grubbström (Grubba) #endif /* HAVE_SYS_UIO_H */
7e72671999-04-20Henrik Grubbström (Grubba)  ], [
f6721f1999-06-23Henrik Grubbström (Grubba)  /* This should fail on FreeBSD and HPUX.
fe96de2008-07-10Henrik Grubbström (Grubba)  * If it succeeds, we do not have a prototype,
7e72671999-04-20Henrik Grubbström (Grubba)  * which would indicate Linux. */ return sendfile(0,0,(void *)0,0);
f6721f1999-06-23Henrik Grubbström (Grubba)  ], [ pike_cv_sendfile_args=4 ], [ pike_cv_sendfile_args=7 ]) ], [ AC_TRY_COMPILE([ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif /* HAVE_SYS_SOCKET_H */ #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif /* HAVE_SYS_UIO_H */ ], [ /* Try HPUX */ return (int)sendfile(0,0,0,0,(void *)0,0); ], [ pike_cv_sendfile_args=6 ], [ pike_cv_sendfile_args=4 ]) ])
7e72671999-04-20Henrik Grubbström (Grubba)  ])
f6721f1999-06-23Henrik Grubbström (Grubba)  if test "$pike_cv_sendfile_args" = "7"; then
7e72671999-04-20Henrik Grubbström (Grubba)  AC_MSG_RESULT([7 - FreeBSD style]) AC_DEFINE(HAVE_FREEBSD_SENDFILE)
76c1f02000-03-21Henrik Grubbström (Grubba)  AC_MSG_CHECKING([if sendfile looks thread-safe]) AC_CACHE_VAL(pike_cv_freebsd_sendfile_threadsafe, [ # We're optimistic -- default to assuming it works. pike_cv_freebsd_sendfile_threadsafe="yes" if test -f /usr/lib/libc_r.so; then
fcbcde2000-03-21Henrik Grubbström (Grubba)  if /usr/bin/nm -D /usr/lib/libc_r.so 2>&1 | grep _thread_sys >/dev/null 2>&1; then
76c1f02000-03-21Henrik Grubbström (Grubba)  # Ok, looks like we can perform the test. # Assume we have a broken sendfile(2).
76b4932000-03-22Henrik Grubbström (Grubba)  pike_cv_freebsd_sendfile_threadsafe="no"
fcbcde2000-03-21Henrik Grubbström (Grubba)  if /usr/bin/nm -D /usr/lib/libc_r.so 2>&1 | grep _thread_sys_sendfile >/dev/null 2>&1; then
76c1f02000-03-21Henrik Grubbström (Grubba)  # Wee! They have actually added a wrapper for sendfile(2)! pike_cv_freebsd_sendfile_threadsafe="yes" else :; fi else :; fi else :; fi ]) if test "$pike_cv_freebsd_sendfile_threadsafe" = "yes"; then AC_MSG_RESULT(yes)
b78cc62008-12-17Henrik Grubbström (Grubba)  AC_MSG_CHECKING([whether headers count to the filelength]) AC_CACHE_VAL(pike_cv_new_freebsd_sendfile, [ # FIXME: Ought to do a proper test of whether # headers affect the file length or not. pike_cv_new_freebsd_sendfile="unknown" case "x$pike_cv_sys_os" in xFreeBSD*) pike_cv_new_freebsd_sendfile="yes"
1e8e5b2009-03-21Martin Stjernholm  # The behaviour was fixed in FreeBSD 5.0.
b78cc62008-12-17Henrik Grubbström (Grubba)  if test `uname -r | awk -F. '{print $1}'` -lt 5; then pike_cv_new_freebsd_sendfile="no" fi ;; esac ]) AC_MSG_RESULT($pike_cv_new_freebsd_sendfile) if test "x$pike_cv_new_freebsd_sendfile" = "xno"; then AC_DEFINE(HAVE_SENDFILE_HEADER_LEN_PROBLEM) fi
76c1f02000-03-21Henrik Grubbström (Grubba)  else AC_MSG_RESULT(no - disabling use of sendfile) AC_DEFINE(HAVE_BROKEN_SENDFILE) fi
7e72671999-04-20Henrik Grubbström (Grubba)  else
f6721f1999-06-23Henrik Grubbström (Grubba)  if test "$pike_cv_sendfile_args" = "6"; then
fe96de2008-07-10Henrik Grubbström (Grubba)  AC_MSG_RESULT([6 - HP/UX or MacOS X style]) # FIXME: Detect whether HPUX: # sbsize_t sendfile(int from, int to, off_t off, bsize_t bytes, # struct iovec *hdtrl, int flags) # or MacOS X: # int sendfile(int to, int from, off_t off, off_t *bytes, # struct sf_hdtrl *hdtrl, int flags) AC_MSG_CHECKING(struct sf_hdtr) AC_CACHE_VAL(pike_cv_has_struct_sf_hdtr, [ AC_TRY_LINK([ #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif ], [ struct sf_hdtr foo; ], [ pike_cv_has_struct_sf_hdtr=yes ], [ pike_cv_has_struct_sf_hdtr=no ]) ]) if test "$pike_cv_has_struct_sf_hdtr" = "yes"; then AC_MSG_RESULT(yes - MacOS X) AC_DEFINE(HAVE_MACOSX_SENDFILE)
b78cc62008-12-17Henrik Grubbström (Grubba)  # MacOS X sendfile() has the bug from FreeBSD 4.x and earlier. # FIXME: Ought to do a proper test of whether # headers affect the file length or not. AC_DEFINE(HAVE_SENDFILE_HEADER_LEN_PROBLEM)
fe96de2008-07-10Henrik Grubbström (Grubba)  else AC_MSG_RESULT(no - HPUX) AC_DEFINE(HAVE_HPUX_SENDFILE) fi
f6721f1999-06-23Henrik Grubbström (Grubba)  else AC_MSG_RESULT([4 - Linux style]) fi
7e72671999-04-20Henrik Grubbström (Grubba)  fi else : fi
bdfb861997-12-22Fredrik Hübinette (Hubbe) 
c8bbef2005-05-31H. William Welliver III if test x$ac_cv_func_getxattr = xyes ; then AC_MSG_CHECKING(if getxattr takes 4(Linux) or 6(Darwin) arguments) AC_CACHE_VAL(pike_cv_func_darwin_getxattr, [ AC_TRY_COMPILE([
23b3592005-06-01Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
c8bbef2005-05-31H. William Welliver III #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
c8bbef2005-05-31H. William Welliver III #include <sys/types.h> #ifdef HAVE_SYS_XATTR_H #include <sys/xattr.h> #endif
23b3592005-06-01Henrik Grubbström (Grubba)  ], [ exit(0);
c8bbef2005-05-31H. William Welliver III 
23b3592005-06-01Henrik Grubbström (Grubba)  /* NOT REACHED */ getxattr(0, 0, 0, 0, 0, 0); ], [ AC_TRY_COMPILE([ #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */ #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
23b3592005-06-01Henrik Grubbström (Grubba) #include <sys/types.h> #ifdef HAVE_SYS_XATTR_H #include <sys/xattr.h> #endif ], [ exit(0); /* NOT REACHED */ getxattr(0, 0, 0, 0); ], [ # Missing prototype. pike_cv_func_darwin_getxattr=unknown ], [ pike_cv_func_darwin_getxattr=yes ]) ], [ pike_cv_func_darwin_getxattr=no ])
c8bbef2005-05-31H. William Welliver III  ]) if test x$pike_cv_func_darwin_getxattr = xyes ; then
23b3592005-06-01Henrik Grubbström (Grubba)  AC_MSG_RESULT(6 - Darwin) AC_DEFINE(HAVE_DARWIN_XATTR) elif test x$pike_cv_func_darwin_getxattr = xno ; then
c8bbef2005-05-31H. William Welliver III  AC_MSG_RESULT(4 - Linux)
23b3592005-06-01Henrik Grubbström (Grubba)  else AC_MSG_RESULT(Unknown - Missing prototype)
c8bbef2005-05-31H. William Welliver III  fi fi
3851261997-01-23Henrik Grubbström (Grubba) if test x$ac_cv_func_readdir_r = xyes ; then
5f3bc11999-06-25Per Hedbor  AC_MSG_CHECKING(if readdir_r takes 2(old Solaris & HPUX) or 3(Posix) arguments)
3851261997-01-23Henrik Grubbström (Grubba)  AC_CACHE_VAL(pike_cv_func_posix_readdir_r, [
763b581998-05-22Henrik Grubbström (Grubba)  AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
b8a0281997-12-05Henrik Grubbström (Grubba) /* For _REENTRANT */
dae4d02003-05-14Marcus Comstedt #include "../../machine.h"
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
f5cf311998-07-16Fredrik Hübinette (Hubbe) #include <sys/types.h>
3851261997-01-23Henrik Grubbström (Grubba) #ifdef HAVE_DIRENT_H #include <dirent.h> #else #ifdef HAVE_SYS_NDIR_H #include <sys/ndir.h> #endif #ifdef HAVE_SYS_DIR_H #include <sys/dir.h> #endif #ifdef HAVE_NDIR_H #include <ndri.h> #endif #endif
a40d3a1997-06-13Henrik Grubbström (Grubba) #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif
763b581998-05-22Henrik Grubbström (Grubba) ], [
3851261997-01-23Henrik Grubbström (Grubba)  exit(0); /* NOT REACHED */ readdir_r((DIR *)0, (struct dirent *)0); ],pike_cv_func_posix_readdir_r=no,pike_cv_func_posix_readdir_r=yes) ]) if test x$pike_cv_func_posix_readdir_r = xyes ; then AC_MSG_RESULT(3 - POSIX)
264d061998-07-06Henrik Grubbström (Grubba)  # Linux libc 5 has a broken POSIX readdir_r(). # It always returns 9 (EBADF). AC_MSG_CHECKING(if readdir_r works) AC_CACHE_VAL(pike_cv_func_working_posix_readdir_r, [ AC_TRY_RUN([ #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
264d061998-07-06Henrik Grubbström (Grubba) /* For _REENTRANT */
dae4d02003-05-14Marcus Comstedt #include "../../machine.h"
264d061998-07-06Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
264d061998-07-06Henrik Grubbström (Grubba) #include <sys/errno.h> #ifdef HAVE_DIRENT_H #include <dirent.h> #else #ifdef HAVE_SYS_NDIR_H #include <sys/ndir.h> #endif #ifdef HAVE_SYS_DIR_H #include <sys/dir.h> #endif #ifdef HAVE_NDIR_H #include <ndri.h> #endif #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif extern int errno; int main() { DIR *dir = opendir("."); char tmp[1024]; struct dirent *d; int retval; if (!dir) { /* Failed to open dir */ exit(1); } retval = readdir_r(dir, (struct dirent *)tmp, &d); if (!retval) { /* OK, got an entry */ exit(0); } if (retval == -1) { /* Solaris returns -1 instead of errno */ retval = errno; } if (retval == ENOENT) { /* No entries left */ exit(0); } exit(retval); } ], pike_cv_func_working_posix_readdir_r=yes, pike_cv_func_working_posix_readdir_r=no, pike_cv_func_working_posix_readdir_r=no) ]) if test x$pike_cv_func_working_posix_readdir_r = xyes ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_POSIX_READDIR_R) else AC_MSG_RESULT(no) fi
3851261997-01-23Henrik Grubbström (Grubba) else AC_MSG_RESULT(2) AC_MSG_CHECKING(if readdir_r returns an int(HPUX) or a pointer(Solaris)) AC_CACHE_VAL(pike_cv_func_solaris_style_readdir_r, [ AC_TRY_RUN([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
b8a0281997-12-05Henrik Grubbström (Grubba) /* For _REENTRANT */
dae4d02003-05-14Marcus Comstedt #include "../../machine.h"
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
3851261997-01-23Henrik Grubbström (Grubba) #include <sys/errno.h> #ifdef HAVE_DIRENT_H #include <dirent.h> #else #ifdef HAVE_SYS_NDIR_H #include <sys/ndir.h> #endif #ifdef HAVE_SYS_DIR_H #include <sys/dir.h> #endif #ifdef HAVE_NDIR_H #include <ndri.h> #endif #endif
a40d3a1997-06-13Henrik Grubbström (Grubba) #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif
3851261997-01-23Henrik Grubbström (Grubba)  extern int errno; int main() { DIR *dir = opendir("."); char tmp[1024]; unsigned long retval; retval = (unsigned long) readdir_r(dir, (struct dirent *)tmp); if (retval == (unsigned long)tmp) { /* Solaris */ exit(0); } else if (retval == ~0UL) { /* HPUX */ exit(1); } else if (!retval) { if (!errno) { /* HPUX */ exit(1); } else { /* Solaris */ exit(0); } } else { /* Unknown, but probably Solaris */ exit(0); } }
bb2da11998-06-28Henrik Grubbström (Grubba) ],pike_cv_func_solaris_style_readdir_r=yes, pike_cv_func_solaris_style_readdir_r=no,
fc5b321998-06-28Henrik Grubbström (Grubba)  pike_cv_func_solaris_style_readdir_r=unknown)
3851261997-01-23Henrik Grubbström (Grubba)  ]) if test x$pike_cv_func_solaris_style_readdir_r = xyes ; then AC_MSG_RESULT(Solaris style) AC_DEFINE(HAVE_SOLARIS_READDIR_R) else
bb2da11998-06-28Henrik Grubbström (Grubba)  if test x$pike_cv_func_solaris_style_readdir_r = xno ; then AC_MSG_RESULT(HPUX style) AC_DEFINE(HAVE_HPUX_READDIR_R) else AC_MSG_RESULT(Unknown) fi
3851261997-01-23Henrik Grubbström (Grubba)  fi fi else :; fi
0285f11998-05-17Henrik Grubbström (Grubba) if test x$ac_cv_func_statvfs = xyes ; then AC_MSG_CHECKING(if the struct statvfs exists) AC_CACHE_VAL(pike_cv_struct_statvfs, [ AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0285f11998-05-17Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #include <sys/types.h> #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statfs st; ], [ pike_cv_struct_statvfs=yes ], [ pike_cv_struct_statvfs=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statvfs) if test x$pike_cv_struct_statvfs = xyes; then AC_DEFINE(HAVE_STRUCT_STATVFS)
b42e3a1999-02-15Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if the struct statvfs has the member f_fstr) AC_CACHE_VAL(pike_cv_struct_statvfs_f_fstr, [ AC_TRY_COMPILE([ #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */ #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statvfs st; st.f_fstr[0] = 0; ], [ pike_cv_struct_statvfs_f_fstr=yes ], [ pike_cv_struct_statvfs_f_fstr=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statvfs_f_fstr)
5f3bc11999-06-25Per Hedbor  if test x$pike_cv_struct_statvfs_f_fstr = xyes; then
b42e3a1999-02-15Henrik Grubbström (Grubba)  AC_DEFINE(HAVE_STATVFS_F_FSTR) else :; fi
5f3bc11999-06-25Per Hedbor 
5d94331999-08-19Fredrik Hübinette (Hubbe) ###############################################################
5f3bc11999-06-25Per Hedbor  AC_MSG_CHECKING(if the struct statvfs has the member f_basetype)
0285f11998-05-17Henrik Grubbström (Grubba)  AC_CACHE_VAL(pike_cv_struct_statvfs_f_basetype, [ AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0285f11998-05-17Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statvfs st;
b42e3a1999-02-15Henrik Grubbström (Grubba)  st.f_basetype[0] = 0;
0285f11998-05-17Henrik Grubbström (Grubba)  ], [ pike_cv_struct_statvfs_f_basetype=yes ], [ pike_cv_struct_statvfs_f_basetype=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statvfs_f_basetype)
5f3bc11999-06-25Per Hedbor  if test x$pike_cv_struct_statvfs_f_basetype = xyes; then
0285f11998-05-17Henrik Grubbström (Grubba)  AC_DEFINE(HAVE_STATVFS_F_BASETYPE) else :; fi
5d94331999-08-19Fredrik Hübinette (Hubbe)  ###############################################################
0285f11998-05-17Henrik Grubbström (Grubba)  else :; fi else :; fi
06b9a31997-06-01Henrik Grubbström (Grubba) if test x$ac_cv_func_statfs = xyes ; then
a40d3a1997-06-13Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if statfs takes 2(BSD) or 4(SysV) arguments) AC_CACHE_VAL(pike_cv_func_sysv_statfs, [
763b581998-05-22Henrik Grubbström (Grubba)  AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
e812332021-01-04Marcus Comstedt #include <stdlib.h>
a40d3a1997-06-13Henrik Grubbström (Grubba) #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif
f35a831997-06-02Henrik Grubbström (Grubba) #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h>
06b9a31997-06-01Henrik Grubbström (Grubba) #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif
a40d3a1997-06-13Henrik Grubbström (Grubba) #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif
f35a831997-06-02Henrik Grubbström (Grubba) #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h>
3b29751997-06-02Henrik Grubbström (Grubba) #endif
763b581998-05-22Henrik Grubbström (Grubba) ], [
06b9a31997-06-01Henrik Grubbström (Grubba)  exit(0); /* NOT REACHED */
eaab0d1998-05-17Henrik Grubbström (Grubba)  /* NOTE: * If there isn't any prototype for statfs this will succeed even * on BSDs. This doesn't matter since the first two arguments are * the same on both BSD and SysV. * /grubba 1998-05-17 */
a40d3a1997-06-13Henrik Grubbström (Grubba)  statfs((char *)0, (struct statfs *)0, 0, 0); ],pike_cv_func_sysv_statfs=yes,pike_cv_func_sysv_statfs=no)
06b9a31997-06-01Henrik Grubbström (Grubba)  ])
a40d3a1997-06-13Henrik Grubbström (Grubba)  if test x$pike_cv_func_sysv_statfs = xyes ; then
eaab0d1998-05-17Henrik Grubbström (Grubba)  AC_MSG_RESULT([SysV style, or no prototype])
a40d3a1997-06-13Henrik Grubbström (Grubba)  AC_DEFINE(HAVE_SYSV_STATFS)
06b9a31997-06-01Henrik Grubbström (Grubba)  else
a40d3a1997-06-13Henrik Grubbström (Grubba)  AC_MSG_RESULT(BSD style)
06b9a31997-06-01Henrik Grubbström (Grubba)  fi
4870d71997-12-02Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if the struct statfs exists) AC_CACHE_VAL(pike_cv_struct_statfs, [
06b9a31997-06-01Henrik Grubbström (Grubba)  AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
a40d3a1997-06-13Henrik Grubbström (Grubba) #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif
3b29751997-06-02Henrik Grubbström (Grubba) #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif
244e4d1997-06-02Henrik Grubbström (Grubba) #include <sys/stat.h>
f35a831997-06-02Henrik Grubbström (Grubba) #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h>
06b9a31997-06-01Henrik Grubbström (Grubba) #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h>
0106371997-06-02Henrik Grubbström (Grubba) #endif
f35a831997-06-02Henrik Grubbström (Grubba) #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h>
06b9a31997-06-01Henrik Grubbström (Grubba) #endif ], [
3b29751997-06-02Henrik Grubbström (Grubba)  struct statfs st;
4870d71997-12-02Henrik Grubbström (Grubba)  ], [ pike_cv_struct_statfs=yes ], [ pike_cv_struct_statfs=no
3b29751997-06-02Henrik Grubbström (Grubba)  ])
06b9a31997-06-01Henrik Grubbström (Grubba)  ])
4870d71997-12-02Henrik Grubbström (Grubba)  AC_MSG_RESULT($pike_cv_struct_statfs) if test x$pike_cv_struct_statfs = xyes; then AC_DEFINE(HAVE_STRUCT_STATFS)
5f3bc11999-06-25Per Hedbor  AC_MSG_CHECKING(if the struct statfs has the member f_fsid) AC_CACHE_VAL(pike_cv_struct_statfs_f_fsid, [ AC_TRY_COMPILE([ #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */ #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statfs st; st.f_fsid = 0; ], [ pike_cv_struct_statfs_f_fsid=yes ], [ pike_cv_struct_statfs_f_fsid=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statfs_f_fsid) if test x$pike_cv_struct_statfs_f_fsid = xyes; then AC_DEFINE(HAVE_STATFS_F_FSID) else :; fi
4870d71997-12-02Henrik Grubbström (Grubba)  AC_MSG_CHECKING(if the struct statfs has the member f_bavail) AC_CACHE_VAL(pike_cv_struct_statfs_f_bavail, [ AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
4870d71997-12-02Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statfs st; st.f_bavail = 0; ], [ pike_cv_struct_statfs_f_bavail=yes ], [ pike_cv_struct_statfs_f_bavail=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statfs_f_bavail) if test x$pike_cv_struct_statfs_f_bavail = xyes; then AC_DEFINE(HAVE_STATFS_F_BAVAIL) else :; fi
968cc52017-07-12William Welliver  AC_MSG_CHECKING(if the struct statfs has the member f_fstypename) AC_CACHE_VAL(pike_cv_struct_statfs_f_fstypename, [ AC_TRY_COMPILE([ #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */ #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [ struct statfs st; char * x = st.f_fstypename; ], [ pike_cv_struct_statfs_f_fstypename=yes ], [ pike_cv_struct_statfs_f_fstypename=no ]) ]) AC_MSG_RESULT($pike_cv_struct_statfs_f_fstypename) if test x$pike_cv_struct_statfs_f_fstypename = xyes; then AC_DEFINE(HAVE_STATFS_F_FSTYPENAME) else :; fi
4870d71997-12-02Henrik Grubbström (Grubba)  else # No struct statfs. We might be running ULTRIX, # so check for struct fs_data. AC_MSG_CHECKING(if the struct fs_data exists) AC_CACHE_VAL(pike_cv_struct_fs_data, [ AC_TRY_COMPILE([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
4870d71997-12-02Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #ifdef HAVE_SYS_SYSPROTO_H #include <sys/sysproto.h> #endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include <sys/stat.h> #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif #ifdef HAVE_SYS_MOUNT_H #include <sys/mount.h> #endif ], [
1107921997-12-02Henrik Grubbström (Grubba)  struct fs_data st;
4870d71997-12-02Henrik Grubbström (Grubba)  ], [ pike_cv_struct_fs_data=yes ], [ pike_cv_struct_fs_data=no ]) ]) AC_MSG_RESULT($pike_cv_struct_fs_data) if test x$pike_cv_struct_fs_data = xyes; then AC_DEFINE(HAVE_STRUCT_FS_DATA) else :; fi fi
06b9a31997-06-01Henrik Grubbström (Grubba) else :; fi
72ef221996-09-23Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(for working (and failsafe) strerror)
2263341996-09-23Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_func_failsafe_strerror,
72ef221996-09-23Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <stdio.h> #include <string.h>
e812332021-01-04Marcus Comstedt #include <stdlib.h>
72ef221996-09-23Fredrik Hübinette (Hubbe) int main() { int e; char *s;
2263341996-09-23Fredrik Hübinette (Hubbe)  for(e=0;e<256;e++) if(strerror(e)) if(strerror(e)[0]=='\b') exit(1);
72ef221996-09-23Fredrik Hübinette (Hubbe)  exit(0); }
2bf5561998-06-28Henrik Grubbström (Grubba) ],pike_cv_func_failsafe_strerror=yes,pike_cv_func_failsafe_strerror=no, pike_cv_func_failsafe_strerror=no)
72ef221996-09-23Fredrik Hübinette (Hubbe) ])
2263341996-09-23Fredrik Hübinette (Hubbe) if test "$pike_cv_func_failsafe_strerror" = yes; then
72ef221996-09-23Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRERROR) else AC_MSG_RESULT(no) fi
151d451997-05-19Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(for select on AF_UNIX sockets) AC_CACHE_VAL(pike_cv_select_on_unix_sockets, [ AC_TRY_RUN([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
151d451997-05-19Fredrik Hübinette (Hubbe) #include <stdio.h>
e812332021-01-04Marcus Comstedt #include <stdlib.h>
151d451997-05-19Fredrik Hübinette (Hubbe) #include <sys/types.h> #include <sys/wait.h> #include <netinet/in.h> #include <errno.h>
91be7e1998-08-07Henrik Grubbström (Grubba) #ifdef HAVE_UNISTD_H
71b9c11997-05-19Fredrik Hübinette (Hubbe) #include <unistd.h>
91be7e1998-08-07Henrik Grubbström (Grubba) #endif
71b9c11997-05-19Fredrik Hübinette (Hubbe) #include <sys/time.h>
151d451997-05-19Fredrik Hübinette (Hubbe) #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif
4bc7dd1997-05-20Henrik Grubbström (Grubba) #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif
151d451997-05-19Fredrik Hübinette (Hubbe)  int main() { fd_set tmp;
8836821997-06-02Fredrik Hübinette (Hubbe)  struct timeval foo;
151d451997-05-19Fredrik Hübinette (Hubbe)  int fds[2];
7d66951997-09-15Fredrik Hübinette (Hubbe)  char x;
8836821997-06-02Fredrik Hübinette (Hubbe) 
5c71731997-09-15Fredrik Hübinette (Hubbe)  if(socketpair(AF_UNIX, SOCK_STREAM, 0, fds)<0) { fprintf(stderr,"socketpair() failed\n"); exit(1); } if(shutdown(fds[1],1)) { fprintf(stderr,"shutdown failed\n"); exit(9); }
1e8e5b2009-03-21Martin Stjernholm 
5c71731997-09-15Fredrik Hübinette (Hubbe)  if(shutdown(fds[0],1)) { fprintf(stderr,"shutdown failed\n"); exit(9); } close(fds[0]); foo.tv_sec=5; foo.tv_usec=0; FD_ZERO(&tmp); FD_SET(fds[1], &tmp); if(select(fds[1]+1,&tmp, 0,0,&foo)<=0) { fprintf(stderr,"select() does report closed sockets properly\n"); exit(2); } if(!FD_ISSET(fds[1], &tmp)) { fprintf(stderr,"FD_ISSET does not report closed sockets properly\n"); exit(3); }
151d451997-05-19Fredrik Hübinette (Hubbe)  if(socketpair(AF_UNIX, SOCK_STREAM, 0, fds)<0) exit(1);
7d66951997-09-15Fredrik Hübinette (Hubbe)  foo.tv_sec=1; foo.tv_usec=0; FD_ZERO(&tmp); FD_SET(fds[1], &tmp); if(select(fds[1]+1,&tmp, 0,0,&foo)>0) { fprintf(stderr,"select() always falls through\n"); exit(4); }
5c71731997-09-15Fredrik Hübinette (Hubbe)  if(write(fds[0],"x",1)!=1) { fprintf(stderr,"write() failed\n"); exit(1); }
1e8e5b2009-03-21Martin Stjernholm 
7d66951997-09-15Fredrik Hübinette (Hubbe)  foo.tv_sec=1; foo.tv_usec=0; FD_ZERO(&tmp); FD_SET(fds[1], &tmp); if(select(fds[1]+1,&tmp, 0,0,&foo)<=0) { fprintf(stderr,"select() never falls through\n"); exit(5); }
1e8e5b2009-03-21Martin Stjernholm 
7d66951997-09-15Fredrik Hübinette (Hubbe)  if(!FD_ISSET(fds[1], &tmp)) { fprintf(stderr,"select() does not modify read set properly\n"); exit(6); }
5c71731997-09-15Fredrik Hübinette (Hubbe)  if(read(fds[1], &x, 1)!=1) { fprintf(stderr,"read() failed\n"); exit(1); }
7d66951997-09-15Fredrik Hübinette (Hubbe) 
5c71731997-09-15Fredrik Hübinette (Hubbe)  if(shutdown(fds[0],1)) { fprintf(stderr,"socketpair() failed\n"); exit(1); }
8836821997-06-02Fredrik Hübinette (Hubbe) 
5c71731997-09-15Fredrik Hübinette (Hubbe)  foo.tv_sec=1;
8836821997-06-02Fredrik Hübinette (Hubbe)  foo.tv_usec=0;
151d451997-05-19Fredrik Hübinette (Hubbe)  FD_ZERO(&tmp); FD_SET(fds[1], &tmp);
5c71731997-09-15Fredrik Hübinette (Hubbe) 
8836821997-06-02Fredrik Hübinette (Hubbe)  if(select(fds[1]+1,&tmp, 0,0,&foo)<=0)
7d66951997-09-15Fredrik Hübinette (Hubbe)  {
5c71731997-09-15Fredrik Hübinette (Hubbe)  fprintf(stderr,"select() does not report shutdown()\n"); exit(7);
7d66951997-09-15Fredrik Hübinette (Hubbe)  }
1e8e5b2009-03-21Martin Stjernholm 
8836821997-06-02Fredrik Hübinette (Hubbe)  if(!FD_ISSET(fds[1], &tmp))
7d66951997-09-15Fredrik Hübinette (Hubbe)  {
4e6ea71997-09-17Henrik Grubbström (Grubba)  fprintf(stderr,"select() does not modify read set properly on shutdown()\n");
5c71731997-09-15Fredrik Hübinette (Hubbe)  exit(8);
7d66951997-09-15Fredrik Hübinette (Hubbe)  }
8836821997-06-02Fredrik Hübinette (Hubbe)  exit(0);
151d451997-05-19Fredrik Hübinette (Hubbe) }
8836821997-06-02Fredrik Hübinette (Hubbe) 
2bf5561998-06-28Henrik Grubbström (Grubba) ],pike_cv_select_on_unix_sockets=yes,pike_cv_select_on_unix_sockets=no, pike_cv_select_on_unix_sockets=no)
151d451997-05-19Fredrik Hübinette (Hubbe) ]) AC_MSG_RESULT($pike_cv_select_on_unix_sockets) if test x$pike_cv_select_on_unix_sockets = xyes ; then
bcf9461998-01-27Fredrik Hübinette (Hubbe)  AC_DEFINE(UNIX_SOCKETS_WORKS_WITH_SHUTDOWN)
151d451997-05-19Fredrik Hübinette (Hubbe) fi
72ef221996-09-23Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(size of socket buffers)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_socket_buffer_max,
5267b71995-08-09Fredrik Hübinette (Hubbe) [
c6f4a82002-01-27Martin Stjernholm if test "x$enable_binary" = "xno"; then pike_cv_socket_buffer_max=0 else
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_TRY_RUN([
97f5f01998-05-24Henrik Grubbström (Grubba) #ifndef _LARGEFILE_SOURCE # define _FILE_OFFSET_BITS 64 # define _LARGEFILE_SOURCE # define _LARGEFILE64_SOURCE 1 #endif
4631091998-07-24Henrik Grubbström (Grubba) /* HPUX needs these too... */ #ifndef __STDC_EXT__ # define __STDC_EXT__ #endif /* !__STDC_EXT__ */
0ae2441997-10-15Henrik Grubbström (Grubba) #ifndef POSIX_SOURCE #define POSIX_SOURCE #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) #include <stdio.h> #include <sys/types.h> #include <sys/param.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <sys/wait.h> #include <sys/socket.h> int main() { FILE *f; int fd, try, tmp; fd=socket(AF_INET, SOCK_STREAM, 0); if(fd < 0) return 1; try=1024; while(try < 65000) { tmp=try*2; if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&tmp, sizeof(int)) < 0) { break; } try*=2; } f=fopen("conftest.out.2","w"); fprintf(f,"%d\n",try); fclose(f);
1e8e5b2009-03-21Martin Stjernholm 
5267b71995-08-09Fredrik Hübinette (Hubbe)  return 0; }],
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_socket_buffer_max=`cat conftest.out.2`
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
2bf5561998-06-28Henrik Grubbström (Grubba) pike_cv_socket_buffer_max=0,
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_socket_buffer_max=0
c6f4a82002-01-27Martin Stjernholm ) fi ])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_DEFINE_UNQUOTED(SOCKET_BUFFER_MAX,$pike_cv_socket_buffer_max) AC_MSG_RESULT($pike_cv_socket_buffer_max)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
0e49202003-05-15Marcus Comstedt AC_MSG_CHECKING(for pty master device) AC_CACHE_VAL(pike_cv_pty_master_pathname, [ pike_cv_pty_master_pathname=no for i in ptmx ptc; do if test -c /dev/$i; then pike_cv_pty_master_pathname="/dev/$i" break else : fi done ]) AC_MSG_RESULT($pike_cv_pty_master_pathname) if test no = "$pike_cv_pty_master_pathname"; then : else AC_DEFINE_UNQUOTED(PTY_MASTER_PATHNAME, "$pike_cv_pty_master_pathname") fi
da2e892003-05-14Marcus Comstedt if test yes = "$ac_cv_func_grantpt"; then pt_chmod_dirs="" case "$pike_cv_sys_os" in
8cd13a2003-05-15Marcus Comstedt  Solaris|HP-UX|OSF1) pt_chmod_dirs="/lib /usr/lib /lbin /usr/lbin" ;;
da2e892003-05-14Marcus Comstedt  esac if test x = x"$pt_chmod_dirs"; then : else
791dab2003-07-03Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for pt_chmod since OS is $pike_cv_sys_os)
da2e892003-05-14Marcus Comstedt  AC_CACHE_VAL(pike_cv_pt_chmod_path, [ pike_cv_pt_chmod_path=no for i in $pt_chmod_dirs; do
791dab2003-07-03Henrik Grubbström (Grubba)  if test -x ${i}/pt_chmod; then pike_cv_pt_chmod_path="${i}/pt_chmod"
da2e892003-05-14Marcus Comstedt  break
791dab2003-07-03Henrik Grubbström (Grubba)  else : fi
da2e892003-05-14Marcus Comstedt  done ]) AC_MSG_RESULT($pike_cv_pt_chmod_path)
e063db2003-05-16Henrik Grubbström (Grubba)  if test no = "$pike_cv_pt_chmod_path"; then
da2e892003-05-14Marcus Comstedt  : else AC_DEFINE_UNQUOTED(USE_PT_CHMOD,"$pike_cv_pt_chmod_path") fi
791dab2003-07-03Henrik Grubbström (Grubba)  AC_MSG_CHECKING(for chgpt since OS is $pike_cv_sys_os) AC_CACHE_VAL(pike_cv_chgpt_path, [ pike_cv_chgpt_path=no for i in $pt_chmod_dirs; do if test -x ${i}/chgpt; then
41e64c2003-07-04Henrik Grubbström (Grubba)  pike_cv_chgpt_path="${i}/chgpt"
791dab2003-07-03Henrik Grubbström (Grubba)  break else : fi done ]) AC_MSG_RESULT($pike_cv_chgpt_path) if test no = "$pike_cv_chgpt_path"; then : else AC_DEFINE_UNQUOTED(USE_CHGPT,"$pike_cv_chgpt_path") fi
da2e892003-05-14Marcus Comstedt  fi else : fi
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_OUTPUT(Makefile,echo FOO >stamp-h )