diff --git a/Makefile.am b/Makefile.am index 854a32e..ed0a78d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,4 @@ SUBDIRS = src -EXTRA_DIST = CREDITS Changelog girl_from_mars.xm os2/Makefile.os2 Makefile.w32 os2/unistd.h os2/usleep.c +EXTRA_DIST = CREDITS Changelog girl_from_mars.xm Makefile.os2 Makefile.w32 diff --git a/os2/Makefile.os2 b/Makefile.os2 similarity index 84% rename from os2/Makefile.os2 rename to Makefile.os2 index dc82150..f7ed24c 100644 --- a/os2/Makefile.os2 +++ b/Makefile.os2 @@ -3,7 +3,7 @@ # wmake -f Makefile.os2 CC=wcc386 -CPPFLAGS=-DHAVE_SIGNAL_H -DHAVE_SYS_TIME_H +CPPFLAGS=-DHAVE_SIGNAL_H CPPFLAGS+= -DSOUND_OS2DART !ifndef __UNIX__ @@ -11,15 +11,17 @@ CPPFLAGS+= -DVERSION="4.2.0" !else CPPFLAGS+= -DVERSION=\"4.2.0\" !endif -INCLUDES=-I"../os2" -I"../src" +INCLUDES=-I"src/watcom" -Isrc -#LIBXMP=libxmp_static.lib +#LIBXMP=xmp_static.lib LIBXMP=libxmp.lib LIBS=$(LIBXMP) # for sound_dart: LIBS+= mmpm2.lib CFLAGS = -bt=os2 -bm -fp5 -fpi87 -mf -oeatxh -w4 -zp8 -ei -q +# newer OpenWatcom versions enable W303 by default. +CFLAGS += -wcd=303 # -5s : Pentium stack calling conventions. # -5r : Pentium register calling conventions. CFLAGS+= -5s @@ -37,7 +39,7 @@ all: $(AOUT) $(AOUT): $(OBJ) wlink N $(AOUT) SYS OS2V2 OP QUIET LIBR {$(LIBS)} F {$(OBJ)} -.c: ../src +.c: src;src/watcom .c.obj: $(COMPILE) -fo=$^@ $< diff --git a/Makefile.w32 b/Makefile.w32 index 4f3ba40..186178f 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -3,7 +3,7 @@ # wmake -f Makefile.w32 CC=wcc386 -CPPFLAGS=-DHAVE_SIGNAL_H -DWIN32 +CPPFLAGS=-DHAVE_SIGNAL_H CPPFLAGS+= -DSOUND_WIN32 !ifndef __UNIX__ @@ -11,10 +11,10 @@ CPPFLAGS+= -DVERSION="4.2.0" !else CPPFLAGS+= -DVERSION=\"4.2.0\" !endif -INCLUDES=-I"./src/win32" -I"./src" -I"../libxmp/include" -I"$(%WATCOM)/h/nt" +INCLUDES=-I"src/win32" -Isrc -I"$(%WATCOM)/h/nt" -#LIBXMP=../libxmp/xmp_static.lib -LIBXMP=../libxmp/libxmp.lib +#LIBXMP=xmp_static.lib +LIBXMP=libxmp.lib LIBS=$(LIBXMP) # for sound_win32: LIBS+= winmm.lib @@ -39,11 +39,11 @@ all: $(AOUT) $(AOUT): $(OBJ) wlink N $(AOUT) SYS NT OP QUIET LIBR {$(LIBS)} F {$(OBJ)} -.c: ./src;./src/win32 +.c: src;src/win32 .c.obj: $(COMPILE) -fo=$^@ $< distclean: clean .symbolic - rm -f $(AOUT) + rm -f $(AOUT) *.err clean: .symbolic - rm -f *.obj *.err + rm -f *.obj diff --git a/configure.ac b/configure.ac index 8f6501c..54215fc 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ AM_CONDITIONAL([SOUND_QNX], [false]) AM_CONDITIONAL([SOUND_SGI], [false]) AM_CONDITIONAL([SOUND_SNDIO], [false]) AM_CONDITIONAL([SOUND_SOLARIS], [false]) +AM_CONDITIONAL([SOUND_OS2DART], [false]) AM_CONDITIONAL([SOUND_WIN32], [false]) if test "${enable_oss}" != "no"; then diff --git a/os2/usleep.c b/os2/usleep.c deleted file mode 100644 index 0947c1e..0000000 --- a/os2/usleep.c +++ /dev/null @@ -1,6 +0,0 @@ -#define INCL_DOSPROCESS -#include -void usleep (unsigned long usec) -{ - DosSleep((usec >= 1000)? (usec / 1000) : 1); -} diff --git a/src/Makefile.am b/src/Makefile.am index a150788..afb0086 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -84,12 +84,17 @@ xmp_SOURCES += sound_beos.cpp xmp_LDADD += -lmedia -lbe endif +if SOUND_OS2DART +xmp_SOURCES += sound_dart.c +# for mciSendCommand() +xmp_LDADD += -lmmpm2 +endif + man_MANS = xmp.1 pkgsysconfdir = ${sysconfdir}/${PACKAGE_NAME} pkgsysconf_DATA = modules.conf xmp.conf -EXTRA_DIST = ${man_MANS} ${pkgsysconf_DATA} win32/usleep.c win32/unistd.h - -# unused sources -EXTRA_DIST += sound_dart.c +EXTRA_DIST = ${man_MANS} ${pkgsysconf_DATA} \ + win32/usleep.c win32/unistd.h \ + watcom/usleep.c watcom/unistd.h diff --git a/src/main.c b/src/main.c index 8376e73..b6cbb02 100644 --- a/src/main.c +++ b/src/main.c @@ -15,6 +15,9 @@ #ifdef HAVE_SYS_TIME_H #include #endif +#if defined(__WATCOMC__) +#include +#endif #include #include #include @@ -23,7 +26,7 @@ #include "sound.h" #include "common.h" -#ifdef WIN32 +#ifdef _WIN32 #include #endif @@ -245,15 +248,17 @@ int main(int argc, char **argv) int val, lf_flag; int flags; int played; -#ifndef _WIN32 +#if defined(_WIN32) + setvbuf(stderr, NULL, _IONBF, 0); + srand(GetTickCount()); +#elif defined(__WATCOMC__) + srand(time(NULL)); +#else struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); srand(tv.tv_usec); -#else - setvbuf(stderr, NULL, _IONBF, 0); - srand(GetTickCount()); #endif init_sound_drivers(); diff --git a/os2/unistd.h b/src/watcom/unistd.h similarity index 62% rename from os2/unistd.h rename to src/watcom/unistd.h index 5c3cea0..0d064c1 100644 --- a/os2/unistd.h +++ b/src/watcom/unistd.h @@ -1,5 +1,5 @@ -#ifndef _XMP_OS2_UNISTD_H -#define _XMP_OS2_UNISTD_H +#ifndef XMP_WATCOM_UNISTD_H +#define XMP_WATCOM_UNISTD_H #include /* do not want Watcom unistd.h */ diff --git a/src/watcom/usleep.c b/src/watcom/usleep.c new file mode 100644 index 0000000..6c9afb1 --- /dev/null +++ b/src/watcom/usleep.c @@ -0,0 +1,14 @@ +#ifdef __OS2__ +#define INCL_DOSPROCESS +#include +void usleep (unsigned long usec) { + DosSleep (usec / 1000); +} +#endif + +#ifdef _DOS +#include +void usleep (unsigned long usec) { + delay (usec / 1000); /* doesn't seem to use int 15h. */ +} +#endif