summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BUILD21
-rw-r--r--Jamfile12
-rwxr-xr-xconfigure13
-rw-r--r--contrib/Jamfile81
-rw-r--r--contrib/patch-ffmpeg-cygwin.patch15
-rw-r--r--contrib/patch-x264-cygwin.patch14
-rw-r--r--contrib/patch-xvidcore-cygwin.patch34
-rw-r--r--contrib/patch-xvidcore-macosx.patch (renamed from contrib/patch-xvidcore.patch)0
-rw-r--r--libhb/ports.c116
-rw-r--r--test/test.c3
10 files changed, 224 insertions, 85 deletions
diff --git a/BUILD b/BUILD
index 9031c1400..b6822950b 100644
--- a/BUILD
+++ b/BUILD
@@ -5,8 +5,8 @@ BUILD file for HandBrake <http://handbrake.m0k.org/>
Building HandBrake
==================
-You can build HandBrake on BeOS, MacOS X and Linux. If you'd like to
-port it to another OS, email me ([email protected]).
+You can build HandBrake on BeOS, MacOS X, Linux, and on Windows using Cygwin.
+If you'd like to port it to another OS, email me ([email protected]).
Step 1: get needed tools
========================
@@ -20,8 +20,25 @@ Step 1: get needed tools
On OS X, you cannot use the modified jam shipped with the developer
tools, use this one instead:
<http://download.m0k.org/handbrake/jam-2.5rc3-OSX.zip>.
+ On Cygwin, get the jam source from
+ http://public.perforce.com/public/jam/index.html,
+ compile it with gcc in Cygwin, and put the jam executable somewhere on
+ your path.
+ nasm (Only for x86. On Mac OS X Intel, Nasm CVS is required)
+Cygwin setup:
+ There are a couple extra things required to make the code build for Cygwin.
+ Make sure you have /bin and /usr/bin on your path *first*, before
+ the Windows paths. Otherwise the Cygwin find.exe won't be used, and
+ lame won't build.
+ Also, I have not tried to build this with MinGW, I've only built it with
+ the Cygwin environment, so you should build with Cygwin gcc and dev tools.
+ Unfortunately this means you need to have cygwin1.dll around to run the
+ HBTest.exe program, but that's the way it is for now, until I get time
+ to try building it with MinGW. If you want to try making it work with
+ MinGW, then go for it!
+
+
Step 2: build
=============
diff --git a/Jamfile b/Jamfile
index 090798e95..c9c0450da 100644
--- a/Jamfile
+++ b/Jamfile
@@ -10,13 +10,23 @@ SubDir TOP ;
HB_LIBS = libhb.a
contrib/lib/liba52.a contrib/lib/libavformat.a
contrib/lib/libavcodec.a contrib/lib/libavutil.a
- contrib/lib/libdvdread.a contrib/lib/libdvdcss.a
+ contrib/lib/libdvdread.a
contrib/lib/libfaac.a contrib/lib/libmp3lame.a
contrib/lib/libmpeg2.a contrib/lib/libvorbis.a
contrib/lib/libvorbisenc.a contrib/lib/libogg.a
contrib/lib/libsamplerate.a contrib/lib/libx264.a
contrib/lib/libxvidcore.a ;
+if $(OS) = UNKNOWN
+{
+ OS = CYGWIN ;
+}
+
+if $(OS) != CYGWIN
+{
+ HB_LIBS = $(HB_LIBS) contrib/lib/libdvdcss.a ;
+}
+
# Interfaces
TEST_BIN = HBTest ;
TEST_SRC = test/test.c ;
diff --git a/configure b/configure
index abe2b1779..1658193f9 100755
--- a/configure
+++ b/configure
@@ -32,22 +32,27 @@ case $SYSTEM in
;;
Darwin)
- DEFINES="$DEFINES SYS_DARWIN"
+ DEFINES="$DEFINES SYS_DARWIN USE_PTHREAD"
LINKLIBS="$LINKLIBS -lpthread"
;;
FreeBSD)
- DEFINES="$DEFINES SYS_FREEBSD"
+ DEFINES="$DEFINES SYS_FREEBSD USE_PTHREAD"
LINKLIBS="$LINKLIBS -pthread"
;;
NetBSD)
- DEFINES="$DEFINES SYS_NETBSD"
+ DEFINES="$DEFINES SYS_NETBSD USE_PTHREAD"
LINKLIBS="$LINKLIBS -lpthread"
;;
Linux)
- DEFINES="$DEFINES SYS_LINUX"
+ DEFINES="$DEFINES SYS_LINUX USE_PTHREAD"
+ LINKLIBS="$LINKLIBS -lpthread"
+ ;;
+
+ CYGWIN*)
+ DEFINES="$DEFINES SYS_CYGWIN USE_PTHREAD"
LINKLIBS="$LINKLIBS -lpthread"
;;
diff --git a/contrib/Jamfile b/contrib/Jamfile
index 92666a903..1cdc3793d 100644
--- a/contrib/Jamfile
+++ b/contrib/Jamfile
@@ -48,6 +48,10 @@ rule LibAvCodec
FFMPEG_OPTIONS = --enable-memalign-hack ;
FFMPEG_PATCH += " && patch -p1 < ../patch-ffmpeg-macintel.patch" ;
}
+ else if $(OS) = CYGWIN
+ {
+ FFMPEG_PATCH += " && patch -p1 < ../patch-ffmpeg-cygwin.patch " ;
+ }
Depends $(<) : $(>) ;
Depends lib : $(<) ;
}
@@ -75,22 +79,26 @@ actions LibAvUtil
LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
-# libdvdcss
-# We need libdvdcss.so for libdvdread's configure to work...
-rule LibDvdCss
+# CSS doesn't work on Cygwin/Windows as of now, so don't use it.
+if $(OS) != CYGWIN
{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibDvdCss
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdvdcss && tar xzf libdvdcss.tar.gz && cd libdvdcss &&
- ./configure --prefix=$CONTRIB && make && make install &&
- strip -S $CONTRIB/lib/libdvdcss.a
+ # libdvdcss
+ # We need libdvdcss.so for libdvdread's configure to work...
+ rule LibDvdCss
+ {
+ Depends $(<) : $(>) ;
+ Depends lib : $(<) ;
+ }
+ actions LibDvdCss
+ {
+ cd `dirname $(>)` && CONTRIB=`pwd` &&
+ rm -rf libdvdcss && tar xzf libdvdcss.tar.gz && cd libdvdcss &&
+ ./configure --prefix=$CONTRIB && make && make install &&
+ strip -S $CONTRIB/lib/libdvdcss.a
+ }
+ Wget $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
+ LibDvdCss $(SUBDIR)/lib/libdvdcss.a : $(SUBDIR)/libdvdcss.tar.gz ;
}
-Wget $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
-LibDvdCss $(SUBDIR)/lib/libdvdcss.a : $(SUBDIR)/libdvdcss.tar.gz ;
# libdvdread
rule LibDvdRead
@@ -99,14 +107,30 @@ rule LibDvdRead
Depends $(<) : $(>) ;
Depends lib : $(<) ;
}
-actions LibDvdRead
+if $(OS) != CYGWIN
{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
- $(LIBDVDREAD_PATCH) &&
- ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB &&
- make && make install &&
- strip -S $CONTRIB/lib/libdvdread.a
+ actions LibDvdRead
+ {
+ cd `dirname $(>)` && CONTRIB=`pwd` &&
+ rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
+ $(LIBDVDREAD_PATCH) &&
+ ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB &&
+ make && make install &&
+ strip -S $CONTRIB/lib/libdvdread.a
+ }
+}
+else {
+ # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
+ # configure line.
+ actions LibDvdRead
+ {
+ cd `dirname $(>)` && CONTRIB=`pwd` &&
+ rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
+ $(LIBDVDREAD_PATCH) &&
+ ./configure --prefix=$CONTRIB --disable-shared &&
+ make && make install &&
+ strip -S $CONTRIB/lib/libdvdread.a
+ }
}
Wget $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
LibDvdRead $(SUBDIR)/lib/libdvdread.a : $(SUBDIR)/libdvdread.tar.gz ;
@@ -232,6 +256,10 @@ rule LibX264
{
LIBX264_PATCH = " patch -p1 < ../patch-x264-macintel.patch && " ;
}
+ else if $(OS) = CYGWIN
+ {
+ LIBX264_PATCH = " patch -p1 < ../patch-x264-cygwin.patch && " ;
+ }
Depends $(<) : $(>) ;
Depends lib : $(<) ;
}
@@ -249,6 +277,15 @@ LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
# libxvidcore
rule LibXvidCore
{
+ LIBXVIDCORE_PATCH = "" ;
+ if $(OS) = MACOSX
+ {
+ LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-macosx.patch && " ;
+ }
+ else if $(OS) = CYGWIN
+ {
+ LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-cygwin.patch && " ;
+ }
Depends $(<) : $(>) ;
Depends lib : $(<) ;
}
@@ -256,7 +293,7 @@ actions LibXvidCore
{
cd `dirname $(>)` && CONTRIB=`pwd` &&
rm -rf xvidcore && tar xzf xvidcore.tar.gz &&
- cd xvidcore && patch -p1 < ../patch-xvidcore.patch &&
+ cd xvidcore && $(LIBXVIDCORE_PATCH)
cd build/generic/ && ./configure && make libxvidcore.a &&
cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
cp ../../src/xvid.h $CONTRIB/include/ &&
diff --git a/contrib/patch-ffmpeg-cygwin.patch b/contrib/patch-ffmpeg-cygwin.patch
new file mode 100644
index 000000000..b6ca99f26
--- /dev/null
+++ b/contrib/patch-ffmpeg-cygwin.patch
@@ -0,0 +1,15 @@
+diff -Naur ffmpeg/libavcodec/mpegaudiodec.c ffmpeg-patched/libavcodec/mpegaudiodec.c
+--- ffmpeg/libavcodec/mpegaudiodec.c 2006-09-23 14:22:06.000000000 -0400
++++ ffmpeg-patched/libavcodec/mpegaudiodec.c 2007-01-01 18:31:51.156250000 -0500
+@@ -401,9 +401,9 @@
+ for(i=0; i<512*16; i++){
+ int exponent= (i>>4);
+ double f= pow(i&15, 4.0 / 3.0) * pow(2, (exponent-400)*0.25 + FRAC_BITS + 5);
+- expval_table[exponent][i&15]= llrint(f);
++ expval_table[exponent][i&15]= lrint(f);
+ if((i&15)==1)
+- exp_table[exponent]= llrint(f);
++ exp_table[exponent]= lrint(f);
+ }
+
+ for(i=0;i<7;i++) {
diff --git a/contrib/patch-x264-cygwin.patch b/contrib/patch-x264-cygwin.patch
new file mode 100644
index 000000000..40a14fa44
--- /dev/null
+++ b/contrib/patch-x264-cygwin.patch
@@ -0,0 +1,14 @@
+diff -Naur x264/configure x264-patched/configure
+--- x264/configure 2007-01-01 17:01:36.609375000 -0500
++++ x264-patched/configure 2007-01-01 17:02:36.468750000 -0500
+@@ -96,8 +96,8 @@
+ ;;
+ cygwin*)
+ SYS="CYGWIN"
+- CFLAGS="$CFLAGS -mno-cygwin"
+- LDFLAGS="$LDFLAGS -mno-cygwin"
++ #CFLAGS="$CFLAGS -mno-cygwin"
++ #LDFLAGS="$LDFLAGS -mno-cygwin"
+ EXE=".exe"
+ DEVNULL="NUL"
+ ;;
diff --git a/contrib/patch-xvidcore-cygwin.patch b/contrib/patch-xvidcore-cygwin.patch
new file mode 100644
index 000000000..7b60510d0
--- /dev/null
+++ b/contrib/patch-xvidcore-cygwin.patch
@@ -0,0 +1,34 @@
+diff -Naur xvidcore/build/generic/configure xvidcore-patched/build/generic/configure
+--- xvidcore/build/generic/configure 2005-12-30 09:45:30.000000000 -0500
++++ xvidcore-patched/build/generic/configure 2007-01-01 18:43:27.953125000 -0500
+@@ -3844,10 +3844,9 @@
+ [cC][yY][gG][wW][iI][nN]*|mingw32*|mks*)
+ echo "$as_me:$LINENO: result: ok" >&5
+ echo "${ECHO_T}ok" >&6
+- STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)"
+- SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)"
+- SPECIFIC_LDFLAGS="-mno-cygwin -shared -Wl,--dll,--out-implib,\[email protected] libxvidcore.def"
+- SPECIFIC_CFLAGS="-mno-cygwin"
++ STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
++ SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
++ SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\[email protected] libxvidcore.def"
+ ;;
+ darwin*|raphsody*)
+ STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
+diff -Naur xvidcore/build/generic/configure.in xvidcore-patched/build/generic/configure.in
+--- xvidcore/build/generic/configure.in 2005-12-30 09:45:30.000000000 -0500
++++ xvidcore-patched/build/generic/configure.in 2007-01-01 18:43:11.453125000 -0500
+@@ -281,10 +281,9 @@
+ ;;
+ [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
+ AC_MSG_RESULT([ok])
+- STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)"
+- SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)"
+- SPECIFIC_LDFLAGS="-mno-cygwin -shared -Wl,--dll,--out-implib,\[email protected] libxvidcore.def"
+- SPECIFIC_CFLAGS="-mno-cygwin"
++ STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
++ SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
++ SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\[email protected] libxvidcore.def"
+ ;;
+ darwin*|raphsody*)
+ STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
diff --git a/contrib/patch-xvidcore.patch b/contrib/patch-xvidcore-macosx.patch
index 51cb94c6d..51cb94c6d 100644
--- a/contrib/patch-xvidcore.patch
+++ b/contrib/patch-xvidcore-macosx.patch
diff --git a/libhb/ports.c b/libhb/ports.c
index 20c2cae94..bdeadc1f8 100644
--- a/libhb/ports.c
+++ b/libhb/ports.c
@@ -10,21 +10,23 @@
#if defined( SYS_BEOS )
#include <OS.h>
#include <signal.h>
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
-#include <pthread.h>
#elif defined( SYS_CYGWIN )
#include <windows.h>
#endif
-#ifdef SYS_CYGWIN
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
+#if USE_PTHREAD
+#include <pthread.h>
+#endif
+
+//#ifdef SYS_CYGWIN
+//#include <winsock2.h>
+//#include <ws2tcpip.h>
+//#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
-#endif
+//#endif
#include "hb.h"
@@ -35,6 +37,7 @@
* On Win32, we implement a gettimeofday emulation here because
* libdvdread and libmp4v2 use it without checking.
************************************************************************/
+/*
#ifdef SYS_CYGWIN
struct timezone
{
@@ -49,6 +52,7 @@ int gettimeofday( struct timeval * tv, struct timezone * tz )
return 0;
}
#endif
+*/
uint64_t hb_get_date()
{
@@ -204,11 +208,11 @@ void hb_get_tempory_filename( hb_handle_t * h, char name[1024],
***********************************************************************/
void hb_mkdir( char * name )
{
-#ifdef SYS_CYGWIN
- mkdir( name );
-#else
+//#ifdef SYS_CYGWIN
+// mkdir( name );
+//#else
mkdir( name, 0755 );
-#endif
+//#endif
}
/************************************************************************
@@ -226,10 +230,10 @@ struct hb_thread_s
#if defined( SYS_BEOS )
thread_id thread;
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_t thread;
-#elif defined( SYS_CYGWIN )
- HANDLE thread;
+//#elif defined( SYS_CYGWIN )
+// HANDLE thread;
#endif
};
@@ -295,17 +299,17 @@ hb_thread_t * hb_thread_init( char * name, void (* function)(void *),
name, priority, t );
resume_thread( t->thread );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_create( &t->thread, NULL,
(void * (*)( void * )) hb_thread_func, t );
-#elif defined( SYS_CYGWIN )
- t->thread = CreateThread( NULL, 0,
- (LPTHREAD_START_ROUTINE) hb_thread_func, t, 0, NULL );
-
- /* Maybe use THREAD_PRIORITY_LOWEST instead */
- if( priority == HB_LOW_PRIORITY )
- SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL );
+//#elif defined( SYS_CYGWIN )
+// t->thread = CreateThread( NULL, 0,
+// (LPTHREAD_START_ROUTINE) hb_thread_func, t, 0, NULL );
+//
+// /* Maybe use THREAD_PRIORITY_LOWEST instead */
+// if( priority == HB_LOW_PRIORITY )
+// SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL );
#endif
hb_log( "thread %d started (\"%s\")", t->thread, t->name );
@@ -326,11 +330,11 @@ void hb_thread_close( hb_thread_t ** _t )
long exit_value;
wait_for_thread( t->thread, &exit_value );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_join( t->thread, NULL );
-#elif defined( SYS_CYGWIN )
- WaitForSingleObject( t->thread, INFINITE );
+//#elif defined( SYS_CYGWIN )
+// WaitForSingleObject( t->thread, INFINITE );
#endif
hb_log( "thread %d joined (\"%s\")",
@@ -365,10 +369,10 @@ struct hb_lock_s
{
#if defined( SYS_BEOS )
sem_id sem;
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_mutex_t mutex;
-#elif defined( SYS_CYGWIN )
- HANDLE mutex;
+//#elif defined( SYS_CYGWIN )
+// HANDLE mutex;
#endif
};
@@ -386,10 +390,10 @@ hb_lock_t * hb_lock_init()
#if defined( SYS_BEOS )
l->sem = create_sem( 1, "sem" );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_mutex_init( &l->mutex, NULL );
-#elif defined( SYS_CYGWIN )
- l->mutex = CreateMutex( 0, FALSE, 0 );
+//#elif defined( SYS_CYGWIN )
+// l->mutex = CreateMutex( 0, FALSE, 0 );
#endif
return l;
@@ -401,10 +405,10 @@ void hb_lock_close( hb_lock_t ** _l )
#if defined( SYS_BEOS )
delete_sem( l->sem );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_mutex_destroy( &l->mutex );
-#elif defined( SYS_CYGWIN )
- CloseHandle( l->mutex );
+//#elif defined( SYS_CYGWIN )
+// CloseHandle( l->mutex );
#endif
free( l );
@@ -415,10 +419,10 @@ void hb_lock( hb_lock_t * l )
{
#if defined( SYS_BEOS )
acquire_sem( l->sem );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_mutex_lock( &l->mutex );
-#elif defined( SYS_CYGWIN )
- WaitForSingleObject( l->mutex, INFINITE );
+//#elif defined( SYS_CYGWIN )
+// WaitForSingleObject( l->mutex, INFINITE );
#endif
}
@@ -426,10 +430,10 @@ void hb_unlock( hb_lock_t * l )
{
#if defined( SYS_BEOS )
release_sem( l->sem );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_mutex_unlock( &l->mutex );
-#elif defined( SYS_CYGWIN )
- ReleaseMutex( l->mutex );
+//#elif defined( SYS_CYGWIN )
+// ReleaseMutex( l->mutex );
#endif
}
@@ -440,10 +444,10 @@ struct hb_cond_s
{
#if defined( SYS_BEOS )
int thread;
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_cond_t cond;
-#elif defined( SYS_CYGWIN )
- HANDLE event;
+//#elif defined( SYS_CYGWIN )
+// HANDLE event;
#endif
};
@@ -462,10 +466,10 @@ hb_cond_t * hb_cond_init()
#if defined( SYS_BEOS )
c->thread = -1;
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_cond_init( &c->cond, NULL );
-#elif defined( SYS_CYGWIN )
- c->event = CreateEvent( NULL, FALSE, FALSE, NULL );
+//#elif defined( SYS_CYGWIN )
+// c->event = CreateEvent( NULL, FALSE, FALSE, NULL );
#endif
return c;
@@ -476,10 +480,10 @@ void hb_cond_close( hb_cond_t ** _c )
hb_cond_t * c = *_c;
#if defined( SYS_BEOS )
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_cond_destroy( &c->cond );
-#elif defined( SYS_CYGWIN )
- CloseHandle( c->event );
+//#elif defined( SYS_CYGWIN )
+// CloseHandle( c->event );
#endif
free( c );
@@ -494,11 +498,11 @@ void hb_cond_wait( hb_cond_t * c, hb_lock_t * lock )
suspend_thread( c->thread );
acquire_sem( lock->sem );
c->thread = -1;
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_cond_wait( &c->cond, &lock->mutex );
-#elif defined( SYS_CYGWIN )
- SignalObjectAndWait( lock->mutex, c->event, INFINITE, FALSE );
- WaitForSingleObject( lock->mutex, INFINITE );
+//#elif defined( SYS_CYGWIN )
+// SignalObjectAndWait( lock->mutex, c->event, INFINITE, FALSE );
+// WaitForSingleObject( lock->mutex, INFINITE );
#endif
}
@@ -519,10 +523,10 @@ void hb_cond_signal( hb_cond_t * c )
thread is actually suspended before we resume it */
snooze( 5000 );
}
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD )
+#elif USE_PTHREAD
pthread_cond_signal( &c->cond );
-#elif defined( SYS_CYGWIN )
- PulseEvent( c->event );
+//#elif defined( SYS_CYGWIN )
+// PulseEvent( c->event );
#endif
}
diff --git a/test/test.c b/test/test.c
index 0f43a7f16..de499f4fd 100644
--- a/test/test.c
+++ b/test/test.c
@@ -6,6 +6,9 @@
#include <signal.h>
#include <getopt.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
#include "hb.h"