# Checks for library functions
AC_CHECK_FUNCS([lrand48 drand48 srand48 setmode setenv getenv \
- cbrt vsnprintf _NSGetEnviron mallopt mallinfo mstats getpagesize])
+ cbrt vsnprintf _NSGetEnviron mallopt mallinfo mstats getpagesize \
+ ftruncate lseek64 stat64 vfork unlink waitpid select])
AC_REPLACE_FUNCS([strcasecmp strncasecmp strcasestr])
# Converted to sfio v10/01/94 by Giampiero Sierra (06/08/95).
##################################################################
-lib ftruncate
-
-lib lseek64
-lib stat64
typ off64_t
typ struct_stat64 compile{
#include <sys/types.h>
}
}end
-
-##################################################
-# vfork and any associated header files
-##################################################
-
-lib vfork
-
##################################################
# file control checks
##################################################
-lib remove
-lib unlink
-lib waitpid
-lib getpagesize
-
tmp rmfail note{ file not removable if still opened }end execute{
#include <sys/time.h>
_BEGIN_EXTERNS_
}
}end
-lib select note{ select() has standard 5 arg interface }end link{
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/socket.h>
- main()
- { struct timeval tmb;
- fd_set rd;
- FD_ZERO(&rd);
- FD_SET(0,&rd);
- tmb.tv_sec = 0;
- tmb.tv_usec = 0;
- select(1,&rd,(fd_set*)0,(fd_set*)0,&tmb);
- return 0;
- }
-}end
-
################################################################
## See if we can peek ahead in unseekable devices
################################################################
** Written by Kiem-Phong Vo
*/
-#if _lib_waitpid
+#ifdef HAVE_WAITPID
int _Sf_no_need_for_waitpid;
#else
return -1;
}
-#endif /*_lib_waitpid*/
+#endif /*HAVE_WAITPID*/
#endif
#define _NO_LARGEFILE64_SOURCE 1
#endif
#if !defined(_NO_LARGEFILE64_SOURCE) && \
- _lib_lseek64 && _lib_stat64 && defined(_typ_off64_t) && \
+ HAVE_LSEEK64 && HAVE_STAT64 && defined(_typ_off64_t) && \
_typ_struct_stat64
# if !defined(_LARGEFILE64_SOURCE)
# define _LARGEFILE64_SOURCE 1
#undef _socket_peek
#undef HAVE_VFORK_H
#undef _HAVE_SYS_VFORK_H
-#undef _lib_vfork
+#undef HAVE_VFORK
#undef HAVE_SYS_IOCTL_H
#endif
#define POOLMTXRETURN(p,v) { return(v); }
/* functions for polling readiness of streams */
-#if _lib_select
+#ifdef HAVE_SELECT
#undef _lib_poll
#else
#if _lib_poll_fd_1 || _lib_poll_fd_2
#define _lib_poll 1
#endif
-#endif /*_lib_select_*/
+#endif /*HAVE_SELECT*/
#if defined(_lib_poll)
#include <poll.h>
#endif
/* alternative process forking */
-#if _lib_vfork && !defined(fork) && !defined(sparc) && !defined(__sparc)
+#if HAVE_VFORK && !defined(fork) && !defined(sparc) && !defined(__sparc)
#if defined(HAVE_VFORK_H)
#include <vfork.h>
#endif
#define fork vfork
#endif
-#if _lib_unlink
+#ifdef HAVE_UNLINK
#define remove unlink
#endif
#if !defined(fork)
extern int fork(void);
#endif
-#if _lib_unlink
+#ifdef HAVE_UNLINK
extern int unlink(const char *);
#endif
extern int fstat(int, Stat_t *);
#endif
-#if _lib_vfork && !defined(HAVE_VFORK_H) && !defined(_HAVE_SYS_VFORK_H)
+#if HAVE_VFORK && !defined(HAVE_VFORK_H) && !defined(_HAVE_SYS_VFORK_H)
extern pid_t vfork(void);
-#endif /*_lib_vfork*/
+#endif /*HAVE_VFORK*/
#if defined(_lib_poll)
#if _lib_poll_fd_1
r = (po.revents & POLLIN) ? 1 : -1;
}
#endif /*_lib_poll*/
-#if _lib_select
+#ifdef HAVE_SELECT
if (r == -2) {
fd_set rd;
struct timeval tmb, *tmp;
} else
r = FD_ISSET(fd, &rd) ? 1 : -1;
}
-#endif /*_lib_select*/
+#endif /*HAVE_SELECT*/
if (r == -2) {
-#if !_lib_poll && !_lib_select /* both poll and select cann't be used */
+#if !_lib_poll && !defined(HAVE_SELECT) /* both poll and select cann't be used */
#ifdef FIONREAD /* quick and dirty check for availability */
long nsec = tm < 0 ? 0 : (tm + 999) / 1000;
while (nsec > 0 && r < 0) {
}
#endif /*_lib_poll*/
-#if _lib_select
+#ifdef HAVE_SELECT
if (c > 0) {
fd_set rd, wr;
struct timeval tmb, *tmp;
break;
}
}
-#endif /*_lib_select*/
+#endif /*HAVE_SELECT*/
/* call exception functions */
for (c = 0; c < n; ++c) {
} else {
if (f->next > f->data)
SFSYNC(f);
-#if _lib_ftruncate
+#ifdef HAVE_FTRUNCATE
if (ftruncate(f->file, size) < 0)
SFMTXRETURN(f, -1);
#else
#undef getpagesize
#endif
-#if _lib_getpagesize
+#ifdef HAVE_GETPAGESIZE
#ifdef __cplusplus
extern "C" {
#endif
/* set page size, this is also the desired default buffer size */
if (_Sfpage <= 0) {
-#if _lib_getpagesize
+#ifdef HAVE_GETPAGESIZE
if ((_Sfpage = (size_t) getpagesize()) <= 0)
#endif
_Sfpage = SF_PAGE;
#define _def_time_Sfio_f 1
#define _sys_types 1 /* #include <sys/types.h> ok */
//#define _hdr_unistd 1 /* #include <unistd.h> ok */
-#define _lib_ftruncate 0 /* ftruncate() in default lib(s) */
-#define _lib_lseek64 1 /* lseek64() in default lib(s) */
#define _typ_off64_t 1 /* off64_t is a type */
#define _sys_stat 1 /* stat() in default lib(s) */
#define _lib_remove 1 /* remove() in default lib(s) */
-#define _lib_unlink 1 /* unlink() in default lib(s) */
#define _lib_getpagesize 0 /* getpagesize() in default lib(s) */
#define _tmp_rmfail 1 /* file not removable if still opened */
#define _proto_open 1 /* open() has a vararg prototype */