--- /dev/null
+/* Define autoconf macros libspamc.c expects. */
+#define HAVE_SYSEXITS_H 1
+#define HAVE_ERRNO_H 1
+#define HAVE_TIME_H 1
+#define HAVE_H_ERRNO 1
+#define HAVE_EX__MAX 1
+
+/* Includes for my code. */
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+
+/* Swap in my logging replacement. */
+void _err(int, bool, char *, int, char *, ...);
+#define libspamc_log(flags, level, ...) _err(-1, false, __FILE__, __LINE__, __VA_ARGS__)
* </@LICENSE>
*/
+#include "config.h"
#include "libspamc.h"
#include "utils.h"
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
-#include <strings.h>
+#ifdef _WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define strcasecmp stricmp
+#define sleep Sleep
+#include <io.h>
+#else
+#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#define closesocket(x) close(x)
+#endif
+#ifdef HAVE_SYSEXITS_H
#include <sysexits.h>
+#endif
+#ifdef HAVE_ERRNO_H
#include <errno.h>
+#endif
+#ifdef HAVE_SYS_ERRNO_H
+#include <sys/errno.h>
+#endif
+#ifdef HAVE_TIME_H
#include <time.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-
-void _err(int, bool, char *, int, char *, ...);
-#define libspamc_log(flags, level, ...) _err(-1, false, __FILE__, __LINE__, __VA_ARGS__)
-
-enum { LOG_ERR, LOG_DEBUG, LOG_NOTICE };
+#endif
/* FIXME: Make this configurable */
#define MAX_CONNECT_RETRIES 3
# define SHUT_RDWR 2 /* no more receptions or transmissions */
#endif
+#ifndef HAVE_H_ERRNO
+#define h_errno errno
+#endif
+
#ifndef HAVE_OPTARG
extern char *optarg;
#endif
/* jm: turned off for now, it should not be necessary. */
#undef USE_TCP_NODELAY
+#ifndef HAVE_EX__MAX
+/* jm: very conservative figure, should be well out of range on almost all NIXes */
+#define EX__MAX 200
+#endif
+
#undef DO_CONNECT_DEBUG_SYSLOGS
/* or #define DO_CONNECT_DEBUG_SYSLOGS 1 */
int max_size, int in_fd, int out_fd,
const int check_only, const int safe_fallback);
+#ifndef libspamc_log
void libspamc_log(int flags, int level, char *msg, ...);
+#endif
#endif