From b2341111a6a40427f8c7991c34d99af8b25ac6e1 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 24 Jul 2012 09:49:44 +0200 Subject: [PATCH] MacOSX compatibility: check whether memcpy is a macro, and if #undef it to get the original function. --- libcitadel/configure.in | 31 +++++++++++++++++++++++++++++++ libcitadel/lib/stringbuf.c | 4 ++-- webcit/configure.ac | 29 +++++++++++++++++++++++++++++ webcit/webcit.h | 4 ++++ 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/libcitadel/configure.in b/libcitadel/configure.in index fb45b74a2..76867ee12 100755 --- a/libcitadel/configure.in +++ b/libcitadel/configure.in @@ -10,6 +10,7 @@ AC_INIT(libcitadel, 3.8.13, http://uncensored.citadel.org) AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_AUX_DIR(conftools) AC_CONFIG_SRCDIR(tests/Makefile.in) +m4_include([m4/local.m4]) dnl dnl Increment LIBREVISION if source code has changed at all @@ -103,6 +104,36 @@ AC_TRY_COMPILE([ ] ) +AC_MSG_CHECKING([whether your system likes memcpy + HKEY]) +AC_TRY_COMPILE([ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lib/libcitadel.h" +], +[ + char foo[22]; + memcpy(foo, HKEY("foo")); + +], + [ + + AC_MSG_RESULT([yes]) + ], + [ + AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy]) + AC_MSG_RESULT([no]) + ] +) + AC_CHECK_HEADERS(iconv.h) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index 963c55f6a..ba88a2f43 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -40,8 +40,8 @@ #include #endif -#ifdef LINUX_SENDFILE -#include +#ifdef UNDEF_MEMCPY +#undef memcpy #endif #ifdef HAVE_ZLIB diff --git a/webcit/configure.ac b/webcit/configure.ac index 5fc9194ce..9b33da91b 100644 --- a/webcit/configure.ac +++ b/webcit/configure.ac @@ -252,6 +252,35 @@ AC_CHECK_HEADER(libcitadel.h, ] ) +AC_MSG_CHECKING([whether your system likes memcpy + HKEY]) +AC_TRY_COMPILE([ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lib/libcitadel.h" +], +[ + char foo[22]; + memcpy(foo, HKEY("foo")); + +], + [ + + AC_MSG_RESULT([yes]) + ], + [ + AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy]) + AC_MSG_RESULT([no]) + ] +) dnl Checks for the Expat XML parser. AC_CHECK_HEADER(expat.h, diff --git a/webcit/webcit.h b/webcit/webcit.h index b34400920..342571fcb 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -123,6 +123,10 @@ extern char *ssl_cipher_list; #define TRACE syslog(LOG_DEBUG, "\033[3%dmCHECKPOINT: %s:%d\033[0m", ((__LINE__%6)+1), __FILE__, __LINE__) +#ifdef UNDEF_MEMCPY +#undef memcpy +#endif + #define SLEEPING 180 /* TCP connection timeout */ #define WEBCIT_TIMEOUT 900 /* WebCit session timeout */ #define PORT_NUM 2000 /* port number to listen on */ -- 2.30.2