Do not compile/link snprintf.o if it is not needed

This commit is contained in:
Stu Tomlinson
2022-03-16 11:33:58 +00:00
parent 08158ee8ad
commit a92115ab9f
2 changed files with 6 additions and 2 deletions

View File

@@ -52,7 +52,6 @@ libstrophe_la_SOURCES = \
src/sha1.c \
src/sha256.c \
src/sha512.c \
src/snprintf.c \
src/sock.c \
src/stanza.c \
src/tls.c \
@@ -76,6 +75,10 @@ libstrophe_la_SOURCES += \
src/tls.h \
src/util.h
if NEED_SNPRINTF
libstrophe_la_SOURCES += src/snprintf.c
endif
if DISABLE_TLS
libstrophe_la_SOURCES += src/tls_dummy.c
else

View File

@@ -75,7 +75,7 @@ else
fi
AC_SEARCH_LIBS([socket], [network socket])
AC_CHECK_FUNCS([snprintf vsnprintf])
AC_CHECK_FUNCS([snprintf vsnprintf], [], [have_snprintf=no])
AC_CHECK_DECLS([va_copy], [], [], [#include <stdarg.h>])
if test "x$enable_tls" != xno -a "x$with_gnutls" == xyes; then
@@ -207,6 +207,7 @@ m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
AM_CONDITIONAL([DISABLE_TLS], [test x$enable_tls = xno])
AM_CONDITIONAL([NEED_SNPRINTF], [test x$have_snprintf = xno])
AM_CONDITIONAL([TLS_WITH_GNUTLS], [test x$with_gnutls = xyes])
# define while compiling