LRN
Joined: 17 Jun 2009 Posts: 1
|
Posted: Wed Jun 17, 2009 8:56 am Post subject: Problems building libshout from the source with MinGW/MSys |
|
|
1) libshout uses general _WIN32 preprocessor check, but assumes that it means Microsoft's cl.exe compiler - that it not true. Only the presence of _MSC_VER points to that, _WIN32 may be (and is) defined by MinGW, which (being C99- and *nix-compatible) does not need some of the definitions that libshout does for cl.exe
2) grep-based automake version check is made for old "automake (GNU automake) 1.x", and it thinks that "automake (GNU automake) 1.10" to be 1.1, not 1.10
3) there is no sleep() function in MinGW, only _sleep() (considered to be deprecated, on Windows one should use native Sleep() function) and usleep() (same thing, but takes microseconds), but nonblocking example requires sleep() to be present
A patch to fix all three:
Code: |
Index: include/os.h
===================================================================
--- include/os.h (revision 16141)
+++ include/os.h (working copy)
@@ -1,4 +1,4 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
Index: src/shout.c
===================================================================
--- src/shout.c (revision 16141)
+++ src/shout.c (working copy)
@@ -38,7 +38,7 @@
#include "shout_private.h"
#include "util.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
# ifndef va_copy
# define va_copy(ap1, ap2) memcpy(&ap1, &ap2, sizeof(va_list))
# endif
Index: autogen.sh
===================================================================
--- autogen.sh (revision 16141)
+++ autogen.sh (working copy)
@@ -18,7 +18,7 @@
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
-VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]\).*/\1/"
# do we need automake?
if test -r Makefile.am; then
Index: examples/nonblocking.c
===================================================================
--- examples/nonblocking.c (revision 16141)
+++ examples/nonblocking.c (working copy)
@@ -68,7 +68,7 @@
while (ret == SHOUTERR_BUSY) {
printf("Connection pending. Sleeping...\n");
- sleep(1);
+ usleep(1000000);
ret = shout_get_connected(shout);
}
|
|
|