Commit 9ee9b19c authored by deuce's avatar deuce
Browse files

SDL back where it belongs...

parent f389631e
......@@ -27,6 +27,84 @@ endif
ifdef NO_X
ifndef WITH_SDL
CIOLIB-MT_CFLAGS += -DNO_FONTS
CIOLIB-CFLAGS += -DNO_FONTS
CIOLIB_CFLAGS += -DNO_FONTS
endif
endif
# Find SDL headers!
ifdef USE_SDL
ifndef WITH_SDL_AUDIO
ifdef SDL_CONFIG
ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
WITH_SDL := 1
endif
else
ifeq ($(os),darwin)
ifeq ($(shell if [ -d /Library/Frameworks/SDL.framework ] ; then echo YES ; fi),YES)
WITH_SDL := 1
endif
else
ifeq ($(shell sdl-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl-config
WITH_SDL := 1
else
ifeq ($(shell sdl13-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl13-config
WITH_SDL := 1
else
ifeq ($(shell sdl12-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl12-config
WITH_SDL := 1
else
ifeq ($(shell sdl11-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl11-config
WITH_SDL := 1
endif
endif
endif
endif
endif
endif
endif
endif
ifdef WITH_SDL
ifndef WITH_SDL_AUDIO
ifdef SDL_CONFIG
ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
CIOLIB-MT_CFLAGS += -DWITH_SDL
CIOLIB-MT_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
CIOLIB_CFLAGS += -DWITH_SDL
CIOLIB_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
ifdef STATIC_SDL
CIOLIB-MT_LIBS += $(shell $(SDL_CONFIG) --static-libs)
CIOLIB-MT_CFLAGS += -DSTATIC_SDL
CIOLIB-LIBS += $(shell $(SDL_CONFIG) --static-libs)
CIOLIB-CFLAGS += -DSTATIC_SDL
else
ifeq ($(os),darwin)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),linux)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),sunos)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
endif
endif
else
ifeq ($(os),darwin)
CIOLIB-MT_CFLAGS += -DWITH_SDL -DSTATIC_SDL
CIOLIB-MT_CFLAGS += -I/Library/Frameworks/SDL.framework/Headers
CIOLIB-MT_LIBS += -framework SDL -framework Cocoa -framework Carbon -I/Library/Frameworks/SDL.framework/Headers
CIOLIB_CFLAGS += -DWITH_SDL -DSTATIC_SDL
CIOLIB_CFLAGS += -I/Library/Frameworks/SDL.framework/Headers
CIOLIB_LIBS += -framework SDL -framework Cocoa -framework Carbon -I/Library/Frameworks/SDL.framework/Headers
endif
endif
endif
endif
......@@ -12,8 +12,17 @@ else
$(MTOBJODIR)$(DIRSEP)x_cio$(OFILE)
endif
ifdef WITH_SDL
ifdef WITH_SDL_AUDIO
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
else
ifdef WITH_SDL
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)sdlfuncs$(OFILE)
ifeq ($(os),darwin)
MTOBJS += $(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE)
OBJS += $(OBJODIR)$(DIRSEP)SDLMain$(OFILE)
endif
endif
endif
ifeq ($(os),netbsd)
......
......@@ -48,7 +48,7 @@
#define CIOLIB_NO_MACROS
#include "ciolib.h"
#ifdef WITH_SDL
#if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
#include "sdl_con.h"
#endif
#ifdef _WIN32
......@@ -111,7 +111,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void);
#define CIOLIB_INIT() { if(initialized != 1) initciolib(CIOLIB_MODE_AUTO); }
#ifdef WITH_SDL
#if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
int try_sdl_init(int mode)
{
if(!sdl_initciolib(mode)) {
......@@ -304,7 +304,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode)
switch(mode) {
case CIOLIB_MODE_AUTO:
#ifdef WITH_SDL
#if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
if(!try_sdl_init(mode))
#endif
#ifdef _WIN32
......@@ -337,7 +337,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode)
try_ansi_init(mode);
break;
#ifdef WITH_SDL
#if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
case CIOLIB_MODE_SDL:
case CIOLIB_MODE_SDL_FULLSCREEN:
try_sdl_init(mode);
......
......@@ -361,4 +361,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_loadfont(char *filename);
#define loadfont(a) ciolib_loadfont(a)
#endif
#ifdef WITH_SDL
#include <SDL.h>
#ifdef main
#undef main
#endif
#define main CIOLIB_main
#endif
#endif /* Do not add anything after this line */
......@@ -28,7 +28,7 @@ static int main_returned=0;
static SDL_sem *sdl_main_sem;
SDL_sem *sdl_exit_sem;
int XPDEV_main(int argc, char **argv, char **enviro);
int CIOLIB_main(int argc, char **argv, char **enviro);
#ifdef STATIC_SDL
int load_sdl_funcs(struct sdlfuncs *sdlf)
......@@ -479,7 +479,7 @@ static int sdl_run_main(void *data)
int ret;
args=data;
ret=XPDEV_main(args->argc, args->argv, args->enviro);
ret=CIOLIB_main(args->argc, args->argv, args->enviro);
main_returned=1;
sdl.SemPost(sdl_main_sem);
if(sdl_exit_drawing_thread!=NULL)
......@@ -589,6 +589,6 @@ int SDL_main_env(int argc, char **argv, char **env)
sdl.WaitThread(main_thread, &main_ret);
}
else
main_ret=XPDEV_main(argc, argv, env);
main_ret=CIOLIB_main(argc, argv, env);
return(main_ret);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment