History

Merge pull request #15 from kubo/mingw32

Fix Mingw32 compilation

Kevin Lenzo committed 6 years ago

Commit d8826b02 parents 6bc1cdd 3b16ff87 files · +44 −29Browse files

Unified · Split

7 files
  1. configure +13 −11
  2. configure.in +14 −11
  3. include/cst_file.h +8 −2
  4. include/cst_tokenstream.h +1 −1
  5. src/audio/au_wince.c +6 −2
  6. src/utils/cst_tokenstream.c +1 −1
  7. windows/Makefile +1 −1
configure+13−11
@@ -4080,11 +4080,17 @@ case "$target_os" in · 4079 unmodified lines
4080 # For the Windows under mingw32 environment4080 # For the Windows under mingw32 environment
4081 # http://www.mingw.org4081 # http://www.mingw.org
4082 shared=false4082 shared=false
4083 CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared"4083 CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32"
4084 MINGWPREF="i386-mingw32-"4084 PREFLEN=`expr match "$CC" ".*-gcc"`
4085 CC="${MINGWPREF}gcc"4085 if expr $PREFLEN != 0 > /dev/null; then
4086 RANLIB="${MINGWPREF}ranlib"4086 # When $CC includes "-gcc", use the preceding
4087 AR="${MINGWPREF}ar"4087 # charactors + '-' as MINGPREF.
4088 # for example:
4089 # CC=x86_64-w64-mingw32-gcc.exe
4090 # --> MINGWPREF=x86_64-w64-mingw32-
4091 PREFLEN=`expr $PREFLEN - 3`
4092 MINGPREF=`expr substr $CC 1 $PREFLEN`
4093 fi
4088 WINDRES="${MINGWPREF}windres"4094 WINDRES="${MINGWPREF}windres"
4089 DLLTOOL="${MINGWPREF}dlltool"4095 DLLTOOL="${MINGWPREF}dlltool"
4090 DLLWRAP="${MINGWPREF}dllwrap"4096 DLLWRAP="${MINGWPREF}dllwrap"
@@ -4355,7 +4361,8 @@ if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then : · 264 unmodified lines
4355fi4361fi
4356 4362
4357 4363
4358ac_fn_c_check_header_mongrel "$LINENO" "mmsystem.h" "ac_cv_header_mmsystem_h" "$ac_includes_default"4364ac_fn_c_check_header_compile "$LINENO" "mmsystem.h" "ac_cv_header_mmsystem_h" "#include <windows.h>
4365"
4359if test "x$ac_cv_header_mmsystem_h" = xyes; then :4366if test "x$ac_cv_header_mmsystem_h" = xyes; then :
4360 AUDIODRIVER="wince"4367 AUDIODRIVER="wince"
4361 AUDIODEFS=-DCST_AUDIO_WINCE4368 AUDIODEFS=-DCST_AUDIO_WINCE
@@ -4370,11 +4377,6 @@ case "$target_os" in · 8 unmodified lines
4370 AUDIODEFS=-DCST_AUDIO_WINCE4377 AUDIODEFS=-DCST_AUDIO_WINCE
4371 AUDIOLIBS=4378 AUDIOLIBS=
4372 ;;4379 ;;
4373 mingw*)
4374 AUDIODRIVER="none"
4375 AUDIODEFS=-DCST_AUDIO_NONE
4376 AUDIOLIBS=
4377 ;;
4378 android*)4380 android*)
4379 AUDIODRIVER="none"4381 AUDIODRIVER="none"
4380 AUDIODEFS=-DCST_AUDIO_NONE4382 AUDIODEFS=-DCST_AUDIO_NONE
configure.in+14−11
@@ -136,11 +136,17 @@ dnl ;; · 135 unmodified lines
136 # For the Windows under mingw32 environment136 # For the Windows under mingw32 environment
137 # http://www.mingw.org137 # http://www.mingw.org
138 shared=false138 shared=false
139 CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared"139 CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32"
140 MINGWPREF="i386-mingw32-"140 PREFLEN=`expr match "$CC" ".*-gcc"`
141 CC="${MINGWPREF}gcc"141 if expr $PREFLEN != 0 > /dev/null; then
142 RANLIB="${MINGWPREF}ranlib"142 # When $CC includes "-gcc", use the preceding
143 AR="${MINGWPREF}ar"143 # charactors + '-' as MINGPREF.
144 # for example:
145 # CC=x86_64-w64-mingw32-gcc.exe
146 # --> MINGWPREF=x86_64-w64-mingw32-
147 PREFLEN=`expr $PREFLEN - 3`
148 MINGPREF=`expr substr $CC 1 $PREFLEN`
149 fi
144 WINDRES="${MINGWPREF}windres"150 WINDRES="${MINGWPREF}windres"
145 DLLTOOL="${MINGWPREF}dlltool"151 DLLTOOL="${MINGWPREF}dlltool"
146 DLLWRAP="${MINGWPREF}dllwrap"152 DLLWRAP="${MINGWPREF}dllwrap"
@@ -387,7 +393,9 @@ AC_CHECK_HEADER(alsa/asoundlib.h, · 240 unmodified lines
387AC_CHECK_HEADER(mmsystem.h,393AC_CHECK_HEADER(mmsystem.h,
388 [AUDIODRIVER="wince"394 [AUDIODRIVER="wince"
389 AUDIODEFS=-DCST_AUDIO_WINCE395 AUDIODEFS=-DCST_AUDIO_WINCE
390 AUDIOLIBS=-lwinmm])396 AUDIOLIBS=-lwinmm],
397 [],
398 [#include <windows.h>])
391 399
392dnl I don't care what you ask for, for wince you get wince400dnl I don't care what you ask for, for wince you get wince
393case "$target_os" in401case "$target_os" in
@@ -396,11 +404,6 @@ case "$target_os" in · 2 unmodified lines
396 AUDIODEFS=-DCST_AUDIO_WINCE404 AUDIODEFS=-DCST_AUDIO_WINCE
397 AUDIOLIBS=405 AUDIOLIBS=
398 ;;406 ;;
399 mingw*)
400 AUDIODRIVER="none"
401 AUDIODEFS=-DCST_AUDIO_NONE
402 AUDIOLIBS=
403 ;;
404 android*)407 android*)
405 AUDIODRIVER="none"408 AUDIODRIVER="none"
406 AUDIODEFS=-DCST_AUDIO_NONE409 AUDIODEFS=-DCST_AUDIO_NONE
include/cst_file.h+8−2
@@ -101,7 +101,13 @@ int cst_sprintf(char *s, const char *fmt, ...); · 100 unmodified lines
101#ifdef _WIN32101#ifdef _WIN32
102#define snprintf c99_snprintf102#define snprintf c99_snprintf
103 103
104__inline int c99_vsnprintf(char* str, size_t size, const char* format,104#ifdef __GNUC__
105#define INLINE static inline
106#else
107#define INLINE __inline
108#endif
109
110INLINE int c99_vsnprintf(char* str, size_t size, const char* format,
105va_list ap) {111va_list ap) {
106 int count = -1;112 int count = -1;
107 if (size != 0)113 if (size != 0)
@@ -110,7 +116,7 @@ va_list ap) { · 2 unmodified lines
110 count = _vscprintf(format, ap);116 count = _vscprintf(format, ap);
111 return count;117 return count;
112 }118 }
113__inline int c99_snprintf(char* str, size_t size, const char* format, ...)119INLINE int c99_snprintf(char* str, size_t size, const char* format, ...)
114{120{
115 int count;121 int count;
116 va_list ap;122 va_list ap;
include/cst_tokenstream.h+1−1
@@ -130,7 +130,7 @@ cst_tokenstream *ts_open_generic(const char *filename, · 129 unmodified lines
130 int (*getc)(cst_tokenstream *ts));130 int (*getc)(cst_tokenstream *ts));
131void ts_close(cst_tokenstream *ts);131void ts_close(cst_tokenstream *ts);
132 132
133#ifdef _WIN32133#if defined(_WIN32) && !defined(__GNUC__)
134__inline int ts_utf8_sequence_length(char c0);134__inline int ts_utf8_sequence_length(char c0);
135#else135#else
136int ts_utf8_sequence_length(char c0);136int ts_utf8_sequence_length(char c0);
src/audio/au_wince.c+6−2
@@ -43,6 +43,10 @@ · 42 unmodified lines
43#include "cst_audio.h"43#include "cst_audio.h"
44#include "cst_alloc.h"44#include "cst_alloc.h"
45 45
46#ifndef MAXULONG_PTR
47#define DWORD_PTR DWORD
48#endif
49
46typedef struct au_wince_pdata_struct {50typedef struct au_wince_pdata_struct {
47 HWAVEOUT wo;51 HWAVEOUT wo;
48 HANDLE bevt;52 HANDLE bevt;
@@ -84,7 +88,7 @@ static void finish_header(HWAVEOUT drvr, WAVEHDR *hdr) · 35 unmodified lines
84}88}
85 89
86static void CALLBACK sndbuf_done(HWAVEOUT drvr, UINT msg,90static void CALLBACK sndbuf_done(HWAVEOUT drvr, UINT msg,
87 DWORD udata, DWORD param1, DWORD param2)91 DWORD_PTR udata, DWORD_PTR param1, DWORD_PTR param2)
88{92{
89 WAVEHDR *hdr = (WAVEHDR *)param1;93 WAVEHDR *hdr = (WAVEHDR *)param1;
90 cst_audiodev *ad = (cst_audiodev *)udata;94 cst_audiodev *ad = (cst_audiodev *)udata;
@@ -137,7 +141,7 @@ cst_audiodev *audio_open_wince(int sps, int channels, int fmt) · 46 unmodified lines
137 wfx.nBlockAlign = wfx.nChannels*wfx.wBitsPerSample/8;141 wfx.nBlockAlign = wfx.nChannels*wfx.wBitsPerSample/8;
138 wfx.nAvgBytesPerSec = wfx.nSamplesPerSec*wfx.nBlockAlign;142 wfx.nAvgBytesPerSec = wfx.nSamplesPerSec*wfx.nBlockAlign;
139 err = waveOutOpen(&wo,WAVE_MAPPER,&wfx,143 err = waveOutOpen(&wo,WAVE_MAPPER,&wfx,
140 (DWORD)sndbuf_done,(DWORD)ad,144 (DWORD_PTR)sndbuf_done,(DWORD_PTR)ad,
141 CALLBACK_FUNCTION);145 CALLBACK_FUNCTION);
142 if (err != MMSYSERR_NOERROR)146 if (err != MMSYSERR_NOERROR)
143 {147 {
src/utils/cst_tokenstream.c+1−1
@@ -266,7 +266,7 @@ static void get_token_sub_part(cst_tokenstream *ts, · 265 unmodified lines
266 (*buffer)[p] = '\0';266 (*buffer)[p] = '\0';
267}267}
268 268
269 #ifdef _WIN32269 #if defined _WIN32 && !defined(__GNUC__)
270 __inline int ts_utf8_sequence_length(char c0)270 __inline int ts_utf8_sequence_length(char c0)
271 #else271 #else
272 int ts_utf8_sequence_length(char c0)272 int ts_utf8_sequence_length(char c0)
windows/Makefile+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
40## Also an example command line program ## 40## Also an example command line program ##
41## ##41## ##
42## At top level ##42## At top level ##
43## ./configure --target=i386-mingw32 ##43## ./configure ##
44## make ##44## make ##
45## ##45## ##
46###########################################################################46###########################################################################

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t