From a92115ab9f82f5e41e6d1818a6f9d2f54cedc5fb Mon Sep 17 00:00:00 2001 From: Stu Tomlinson Date: Wed, 16 Mar 2022 11:33:58 +0000 Subject: [PATCH] Do not compile/link snprintf.o if it is not needed --- Makefile.am | 5 ++++- configure.ac | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8765778..8849295 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index a28b4d0..d20f68c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) 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