diff --git a/Makefile.conf b/Makefile.conf index c1fadb4e..b4a221cc 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -100,8 +100,11 @@ ifeq ($(BUILD_FOR),OS/390) CFLAGS+= -I/usr/include CFLAGS+= -DZOS -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L -qlanglvl=NOLIBEXT else ifeq ($(BUILD_FOR),Linux) + CFLAGS+= -DUNIX CFLAGS+=-fPIC -fstrict-aliasing -fdiagnostics-color=auto else ifeq ($(BUILD_FOR),Darwin) + CFLAGS+= -DUNIX + CFLAGS+= -DDARWIN CFLAGS+=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics endif diff --git a/src/Makefile b/src/Makefile index 0eb3766e..b11db044 100644 --- a/src/Makefile +++ b/src/Makefile @@ -128,7 +128,8 @@ HEADERS_TO_INSTALL = \ timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h group.h \ cryptotech.h sync_api.h pEp_string.h openpgp_compat.h engine_sql.h \ labeled_int_list.h key_reset.h base64.h sync_codec.h distribution_codec.h \ - storage_codec.h status_to_string.h keyreset_command.h platform.h platform_unix.h \ + storage_codec.h status_to_string.h keyreset_command.h platform.h \ + platform_unix.h platform_windows.h platform_zos.h \ transport.h growing_buf.h $(wildcard ../asn.1/*.h) # CAVEAT: diff --git a/src/platform.h b/src/platform.h index 7d0bb3fd..bcef6e84 100644 --- a/src/platform.h +++ b/src/platform.h @@ -11,10 +11,14 @@ extern "C" { #endif -#ifdef _WIN32 -#include "platform_windows.h" +#if defined (_WIN32) +# include "platform_windows.h" +#elif defined (UNIX) +# include "platform_unix.h" +#elif defined (ZOS) +# include "platform_zos.h" #else -#include "platform_unix.h" +# error "unknown platform" #endif #ifdef __cplusplus diff --git a/src/platform_zos.c b/src/platform_zos.c new file mode 100644 index 00000000..32bc3c6a --- /dev/null +++ b/src/platform_zos.c @@ -0,0 +1,15 @@ +// This file is under GNU General Public License 3.0 +// see LICENSE.txt + +/* Include the entire useful part of this compilation unit within a CPP + conditional, so that the entire file expands to nothing if this is not + the platform it is used on. */ +#ifdef ZOS + +#include "pEpEngine.h" +#include "platform_zos.h" +#include "dynamic_api.h" + +/* Nothing useful here at this time. */ + +#endif // #ifdef ZOS diff --git a/src/platform_zos.h b/src/platform_zos.h new file mode 100644 index 00000000..29088acc --- /dev/null +++ b/src/platform_zos.h @@ -0,0 +1,32 @@ +/** + * @file platform_zos.h + * @brief z/OS platform-specific implementation details + * @license GNU General Public License 3.0 - see LICENSE.txt + */ + +#ifndef PEP_PLATFORM_ZOS_H +#define PEP_PLATFORM_ZOS_H + +#if ! defined (ZOS) +# error "this header should only ever be included on z/OS" +#endif + +/* Workaround standard header problems. */ + +#ifdef __cplusplus +# undef _EXT +# define _NO_EXT +#endif +#include_next + +#ifndef __cplusplus +char * stpcpy (char *dst, const char *src); +char * strndup (const char *s, size_t n); +size_t strnlen (const char *s, size_t maxlen); +#endif +#include + +#include_next + + +#endif // #ifndef PEP_PLATFORM_ZOS_H diff --git a/src/stdlib.h b/src/stdlib.h deleted file mode 100644 index 5370b1c7..00000000 --- a/src/stdlib.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifdef ZOS -#ifdef __cplusplus -#undef _EXT -#define _NO_EXT -#endif -#endif - -#include_next diff --git a/src/string.h b/src/string.h deleted file mode 100644 index ac2323f5..00000000 --- a/src/string.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef ZOS -#ifndef __cplusplus -char * stpcpy (char *dst, const char *src); -char * strndup (const char *s, size_t n); -size_t strnlen (const char *s, size_t maxlen); -#endif -#include -#endif - -#include_next