buildsys cleanup, mostly to help with AIX,HP-UX,MinGW builds

This commit is contained in:
Brian Cox 2019-09-28 06:13:38 -07:00
parent c0a67bc3c2
commit a260b75db5
13 changed files with 1031 additions and 295 deletions

View File

@ -3,6 +3,15 @@
/* Define if building universal (internal helper macro) */ /* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD #undef AC_APPLE_UNIVERSAL_BUILD
/* The normal alignment of `int', in bytes. */
#undef ALIGNOF_INT
/* The normal alignment of `long', in bytes. */
#undef ALIGNOF_LONG
/* The normal alignment of `long long', in bytes. */
#undef ALIGNOF_LONG_LONG
/* Compile with debug code */ /* Compile with debug code */
#undef DEBUG #undef DEBUG
@ -12,12 +21,12 @@
/* this is the prefix for STL exception functions */ /* this is the prefix for STL exception functions */
#undef EXCEPTION_NAMESPACE #undef EXCEPTION_NAMESPACE
/* Define to 1 if you have the `bind' function. */
#undef HAVE_BIND
/* Define to 1 if you have the <bits/signum.h> header file. */ /* Define to 1 if you have the <bits/signum.h> header file. */
#undef HAVE_BITS_SIGNUM_H #undef HAVE_BITS_SIGNUM_H
/* Define to 1 if you have the `break' function. */
#undef HAVE_BREAK
/* Define to 1 if you have the `broken_ac_check_func' function. */ /* Define to 1 if you have the `broken_ac_check_func' function. */
#undef HAVE_BROKEN_AC_CHECK_FUNC #undef HAVE_BROKEN_AC_CHECK_FUNC
@ -42,6 +51,13 @@
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */ /* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
/* Define to 1 if you have the `connect' function. */
#undef HAVE_CONNECT
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `door_create' function. */ /* Define to 1 if you have the `door_create' function. */
#undef HAVE_DOOR_CREATE #undef HAVE_DOOR_CREATE
@ -129,15 +145,27 @@
/* Define to 1 if you have the <malloc.h> header file. */ /* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H #undef HAVE_MALLOC_H
/* Define to 1 if you have the `memcpy_s' function. */
#undef HAVE_MEMCPY_S
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
/* Define to 1 if you have the `mkfifo' function. */
#undef HAVE_MKFIFO
/* Define to 1 if you have the `mknod' function. */
#undef HAVE_MKNOD
/* Define to 1 if you have the `mkstemp' function. */ /* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP #undef HAVE_MKSTEMP
/* Define to 1 if you have the `mktemp' function. */ /* Define to 1 if you have the `mktemp' function. */
#undef HAVE_MKTEMP #undef HAVE_MKTEMP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the `open' function. */ /* Define to 1 if you have the `open' function. */
#undef HAVE_OPEN #undef HAVE_OPEN
@ -174,6 +202,9 @@
/* Define to 1 if you have the `posix_spawn' function. */ /* Define to 1 if you have the `posix_spawn' function. */
#undef HAVE_POSIX_SPAWN #undef HAVE_POSIX_SPAWN
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <pwd.h> header file. */ /* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H #undef HAVE_PWD_H
@ -231,6 +262,9 @@
/* Define to 1 if `st_attrib' is a member of `struct stat'. */ /* Define to 1 if `st_attrib' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ATTRIB #undef HAVE_STRUCT_STAT_ST_ATTRIB
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if `st_blocks' is a member of `struct stat'. */ /* Define to 1 if `st_blocks' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS #undef HAVE_STRUCT_STAT_ST_BLOCKS
@ -258,6 +292,10 @@
/* Define to 1 if you have the <syslog.h> header file. */ /* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H #undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/file.h> header file. */ /* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H #undef HAVE_SYS_FILE_H
@ -267,6 +305,10 @@
/* Define to 1 if you have the <sys/mount.h> header file. */ /* Define to 1 if you have the <sys/mount.h> header file. */
#undef HAVE_SYS_MOUNT_H #undef HAVE_SYS_MOUNT_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/param.h> header file. */ /* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H #undef HAVE_SYS_PARAM_H
@ -303,6 +345,9 @@
/* Define to 1 if you have the <sys/utsname.h> header file. */ /* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H #undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <termios.h> header file. */ /* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H #undef HAVE_TERMIOS_H
@ -312,6 +357,9 @@
/* Define to 1 if you have the `tzset' function. */ /* Define to 1 if you have the `tzset' function. */
#undef HAVE_TZSET #undef HAVE_TZSET
/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
@ -333,12 +381,6 @@
/* Define to 1 if you have the `_exit' function. */ /* Define to 1 if you have the `_exit' function. */
#undef HAVE__EXIT #undef HAVE__EXIT
/* Is byte aligned */
#undef IS_BYTE_ALIGNED
/* Is a unix type platform */
#undef IS_UNIX
/* Compile without debug code */ /* Compile without debug code */
#undef NDEBUG #undef NDEBUG
@ -375,6 +417,9 @@
/* The size of `time_t', as computed by sizeof. */ /* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T #undef SIZEOF_TIME_T
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* Don't use gethostbyname() on Solaris */ /* Don't use gethostbyname() on Solaris */
#undef SOLARIS_NO_GETHOSTBYNAME #undef SOLARIS_NO_GETHOSTBYNAME
@ -425,9 +470,17 @@
/* Define for large files, on AIX-style hosts. */ /* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES #undef _LARGE_FILES
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
#endif
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
#undef const #undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to the equivalent of the C99 'restrict' keyword, or to /* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is nothing if this is not supported. Do not define if restrict is
supported directly. */ supported directly. */
@ -445,4 +498,11 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
#undef uintptr_t
#include "core/fixups.h" #include "core/fixups.h"

837
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -46,13 +46,12 @@ dnl #########################################
dnl Set up per-compiler constants & base args dnl Set up per-compiler constants & base args
dnl ######################################### dnl #########################################
if test "x${GXX}" != "x"; then dnl if test "x${GXX}" != "x"; then
if test "x${CXX}" = "xg++"; then
AC_DEFINE(HAVE_GCC, 1, [Uses the GNU gcc compiler]) AC_DEFINE(HAVE_GCC, 1, [Uses the GNU gcc compiler])
CFLAGS=${CFLAGS:-"-O -pipe"} CFLAGS=${CFLAGS:-"-O -pipe"}
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
else
AC_DEFINE(HAVE_GCC, 0, [Uses the GNU gcc compiler])
fi fi
if test "x${CXX}" = "xclang++"; then if test "x${CXX}" = "xclang++"; then
@ -60,8 +59,6 @@ if test "x${CXX}" = "xclang++"; then
CFLAGS=${CFLAGS:-"-O -pipe"} CFLAGS=${CFLAGS:-"-O -pipe"}
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
else
AC_DEFINE(HAVE_CLANG, 0, [Uses the Clang compiler])
fi fi
if test "x${CXX}" = "xgxlc++"; then if test "x${CXX}" = "xgxlc++"; then
@ -72,8 +69,6 @@ dnl OBJECT_MODE needs to be set while compiling
CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" } CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" }
CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"} CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"}
ARFLAGS=${ARFLAGS:-"-X 64"} ARFLAGS=${ARFLAGS:-"-X 64"}
else
AC_DEFINE(HAVE_IBM_GXLC, 0, [Uses the gxlc++ compiler])
fi fi
if test "x${CXX}" = "xxlc++_r"; then if test "x${CXX}" = "xxlc++_r"; then
@ -81,25 +76,19 @@ if test "x${CXX}" = "xxlc++_r"; then
dnl OBJECT_MODE needs to be set while compiling dnl OBJECT_MODE needs to be set while compiling
export OBJECT_MODE=64 export OBJECT_MODE=64
CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all"} CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all"} CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
ARFLAGS=${ARFLAGS:-"-X 64"} ARFLAGS=${ARFLAGS:-"-X 64"}
else
AC_DEFINE(HAVE_IBM_XLC, 0, [Uses the IBM XL C++ compiler])
fi fi
dnl *** TODO these compilers need work on default args **** dnl *** TODO these compilers need work on default args ****
if test "x${CXX}" = "xsunCC"; then if test "x${CXX}" = "xsunCC"; then
AC_DEFINE(HAVE_ORACLE_SUNCC, 1, [Uses the sunCC compiler]) AC_DEFINE(HAVE_ORACLE_SUNCC, 1, [Uses the sunCC compiler])
else
AC_DEFINE(HAVE_ORACLE_SUNCC, 0, [Uses the sunCC compiler])
fi fi
if test "x${CXX}" = "xaCC"; then if test "x${CXX}" = "xaCC"; then
AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler]) AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler])
else
AC_DEFINE(HAVE_HP_ACC, 0, [Uses the aCC compiler])
fi fi
dnl ###################### dnl ######################
@ -113,14 +102,9 @@ dnl AX_CHECK_COMPILE_FLAG([-Weverything], [CXXFLAGS="$CXXFLAGS -Weverything"])
dnl ##################### dnl #####################
dnl Configuration options dnl Configuration options
dnl ##################### dnl #####################
dnl
# This is primarily to support old compilers that dont understand -Wextra dnl These options generally expect a compiler+linker
#AC_ARG_ENABLE(extrawarnings, [ —-disable-extrawarnings do not compile with -Wextra warnings enabled]) dnl that understand gcc-like command line options.
#if test "x$enable_extrawarnings" != "xno"
#then
# CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
# CXXFLAGS="${CXXFLAGS} -Wextra -Wno-unused-parameter"
#fi
AC_ARG_ENABLE(static, [ --enable-static compile static binaries]) AC_ARG_ENABLE(static, [ --enable-static compile static binaries])
if test "x$enable_static" = xyes if test "x$enable_static" = xyes
@ -184,21 +168,40 @@ dnl #######################
dnl Checks for header files dnl Checks for header files
dnl ####################### dnl #######################
AC_HEADER_STDC AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_HEADERS(memory.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(signum.h bits/signum.h, break)
AC_CHECK_HEADERS(stdarg.h varargs.h, break)
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(syslog.h sys/syslog.h, break)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(unistd.h sys/unistd.h, break)
AC_CHECK_HEADERS(sys/file.h)
AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mount.h,,, AC_CHECK_HEADERS(sys/mount.h,,,
[[#if defined(HAVE_SYS_PARAM_H) [[#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h> #include <sys/param.h>
#endif #endif
]]) ]])
AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h)
AC_CHECK_HEADERS(unistd.h sys/unistd.h pwd.h grp.h termios.h) AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h sys/time.h sys/file.h) AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(signum.h bits/signum.h, break ) AC_CHECK_HEADERS(sys/statfs.h)
AC_CHECK_HEADERS(stdarg.h varargs.h, break ) AC_CHECK_HEADERS(sys/sysmacros.h)
AC_CHECK_HEADERS(sys/utsname.h memory.h) AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/ustat.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_HEADERS(sys/fs/vx_ioctl.h) AC_CHECK_HEADERS(sys/fs/vx_ioctl.h)
dnl # Special case for malloc.h, because it's depreciated on most systems. dnl # Special case for malloc.h, because it's deprecated on most systems.
CPPFLAGS_SAVE="${CPPFLAGS}" CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} -Werror" CPPFLAGS="${CPPFLAGS} -Werror"
AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(malloc.h)
@ -209,38 +212,46 @@ dnl Checks for typedefs, structures, and compiler characteristics
dnl ############################################################# dnl #############################################################
AC_C_CONST AC_C_CONST
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_UINTPTR_T
AC_HEADER_TIME AC_HEADER_TIME
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_C_CHAR_UNSIGNED
AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(time_t) AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(wchar_t)
dnl All platforms we support use 2's complement, are byte aligned, etc... AC_CHECK_ALIGNOF(int)
AC_CHECK_ALIGNOF(long)
AC_CHECK_ALIGNOF(long long)
dnl TODO: These could be replaced with actual detection logic, for the few
dnl remaining platforms that have non-2s complement signed ints
AC_DEFINE(USES_1S_COMPLEMENT, 0, [Uses one's complement]) AC_DEFINE(USES_1S_COMPLEMENT, 0, [Uses one's complement])
AC_DEFINE(USES_2S_COMPLEMENT, 1, [Uses two's complement]) AC_DEFINE(USES_2S_COMPLEMENT, 1, [Uses two's complement])
AC_DEFINE(USES_SIGNED_MAGNITUDE, 0, [Uses signed magnitute]) AC_DEFINE(USES_SIGNED_MAGNITUDE, 0, [Uses signed magnitute])
AC_DEFINE(IS_BYTE_ALIGNED, 1, [Is byte aligned])
AC_DEFINE(EXCEPTION_NAMESPACE, std::, [this is the prefix for STL exception functions]) AC_DEFINE(EXCEPTION_NAMESPACE, std::, [this is the prefix for STL exception functions])
dnl We used to check for UNIX or Unix-like target platforms,
dnl but that is a little extreme, so just assume that the
dnl target is unix. This can still be changed in config.h
AC_DEFINE(IS_UNIX, 1, [Is a unix type platform])
dnl whether or not to generate debuging code? dnl whether or not to generate debuging code?
dnl this gets defined elsewhere based on config args AC_DEFINE(NDEBUG, 1, [don't generate debuging code]) dnl this gets defined elsewhere based on config args AC_DEFINE(NDEBUG, 1, [don't generate debuging code])
dnl look for struct stat members that aren't always there: dnl look for struct stat members that aren't always there:
dnl st_rdev & st_blocks are standard but a few platforms don't have them. dnl st_rdev, st_blksize, & st_blocks are standard but a few platforms don't have them.
dnl st_flags & st_gen are BSD-isms & are mostly seen there, including macOS dnl st_flags & st_gen are BSD-isms & are mostly seen there, including macOS
dnl st_flag (singular) is AIX-only, while st_attrib holds DOS attribute bits on VxWorks dnl st_flag (singular) is AIX-only, while st_attrib holds DOS attribute bits on VxWorks
AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blocks, struct stat.st_flags, struct stat.st_gen, struct stat.st_flag, struct stat.st_attrib]) AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks, struct stat.st_flags, struct stat.st_gen, struct stat.st_flag, struct stat.st_attrib])
dnl detect large file support & use it where available dnl detect large file support & use it where available
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
dnl detect whether Posix termios is available.
dnl we use termios to turn echo off when user is entering a passphrase
AC_SYS_POSIX_TERMIOS
dnl detect whether C++ compiler supports any variant of 'restrict' keyword dnl detect whether C++ compiler supports any variant of 'restrict' keyword
dnl (the macro says 'C' but works for both C & C++) dnl (the macro says 'C' but works for both C & C++)
AC_C_RESTRICT AC_C_RESTRICT
@ -254,9 +265,11 @@ dnl #############################
dnl Checks for standard functions dnl Checks for standard functions
dnl ############################# dnl #############################
AC_CHECK_FUNCS(strftime) AC_CHECK_FUNCS(strftime)
AC_CHECK_FUNCS(getaddrinfo gethostname gethostbyname gethostid getuid) AC_CHECK_FUNCS(getaddrinfo gethostname gethostbyname gethostid)
AC_CHECK_FUNCS(mkstemp mktemp tmpnam break) AC_CHECK_FUNCS(getuid)
AC_CHECK_FUNCS(swab tzset _exit popen) dnl various ways of creating/naming temp files
AC_CHECK_FUNCS(mkstemp mktemp tmpnam, break)
AC_CHECK_FUNCS(swab tzset _exit popen memcpy_s)
dnl posix way to read files dnl posix way to read files
AC_CHECK_FUNCS(openat open read close) AC_CHECK_FUNCS(openat open read close)
@ -270,11 +283,13 @@ dnl posix way to get symlink contents
AC_CHECK_FUNCS(readlinkat readlink) AC_CHECK_FUNCS(readlinkat readlink)
dnl posix fns that make filesystem changes dnl posix fns that make filesystem changes
AC_CHECK_FUNCS(chown chmod link symlink) AC_CHECK_FUNCS(chown chmod link symlink mknod mkfifo)
dnl posix syslog fns dnl posix syslog fns
AC_CHECK_FUNCS(openlog syslog closelog) AC_CHECK_FUNCS(openlog syslog closelog)
dnl posix process & networking stuff dnl posix process fns
AC_CHECK_FUNCS(fork execve posix_spawn socket) AC_CHECK_FUNCS(fork execve posix_spawn)
dnl bsd socket fns
AC_CHECK_FUNCS(socket connect bind)
dnl posix user & group stuff dnl posix user & group stuff
AC_CHECK_FUNCS(setuid setgid getgrgid) AC_CHECK_FUNCS(setuid setgid getgrgid)

View File

@ -173,7 +173,7 @@ public:
static bool IsAbsolutePath(const TSTRING& in); static bool IsAbsolutePath(const TSTRING& in);
}; };
# if IS_DOS_DJGPP # if USES_DOS_DEVICE_PATH
# define cDevicePath cDosPath # define cDevicePath cDosPath
# elif IS_AROS # elif IS_AROS
# define cDevicePath cArosPath # define cDevicePath cArosPath

View File

@ -39,11 +39,6 @@
#endif #endif
#include "core/stdcore.h" #include "core/stdcore.h"
#if !IS_UNIX
# error Need to be unix to use unixfsservices
#endif
#include "core/file.h" #include "core/file.h"
//#include <stdio.h> //#include <stdio.h>

View File

@ -72,25 +72,36 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#if !IS_SORTIX && HAVE_SYS_FILE_H #if !IS_SORTIX && HAVE_SYS_FILE_H
# include <sys/file.h> # include <sys/file.h>
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
#if HAVE_SYS_WAIT_H
# include <sys/wait.h> # include <sys/wait.h>
#endif
#include <time.h> #include <time.h>
#if HAVE_MALLOC_H && !IS_AROS #if HAVE_MALLOC_H && !IS_AROS
# include <malloc.h> # include <malloc.h>
#endif #endif
#include <string.h> #include <string.h>
//#include <signal.h> //#include <signal.h>
#include "tw_signal.h" #include "tw_signal.h"
#ifdef __STDC__ #ifdef __STDC__
# include <unistd.h> # include <unistd.h>
# include <stdlib.h> # include <stdlib.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#endif #endif
#include <assert.h> #include <assert.h>
#include "msystem.h" #include "msystem.h"

View File

@ -33,12 +33,16 @@
// platform.h // platform.h
// //
#ifndef __PLATFORM_H
#define __PLATFORM_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#ifndef __PLATFORM_H #if HAVE_STDINT_H
# define __PLATFORM_H #include <stdint.h>
#endif
//NOTE: Autoconf is strongly preferred as the Right Way to detect platform-specific features/behaviors. //NOTE: Autoconf is strongly preferred as the Right Way to detect platform-specific features/behaviors.
// These macros should really only be used when autoconf can't get the job done. // These macros should really only be used when autoconf can't get the job done.
@ -54,6 +58,9 @@
# define OS_WIN32 0x0101 # define OS_WIN32 0x0101
# define OS_CYGWIN 0x0102 # define OS_CYGWIN 0x0102
# define OS_DOS_DJGPP 0x0103 # define OS_DOS_DJGPP 0x0103
# define OS_WIN32_MINGW 0x0104
# define OS_OS2 0x0105
# define OS_OS2_EMX 0x0106
# define OS_LINUX 0x0201 # define OS_LINUX 0x0201
# define OS_ANDROID 0x0202 # define OS_ANDROID 0x0202
@ -75,6 +82,7 @@
# define OS_IRIX 0x0403 # define OS_IRIX 0x0403
# define OS_OSF1 0x0404 # define OS_OSF1 0x0404
# define OS_OS400 0x0405 # define OS_OS400 0x0405
# define OS_MVS 0x0406
# define OS_MINIX 0x0501 # define OS_MINIX 0x0501
# define OS_HURD 0x0502 # define OS_HURD 0x0502
@ -88,10 +96,13 @@
# define OS_RISCOS 0x050A # define OS_RISCOS 0x050A
# define OS_REDOX 0x050B # define OS_REDOX 0x050B
# define OS_QNX 0x050C # define OS_QNX 0x050C
# define OS_VXWORKS 0x50D # define OS_VXWORKS 0x050D
# define OS_LYNXOS 0x50E # define OS_LYNXOS 0x050E
# define OS_OS9 0x50F // For Microware's OS-9, not the Apple one. # define OS_OS9 0x050F // For Microware's OS-9, not the Apple one.
# define OS_PLAN9 0x510 # define OS_PLAN9 0x0510
///////////////////////////////
# define COMP_UNKNOWN 0 # define COMP_UNKNOWN 0
# define COMP_GCC 0x0001 # define COMP_GCC 0x0001
@ -102,6 +113,7 @@
// Definitions for the old KAI C++ compiler. // Definitions for the old KAI C++ compiler.
// KCC was EOL'd ages ago, but I'm leaving these definitions here for now // KCC was EOL'd ages ago, but I'm leaving these definitions here for now
// on the off chance someone's still using it. // on the off chance someone's still using it.
# define COMP_KAI 0x0200
# define COMP_KAI_GCC 0x0201 # define COMP_KAI_GCC 0x0201
# define COMP_KAI_SUNPRO 0x0202 # define COMP_KAI_SUNPRO 0x0202
# define COMP_KAI_GLIBC 0x0203 # define COMP_KAI_GLIBC 0x0203
@ -114,6 +126,7 @@
# define COMP_XL_C 0x0302 # define COMP_XL_C 0x0302
# define COMP_ACC 0x0303 # define COMP_ACC 0x0303
//============================================================================= //=============================================================================
// Platform detection // Platform detection
// //
@ -124,13 +137,54 @@
// //
// OS The OS // OS The OS
// COMP The compiler // COMP The compiler
// // plus IS_xxx macros for the OS & compiler
// PLEASE NOTE: Do not set any preprocessor variable other than the above three in this
// section. Use the following sections for anything that does not fall into
// the above catagories. //////////////////////////////
// Compiler detection
# if defined(HAVE_GCC)
# define COMP COMP_GCC
# define IS_GCC 1
# elif defined(HAVE_CLANG)
# define COMP COMP_CLANG
# define IS_CLANG 1
# elif defined(HAVE_MSVC)
# define COMP COMP_MSVC
# define IS_MSVC 1
# elif defined(HAVE_KAI_KCC)
# if !defined(COMP)
# define COMP COMP_KAI
# endif
# define IS_KAI 1
# elif defined(HAVE_ORACLE_SUNCC)
# define COMP COMP_SUNPRO
# define IS_SUNPRO 1
# elif defined(HAVE_IBM_XL_C || HAVE_IBM_GXLC)
# define COMP COMP_XL_C
# define IS_XL_C 1
# elif defined(HAVE_HP_ACC)
# define COMP COMP_ACC
# define IS_HP_ACC 1
# endif
//////////////////////////
// OS detection
# if defined(_WIN32) # if defined(_WIN32)
# if defined(__MINGW32__)
# define OS OS_WIN32_MINGW
# define IS_MINGW 1
# else
# define OS OS_WIN32 # define OS OS_WIN32
# endif
# define IS_WIN32 1 # define IS_WIN32 1
# elif defined(__CYGWIN__) # elif defined(__CYGWIN__)
@ -141,6 +195,15 @@
# define OS OS_DOS_DJGPP # define OS OS_DOS_DJGPP
# define IS_DOS_DJGPP 1 # define IS_DOS_DJGPP 1
# elif defined(__OS2__)
# if defined(__EMX__)
# define OS OS_OS2_EMX
# define IS_EMX 1
# else
# define OS OS_OS2
# endif
# define IS_OS2 1
// Detect Android first, since Linux macros are also defined there // Detect Android first, since Linux macros are also defined there
# elif defined(__ANDROID__) # elif defined(__ANDROID__)
# define OS OS_ANDROID # define OS OS_ANDROID
@ -193,6 +256,8 @@
# define IS_DARWIN 1 # define IS_DARWIN 1
// Next up, SysV Unixes, commercial & otherwise, and platforms that
// resemble SysV to varying degrees
# elif defined(__sun) # elif defined(__sun)
# define OS OS_SOLARIS # define OS OS_SOLARIS
# define IS_SOLARIS 1 # define IS_SOLARIS 1
@ -220,6 +285,12 @@
# define OS OS_OS400 # define OS OS_OS400
# define IS_OS400 1 # define IS_OS400 1
# elif defined(__MVS__)
# define OS OS_MVS
# define IS_MVS 1
// Anything else that has a vaguely POSIX-esque file API
# elif defined(__minix__) # elif defined(__minix__)
# define OS OS_MINIX # define OS OS_MINIX
# define IS_MINIX 1 # define IS_MINIX 1
@ -287,22 +358,6 @@
# endif # endif
/* XXX: COMP may now not resolve, because autoconf may
* detect GCC. This is done in the hopes that all
* COMP detections, and indeed both OS & COMP detechtions
* will eventualy be done automatically.
*
* This means, the former "#if !defined(COMP)" will
* temporarily have to also check the HAVE_[compiler]
* #defines until all compilers are checked by autoconf,
* at which point this can be removed completely.
*
* PH - 20010311
*/
# if !defined(COMP) && !defined(HAVE_GCC)
# error COMP definition did not resolve. Check "platform.h".
# endif
//============================================================================= //=============================================================================
// Platform Macros (a.k.a. "IS_" macros) // Platform Macros (a.k.a. "IS_" macros)
// //
@ -335,47 +390,42 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// complier detection
# define IS_KAI \
(COMP == COMP_KAI_GCC || COMP == COMP_KAI_SUNPRO || COMP == COMP_KAI_GLIBC || COMP == COMP_KAI_VISUALAGE || \
COMP == COMP_KAI_HPANSIC || COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA)
# define IS_MSVC (COMP == COMP_MSVC)
# define IS_SUNPRO (COMP == COMP_SUNPRO)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Unicode
# define SUPPORTS_UNICODE IS_WIN32 // The OS supports Unicode
// KAI 3.4 uses a much improved stl // KAI 3.4 uses a much improved stl
# define IS_KAI_3_4 (IS_KAI && (COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA || COMP == COMP_KAI_GLIBC)) # define IS_KAI_3_4 (IS_KAI && (COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA || COMP == COMP_KAI_GLIBC))
// Used in twlocale // Used in twlocale
# define USE_STD_CPP_LOCALE_WORKAROUND \ # define USE_STD_CPP_LOCALE_WORKAROUND \
(IS_SUNPRO || (IS_KAI && !IS_KAI_3_4)) // TODO:BAM -- name this something more general. (IS_SUNPRO || (IS_KAI && !IS_KAI_3_4)) // TODO:BAM -- name this something more general.
# define USE_CLIB_LOCALE (!HAVE_LOCALE || HAVE_GCC || IS_KAI) # define USE_CLIB_LOCALE (!HAVE_LOCALE || HAVE_GCC || IS_KAI)
# define USES_CLIB_DATE_FUNCTION \ # define USES_CLIB_DATE_FUNCTION \
(USE_CLIB_LOCALE || IS_SUNPRO || \ (USE_CLIB_LOCALE || IS_SUNPRO || \
IS_MSVC) // if we use clib, can't use C++ time_put, and SUNPRO and MSVC add characters IS_MSVC) // if we use clib, can't use C++ time_put, and SUNPRO and MSVC add characters
//#define USE_CLIB_LOCALE (IS_ALPHA || IS_IRIX || (IS_KAI && !IS_KAI_3_4))
// Threading API // Threading API
# define SUPPORTS_WIN32_THREADS IS_WIN32 # define SUPPORTS_WIN32_THREADS IS_WIN32
# define SUPPORTS_POSIX_THREADS (HAVE_PTHREAD_GETSPECIFIC) # define SUPPORTS_POSIX_THREADS (HAVE_PTHREAD_H)
// Miscellaneous // Miscellaneous
# define SUPPORTS_C_FILE_IO (HAVE_FOPEN && HAVE_FREAD && HAVE_FCLOSE) # define SUPPORTS_C_FILE_IO (HAVE_FOPEN && HAVE_FREAD && HAVE_FCLOSE)
# define SUPPORTS_POSIX_FILE_IO (HAVE_OPEN && HAVE_READ && HAVE_CLOSE) # define SUPPORTS_POSIX_FILE_IO (HAVE_OPEN && HAVE_READ && HAVE_CLOSE)
# define SUPPORTS_SYMLINKS (HAVE_READLINK || HAVE_READLINKAT)
# define WCHAR_IS_16_BITS IS_WIN32 # if (SIZEOF_WCHAR_T == 2)
# define WCHAR_IS_32_BITS IS_UNIX # define WCHAR_IS_16_BITS 1
# define WCHAR_REP_IS_UCS2 IS_WIN32 # define WCHAR_REP_IS_UCS2 1
# elif (SIZEOF_WCHAR_T == 4)
# define WCHAR_IS_32_BITS 1
# endif
# define SUPPORTS_POSIX_FORK_EXEC (HAVE_FORK && HAVE_EXECVE) # define SUPPORTS_POSIX_FORK_EXEC (HAVE_FORK && HAVE_EXECVE)
// msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why. // msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why.
// TODO: Figure out why. // TODO: Figure out why.
# define USES_MPOPEN (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE) # define USES_MPOPEN (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE)
# define USES_MSYSTEM (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE) # define USES_MSYSTEM (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE)
# define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI # define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI
# define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC) # define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC)
# define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO) # define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO)
@ -386,8 +436,11 @@
# define SUPPORTS_SYSLOG (HAVE_SYSLOG && !IS_SKYOS && !IS_RISCOS) # define SUPPORTS_SYSLOG (HAVE_SYSLOG && !IS_SKYOS && !IS_RISCOS)
# define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) # define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX)
# define USES_MBLEN (!IS_ANDROID && !IS_AROS) # define USES_MBLEN (!IS_ANDROID && !IS_AROS)
# define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_WIN32 || IS_RISCOS || IS_REDOX) # define USES_DOS_DEVICE_PATH (IS_DOS_DJGPP || (IS_WIN32 && !IS_CYGWIN) || (IS_OS2 && !IS_EMX))
# define USES_DEVICE_PATH (IS_AROS || IS_RISCOS || IS_REDOX || USES_DOS_DEVICE_PATH)
# define ICONV_CONST_SOURCE (IS_MINIX) # define ICONV_CONST_SOURCE (IS_MINIX)
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
# define SUPPORTS_DIRECT_IO (IS_LINUX) # define SUPPORTS_DIRECT_IO (IS_LINUX)
// HP-UX does have posix_fadvise(), but sys/fcntl.h neglects to wrap it in extern "C" on // HP-UX does have posix_fadvise(), but sys/fcntl.h neglects to wrap it in extern "C" on
@ -397,24 +450,27 @@
# define SUPPORTS_POSIX_FADVISE (HAVE_POSIX_FADVISE && !IS_HPUX) # define SUPPORTS_POSIX_FADVISE (HAVE_POSIX_FADVISE && !IS_HPUX)
# define READ_TAKES_CHAR_PTR (IS_VXWORKS) # define READ_TAKES_CHAR_PTR (IS_VXWORKS)
# define BCOPY_TAKES_CHAR_PTR (IS_VXWORKS)
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
# define SUPPORTS_TERMIOS (HAVE_TERMIOS_H && (!IS_RTEMS && !IS_REDOX))
// RTEMS errors are probably just a buildsys issue & this will change or go away. // RTEMS errors are probably just a buildsys issue & this will change or go away.
// Redox will probably implement this in the future. // Redox will probably implement this in the future.
# define SUPPORTS_TERMIOS (HAVE_TERMIOS_H && (!IS_RTEMS && !IS_REDOX))
// Unlinking an open file (to make a temporary file nobody else can see) is a Posix-ism
// that other platforms generally don't support.
# define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX && !IS_DOS_DJGPP) # define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX && !IS_DOS_DJGPP)
# define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN)
// POSIX standard says paths beginning with 2 slashes are "implementation defined" // POSIX standard says paths beginning with 2 slashes are "implementation defined"
// (see http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 ) // (see http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 )
// The only platform OST is known to work on (afaik) that actually defines a double-slash behavior is Cygwin // The only platform OST is known to work on (afaik) that actually defines a double-slash behavior is Cygwin
// which uses this syntax for UNC paths. So we'll allow leading double slashes there, but // which uses this syntax for UNC paths. OST also might Just Work under Unix System Services on
// continue removing them on all other platforms for now. // z/OS / MVS / OS/390, which uses a leading double slash for dataset paths, so I'll add that
// Other platform known to use this include IBM z/OS and the ancient Apollo Domain/OS. // to the macro even though I don't have the hardware to actually test this.
// //
// Other platform known to use this include IBM z/OS and the ancient Apollo Domain/OS.
# define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN || IS_MVS)
# define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM) # define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM)
@ -422,6 +478,7 @@
// which are only sometimes readable via ordinary file API // which are only sometimes readable via ordinary file API
# define SUPPORTS_NATIVE_OBJECTS (IS_AIX || IS_OS400) # define SUPPORTS_NATIVE_OBJECTS (IS_AIX || IS_OS400)
// On most platforms, uname() returns 0 on success, like every other syscall out there. // On most platforms, uname() returns 0 on success, like every other syscall out there.
// However the POSIX standard merely says uname() returns some nonnegative value on success, probably // However the POSIX standard merely says uname() returns some nonnegative value on success, probably
// so certain vendors could be POSIX-compliant without changing anything. Solaris seems to return 1 // so certain vendors could be POSIX-compliant without changing anything. Solaris seems to return 1
@ -429,24 +486,26 @@
#if IS_SOLARIS #if IS_SOLARIS
# define UNAME_SUCCESS_POSIX 1 # define UNAME_SUCCESS_POSIX 1
#else #else
# define UNAME_SUCCESS_ZERO # define UNAME_SUCCESS_ZERO 1
#endif #endif
// Work around single-arg mkdir on MinGW.
// consider using autoconf AX_FUNC_MKDIR if
// we need to handle any more cases here
#if IS_MINGW
# define mkdir(a,b) mkdir(a)
#endif
//============================================================================= //=============================================================================
// Miscellaneous // Miscellaneous
// //
// Put all items that are not an "IS_" macro here. // Put all items that are not an "IS_" macro here.
# if IS_BYTE_ALIGNED // This should ordinarily always be 8, but we'll do it the autoconf way just in case.
# define BYTE_ALIGN 8 #define BYTE_ALIGN ALIGNOF_LONG_LONG
# else
# error Unknown Byte alignment
# endif
// A scalar that matches the sizeof a pointer // A scalar that matches the sizeof a pointer
typedef unsigned long ptr_size_type; // true for all of our current platforms typedef uintptr_t ptr_size_type;
// TODO: I would like to use a XXXX_t like name
// Check integer representation // Check integer representation
# if !(USES_2S_COMPLEMENT) # if !(USES_2S_COMPLEMENT)

View File

@ -39,10 +39,6 @@
#include "core/corestrings.h" #include "core/corestrings.h"
#include "core/file.h" #include "core/file.h"
#if !IS_UNIX //encase this all in an ifdef so it won't cause compile errors
# error Must be unix for unixfsservices
#endif
//========================================================================= //=========================================================================
// STANDARD LIBRARY INCLUDES // STANDARD LIBRARY INCLUDES
//========================================================================= //=========================================================================
@ -51,8 +47,14 @@
//#include <iostream> //#include <iostream>
//#include <sys/types.h> //#include <sys/types.h>
#if HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif
#if HAVE_DIRENT_H
# include <dirent.h> # include <dirent.h>
#endif
//#include <sys/stat.h> //#include <sys/stat.h>
//#if HAVE_SYS_TIME_H //#if HAVE_SYS_TIME_H
@ -87,10 +89,6 @@
# include <pwd.h> # include <pwd.h>
#endif #endif
#if IS_REDOX
# define restrict __restrict__
#endif
#if HAVE_SYS_SOCKET_H #if HAVE_SYS_SOCKET_H
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
@ -394,7 +392,12 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& statArgs) const
statArgs.nlink = statbuf.st_nlink; statArgs.nlink = statbuf.st_nlink;
statArgs.size = statbuf.st_size; statArgs.size = statbuf.st_size;
statArgs.uid = statbuf.st_uid; statArgs.uid = statbuf.st_uid;
#if HAVE_STRUCT_STAT_ST_BLKSIZE
statArgs.blksize = statbuf.st_blksize; statArgs.blksize = statbuf.st_blksize;
#else
statArgs.blksize = 0;
#endif
#if HAVE_STRUCT_STAT_ST_BLOCKS #if HAVE_STRUCT_STAT_ST_BLOCKS
statArgs.blocks = statbuf.st_blocks; statArgs.blocks = statbuf.st_blocks;
@ -405,56 +408,58 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& statArgs) const
// set the file type // set the file type
if (S_ISREG(statbuf.st_mode)) if (S_ISREG(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_FILE; statArgs.mFileType = cFSStatArgs::TY_FILE;
#ifdef S_ISDIR
else if (S_ISDIR(statbuf.st_mode)) else if (S_ISDIR(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_DIR; statArgs.mFileType = cFSStatArgs::TY_DIR;
#endif
#ifdef S_ISLNK
else if (S_ISLNK(statbuf.st_mode)) else if (S_ISLNK(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_SYMLINK; statArgs.mFileType = cFSStatArgs::TY_SYMLINK;
#endif
#ifdef S_ISBLK
else if (S_ISBLK(statbuf.st_mode)) else if (S_ISBLK(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_BLOCKDEV; statArgs.mFileType = cFSStatArgs::TY_BLOCKDEV;
#endif
#ifdef S_ISCHR
else if (S_ISCHR(statbuf.st_mode)) else if (S_ISCHR(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_CHARDEV; statArgs.mFileType = cFSStatArgs::TY_CHARDEV;
#endif
#ifdef S_ISFIFO
else if (S_ISFIFO(statbuf.st_mode)) else if (S_ISFIFO(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_FIFO; statArgs.mFileType = cFSStatArgs::TY_FIFO;
#endif
#ifdef S_ISSOCK #ifdef S_ISSOCK
else if (S_ISSOCK(statbuf.st_mode)) else if (S_ISSOCK(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_SOCK; statArgs.mFileType = cFSStatArgs::TY_SOCK;
#endif #endif
#ifdef S_ISDOOR
#if HAVE_DOOR_CREATE
else if (S_ISDOOR(statbuf.st_mode)) else if (S_ISDOOR(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_DOOR; statArgs.mFileType = cFSStatArgs::TY_DOOR;
#endif #endif
#ifdef S_ISPORT
#if HAVE_PORT_CREATE
else if (S_ISPORT(statbuf.st_mode)) else if (S_ISPORT(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_PORT; statArgs.mFileType = cFSStatArgs::TY_PORT;
#endif #endif
#ifdef S_ISNAM #ifdef S_ISNAM
else if (S_ISNAM(statbuf.st_mode)) else if (S_ISNAM(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_NAMED; statArgs.mFileType = cFSStatArgs::TY_NAMED;
#endif #endif
#ifdef S_ISNATIVE #ifdef S_ISNATIVE
else if (S_ISNATIVE(statbuf.st_mode)) else if (S_ISNATIVE(statbuf.st_mode))
statArgs.mFileType = cFSStatArgs::TY_NATIVE; statArgs.mFileType = cFSStatArgs::TY_NATIVE;
#endif #endif
#ifdef S_TYPEISMQ #ifdef S_TYPEISMQ
else if (S_TYPEISMQ(&statbuf)) else if (S_TYPEISMQ(&statbuf))
statArgs.mFileType = cFSStatArgs::TY_MESSAGE_QUEUE; statArgs.mFileType = cFSStatArgs::TY_MESSAGE_QUEUE;
#endif #endif
#ifdef S_TYPEISSEM #ifdef S_TYPEISSEM
else if (S_TYPEISSEM(&statbuf)) else if (S_TYPEISSEM(&statbuf))
statArgs.mFileType = cFSStatArgs::TY_SEMAPHORE; statArgs.mFileType = cFSStatArgs::TY_SEMAPHORE;
#endif #endif
#ifdef S_TYPEISSHM #ifdef S_TYPEISSHM
else if (S_TYPEISSHM(&statbuf)) else if (S_TYPEISSHM(&statbuf))
statArgs.mFileType = cFSStatArgs::TY_SHARED_MEMORY; statArgs.mFileType = cFSStatArgs::TY_SHARED_MEMORY;
#endif #endif
else else
statArgs.mFileType = cFSStatArgs::TY_INVALID; statArgs.mFileType = cFSStatArgs::TY_INVALID;
} }

View File

@ -38,10 +38,6 @@
#ifndef __UNIXFSSERVICES_H #ifndef __UNIXFSSERVICES_H
#define __UNIXFSSERVICES_H #define __UNIXFSSERVICES_H
#if !IS_UNIX
#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h.
#endif
//========================================================================= //=========================================================================
// INCLUDES // INCLUDES
//========================================================================= //=========================================================================

View File

@ -177,7 +177,7 @@ typedef unsigned long dword;
#endif #endif
// You may need to tweak this to fit your architecture // You may need to tweak this to fit your architecture
typedef unsigned long ptr_size_type; typedef uintptr_t ptr_size_type;
const unsigned int WORD_SIZE = sizeof(word); const unsigned int WORD_SIZE = sizeof(word);
const unsigned int WORD_BITS = WORD_SIZE * 8; const unsigned int WORD_BITS = WORD_SIZE * 8;

View File

@ -521,10 +521,10 @@ void cMD5Signature::Finit()
#else #else
MD5Final(&mMD5Info); MD5Final(&mMD5Info);
#if BCOPY_TAKES_CHAR_PTR #if HAVE_MEMCPY_S
bcopy((char*)mMD5Info.digest, (char*)md5_digest, MD5_DIGEST_LENGTH); memcpy_s(mMD5Info.digest, sizeof(mMD5Info.digest), md5_digest, MD5_DIGEST_LENGTH);
#else #else
bcopy(mMD5Info.digest, md5_digest, MD5_DIGEST_LENGTH); memcpy(mMD5Info.digest, md5_digest, MD5_DIGEST_LENGTH);
#endif #endif
#endif #endif

View File

@ -78,9 +78,7 @@ static bool NeedsStat(const cFCOPropVector& v)
bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size) bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size)
{ {
#if !HAVE_READLINK #if SUPPORTS_SYMLINKS
return false;
#else
std::vector<char> data(size + 1); std::vector<char> data(size + 1);
char* buf = &data[0]; char* buf = &data[0];
@ -121,6 +119,8 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s
arch.WriteBlob(buf, rtn); arch.WriteBlob(buf, rtn);
return true; return true;
#else
return false;
#endif #endif
} }

View File

@ -239,7 +239,7 @@ const TSTRING expected_os("Linux");
#elif IS_DARWIN #elif IS_DARWIN
const TSTRING expected_os("Darwin"); const TSTRING expected_os("Darwin");
#elif IS_CYGWIN #elif IS_CYGWIN
const TSTRING expected_os("Cygwin"); const TSTRING expected_os("CYGWIN_NT");
#elif IS_DOS_DJGPP #elif IS_DOS_DJGPP
const TSTRING expected_os("FreeDOS"); // This will likely fail for other DOS flavors const TSTRING expected_os("FreeDOS"); // This will likely fail for other DOS flavors
#elif IS_ANDROID #elif IS_ANDROID
@ -262,6 +262,8 @@ const TSTRING expected_os("LibertyBSD");
const TSTRING expected_os("OpenBSD"); const TSTRING expected_os("OpenBSD");
#elif IS_SOLARIS #elif IS_SOLARIS
const TSTRING expected_os("SunOS"); const TSTRING expected_os("SunOS");
#elif (IS_OS400 || IS_PASE)
const TSTRING expected_os("OS400");
#elif IS_AIX #elif IS_AIX
const TSTRING expected_os("AIX"); const TSTRING expected_os("AIX");
#elif IS_HPUX #elif IS_HPUX