diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e85a2781..53d89d321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ ENDIF(HAVE_STDBOOL_H) IF(HAVE_UNISTD_H) CHECK_SYMBOL_EXISTS (sleep "unistd.h" HAVE_SLEEP) CHECK_SYMBOL_EXISTS (usleep "unistd.h" HAVE_USLEEP) +CHECK_SYMBOL_EXISTS (access "unistd.h" HAVE_ACCESS) ENDIF(HAVE_UNISTD_H) CHECK_SYMBOL_EXISTS (strcasecmp "string.h" HAVE_STRCASECMP) CHECK_SYMBOL_EXISTS (strncasecmp "string.h" HAVE_STRNCASECMP) diff --git a/autoconf.h.in b/autoconf.h.in index 477f8b4d8..4b399bf70 100644 --- a/autoconf.h.in +++ b/autoconf.h.in @@ -12,6 +12,8 @@ #cmakedefine HAVE__STRICMP 1 #cmakedefine HAVE_SNPRINTF 1 #cmakedefine HAVE__SNPRINTF 1 +#cmakedefine HAVE_ACCESS 1 +#cmakedefine HAVE__ACCESS 1 #cmakedefine HAVE_SLEEP 1 #cmakedefine HAVE_USLEEP 1 #cmakedefine HAVE__SLEEP 1 @@ -34,6 +36,24 @@ #include #endif +#ifndef HAVE__ACCESS +#ifdef HAVE_ACCESS +#define _access(path, mode) access(path, mode) +#ifndef _A_RDONLY +#define _A_RDONLY R_OK +#endif +#ifndef _A_WRONLY +#define _A_WRONLY W_OK +#endif +#endif +#endif + +#ifndef _A_RDONLY +#ifdef R_OK +#define _A_RDONLY R_OK +#endif +#endif + #if !defined(HAVE__MEMICMP) #if defined(HAVE_MEMICMP) #define _memicmp(a, b, n) memicmp(a, b, n)