Makefile.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Nov 2014 04:51:33 -0800
changeset 9246 a761913e5e91
parent 8876 60edb019f0fe
child 9769 4716db508b0d
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@1362
     1
# Makefile to build and install the SDL library
slouken@1362
     2
slouken@1362
     3
top_builddir = .
slouken@1362
     4
srcdir  = @srcdir@
slouken@1362
     5
objects = build
slouken@1362
     6
prefix = @prefix@
slouken@1362
     7
exec_prefix = @exec_prefix@
slouken@2156
     8
bindir	= @bindir@
slouken@2156
     9
libdir  = @libdir@
slouken@2156
    10
includedir = @includedir@
slouken@2156
    11
datarootdir = @datarootdir@
slouken@2156
    12
datadir	= @datadir@
slouken@1391
    13
auxdir	= @ac_aux_dir@
slouken@1362
    14
distpath = $(srcdir)/..
slouken@6250
    15
distdir = SDL2-@SDL_VERSION@
slouken@1362
    16
distfile = $(distdir).tar.gz
slouken@1362
    17
slouken@1380
    18
@SET_MAKE@
slouken@1362
    19
SHELL	= @SHELL@
slouken@1362
    20
CC      = @CC@
slouken@1362
    21
INCLUDE = @INCLUDE@
slouken@1362
    22
CFLAGS  = @BUILD_CFLAGS@
slouken@1521
    23
EXTRA_CFLAGS = @EXTRA_CFLAGS@
slouken@1393
    24
LDFLAGS = @BUILD_LDFLAGS@
slouken@1521
    25
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
slouken@1362
    26
LIBTOOL = @LIBTOOL@
slouken@1362
    27
INSTALL = @INSTALL@
slouken@1419
    28
AR	= @AR@
slouken@1419
    29
RANLIB	= @RANLIB@
slouken@2204
    30
WINDRES	= @WINDRES@
slouken@1362
    31
slouken@6250
    32
TARGET  = libSDL2.la
slouken@1362
    33
OBJECTS = @OBJECTS@
slouken@3334
    34
VERSION_OBJECTS = @VERSION_OBJECTS@
slouken@1362
    35
slouken@6250
    36
SDLMAIN_TARGET = libSDL2main.a
slouken@1397
    37
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
slouken@1397
    38
slouken@6688
    39
SDLTEST_TARGET = libSDL2_test.a
slouken@6688
    40
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
slouken@6688
    41
slouken@7228
    42
SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake configure configure.in debian include Makefile.* sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC Xcode Xcode-iOS
slouken@6250
    43
GEN_DIST = SDL2.spec
slouken@1362
    44
sbc@8876
    45
ifneq ($V,1)
sbc@8876
    46
RUN_CMD_AR     = @echo "  AR    " $@;
sbc@8876
    47
RUN_CMD_CC     = @echo "  CC    " $@;
sbc@8876
    48
RUN_CMD_CXX    = @echo "  CXX   " $@;
sbc@8876
    49
RUN_CMD_LTLINK = @echo "  LTLINK" $@;
sbc@8876
    50
RUN_CMD_RANLIB = @echo "  RANLIB" $@;
sbc@8876
    51
LIBTOOL += --quiet
sbc@8876
    52
endif
sbc@8876
    53
slouken@4929
    54
HDRS = \
slouken@4929
    55
	SDL.h \
slouken@4929
    56
	SDL_assert.h \
slouken@4929
    57
	SDL_atomic.h \
slouken@4929
    58
	SDL_audio.h \
slouken@8829
    59
	SDL_bits.h \
slouken@4929
    60
	SDL_blendmode.h \
slouken@4929
    61
	SDL_clipboard.h \
slouken@4929
    62
	SDL_cpuinfo.h \
slouken@8829
    63
	SDL_egl.h \
slouken@4929
    64
	SDL_endian.h \
slouken@4929
    65
	SDL_error.h \
slouken@4929
    66
	SDL_events.h \
icculus@7667
    67
	SDL_filesystem.h \
slouken@6690
    68
	SDL_gamecontroller.h \
slouken@4929
    69
	SDL_gesture.h \
slouken@4929
    70
	SDL_haptic.h \
slouken@5189
    71
	SDL_hints.h \
slouken@4929
    72
	SDL_joystick.h \
slouken@4929
    73
	SDL_keyboard.h \
slouken@5340
    74
	SDL_keycode.h \
slouken@4929
    75
	SDL_loadso.h \
slouken@5221
    76
	SDL_log.h \
slouken@4929
    77
	SDL_main.h \
slouken@6607
    78
	SDL_messagebox.h \
slouken@4929
    79
	SDL_mouse.h \
slouken@4929
    80
	SDL_mutex.h \
slouken@4929
    81
	SDL_name.h \
slouken@4929
    82
	SDL_opengl.h \
icculus@8827
    83
	SDL_opengl_glext.h \
slouken@4929
    84
	SDL_opengles.h \
slouken@8829
    85
	SDL_opengles2_gl2ext.h \
slouken@8829
    86
	SDL_opengles2_gl2.h \
slouken@8829
    87
	SDL_opengles2_gl2platform.h \
slouken@6205
    88
	SDL_opengles2.h \
slouken@8829
    89
	SDL_opengles2_khrplatform.h \
slouken@4929
    90
	SDL_pixels.h \
slouken@4929
    91
	SDL_platform.h \
slouken@4929
    92
	SDL_power.h \
slouken@4929
    93
	SDL_quit.h \
slouken@4929
    94
	SDL_rect.h \
slouken@5145
    95
	SDL_render.h \
slouken@4929
    96
	SDL_rwops.h \
slouken@4929
    97
	SDL_scancode.h \
slouken@4929
    98
	SDL_shape.h \
slouken@4929
    99
	SDL_stdinc.h \
slouken@4929
   100
	SDL_surface.h \
slouken@6345
   101
	SDL_system.h \
slouken@4929
   102
	SDL_syswm.h \
slouken@4929
   103
	SDL_thread.h \
slouken@4929
   104
	SDL_timer.h \
slouken@4929
   105
	SDL_touch.h \
icculus@7387
   106
	SDL_types.h \
slouken@4929
   107
	SDL_version.h \
slouken@4929
   108
	SDL_video.h \
slouken@4929
   109
	begin_code.h \
slouken@4929
   110
	close_code.h
slouken@2122
   111
slouken@6689
   112
SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
slouken@6688
   113
slouken@1362
   114
LT_AGE      = @LT_AGE@
slouken@1362
   115
LT_CURRENT  = @LT_CURRENT@
slouken@1362
   116
LT_RELEASE  = @LT_RELEASE@
slouken@1362
   117
LT_REVISION = @LT_REVISION@
slouken@2156
   118
LT_LDFLAGS  = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
slouken@1362
   119
slouken@6688
   120
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
slouken@1622
   121
slouken@1622
   122
$(srcdir)/configure: $(srcdir)/configure.in
slouken@1622
   123
	@echo "Warning, configure.in is out of date"
slouken@1622
   124
	#(cd $(srcdir) && sh autogen.sh && sh configure)
slouken@1623
   125
	@sleep 3
slouken@1362
   126
slouken@1362
   127
Makefile: $(srcdir)/Makefile.in
slouken@1362
   128
	$(SHELL) config.status $@
slouken@1362
   129
slouken@3416
   130
Makefile.in:;
slouken@3416
   131
slouken@1362
   132
$(objects):
slouken@1391
   133
	$(SHELL) $(auxdir)/mkinstalldirs $@
slouken@1362
   134
slouken@2982
   135
update-revision:
slouken@2982
   136
	$(SHELL) $(auxdir)/updaterev.sh
slouken@2982
   137
slouken@5346
   138
.PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
slouken@1362
   139
slouken@5345
   140
$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
sbc@8876
   141
	$(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
slouken@1362
   142
slouken@1397
   143
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
sbc@8876
   144
	$(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS)
sbc@8876
   145
	$(RUN_CMD_RANLIB)$(RANLIB) $@
slouken@1397
   146
slouken@6688
   147
$(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
sbc@8876
   148
	$(RUN_CMD_AR)$(AR) cru $@ $(SDLTEST_OBJECTS)
sbc@8876
   149
	$(RUN_CMD_RANLIB)$(RANLIB) $@
slouken@6688
   150
slouken@3352
   151
install: all install-bin install-hdrs install-lib install-data
slouken@1362
   152
install-bin:
slouken@2156
   153
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
slouken@6250
   154
	$(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config
slouken@5345
   155
install-hdrs: update-revision
slouken@6250
   156
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2
slouken@6688
   157
	for file in $(HDRS) $(SDLTEST_HDRS); do \
slouken@6250
   158
	    $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \
slouken@1362
   159
	done
slouken@6250
   160
	$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h
slouken@5345
   161
	if test -f include/SDL_revision.h; then \
slouken@6250
   162
	    $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
slouken@5345
   163
	else \
slouken@6250
   164
	    $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
slouken@5345
   165
	fi
slouken@5345
   166
slouken@6688
   167
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET)
slouken@2156
   168
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
slouken@2156
   169
	$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
slouken@2156
   170
	$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
slouken@2156
   171
	$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
slouken@6688
   172
	$(INSTALL) -m 644 $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
slouken@6688
   173
	$(RANLIB) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
slouken@1362
   174
install-data:
slouken@2156
   175
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
slouken@6250
   176
	$(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
slouken@2156
   177
	$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
slouken@6250
   178
	$(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
slouken@1362
   179
slouken@3352
   180
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
slouken@1362
   181
uninstall-bin:
slouken@6250
   182
	rm -f $(DESTDIR)$(bindir)/sdl2-config
slouken@1362
   183
uninstall-hdrs:
slouken@6688
   184
	for file in $(HDRS) $(SDLTEST_HDRS); do \
slouken@6250
   185
	    rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \
slouken@1362
   186
	done
slouken@6250
   187
	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h
slouken@6250
   188
	rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h
slouken@6250
   189
	-rmdir $(DESTDIR)$(includedir)/SDL2
slouken@1362
   190
uninstall-lib:
slouken@2156
   191
	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
slouken@2156
   192
	rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
slouken@6688
   193
	rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET)
slouken@1362
   194
uninstall-data:
slouken@6250
   195
	rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
slouken@6250
   196
	rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
slouken@1362
   197
slouken@1362
   198
clean:
slouken@1362
   199
	rm -rf $(objects)
slouken@1380
   200
	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
slouken@1362
   201
slouken@1362
   202
distclean: clean
slouken@6250
   203
	rm -f Makefile Makefile.rules sdl2-config
slouken@3334
   204
	rm -f config.status config.cache config.log libtool
slouken@1362
   205
	rm -rf $(srcdir)/autom4te*
slouken@1603
   206
	find $(srcdir) \( \
slouken@1603
   207
	    -name '*~' -o \
slouken@1603
   208
	    -name '*.bak' -o \
slouken@1603
   209
	    -name '*.old' -o \
slouken@1603
   210
	    -name '*.rej' -o \
slouken@1603
   211
	    -name '*.orig' -o \
slouken@1603
   212
	    -name '.#*' \) \
slouken@1362
   213
	    -exec rm -f {} \;
slouken@1380
   214
	if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
slouken@1362
   215
slouken@1362
   216
dist $(distfile):
slouken@1391
   217
	$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
slouken@5498
   218
	(cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
slouken@5498
   219
	tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
slouken@1846
   220
	find $(distdir) \( \
slouken@1845
   221
	    -name '*~' -o \
slouken@1845
   222
	    -name '*.bak' -o \
slouken@1845
   223
	    -name '*.old' -o \
slouken@1845
   224
	    -name '*.rej' -o \
slouken@1845
   225
	    -name '*.orig' -o \
slouken@1845
   226
	    -name '.#*' \) \
slouken@1845
   227
	    -exec rm -f {} \;
slouken@1848
   228
	if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
slouken@6886
   229
	(cd $(distdir); build-scripts/updaterev.sh)
slouken@1362
   230
	tar cvf - $(distdir) | gzip --best >$(distfile)
slouken@1362
   231
	rm -rf $(distdir)
slouken@1362
   232
slouken@1362
   233
rpm: $(distfile)
slouken@1362
   234
	rpmbuild -ta $?