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).
     1 # Makefile to build the SDL tests
     2 
     3 srcdir  = @srcdir@
     4 
     5 CC      = @CC@
     6 EXE	= @EXE@
     7 CFLAGS  = @CFLAGS@ -g
     8 LIBS	= @LIBS@
     9 
    10 TARGETS = \
    11 	checkkeys$(EXE) \
    12 	loopwave$(EXE) \
    13 	loopwavequeue$(EXE) \
    14 	testatomic$(EXE) \
    15 	testaudioinfo$(EXE) \
    16 	testautomation$(EXE) \
    17 	testdraw2$(EXE) \
    18 	testdrawchessboard$(EXE) \
    19 	testdropfile$(EXE) \
    20 	testerror$(EXE) \
    21 	testfile$(EXE) \
    22 	testgamecontroller$(EXE) \
    23 	testgesture$(EXE) \
    24 	testgl2$(EXE) \
    25 	testgles$(EXE) \
    26 	testgles2$(EXE) \
    27 	testhaptic$(EXE) \
    28 	testhittesting$(EXE) \
    29 	testrumble$(EXE) \
    30 	testhotplug$(EXE) \
    31 	testthread$(EXE) \
    32 	testiconv$(EXE) \
    33 	testime$(EXE) \
    34 	testintersections$(EXE) \
    35 	testrelative$(EXE) \
    36 	testjoystick$(EXE) \
    37 	testkeys$(EXE) \
    38 	testloadso$(EXE) \
    39 	testlock$(EXE) \
    40 	testmultiaudio$(EXE) \
    41 	testnative$(EXE) \
    42 	testoverlay2$(EXE) \
    43 	testplatform$(EXE) \
    44 	testpower$(EXE) \
    45 	testfilesystem$(EXE) \
    46 	testrendertarget$(EXE) \
    47 	testresample$(EXE) \
    48 	testscale$(EXE) \
    49 	testsem$(EXE) \
    50 	testshader$(EXE) \
    51 	testshape$(EXE) \
    52 	testsprite2$(EXE) \
    53 	testspriteminimal$(EXE) \
    54 	teststreaming$(EXE) \
    55 	testtimer$(EXE) \
    56 	testver$(EXE) \
    57 	testviewport$(EXE) \
    58 	testwm2$(EXE) \
    59 	torturethread$(EXE) \
    60 	testrendercopyex$(EXE) \
    61 	testmessage$(EXE) \
    62 	controllermap$(EXE) \
    63 	
    64 all: Makefile $(TARGETS)
    65 
    66 Makefile: $(srcdir)/Makefile.in
    67 	$(SHELL) config.status $@
    68 
    69 checkkeys$(EXE): $(srcdir)/checkkeys.c
    70 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    71 
    72 loopwave$(EXE): $(srcdir)/loopwave.c
    73 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    74 
    75 loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c
    76 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    77 
    78 testresample$(EXE): $(srcdir)/testresample.c
    79 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    80 
    81 testaudioinfo$(EXE): $(srcdir)/testaudioinfo.c
    82 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
    83 
    84 testautomation$(EXE): $(srcdir)/testautomation.c \
    85 		      $(srcdir)/testautomation_audio.c \
    86 		      $(srcdir)/testautomation_clipboard.c \
    87 		      $(srcdir)/testautomation_events.c \
    88 		      $(srcdir)/testautomation_keyboard.c \
    89 		      $(srcdir)/testautomation_main.c \
    90 		      $(srcdir)/testautomation_mouse.c \
    91 		      $(srcdir)/testautomation_pixels.c \
    92 		      $(srcdir)/testautomation_platform.c \
    93 		      $(srcdir)/testautomation_rect.c \
    94 		      $(srcdir)/testautomation_render.c \
    95 		      $(srcdir)/testautomation_rwops.c \
    96 		      $(srcdir)/testautomation_sdltest.c \
    97 		      $(srcdir)/testautomation_stdlib.c \
    98 		      $(srcdir)/testautomation_surface.c \
    99 		      $(srcdir)/testautomation_syswm.c \
   100 		      $(srcdir)/testautomation_timer.c \
   101 		      $(srcdir)/testautomation_video.c \
   102 		      $(srcdir)/testautomation_hints.c
   103 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) 
   104 
   105 testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
   106 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   107 
   108 testatomic$(EXE): $(srcdir)/testatomic.c
   109 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   110 
   111 testintersections$(EXE): $(srcdir)/testintersections.c
   112 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   113 
   114 testrelative$(EXE): $(srcdir)/testrelative.c
   115 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   116 
   117 testhittesting$(EXE): $(srcdir)/testhittesting.c
   118 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   119 
   120 testdraw2$(EXE): $(srcdir)/testdraw2.c
   121 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   122 
   123 testdrawchessboard$(EXE): $(srcdir)/testdrawchessboard.c
   124 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   125 
   126 testdropfile$(EXE): $(srcdir)/testdropfile.c
   127 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   128 
   129 testerror$(EXE): $(srcdir)/testerror.c
   130 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   131 
   132 testfile$(EXE): $(srcdir)/testfile.c
   133 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   134 
   135 testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c
   136 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   137  
   138 testgesture$(EXE): $(srcdir)/testgesture.c
   139 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   140  
   141 testgl2$(EXE): $(srcdir)/testgl2.c
   142 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   143 
   144 testgles$(EXE): $(srcdir)/testgles.c
   145 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLESLIB@ @MATHLIB@
   146 
   147 testgles2$(EXE): $(srcdir)/testgles2.c
   148 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   149 
   150 testhaptic$(EXE): $(srcdir)/testhaptic.c
   151 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   152 
   153 testhotplug$(EXE): $(srcdir)/testhotplug.c
   154 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   155 
   156 testrumble$(EXE): $(srcdir)/testrumble.c
   157 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   158 
   159 testthread$(EXE): $(srcdir)/testthread.c
   160 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   161 
   162 testiconv$(EXE): $(srcdir)/testiconv.c
   163 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   164 
   165 testime$(EXE): $(srcdir)/testime.c
   166 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@
   167 
   168 testjoystick$(EXE): $(srcdir)/testjoystick.c
   169 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   170 
   171 testkeys$(EXE): $(srcdir)/testkeys.c
   172 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   173 
   174 testloadso$(EXE): $(srcdir)/testloadso.c
   175 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   176 
   177 testlock$(EXE): $(srcdir)/testlock.c
   178 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   179 
   180 ifeq (@ISMACOSX@,true)
   181 testnative$(EXE): $(srcdir)/testnative.c \
   182 			$(srcdir)/testnativecocoa.m \
   183 			$(srcdir)/testnativex11.c
   184 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@
   185 endif
   186 
   187 ifeq (@ISWINDOWS@,true)
   188 testnative$(EXE): $(srcdir)/testnative.c \
   189 			$(srcdir)/testnativew32.c
   190 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   191 endif
   192 
   193 ifeq (@ISUNIX@,true)
   194 testnative$(EXE): $(srcdir)/testnative.c \
   195 			$(srcdir)/testnativex11.c
   196 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@
   197 endif
   198 
   199 testoverlay2$(EXE): $(srcdir)/testoverlay2.c
   200 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   201 
   202 testplatform$(EXE): $(srcdir)/testplatform.c
   203 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   204 
   205 testpower$(EXE): $(srcdir)/testpower.c
   206 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   207 
   208 testfilesystem$(EXE): $(srcdir)/testfilesystem.c
   209 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   210 
   211 testrendertarget$(EXE): $(srcdir)/testrendertarget.c
   212 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   213 
   214 testscale$(EXE): $(srcdir)/testscale.c
   215 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   216 
   217 testsem$(EXE): $(srcdir)/testsem.c
   218 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   219 
   220 testshader$(EXE): $(srcdir)/testshader.c
   221 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@
   222 
   223 testshape$(EXE): $(srcdir)/testshape.c
   224 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   225 
   226 testsprite2$(EXE): $(srcdir)/testsprite2.c
   227 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   228 
   229 testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c
   230 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   231 
   232 teststreaming$(EXE): $(srcdir)/teststreaming.c
   233 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   234 
   235 testtimer$(EXE): $(srcdir)/testtimer.c
   236 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   237 
   238 testver$(EXE): $(srcdir)/testver.c
   239 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   240 
   241 testviewport$(EXE): $(srcdir)/testviewport.c
   242 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   243 
   244 testwm2$(EXE): $(srcdir)/testwm2.c
   245 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   246 
   247 torturethread$(EXE): $(srcdir)/torturethread.c
   248 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   249 
   250 testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c
   251 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@
   252 
   253 testmessage$(EXE): $(srcdir)/testmessage.c
   254 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   255 
   256 controllermap$(EXE): $(srcdir)/controllermap.c
   257 	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
   258 
   259 
   260 clean:
   261 	rm -f $(TARGETS)
   262 
   263 distclean: clean
   264 	rm -f Makefile
   265 	rm -f config.status config.cache config.log
   266 	rm -rf $(srcdir)/autom4te*