[evolution-exchange/gnome-2-28] Windows build fixes



commit 507c0ea2f6482bfc95bbbd16d135a09c467be149
Author: Fridrich Strba <fridrich strba bluewin ch>
Date:   Mon Mar 8 21:12:05 2010 +0100

    Windows build fixes

 addressbook/e-book-backend-gal.c |   12 ++++++
 addressbook/e-book-backend-gal.h |   69 +++++++++++++++++++++++++++++++++++++-
 configure.ac                     |   16 ++++++---
 storage/Makefile.am              |    4 +-
 4 files changed, 93 insertions(+), 8 deletions(-)
---
diff --git a/addressbook/e-book-backend-gal.c b/addressbook/e-book-backend-gal.c
index 3b33a6e..9151b49 100644
--- a/addressbook/e-book-backend-gal.c
+++ b/addressbook/e-book-backend-gal.c
@@ -53,6 +53,10 @@
 #include "e-book-backend-gal.h"
 #include <libical/ical.h>
 
+#ifdef _WIN32
+#include <winber.h>
+#endif
+
 #ifndef LDAP_CONTROL_PAGEDRESULTS
 #ifdef ENABLE_CACHE
 #undef ENABLE_CACHE
@@ -2233,9 +2237,17 @@ getNextPage:
 			return;
 		}
 		ber_printf( prber, "{iO}", pageSize, &cookie );
+#ifdef G_OS_WIN32
+		if ( ber_flatten( prber, &c[i].ldctl_value ) == -1 ) {
+			ber_free( prber, 1 );
+			return;
+		}
+		ber_free( prber, 1 );
+#else
 		if ( ber_flatten2( prber, &c[i].ldctl_value, 0 ) == -1 ) {
 			return;
 		}
+#endif
 		d(printf ("Setting parameters		\n"));
 		c[i].ldctl_oid = (gchar *) LDAP_CONTROL_PAGEDRESULTS;
 		c[i].ldctl_iscritical = pagedResults > 1;
diff --git a/addressbook/e-book-backend-gal.h b/addressbook/e-book-backend-gal.h
index 43ad2f3..a7cf8d9 100644
--- a/addressbook/e-book-backend-gal.h
+++ b/addressbook/e-book-backend-gal.h
@@ -7,13 +7,80 @@
 #include "libedata-book/e-book-backend.h"
 #include "exchange-component.h"
 
-#ifdef SUNLDAP
+#if defined(SUNLDAP) || defined(G_OS_WIN32)
 /*   copy from openldap ldap.h   */
 #define LDAP_RANGE(n,x,y)      (((x) <= (n)) && ((n) <= (y)))
+#ifndef LDAP_NAME_ERROR
 #define LDAP_NAME_ERROR(n)     LDAP_RANGE((n), 0x20, 0x24)
+#endif
+#ifndef LBER_USE_DER
 #define LBER_USE_DER			0x01
+#endif
+#ifndef LDAP_CONTROL_PAGEDRESULTS
 #define LDAP_CONTROL_PAGEDRESULTS      "1.2.840.113556.1.4.319"
 #endif
+#endif
+
+#ifndef LDAP_TYPE_OR_VALUE_EXISTS
+#define LDAP_TYPE_OR_VALUE_EXISTS 0x14
+#endif
+#ifndef LDAP_SCOPE_DEFAULT
+#define LDAP_SCOPE_DEFAULT -1
+#endif
+#ifndef LDAP_OPT_SUCCESS
+#define LDAP_OPT_SUCCESS 0x00
+#endif
+#ifndef LDAP_INSUFFICIENT_ACCESS
+#define LDAP_INSUFFICIENT_ACCESS 0x32
+#endif
+#ifndef LDAP_OPT_SERVER_CONTROLS
+#define LDAP_OPT_SERVER_CONTROLS 0x12
+#endif
+
+#ifdef G_OS_WIN32
+/* map between the WinLDAP API and OpenLDAP API */
+#  ifndef ldap_msgtype
+#    define ldap_msgtype(m) ((m)->lm_msgtype)
+#  endif
+
+#  ifndef ldap_first_message
+#    define ldap_first_message ldap_first_entry
+#  endif
+
+#  ifndef ldap_next_message
+#    define ldap_next_message ldap_next_entry
+#  endif
+
+#  ifndef LDAP_RES_MODDN
+#    define LDAP_RES_MODDN LDAP_RES_MODRDN
+#  endif
+
+#  ifdef ldap_compare_ext
+#    undef ldap_compare_ext
+#  endif
+#  ifdef ldap_search_ext
+#    undef ldap_search_ext
+#  endif
+#  ifdef ldap_start_tls_s
+#    undef ldap_start_tls_s
+#  endif
+
+#  ifdef UNICODE
+#    define ldap_compare_ext(ld,dn,a,v,sc,cc,msg) \
+        ldap_compare_extW(ld,dn,a,0,v,sc,cc,msg)
+#    define ldap_search_ext(ld,base,scope,f,a,o,sc,cc,(t),s,msg) \
+        ldap_search_extW(ld,base,scope,f,a,o,sc,cc,((PLDAP_TIMEVAL)t)?((PLDAP_TIMEVAL)t)->tv_sec:0,s,msg)
+#    define ldap_start_tls_s(ld,sc,cc) \
+        ldap_start_tls_sW(ld,0,0,sc,cc)
+#  else /* !UNICODE */
+#    define ldap_compare_ext(ld,dn,a,v,sc,cc,msg) \
+        ldap_compare_extA(ld,dn,a,0,v,sc,cc,msg)
+#    define ldap_search_ext(ld,base,scope,f,a,o,sc,cc,t,s,msg) \
+        ldap_search_extA(ld,base,scope,f,a,o,sc,cc,((PLDAP_TIMEVAL)t)?((PLDAP_TIMEVAL)t)->tv_sec:0,s,msg)
+#    define ldap_start_tls_s(ld,sc,cc) \
+        ldap_start_tls_sA(ld,0,0,sc,cc)
+#  endif /* UNICODE */
+#endif /* G_OS_WIN32 */
 
 typedef struct _EBookBackendGALPrivate EBookBackendGALPrivate;
 
diff --git a/configure.ac b/configure.ac
index 3e501e4..f30e74d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,7 +176,9 @@ dnl AC_DEFINE(BONOBO_UI_DISABLE_DEPRECATED,1,[No deprecated bonoboui functions])
 dnl AC_DEFINE(GCONF_DISABLE_DEPRECATED,1,[No deprecated gconf functions])
 dnl AC_DEFINE(LIBGLADE_DISABLE_DEPRECATED,1,[No deprecated libglade functions])
 
-AC_EGREP_HEADER(socklen_t, sys/socket.h, :, AC_DEFINE(socklen_t, int, [Define to "int" if socklen_t is not defined]))
+if test x$os_win32 != xyes; then
+   AC_EGREP_HEADER(socklen_t, sys/socket.h, :, AC_DEFINE(socklen_t, int, [Define to "int" if socklen_t is not defined]))
+fi
 
 AM_PATH_GLIB_2_0
 AM_PATH_ORBIT2
@@ -316,10 +318,14 @@ int main(int argc, char **argv)
 }],[
 AC_DEFINE(HAVE_LDAP_PAGED, 1, [Supports Paged results])
 ac_cv_ldappaged=yes
-],ac_cv_ldappaged="no (GAL Caching disabled)",ac_cv_ldappaged="no (GAL Caching disabled)",[
-AC_DEFINE(HAVE_LDAP_PAGED, 1, [Supports Paged results])
-ac_cv_ldappaged=yes
-])
+],ac_cv_ldappaged="no (GAL Caching disabled)",ac_cv_ldappaged="no (GAL Caching disabled)")
+
+# hardcode this for win32 because winldap.h supports the paged results
+# although with a tad different API
+if test x$os_win32 = xyes; then
+   AC_DEFINE(HAVE_LDAP_PAGED, 1, [Supports Paged results])
+   ac_cv_ldappaged=yes
+fi
 AC_MSG_RESULT($ac_cv_ldappaged)
 
 dnl *******
diff --git a/storage/Makefile.am b/storage/Makefile.am
index 40cdfd4..610df7b 100644
--- a/storage/Makefile.am
+++ b/storage/Makefile.am
@@ -60,9 +60,9 @@ exchange_connector_setup_LDADD = \
 	$(EXCHANGE_STORAGE_LIBS) \
 	$(LIBEXCHANGE_LIBS)
 
-install-exec-local: exchange-connector-setup
+install-exec-local: exchange-connector-setup EXEEXT@
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
-	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) exchange-connector-setup $(DESTDIR)$(bindir)/exchange-connector-setup-$(BASE_VERSION)
+	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) exchange-connector-setup EXEEXT@ $(DESTDIR)$(bindir)/exchange-connector-setup-$(BASE_VERSION)@EXEEXT@
 
 uninstall-local:
 	rm -rf $(DESTDIR)$(bindir)/exchange-connector-setup-$(BASE_VERSION)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]