]> granicus.if.org Git - graphviz/commitdiff
Move function checks features/sfio to configure.ac
authorErwin Janssen <erwinjanssen@outlook.com>
Tue, 30 May 2017 20:42:27 +0000 (22:42 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Thu, 13 Jul 2017 10:52:45 +0000 (12:52 +0200)
The following function checks have been moved:
- ftruncate
- lseek64
- getpagesize (was already present in configure.ac)
- select (check for 5 arg interface no longer required)
- stat64
- unlink
- vfork
- waitpid

The following function checks have been removed becuase they were
not used:
- remove

configure.ac
lib/sfio/features/sfio
lib/sfio/sfexit.c
lib/sfio/sfhdr.h
lib/sfio/sfpkrd.c
lib/sfio/sfpoll.c
lib/sfio/sfresize.c
lib/sfio/sfsetbuf.c
windows/include/FEATURE/sfio

index 764eb531fdd456b2e5d22c94d26b7c35a947c824..edb15ffbea6323ab26431462991e32c22e4771b5 100644 (file)
@@ -435,7 +435,8 @@ LIBS=$save_LIBS
 
 # 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])
 
index 3fbcaa7fd25c0dc81de0c1210c73fea1053fdb34..7b1339ca2cee3ed8806cca4fad8407eee9a7de35 100644 (file)
@@ -6,10 +6,6 @@
 # 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>
@@ -58,22 +54,10 @@ hdr stat note{ stat() in default lib(s) }end link{
        }
 }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_
@@ -179,22 +163,6 @@ lib     poll_fd_2 note{ fd is second arg to poll() }end execute{
         }
 }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
 ################################################################
index 278aaa840b61920230c62082b6818ab158e73589..eb320ce7c31a22403d41982a1b75f7f158447633 100644 (file)
@@ -18,7 +18,7 @@
 **     Written by Kiem-Phong Vo
 */
 
-#if _lib_waitpid
+#ifdef HAVE_WAITPID
 int _Sf_no_need_for_waitpid;
 #else
 
@@ -85,6 +85,6 @@ waitpid(int pid, int *status, int options)
     return -1;
 }
 
-#endif /*_lib_waitpid*/
+#endif /*HAVE_WAITPID*/
 
 #endif
index fe0f87814814d0b5f4597feda2e4d54f11082a69..a48c380dbc63ffb1bf7181a80fb73648708db9b9 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 #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
@@ -57,7 +57,7 @@ extern "C" {
 #undef  _socket_peek
 #undef  HAVE_VFORK_H
 #undef  _HAVE_SYS_VFORK_H
-#undef  _lib_vfork
+#undef  HAVE_VFORK
 #undef  HAVE_SYS_IOCTL_H
 #endif
 
@@ -106,13 +106,13 @@ extern "C" {
 #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>
@@ -138,7 +138,7 @@ extern "C" {
 #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
@@ -148,7 +148,7 @@ extern "C" {
 #define fork   vfork
 #endif
 
-#if _lib_unlink
+#ifdef HAVE_UNLINK
 #define remove unlink
 #endif
 
@@ -808,7 +808,7 @@ extern "C" {
 #if !defined(fork)
     extern int fork(void);
 #endif
-#if _lib_unlink
+#ifdef HAVE_UNLINK
     extern int unlink(const char *);
 #endif
 
@@ -827,9 +827,9 @@ extern "C" {
     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
index 8331f6daa242224cda2e5425daccf6b4c2e690b0..1a6acb07d3fdd123947ec459df160c7c82d2f7ef 100644 (file)
@@ -115,7 +115,7 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
                    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;
@@ -140,9 +140,9 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
                } 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) {
index cb6b0c653da25267643b27c1030286f2dca2453e..e2ae19031f3dbf71c1871e4b88fca82303e811cd 100644 (file)
@@ -155,7 +155,7 @@ int sfpoll(Sfio_t ** fa, reg int n, int tm)
     }
 #endif /*_lib_poll*/
 
-#if _lib_select
+#ifdef HAVE_SELECT
     if (c > 0) {
        fd_set rd, wr;
        struct timeval tmb, *tmp;
@@ -198,7 +198,7 @@ int sfpoll(Sfio_t ** fa, reg int n, int tm)
            break;
        }
     }
-#endif /*_lib_select*/
+#endif /*HAVE_SELECT*/
 
     /* call exception functions */
     for (c = 0; c < n; ++c) {
index 5d353e5aa66e44239ddcbaf06e02c85cd2666e24..cc1218ec56bdefa688a39955de7c858e32404848 100644 (file)
@@ -50,7 +50,7 @@ int sfresize(Sfio_t * f, Sfoff_t size)
     } else {
        if (f->next > f->data)
            SFSYNC(f);
-#if _lib_ftruncate
+#ifdef HAVE_FTRUNCATE
        if (ftruncate(f->file, size) < 0)
            SFMTXRETURN(f, -1);
 #else
index ff51f5b63f5e2e61e8849f2b00da37c160a26902..255be54e867b1a8f8654a70d8716ceebe9ec0691 100644 (file)
@@ -25,7 +25,7 @@ __STDPP__directive pragma pp:nohide getpagesize
 #undef getpagesize
 #endif
 
-#if _lib_getpagesize
+#ifdef HAVE_GETPAGESIZE
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -207,7 +207,7 @@ void *sfsetbuf(reg Sfio_t * f, reg void * buf, reg size_t size)
 
        /* 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;
index 4c0259b8b4819b7e5f9f3fc2efc07ffc3248ef04..3cd7b3670031f4a4d9cc8b5455fb03e9cf346ca7 100644 (file)
@@ -3,12 +3,9 @@
 #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 */