From 20092e09c8f026333f6ebe0d6285550bda9e14af Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Thu, 7 Nov 2002 07:06:34 +0000 Subject: test snprintf function family for ifdefs in snprintf.c git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@169 f882894a-f735-0410-b71e-b25c423dba1c --- configure.in | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index aa68894d..d7594057 100644 --- a/configure.in +++ b/configure.in @@ -12,6 +12,17 @@ AM_CONFIG_HEADER(plugins/config.h plugins/common.h plugins/version.h plugins/net AC_PREFIX_DEFAULT(/usr/local/nagios) +#AC_DEFUN(AC_HAVE_DECL, +#[ +# AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[ +# AC_TRY_COMPILE([$2],[int i = (int)$1], +# ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)]) +# if test x"$ac_cv_have_$1_decl" = x"yes"; then +# AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available]) +# fi +#]) + + dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL @@ -345,7 +356,20 @@ AC_TRY_COMPILE([#include AC_CHECK_FUNCS(getopt_long_only,,LIBS="$LIBS -lgetopt" DEPLIBS="$DEPLIBS libgetopt.a") -AC_CHECK_FUNC(asprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a") +#AC_HAVE_DECL(asprintf, [#include ]) +#AC_HAVE_DECL(vasprintf, [#include ]) +#AC_HAVE_DECL(vsnprintf, [#include ]) +#AC_HAVE_DECL(snprintf, [#include ]) + +AC_CHECK_FUNC(snprintf,AC_DEFINE(HAVE_SNPRINTF,1,[Define if snprintf is present])) +AC_CHECK_FUNC(vsnprintf,AC_DEFINE(HAVE_VSNPRINTF,1,[Define if vsnprintf is present])) +AC_CHECK_FUNC(vasprintf,AC_DEFINE(HAVE_VASPRINTF,1,[Define if vasprintf is present])) +AC_CHECK_FUNC(asprintf,AC_DEFINE(HAVE_ASPRINTF,1,[Define if asprintf is present])) + +if test x"$ac_cv_HAVE_SNPRINTF" = x"no" -o x"$ac_cv_HAVE_VSNPRINTF" = x"no" -o x"$ac_cv_HAVE_VASPRINTF" = x"no" -o x"$ac_cv_HAVE_ASPRINTF" = x"no"; then + LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a" +fi + dnl Checks for library functions. AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul gettimeofday) -- cgit v1.2.3-74-g34f1