MacOSX compatibility: check whether memcpy is a macro, and if #undef it to get the...
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Jul 2012 07:49:44 +0000 (09:49 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Jul 2012 07:49:44 +0000 (09:49 +0200)
libcitadel/configure.in
libcitadel/lib/stringbuf.c
webcit/configure.ac
webcit/webcit.h

index fb45b74a2068e8c7cf02ef82f8a3de93b012c8a2..76867ee12018c4f487b282ef54a2d8bc8dde0ace 100755 (executable)
@@ -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 <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/select.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#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)
 
index 963c55f6a7fbe1a398751e6f4893bf31d7f9df81..ba88a2f431bbfe594661dd738bc3deaba19917e3 100644 (file)
@@ -40,8 +40,8 @@
 #include <execinfo.h>
 #endif
 
-#ifdef LINUX_SENDFILE
-#include <sys/sendfile.h>
+#ifdef UNDEF_MEMCPY
+#undef memcpy
 #endif
 
 #ifdef HAVE_ZLIB
index 5fc9194cee7d0ec157dd827de91ab55382970b93..9b33da91bdf5d13b154d182351bab81f2b543231 100644 (file)
@@ -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 <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/select.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#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,
index b3440092078d57d12e5c37f94735645fa82b536d..342571fcbce08e25e07ee3cf07690b8ec1955085 100644 (file)
@@ -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 */