<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40640 >

> [cazf...@gmail.com - Wed Jan 07 21:23:18 2009]:
> 
>  SDL uses macro magic to rename our main() as SDL_main(). This means
> that client common code library has different symbols when compiling
> SDL client than otherwise. Fixing this is step toward building
> multiple clients at once.
> 
>  Attached patch renames current main() in client common code as
> client_main() and adds new gui specific main(), that only calls
> client_main(). Now SDL can have SDL_main() while others have main().
> 

SDL is also needed for SDL_mixer, so when compiling with audio support
all clients need SDL_main(), but without audio support only the SDL
client needs SDL_main().

The attached patch adds the conditional inclusion of SDL.h to all
gui_main.c files and $(SOUND_CFLAGS) to AM_CPPFLAGS in each gui's
Makefile.am.

Index: client/gui-ftwl/gui_main.c
===================================================================
--- client/gui-ftwl/gui_main.c	(revision 15567)
+++ client/gui-ftwl/gui_main.c	(working copy)
@@ -15,6 +15,10 @@
 #include <config.h>
 #endif
 
+#ifdef SDL
+#include "SDL.h"
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 
Index: client/gui-ftwl/Makefile.am
===================================================================
--- client/gui-ftwl/Makefile.am	(revision 15567)
+++ client/gui-ftwl/Makefile.am	(working copy)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LTLIBRARIES = libguiclient.la
-AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/.. -I$(srcdir)/../include $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/.. -I$(srcdir)/../include $(CLIENT_CFLAGS) $(SOUND_CFLAGS)
 
 libguiclient_la_SOURCES = \
 	canvas.c	\
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
--- client/gui-gtk-2.0/gui_main.c	(revision 15567)
+++ client/gui-gtk-2.0/gui_main.c	(working copy)
@@ -15,6 +15,10 @@
 #include <config.h>
 #endif
 
+#ifdef SDL
+#include "SDL.h"
+#endif
+
 #include <assert.h>
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
Index: client/gui-gtk-2.0/Makefile.am
===================================================================
--- client/gui-gtk-2.0/Makefile.am	(revision 15567)
+++ client/gui-gtk-2.0/Makefile.am	(working copy)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LTLIBRARIES = libguiclient.la
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS) $(GGZ_GTK_INCLUDES)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS) $(SOUND_CFLAGS) $(GGZ_GTK_INCLUDES)
 
 # The AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
 # Freeciv.h in the builddir, in preference to the one 
Index: client/gui-sdl/Makefile.am
===================================================================
--- client/gui-sdl/Makefile.am	(revision 15567)
+++ client/gui-sdl/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LTLIBRARIES = libguiclient.la
 
-AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS) $(SOUND_CFLAGS)
 
 libguiclient_la_SOURCES = \
 	SDL_rotozoom.c	\
Index: client/gui-stub/gui_main.c
===================================================================
--- client/gui-stub/gui_main.c	(revision 15567)
+++ client/gui-stub/gui_main.c	(working copy)
@@ -15,6 +15,10 @@
 #include <config.h>
 #endif
 
+#ifdef SDL
+#include "SDL.h"
+#endif
+
 #include <stdio.h>
 
 /* utility */
Index: client/gui-stub/Makefile.am
===================================================================
--- client/gui-stub/Makefile.am	(revision 15567)
+++ client/gui-stub/Makefile.am	(working copy)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LTLIBRARIES = libguiclient.la
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common $(CLIENT_CFLAGS) $(SOUND_CFLAGS)
 
 libguiclient_la_SOURCES = \
 	canvas.c	\
Index: client/gui-win32/gui_main.c
===================================================================
--- client/gui-win32/gui_main.c	(revision 15567)
+++ client/gui-win32/gui_main.c	(working copy)
@@ -15,6 +15,10 @@
 #include <config.h>
 #endif
 
+#ifdef SDL
+#include "SDL.h"
+#endif
+
 #include <windows.h>
 #include <winsock.h>
 #include <windowsx.h>
Index: client/gui-win32/Makefile.am
===================================================================
--- client/gui-win32/Makefile.am	(revision 15567)
+++ client/gui-win32/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LTLIBRARIES = libguiclient.la
 
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility -I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_srcdir)/common $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility -I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_srcdir)/common $(CLIENT_CFLAGS) $(SOUND_CFLAGS)
 
 libguiclient_la_SOURCES = \
 	canvas.c	\
Index: client/gui-xaw/gui_main.c
===================================================================
--- client/gui-xaw/gui_main.c	(revision 15567)
+++ client/gui-xaw/gui_main.c	(working copy)
@@ -16,6 +16,10 @@
 #include <config.h>
 #endif
 
+#ifdef SDL
+#include "SDL.h"
+#endif
+
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: client/gui-xaw/Makefile.am
===================================================================
--- client/gui-xaw/Makefile.am	(revision 15567)
+++ client/gui-xaw/Makefile.am	(working copy)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LTLIBRARIES = libguiclient.la
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS) $(SOUND_CFLAGS)
 
 # The AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
 # Freeciv.h in the builddir, in preference to the one 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to