Use libc snprintf if available.

SVN revision: 28803
This commit is contained in:
Kim Woelders 2007-03-18 22:29:36 +00:00
parent d83d1aaf7b
commit 57ec0d1a09
3 changed files with 18 additions and 15 deletions

View File

@ -1,14 +1,18 @@
# $Id$ # $Id$
if BUILD_SNPRINTF
SRCS_SNPRINTF = snprintf.c
endif
lib_LTLIBRARIES = libepplet.la lib_LTLIBRARIES = libepplet.la
include_HEADERS = epplet.h include_HEADERS = epplet.h
libepplet_la_SOURCES = epplet.c snprintf.c libepplet_la_SOURCES = epplet.c $(SRCS_SNPRINTF)
libepplet_la_DEPENDENCIES = $(top_builddir)/config.h epplet.h libepplet_la_DEPENDENCIES = $(top_builddir)/config.h epplet.h
libepplet_la_LDFLAGS = -version-info 1:0:0 libepplet_la_LDFLAGS = -version-info 2:0:0
INCLUDES = -I$(top_srcdir) $(X_CFLAGS) -DEROOT=\"@EROOT@\" INCLUDES = -I$(top_srcdir) $(X_CFLAGS) -DEROOT=\"@EROOT@\"
LDADD = -L$(libdir) -L$(prefix)/lib $(LIBS) $(X_LIBS) LDADD = -L$(libdir) -L$(prefix)/lib $(LIBS) $(X_LIBS)
EXTRA_DIST = epplet.h.in EXTRA_DIST = epplet.h.in snprintf.c

View File

@ -41,18 +41,15 @@
#define __sun__ #define __sun__
#endif #endif
#if defined(HAVE_VARARGS_H) && !defined(HAVE_STDARG_H) #define HAVE_SNPRINTF @HAVE_SNPRINTF@
#include <varargs.h> #if HAVE_SNPRINTF
int Evsnprintf(char *str, size_t count, const char *fmt, va_list args); #define Evsnprintf vsnprintf
int Esnprintf(va_alist); #define Esnprintf snprintf
#else #else
/* If they don't have stdarg.h, they have bigger problems.... */ int Evsnprintf(char *str, size_t count, const char *fmt,
#include <stdarg.h> va_list args);
int Evsnprintf(char *str, size_t count, const char *fmt, va_list args); int Esnprintf(char *str, size_t count, const char *fmt, ...);
int Esnprintf(char *str, size_t count, const char *fmt,...); #endif /* HAVE_SNPRINTF */
#endif
/****************************************************************************/ /****************************************************************************/
/* Data structures & primitives */ /* Data structures & primitives */

View File

@ -86,7 +86,9 @@ AC_TYPE_UID_T
dnl# Checks for library functions. dnl# Checks for library functions.
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
dnl#AC_CHECK_FUNCS() AC_CHECK_FUNCS(snprintf, x=1, x=0)
AC_SUBST(HAVE_SNPRINTF, $x)
AM_CONDITIONAL(BUILD_SNPRINTF, test "x$x" = "x0")
# ok enlightenment d00ds want to ignore civilization and install # ok enlightenment d00ds want to ignore civilization and install
# everything in one place. The rest of use prefer sanity. # everything in one place. The rest of use prefer sanity.