From ec6780e3227ff6bd94b5910e93a1f05c72a4c520 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Thu, 23 Feb 2006 22:21:01 +0000 Subject: [PATCH] Compatibility improvements. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2255 8092fc87-c524-0410-9efc-e669fe64eaf9 --- tools/map/Makefile | 10 +++++----- tools/map/port.c | 22 ++++++++++++++++++++++ tools/map/port.h | 12 ++++++++++++ tools/map/sdlpngdrv.c | 1 + 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 tools/map/port.c diff --git a/tools/map/Makefile b/tools/map/Makefile index 7436406ef..ba3f220c4 100755 --- a/tools/map/Makefile +++ b/tools/map/Makefile @@ -7,18 +7,18 @@ TARGET = mapgen # These flags are needed to get it to compile with libpngX.dll on CYGWIN -CYGWINFLAGS = -DPNG_USE_DLL -#CYGWINFLAGS = +#CYGWINFLAGS = -DPNG_USE_DLL +CYGWINFLAGS = PNGFLAGS = -I. SDLFLAGS = $(shell sdl-config --cflags) CC = gcc -CFLAGS = -W -Wall -O0 # -g +CFLAGS += -W -Wall -O0 # -g LIBS = -L/usr/local/lib -lpng -lm -lSDL_ttf -lSDL_image -LDFLAGS = $(shell sdl-config --libs) +LDFLAGS += $(shell sdl-config --libs) BINS = $(TARGET) $(TARGET).exe -OBJS = mapgen.o alist.o scriptlib.o stringbank.o unicode.o sdlpngdrv.o SDL_gfxPrimitives.o +OBJS = mapgen.o alist.o scriptlib.o stringbank.o unicode.o sdlpngdrv.o SDL_gfxPrimitives.o port.o .SUFFIXES: .c .o diff --git a/tools/map/port.c b/tools/map/port.c new file mode 100644 index 000000000..1d6439de1 --- /dev/null +++ b/tools/map/port.c @@ -0,0 +1,22 @@ +#include "port.h" + +#ifndef HAVE_STRUPR + +#include + +char * +strupr (char *str) +{ + char *ptr; + + ptr = str; + while (*ptr) + { + *ptr = (char) toupper (*ptr); + ptr++; + } + return str; +} +#endif + + diff --git a/tools/map/port.h b/tools/map/port.h index 455bfd92e..4562dd3ca 100755 --- a/tools/map/port.h +++ b/tools/map/port.h @@ -14,5 +14,17 @@ #define countof(a) ( sizeof(a)/sizeof(*a) ) +#ifdef __WIN32__ +# define HAVE_STRICMP +# define HAVE_STRUPR +#endif + + +#ifndef HAVE_STRICMP +# define stricmp strcasecmp +#else +# define strcasecmp stricmp +#endif + #endif /* _PORT_H */ diff --git a/tools/map/sdlpngdrv.c b/tools/map/sdlpngdrv.c index 74dda0835..aa23f1699 100755 --- a/tools/map/sdlpngdrv.c +++ b/tools/map/sdlpngdrv.c @@ -12,6 +12,7 @@ #include "mapdrv.h" #include #include +#include #include #include "SDL.h" #include "SDL_image.h"