summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-10-16 10:16:07 +0000
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2002-10-16 10:16:07 +0000
commitd9188e538d16048047997a74af405cbb2871f353 (patch)
treee385eaf488648afc34d524b76020a5480cd89a42 /configure.in
parentdefaea533516de75e361227996be5fc8de134306 (diff)
downloadmonitoring-plugins-d9188e538d16048047997a74af405cbb2871f353.tar.gz
use asprintf
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@119 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in82
1 files changed, 67 insertions, 15 deletions
diff --git a/configure.in b/configure.in
index ca890f76..6c98fe9a 100644
--- a/configure.in
+++ b/configure.in
@@ -17,6 +17,13 @@ dnl Figure out how to invoke "install" and what install options to use.
17AC_PROG_INSTALL 17AC_PROG_INSTALL
18AC_SUBST(INSTALL) 18AC_SUBST(INSTALL)
19 19
20AC_PROG_CC
21AC_PROG_MAKE_SET
22AC_PROG_AWK
23
24AC_FUNC_GETLOADAVG
25AM_FUNC_STRTOD
26AM_WITH_REGEX
20AC_PROG_RANLIB 27AC_PROG_RANLIB
21 28
22AC_PATH_PROG(ACLOCAL,aclocal) 29AC_PATH_PROG(ACLOCAL,aclocal)
@@ -61,10 +68,6 @@ dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$
61LDFLAGS="$LDFLAGS -L." 68LDFLAGS="$LDFLAGS -L."
62 69
63dnl Checks for programs. 70dnl Checks for programs.
64AC_PROG_CC
65AC_PROG_MAKE_SET
66AC_PROG_AWK
67
68AC_PATH_PROG(PYTHON,python) 71AC_PATH_PROG(PYTHON,python)
69AC_PATH_PROG(PERL,perl) 72AC_PATH_PROG(PERL,perl)
70AC_PATH_PROG(SH,sh) 73AC_PATH_PROG(SH,sh)
@@ -261,6 +264,7 @@ AC_HEADER_STDC
261AC_HEADER_TIME 264AC_HEADER_TIME
262AC_HEADER_SYS_WAIT 265AC_HEADER_SYS_WAIT
263AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h unistd.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h) 266AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h unistd.h uio.h errno.h regex.h sys/types.h sys/time.h sys/socket.h sys/loadavg.h)
267AC_CHECK_HEADERS(stdarg.h sys/unistd.h unistd.h ctype.h sys/wait.h stdlib.h)
264 268
265dnl Checks for typedefs, structures, and compiler characteristics. 269dnl Checks for typedefs, structures, and compiler characteristics.
266AC_C_CONST 270AC_C_CONST
@@ -269,17 +273,65 @@ AC_TYPE_PID_T
269AC_TYPE_SIZE_T 273AC_TYPE_SIZE_T
270AC_TYPE_SIGNAL 274AC_TYPE_SIGNAL
271 275
272dnl AC_CHECK_MEMBER(struct timeb.millitm,[AC_DEFINE(HAVE_STRUCT_TIMEB_MILLITM)],,[#include <sys/timeb.h>]) 276AC_CHECK_SIZEOF(int,cross)
277AC_CHECK_SIZEOF(long,cross)
278AC_CHECK_SIZEOF(short,cross)
273 279
274dnl EXTRA_LIBRARIES="libgetopt.a libsnprintf.a" 280AC_CACHE_CHECK([for long long],ac_cv_have_longlong,[
275dnl noinst_LIBRARIES="libgetopt.a libsnprintf.a" 281AC_TRY_RUN([#include <stdio.h>
276dnl libgetopt_a_SOURCES="getopt.c getopt1.c" 282main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
277dnl libgetopt_a_DEPENDENCIES=getopt.h 283ac_cv_have_longlong=yes,ac_cv_have_longlong=no,ac_cv_have_longlong=cross)])
278dnl libsnprintf_a_SOURCES=snprintf.c 284if test x"$ac_cv_have_longlong" = x"yes"; then
279dnl AC_SUBST(noinst_LIBRARIES) 285 AC_DEFINE(HAVE_LONGLONG)
280dnl AC_SUBST(libgetopt_a_SOURCES) 286fi
281dnl AC_SUBST(libgetopt_a_DEPENDENCIES) 287
282dnl AC_SUBST(libsnprintf_a_SOURCES) 288#
289# Check if the compiler supports the LL prefix on long long integers.
290# AIX needs this.
291
292AC_CACHE_CHECK([for LL suffix on long long integers],ac_cv_compiler_supports_ll, [
293 AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
294 ac_cv_compiler_supports_ll=yes,ac_cv_compiler_supports_ll=no)])
295if test x"$ac_cv_compiler_supports_ll" = x"yes"; then
296 AC_DEFINE(COMPILER_SUPPORTS_LL)
297fi
298AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE_VA_COPY,[
299AC_TRY_LINK([#include <stdarg.h>
300va_list ap1,ap2;], [__va_copy(ap1,ap2);],
301ac_cv_HAVE_VA_COPY=yes,ac_cv_HAVE_VA_COPY=no)])
302if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
303 AC_DEFINE(HAVE_VA_COPY)
304fi
305
306AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
307AC_TRY_RUN([
308#include <sys/types.h>
309#include <stdarg.h>
310void foo(const char *format, ...) {
311 va_list ap;
312 int len;
313 char buf[5];
314
315 va_start(ap, format);
316 len = vsnprintf(buf, 0, format, ap);
317 va_end(ap);
318 if (len != 5) exit(1);
319
320 va_start(ap, format);
321 len = vsnprintf(0, 0, format, ap);
322 va_end(ap);
323 if (len != 5) exit(1);
324
325 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
326
327 exit(0);
328}
329main() { foo("hello"); }
330],
331ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
332if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
333 AC_DEFINE(HAVE_C99_VSNPRINTF)
334fi
283 335
284dnl We used to not do long options unless a compatible lib was found 336dnl We used to not do long options unless a compatible lib was found
285dnl Now we provide code and make libgetopt if native is not suitable 337dnl Now we provide code and make libgetopt if native is not suitable
@@ -302,7 +354,7 @@ AC_CHECK_FUNCS(getopt_long_only,,LIBS="$LIBS -lgetopt" DEPLIBS="$DEPLIBS libgeto
302AC_CHECK_FUNC(asprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a") 354AC_CHECK_FUNC(asprintf,,LIBS="$LIBS -lsnprintf" DEPLIBS="$DEPLIBS libsnprintf.a")
303 355
304dnl Checks for library functions. 356dnl Checks for library functions.
305AC_CHECK_FUNCS(select socket strdup strstr strtod strtol strtoul gettimeofday) 357AC_CHECK_FUNCS(memmove select socket strdup strstr strtod strtol strtoul gettimeofday)
306 358
307AC_MSG_CHECKING(for type of socket size) 359AC_MSG_CHECKING(for type of socket size)
308AC_TRY_COMPILE([#include <stdlib.h> 360AC_TRY_COMPILE([#include <stdlib.h>