test/Makefile.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Nov 2014 04:51:33 -0800
changeset 9246 a761913e5e91
parent 9012 aa058c87737b
child 9278 8900afb78a19
permissions -rw-r--r--
Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead

Jonas Kulla

src/main/windows/SDL_windows_main.c:137:
cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR));

I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null.

From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified.

Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
slouken@1380
     1
# Makefile to build the SDL tests
slouken@1380
     2
slouken@1380
     3
srcdir  = @srcdir@
slouken@1380
     4
slouken@1380
     5
CC      = @CC@
slouken@1380
     6
EXE	= @EXE@
urkle@7807
     7
CFLAGS  = @CFLAGS@ -g
slouken@1380
     8
LIBS	= @LIBS@
slouken@1380
     9
slouken@5232
    10
TARGETS = \
slouken@5232
    11
	checkkeys$(EXE) \
slouken@5232
    12
	loopwave$(EXE) \
icculus@9012
    13
	loopwavequeue$(EXE) \
binarycrusader@8979
    14
	testatomic$(EXE) \
icculus@6412
    15
	testaudioinfo$(EXE) \
slouken@6769
    16
	testautomation$(EXE) \
slouken@5232
    17
	testdraw2$(EXE) \
slouken@7529
    18
	testdrawchessboard$(EXE) \
urkle@7807
    19
	testdropfile$(EXE) \
slouken@5232
    20
	testerror$(EXE) \
slouken@5232
    21
	testfile$(EXE) \
slouken@6690
    22
	testgamecontroller$(EXE) \
slouken@5232
    23
	testgesture$(EXE) \
slouken@5232
    24
	testgl2$(EXE) \
slouken@5232
    25
	testgles$(EXE) \
gabomdq@8014
    26
	testgles2$(EXE) \
slouken@5232
    27
	testhaptic$(EXE) \
icculus@8935
    28
	testhittesting$(EXE) \
slouken@5508
    29
	testrumble$(EXE) \
urkle@8164
    30
	testhotplug$(EXE) \
slouken@5508
    31
	testthread$(EXE) \
slouken@5232
    32
	testiconv$(EXE) \
slouken@5232
    33
	testime$(EXE) \
slouken@5232
    34
	testintersections$(EXE) \
slouken@6311
    35
	testrelative$(EXE) \
slouken@5232
    36
	testjoystick$(EXE) \
slouken@5232
    37
	testkeys$(EXE) \
slouken@5232
    38
	testloadso$(EXE) \
slouken@5232
    39
	testlock$(EXE) \
slouken@5232
    40
	testmultiaudio$(EXE) \
slouken@6175
    41
	testnative$(EXE) \
slouken@5232
    42
	testoverlay2$(EXE) \
slouken@5232
    43
	testplatform$(EXE) \
slouken@5232
    44
	testpower$(EXE) \
icculus@7667
    45
	testfilesystem$(EXE) \
slouken@6232
    46
	testrendertarget$(EXE) \
slouken@5232
    47
	testresample$(EXE) \
slouken@5240
    48
	testscale$(EXE) \
slouken@5232
    49
	testsem$(EXE) \
slouken@5232
    50
	testshader$(EXE) \
slouken@5232
    51
	testshape$(EXE) \
slouken@5232
    52
	testsprite2$(EXE) \
slouken@5232
    53
	testspriteminimal$(EXE) \
slouken@5254
    54
	teststreaming$(EXE) \
slouken@5232
    55
	testtimer$(EXE) \
slouken@5232
    56
	testver$(EXE) \
slouken@7994
    57
	testviewport$(EXE) \
slouken@5232
    58
	testwm2$(EXE) \
slouken@5232
    59
	torturethread$(EXE) \
gabomdq@6320
    60
	testrendercopyex$(EXE) \
slouken@6614
    61
	testmessage$(EXE) \
gabomdq@8043
    62
	controllermap$(EXE) \
gabomdq@8043
    63
	
slouken@1914
    64
all: Makefile $(TARGETS)
slouken@1914
    65
slouken@1914
    66
Makefile: $(srcdir)/Makefile.in
slouken@1914
    67
	$(SHELL) config.status $@
slouken@1380
    68
slouken@1380
    69
checkkeys$(EXE): $(srcdir)/checkkeys.c
slouken@6601
    70
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
    71
slouken@1380
    72
loopwave$(EXE): $(srcdir)/loopwave.c
slouken@6601
    73
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
    74
icculus@9012
    75
loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c
icculus@9012
    76
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@9012
    77
icculus@3017
    78
testresample$(EXE): $(srcdir)/testresample.c
slouken@6601
    79
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@3017
    80
icculus@2049
    81
testaudioinfo$(EXE): $(srcdir)/testaudioinfo.c
slouken@6601
    82
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@2049
    83
slouken@6769
    84
testautomation$(EXE): $(srcdir)/testautomation.c \
slouken@7216
    85
		      $(srcdir)/testautomation_audio.c \
slouken@6769
    86
		      $(srcdir)/testautomation_clipboard.c \
slouken@7216
    87
		      $(srcdir)/testautomation_events.c \
slouken@7216
    88
		      $(srcdir)/testautomation_keyboard.c \
jorgen@6866
    89
		      $(srcdir)/testautomation_main.c \
slouken@7216
    90
		      $(srcdir)/testautomation_mouse.c \
slouken@7216
    91
		      $(srcdir)/testautomation_pixels.c \
slouken@6769
    92
		      $(srcdir)/testautomation_platform.c \
slouken@6769
    93
		      $(srcdir)/testautomation_rect.c \
slouken@6769
    94
		      $(srcdir)/testautomation_render.c \
aschiffler@6772
    95
		      $(srcdir)/testautomation_rwops.c \
slouken@7216
    96
		      $(srcdir)/testautomation_sdltest.c \
slouken@7216
    97
		      $(srcdir)/testautomation_stdlib.c \
aschiffler@6800
    98
		      $(srcdir)/testautomation_surface.c \
aschiffler@6801
    99
		      $(srcdir)/testautomation_syswm.c \
aschiffler@7134
   100
		      $(srcdir)/testautomation_timer.c \
aschiffler@8645
   101
		      $(srcdir)/testautomation_video.c \
aschiffler@8645
   102
		      $(srcdir)/testautomation_hints.c
slouken@7280
   103
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) 
slouken@6769
   104
icculus@2049
   105
testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
slouken@6601
   106
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@2049
   107
slouken@5254
   108
testatomic$(EXE): $(srcdir)/testatomic.c
slouken@6601
   109
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5254
   110
slouken@6785
   111
testintersections$(EXE): $(srcdir)/testintersections.c
slouken@6601
   112
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@2994
   113
slouken@6785
   114
testrelative$(EXE): $(srcdir)/testrelative.c
slouken@6601
   115
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@6311
   116
icculus@8935
   117
testhittesting$(EXE): $(srcdir)/testhittesting.c
icculus@8931
   118
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@8931
   119
slouken@6785
   120
testdraw2$(EXE): $(srcdir)/testdraw2.c
slouken@6601
   121
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@2914
   122
slouken@7529
   123
testdrawchessboard$(EXE): $(srcdir)/testdrawchessboard.c
slouken@7529
   124
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@7529
   125
urkle@7807
   126
testdropfile$(EXE): $(srcdir)/testdropfile.c
urkle@7807
   127
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
urkle@7807
   128
slouken@1380
   129
testerror$(EXE): $(srcdir)/testerror.c
slouken@6601
   130
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   131
slouken@1453
   132
testfile$(EXE): $(srcdir)/testfile.c
slouken@6601
   133
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1453
   134
slouken@6690
   135
testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c
slouken@6690
   136
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@6690
   137
 
slouken@5254
   138
testgesture$(EXE): $(srcdir)/testgesture.c
slouken@6601
   139
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
slouken@5254
   140
 
slouken@6785
   141
testgl2$(EXE): $(srcdir)/testgl2.c
gabomdq@8062
   142
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
slouken@1914
   143
slouken@6785
   144
testgles$(EXE): $(srcdir)/testgles.c
gabomdq@7794
   145
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLESLIB@ @MATHLIB@
slouken@3087
   146
gabomdq@8014
   147
testgles2$(EXE): $(srcdir)/testgles2.c
gabomdq@8062
   148
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
gabomdq@8014
   149
slouken@5254
   150
testhaptic$(EXE): $(srcdir)/testhaptic.c
slouken@6601
   151
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5254
   152
urkle@8164
   153
testhotplug$(EXE): $(srcdir)/testhotplug.c
urkle@8164
   154
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
urkle@8164
   155
slouken@5360
   156
testrumble$(EXE): $(srcdir)/testrumble.c
slouken@6601
   157
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5360
   158
slouken@5508
   159
testthread$(EXE): $(srcdir)/testthread.c
slouken@6601
   160
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   161
slouken@1501
   162
testiconv$(EXE): $(srcdir)/testiconv.c
slouken@6601
   163
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1501
   164
slouken@6785
   165
testime$(EXE): $(srcdir)/testime.c
slouken@6601
   166
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@
slouken@5254
   167
slouken@6785
   168
testjoystick$(EXE): $(srcdir)/testjoystick.c
slouken@6601
   169
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   170
slouken@1380
   171
testkeys$(EXE): $(srcdir)/testkeys.c
slouken@6601
   172
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   173
slouken@5254
   174
testloadso$(EXE): $(srcdir)/testloadso.c
slouken@6601
   175
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5254
   176
slouken@1380
   177
testlock$(EXE): $(srcdir)/testlock.c
slouken@6601
   178
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   179
icculus@6390
   180
ifeq (@ISMACOSX@,true)
slouken@6175
   181
testnative$(EXE): $(srcdir)/testnative.c \
slouken@7495
   182
			$(srcdir)/testnativecocoa.m \
slouken@7495
   183
			$(srcdir)/testnativex11.c
slouken@7495
   184
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@
icculus@6390
   185
endif
icculus@6390
   186
icculus@6390
   187
ifeq (@ISWINDOWS@,true)
icculus@6390
   188
testnative$(EXE): $(srcdir)/testnative.c \
icculus@6390
   189
			$(srcdir)/testnativew32.c
slouken@6601
   190
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@6390
   191
endif
icculus@6390
   192
icculus@6390
   193
ifeq (@ISUNIX@,true)
icculus@6390
   194
testnative$(EXE): $(srcdir)/testnative.c \
icculus@6390
   195
			$(srcdir)/testnativex11.c
slouken@7495
   196
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@
icculus@6390
   197
endif
slouken@6175
   198
slouken@1380
   199
testoverlay2$(EXE): $(srcdir)/testoverlay2.c
slouken@6601
   200
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   201
slouken@1421
   202
testplatform$(EXE): $(srcdir)/testplatform.c
slouken@6601
   203
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1421
   204
slouken@5254
   205
testpower$(EXE): $(srcdir)/testpower.c
slouken@6601
   206
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5254
   207
icculus@7667
   208
testfilesystem$(EXE): $(srcdir)/testfilesystem.c
icculus@7667
   209
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
icculus@7667
   210
slouken@6785
   211
testrendertarget$(EXE): $(srcdir)/testrendertarget.c
slouken@6601
   212
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@6232
   213
slouken@6785
   214
testscale$(EXE): $(srcdir)/testscale.c
slouken@6601
   215
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@5240
   216
slouken@1380
   217
testsem$(EXE): $(srcdir)/testsem.c
slouken@6601
   218
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   219
slouken@5232
   220
testshader$(EXE): $(srcdir)/testshader.c
slouken@6601
   221
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
slouken@5232
   222
eligottlieb@4799
   223
testshape$(EXE): $(srcdir)/testshape.c
slouken@6601
   224
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
eligottlieb@4799
   225
slouken@6785
   226
testsprite2$(EXE): $(srcdir)/testsprite2.c
slouken@6785
   227
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1895
   228
slouken@5254
   229
testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c
slouken@6601
   230
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
slouken@5254
   231
slouken@5254
   232
teststreaming$(EXE): $(srcdir)/teststreaming.c
slouken@6601
   233
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
slouken@5254
   234
slouken@1380
   235
testtimer$(EXE): $(srcdir)/testtimer.c
slouken@6601
   236
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   237
slouken@1380
   238
testver$(EXE): $(srcdir)/testver.c
slouken@6601
   239
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   240
slouken@7994
   241
testviewport$(EXE): $(srcdir)/testviewport.c
slouken@7994
   242
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@7994
   243
slouken@6785
   244
testwm2$(EXE): $(srcdir)/testwm2.c
slouken@6601
   245
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1895
   246
slouken@1380
   247
torturethread$(EXE): $(srcdir)/torturethread.c
slouken@6601
   248
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@1380
   249
slouken@6785
   250
testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c
slouken@6601
   251
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
slouken@6614
   252
slouken@6614
   253
testmessage$(EXE): $(srcdir)/testmessage.c
slouken@6614
   254
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
slouken@6614
   255
gabomdq@8043
   256
controllermap$(EXE): $(srcdir)/controllermap.c
gabomdq@8043
   257
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
gabomdq@8043
   258
gabomdq@8043
   259
slouken@1380
   260
clean:
slouken@1380
   261
	rm -f $(TARGETS)
slouken@1380
   262
slouken@1380
   263
distclean: clean
slouken@1380
   264
	rm -f Makefile
slouken@1380
   265
	rm -f config.status config.cache config.log
slouken@1380
   266
	rm -rf $(srcdir)/autom4te*