Define HAVE_SNPRINTF, HAVE_VSNPRINTF, HAVE_STDARG_H at compile time (Fix DJGPP build)

This commit is contained in:
Stas Degteff 2011-03-01 17:10:09 +00:00
parent 2b8880986c
commit c90f069a9a
3 changed files with 9 additions and 12 deletions

View File

@ -48,6 +48,7 @@ WINDRES=windres
EXEEXT=.exe EXEEXT=.exe
OBJEXT=.o OBJEXT=.o
LIBEXT=.a LIBEXT=.a
CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H
else else
ifeq ($(PLATFORM),emx) ifeq ($(PLATFORM),emx)
CAT=cat CAT=cat
@ -69,6 +70,7 @@ LIBEXT=.a
#OBJEXT=.obj #OBJEXT=.obj
#LIBEXT=.lib #LIBEXT=.lib
CXX=$(CC) CXX=$(CC)
CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H
else else
ifeq ($(PLATFORM),djg) ifeq ($(PLATFORM),djg)
CAT=command.com /c type CAT=command.com /c type
@ -95,6 +97,7 @@ EXEEXT=
OBJEXT=.o OBJEXT=.o
LIBEXT=.a LIBEXT=.a
LNKFLAGS+=-lbe -ltextencoding LNKFLAGS+=-lbe -ltextencoding
CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H
else else
ifeq ($(PLATFORM),sun) # SUN Solaris ifeq ($(PLATFORM),sun) # SUN Solaris
CAT=cat CAT=cat
@ -108,6 +111,7 @@ EXEEXT=
OBJEXT=.o OBJEXT=.o
LIBEXT=.a LIBEXT=.a
CFLAGS+=-D__SUNOS__ -D__UNIX__ -DUNIX CFLAGS+=-D__SUNOS__ -D__UNIX__ -DUNIX
CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H
ifeq ($(WIDE_NCURSES),1) ifeq ($(WIDE_NCURSES),1)
LIBCURSES=-L/opt/csw/lib -lncursesw LIBCURSES=-L/opt/csw/lib -lncursesw
else else
@ -131,6 +135,7 @@ LIBCURSES=-lncursesw
else else
LIBCURSES=-lncurses LIBCURSES=-lncurses
endif endif
CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H
else # Linux, *BSD or another unix-like OS else # Linux, *BSD or another unix-like OS
CAT=cat CAT=cat
SED=sed SED=sed
@ -155,7 +160,7 @@ endif
endif endif
endif endif
endif endif
CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK # -fomit-frame-pointer CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H # -fomit-frame-pointer
LNKFLAGS+=-g LNKFLAGS+=-g
CPPFLAGS+=$(CFLAGS) -fno-rtti # -fno-exceptions CPPFLAGS+=$(CFLAGS) -fno-rtti # -fno-exceptions

View File

@ -59,8 +59,10 @@ char* strlwr(char* s);
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#if defined(_MSC_VER) #if !defined(HAVE_SNPRINTF)
int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... ); int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... );
#endif
#if !defined(HAVE_VSNPRINTF)
int vsnprintf( char *buffer, size_t sizeOfBuffer, const char *format, va_list argptr ); int vsnprintf( char *buffer, size_t sizeOfBuffer, const char *format, va_list argptr );
#endif #endif

View File

@ -31,16 +31,6 @@
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// snprintf() and vsnprintf() // snprintf() and vsnprintf()
// ---- FIXME: All HAVE_* macro should be defined in makefile or created by autoconf
#ifdef __GNUC__
# define HAVE_SNPRINTF
# define HAVE_VSNPRINTF
# define HAVE_STDARG_H
#endif
#if defined(__WATCOMC__)
# define HAVE__SNPRINTF
# define HAVE__VSNPRINTF
#endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* It is need a workaround for implementation "speciality" in snprintf() and vsnprintf() from Microsoft. */ /* It is need a workaround for implementation "speciality" in snprintf() and vsnprintf() from Microsoft. */
int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... ) int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... )