#pragma once

#ifndef ACL_CPP_API
# ifdef ACL_CPP_DLL
#  ifdef ACL_CPP_EXPORTS
#   define ACL_CPP_API __declspec(dllexport)
#  else
#   define ACL_CPP_API __declspec(dllimport)
#  endif
# else
#  define ACL_CPP_API
# endif
#endif

#ifndef ACL_CPP_TPL
# ifdef ACL_CPP_DLL
#  ifdef ACL_CPP_EXPORTS
#   define ACL_CPP_TPL __declspec(dllexport)
#  else
#   define ACL_CPP_TPL
#  endif
# else
#  define ACL_CPP_TPL
# endif
#endif

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>

#ifdef	_MSC_VER
# pragma warning(disable:4251)
//# if !defined(VC2003) && !defined(VC6)
//extern "C" { FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]}; }
//extern "C" { FILE _iob[3]; }
//# endif
# ifndef	HAS_SSIZE_T
# define	HAS_SSIZE_T
typedef long ssize_t;
# endif
# if(_MSC_VER >= 1300)
#  include <winsock2.h>
#  include <mswsock.h>
# else
#  include <winsock.h>
# endif
#else
# ifdef HAVE_MEMCACHED
#  undef	HAVE_MEMCACHED
# endif
#endif

#if	__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define	ACL_CPP_PRINTF(format_idx, arg_idx) \
	__attribute__((__format__ (__printf__, (format_idx), (arg_idx))))
#define	ACL_CPP_SCANF(format_idx, arg_idx) \
	__attribute__((__format__ (__scanf__, (format_idx), (arg_idx))))
#define	ACL_CPP_NORETURN __attribute__((__noreturn__))
#define	ACL_CPP_UNUSED __attribute__((__unused__))
#else
#define	ACL_CPP_PRINTF(format_idx, arg_idx)
#define	ACL_CPP_SCANF
#define	ACL_CPP_NORETURN
#define	ACL_CPP_UNUSED
#endif  // __GNUC__

#if	__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define	ACL_CPP_DEPRECATED __attribute__((__deprecated__))
#elif	defined(_MSC_VER) && (_MSC_VER >= 1300)
#define	ACL_CPP_DEPRECATED __declspec(deprecated)
#else
#define	ACL_CPP_DEPRECATED
#endif  // __GNUC__

#if	__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define	ACL_CPP_DEPRECATED_FOR(f) __attribute__((deprecated("Use " #f " instead")))
#elif	defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
#define	ACL_CPP_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
#else
#define	ACL_CPP_DEPRECATED_FOR(f)	ACL_CPP_DEPRECATED
#endif // __GNUC__
