Only in libcddb-1.3.0-w32port: autom4te.cache
diff -r -u libcddb-1.3.0/configure libcddb-1.3.0-w32port/configure
--- libcddb-1.3.0/configure	2006-10-15 11:07:27.000000000 +0200
+++ libcddb-1.3.0-w32port/configure	2007-01-14 00:03:26.000000000 +0100
@@ -22477,7 +22477,12 @@
     WARN_CFLAGS="$warning_flags"
     unset warning_flags
 fi
-CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS"
+
+CFLAGS_GLIB=`pkg-config --cflags glib-2.0`
+LDFLAGS_GLIB=`pkg-config --libs glib-2.0`
+
+CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS $CFLAGS_GLIB"
+LDFLAGS="$LDFLAGS -lws2_32 -lintl -liberty $LDFLAGS_GLIB"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
diff -r -u libcddb-1.3.0/configure.ac libcddb-1.3.0-w32port/configure.ac
--- libcddb-1.3.0/configure.ac	2006-10-15 11:04:53.000000000 +0200
+++ libcddb-1.3.0-w32port/configure.ac	2007-01-14 00:03:06.000000000 +0100
@@ -186,7 +186,12 @@
     WARN_CFLAGS="$warning_flags"
     unset warning_flags
 fi
-CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS"
+
+CFLAGS_GLIB=`pkg-config --cflags glib-2.0`
+LDFLAGS_GLIB=`pkg-config --libs glib-2.0`
+
+CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS $CFLAGS_GLIB"
+LDFLAGS="$LDFLAGS -lws2_32 -lintl -liberty $LDFLAGS_GLIB"
 
 dnl Create makefiles
 AC_OUTPUT
Only in libcddb-1.3.0/include/cddb: cddb_config.h
diff -r -u libcddb-1.3.0/include/cddb/cddb_conn.h libcddb-1.3.0-w32port/include/cddb/cddb_conn.h
--- libcddb-1.3.0/include/cddb/cddb_conn.h	2006-10-15 13:25:35.000000000 +0200
+++ libcddb-1.3.0-w32port/include/cddb/cddb_conn.h	2007-01-13 20:46:55.000000000 +0100
@@ -28,7 +28,8 @@
 
 
 #include <stdio.h>
-#include <netinet/in.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
 
 #include "cddb/cddb_site.h"
 
Only in libcddb-1.3.0-w32port/include/cddb: cddb_conn.h~
Only in libcddb-1.3.0/include/cddb: version.h
diff -r -u libcddb-1.3.0/lib/cddb_cmd.c libcddb-1.3.0-w32port/lib/cddb_cmd.c
--- libcddb-1.3.0/lib/cddb_cmd.c	2006-10-15 12:10:56.000000000 +0200
+++ libcddb-1.3.0-w32port/lib/cddb_cmd.c	2007-01-14 00:08:53.000000000 +0100
@@ -30,6 +30,13 @@
 #include "cddb/cddb_ni.h"
 #include "cddb/ll.h"
 
+#ifdef _WIN32
+#define regcomp xregcomp
+#define regexec xregexec
+#define regfree xregfree
+#include <glib.h>
+#include <glib/gstdio.h>
+#endif /* _WIN32 */
 
 static const char *CDDB_COMMANDS[CMD_LAST] = {
     "cddb hello %s %s %s %s",
@@ -125,7 +132,11 @@
     fn = (char*)malloc(len + 1);
     /* create file name */
     if (fn) {
+#ifdef _WIN32
+        snprintf(fn, len + 1, "%s\\%s\\%08x", c->cache_dir, 
+#else
         snprintf(fn, len + 1, "%s/%s/%08x", c->cache_dir, 
+#endif /* _WIN32 */
                  CDDB_CATEGORY[disc->category], disc->discid);
     } else {
         cddb_errno_log_crit(c, CDDB_ERR_OUT_OF_MEMORY);
@@ -165,7 +176,11 @@
     /* open new entry */
     fn = cddb_cache_file_name(c, disc);
     if (fn) {
+#ifdef _WIN32
+        c->cache_fp = g_fopen(fn, mode);
+#else
         c->cache_fp = fopen(fn, mode);
+#endif /* _WIN32 */
         rv = (c->cache_fp != NULL);
     }
     FREE_NOT_NULL(fn);
@@ -306,7 +321,11 @@
 
     /* create category dir */
     fn = (char*)malloc(c->buf_size);
+#ifdef _WIN32
+    snprintf(fn, c->buf_size, "%s\\%s", c->cache_dir, CDDB_CATEGORY[disc->category]);
+#else
     snprintf(fn, c->buf_size, "%s/%s", c->cache_dir, CDDB_CATEGORY[disc->category]);
+#endif /* _WIN32 */
     if ((MKDIR(fn, 0755) == -1) && (errno != EEXIST)) {
         cddb_log_error("could not create category directory: %s", fn);
         free(fn);
diff -r -u libcddb-1.3.0/lib/cddb_conn.c libcddb-1.3.0-w32port/lib/cddb_conn.c
--- libcddb-1.3.0/lib/cddb_conn.c	2006-10-15 13:53:11.000000000 +0200
+++ libcddb-1.3.0-w32port/lib/cddb_conn.c	2007-01-14 00:00:35.000000000 +0100
@@ -45,6 +45,9 @@
 #include <unistd.h>
 #endif
 
+#ifdef _WIN32
+#include <glib.h>
+#endif /* _WIN32 */
 
 /* --- prototypes --- */
 
@@ -99,9 +102,17 @@
 
         c->use_cache = CACHE_ON;
         /* construct cache dir '$HOME/[DEFAULT_CACHE]' */
-        s = getenv("HOME");
+#ifdef _WIN32
+        s = g_get_home_dir();
+#else
+	s = getenv("HOME");
+#endif /* _WIN32 */
         c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
+#ifdef _WIN32
+        sprintf(c->cache_dir, "%s\\%s", s, DEFAULT_CACHE);
+#else
         sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
+#endif /* _WIN32 */
         c->cache_read = FALSE;
 
         /* use anonymous@localhost */
@@ -549,7 +560,11 @@
         FREE_NOT_NULL(c->cache_dir);
         if (dir[0] == '~') {
             /* expand ~ to $HOME */
-            home = getenv("HOME");
+#ifdef _WIN32
+	    home = g_get_home_dir();
+#else
+	    home = getenv("HOME");
+#endif /* _WIN32 */
             if (home) {
                 c->cache_dir = (char*)malloc(strlen(home) + strlen(dir));
                 sprintf(c->cache_dir, "%s%s", home, dir + 1);
diff -r -u libcddb-1.3.0/lib/cddb_net.c libcddb-1.3.0-w32port/lib/cddb_net.c
--- libcddb-1.3.0/lib/cddb_net.c	2005-03-11 22:29:30.000000000 +0100
+++ libcddb-1.3.0-w32port/lib/cddb_net.c	2007-01-14 00:48:02.000000000 +0100
@@ -62,6 +62,11 @@
 #endif
 
 
+#define ETIMEDOUT WSAETIMEDOUT
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EINPROGRESS WSAEINPROGRESS
+
+
 /* Utility functions */
 
 
@@ -237,30 +242,42 @@
     longjmp(timeout_expired, 1);
 }
 
+//struct hostent *timeout_gethostbyname(const char *hostname, int timeout)
+//{
+//    struct hostent *he = NULL;
+//    struct sigaction action;
+//    struct sigaction old;
+//
+//    /* no signal before setjmp */
+//    alarm(0);
+//
+//    /* register signal handler */
+//    memset(&action, 0, sizeof(action));
+//    action.sa_handler = alarm_handler;
+//    sigaction(SIGALRM, &action, &old);
+//
+//    /* save stack state */
+//    if (!setjmp(timeout_expired)) {
+//        alarm(timeout);         /* set time-out alarm */
+//        he = gethostbyname(hostname); /* execute DNS query */
+//        alarm(0);               /* reset alarm timer */
+//    } else {
+//        errno = ETIMEDOUT;
+//    }
+//    sigaction(SIGALRM, &old, NULL); /* restore previous signal handler */
+//
+//    return he;
+//}
+
 struct hostent *timeout_gethostbyname(const char *hostname, int timeout)
 {
+    /* XXX we simply use the blocking call here, but this should work perfectly
+     * anyway, and is used only in cddb_connect(). There is an asynchronous call
+     * in the WinSock API called WSAAsyncGetHostByName, but it sucks since it
+     * needs an application window to receive the async message.
+     */
     struct hostent *he = NULL;
-    struct sigaction action;
-    struct sigaction old;
-
-    /* no signal before setjmp */
-    alarm(0);
-
-    /* register signal handler */
-    memset(&action, 0, sizeof(action));
-    action.sa_handler = alarm_handler;
-    sigaction(SIGALRM, &action, &old);
-
-    /* save stack state */
-    if (!setjmp(timeout_expired)) {
-        alarm(timeout);         /* set time-out alarm */
-        he = gethostbyname(hostname); /* execute DNS query */
-        alarm(0);               /* reset alarm timer */
-    } else {
-        errno = ETIMEDOUT;
-    }
-    sigaction(SIGALRM, &old, NULL); /* restore previous signal handler */
-
+    he = gethostbyname(hostname); /* execute DNS query */
     return he;
 }
 
@@ -270,7 +287,14 @@
     int got_error = 0;
 
     /* set socket to non-blocking */
-#ifdef BEOS
+#if defined(_WIN32)
+    long nonBlock = TRUE;
+
+    if (ioctlsocket(sockfd, FIONBIO, &nonBlock) == -1) {
+        /* error while trying to set socket to non-blocking */
+        return -1;
+    }
+#elif defined(BEOS)
     int on = 1;
 
     if (setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(on)) == -1) {
@@ -314,7 +338,7 @@
             default:
                 /* we got connected, check error condition */
                 l = sizeof(rv);
-                getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &rv, &l);
+                getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&rv, &l);
                 if (rv) {
                     /* something went wrong, simulate normal connect behaviour */
                     errno = rv;
diff -r -u libcddb-1.3.0/lib/cddb_regex.c libcddb-1.3.0-w32port/lib/cddb_regex.c
--- libcddb-1.3.0/lib/cddb_regex.c	2006-10-15 08:43:19.000000000 +0200
+++ libcddb-1.3.0-w32port/lib/cddb_regex.c	2007-01-13 21:32:00.000000000 +0100
@@ -26,6 +26,9 @@
 #include <string.h>
 #include "cddb/cddb_regex.h"
 
+#define regcomp xregcomp
+#define regexec xregexec
+#define regfree xregfree
 
 regex_t *REGEX_TRACK_FRAME_OFFSETS = NULL;
 regex_t *REGEX_TRACK_FRAME_OFFSET = NULL;
diff -r -u libcddb-1.3.0/lib/cddb_site.c libcddb-1.3.0-w32port/lib/cddb_site.c
--- libcddb-1.3.0/lib/cddb_site.c	2005-06-15 18:12:04.000000000 +0200
+++ libcddb-1.3.0-w32port/lib/cddb_site.c	2007-01-13 21:32:26.000000000 +0100
@@ -29,6 +29,7 @@
 #include "cddb/cddb_ni.h"
 #include "cddb/cddb_site.h"
 
+#define regexec xregexec
 
 /* --- type and structure definitions */
 

