diff --git a/configure.ac b/configure.ac
index e2d5c6af5f646870fd4263678095093dfab85d88..9f59bb70de160544e9c0d3a8a54b92abe53663c0 100644 (file)
--- a/configure.ac
+++ b/configure.ac
# define rrd_realloc(a,b) realloc((a), (b))
#endif
+#if NEED_MALLOC_MALLOC_H
+# include <malloc/malloc.h>
+#endif
+
#if HAVE_MATH_H
# include <math.h>
#endif
AC_FULL_IEEE
+AC_LANG_PUSH(C)
+dnl see if we have to include malloc/malloc.h
+AC_MSG_CHECKING([do we need malloc/malloc.h])
+AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[#include <stdlib.h>]],
+ [[malloc(1)]]
+ ),
+ [ AC_MSG_RESULT([nope, works out of the box]) ],
+ [ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[#include <stdlib.h>
+ #include <malloc/malloc.h>]],
+ [[malloc(1)]]
+ ),
+ [AC_DEFINE(NEED_MALLOC_MALLOC_H)
+ AC_MSG_RESULT([yes we do])],
+ [AC_MSG_ERROR([Can't figure how to compile malloc])]
+ )
+ ]
+)
+AC_LANG_POP(C)
+
dnl How the vertical axis label is printed
AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE,
[Vertical label angle: 90.0 (default) or 270.0])
EX_CHECK_ALL(png, png_access_version_number, png.h, libpng, 1.2.8, http://prdownloads.sourceforge.net/libpng/, "")
EX_CHECK_ALL(freetype, FT_Init_FreeType, ft2build.h, freetype2, 2.1.9, http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
-save_LIBS=${LIBS}
-save_CPPFLAGS=${CPPFLAGS}
-save_LDFLAGS=${LDFLAGS}
-
-if test $enable_rrdcgi != no; then
-EX_CHECK_ALL(cgi, cgiInit, cgi.h, cgilib, 0.5, http://www.infodrom.org/projects/cgilib, "")
-fi
-
-CGI_LIBS=${LIBS}
-CGI_CPPFLAGS=${CPPFLAGS}
-CGI_LDFLAGS=${LDFLAGS}
-
-AC_SUBST(CGI_LIBS)
-AC_SUBST(CGI_CPPFLAGS)
-AC_SUBST(CGI_LDFLAGS)
-
-LIBS=${save_LIBS}
-CPPFLAGS=${save_CPPFLAGS}
-LDFLAGS=${save_LDFLAGS}
-
if test "$EX_CHECK_ALL_ERR" = "YES"; then
AC_MSG_ERROR([Please fix the library issues listed above and try again.])
fi