summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 978e552)
raw | patch | inline | side by side (parent: 978e552)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 21 Nov 2007 06:57:22 +0000 (06:57 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 21 Nov 2007 06:57:22 +0000 (06:57 +0000) |
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1242 a5681a0c-68f1-0310-ab6d-d61299d08faa
bindings/perl-shared/Makefile.PL | patch | blob | history | |
configure.ac | patch | blob | history | |
src/rrd_tool.h | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
index 863444c787c423c14a571c599a2ebe7a5a5a9f3e..c31f3b9d649686dbd87db0ccd8f176bce692c5b9 100644 (file)
'VERSION_FROM' => 'RRDs.pm', # finds $VERSION
'DEFINE' => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
'INC' => '-I../../src',
+ 'LIBS' => '-lm -lpng -lz -lfreetype',
# Perl will figure out which one is valid
- 'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"},
+ #'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"},
+ 'depend' => {'RRDs.c' => "../../src/librrd.la"},
+ 'LDFROM' => '$(OBJECT) '.$librrd,
'realclean' => {FILES => 't/demo?.rrd t/demo?.png' }
);
diff --git a/configure.ac b/configure.ac
index e09c051c2ece20546af777639649072d56ea5fe9..0977c8a9943fd4cb73441211fbfef84679d8d37b 100644 (file)
--- a/configure.ac
+++ b/configure.ac
/* realloc does not support NULL as argument */
#undef NO_NULL_REALLOC
+/* lets enable madvise defines in netbsd */
+#if defined(__NetBSD__)
+# if !defined(_NETBSD_SOURCE)
+# define _NETBSD_SOURCE
+# endif
+#endif
+
])
AH_BOTTOM([
-/* enable posix_fadvise on linux */
-#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
-#define _XOPEN_SOURCE 600
+#ifdef HAVE_FEATURES_H
+#define _XOPEN_SOURCE 600
+#define _BSD_SOURCE 1
+# include <features.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+
+#if defined(HAVE_SYS_MMAN_H)
+#include <sys/mman.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifndef MAXPATH
+# ifdef PATH_MAX
+# define MAXPATH PATH_MAX
+# endif
+#endif
+#ifndef MAXPATH
+/* else try the BSD variant */
+# ifdef MAXPATHLEN
+# define MAXPATH MAXPATHLEN
+# endif
+#endif
+
+#if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
+/* use posix_madvise family */
+# define madvise posix_madvise
+# define MADV_NORMAL POSIX_MADV_NORMAL
+# define MADV_RANDOM POSIX_MADV_RANDOM
+# define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
+# define MADV_WILLNEED POSIX_MADV_WILLNEED
+# define MADV_DONTNEED POSIX_MADV_DONTNEED
+#endif
+
+#if defined POSIX_MADV_RANDOM && !defined MADV_RANDOM
+#define MADV_RANDOM POSIX_MADV_RANDOM
+#endif
+
+
+
+#if defined HAVE_MADVISE || defined HAVE_POSIX_MADVISE
+# define USE_MADVISE 1
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#if (defined(__svr4__) && defined(__sun__))
+/* Solaris headers (pre 2.6) don't have a getrusage prototype.
+ Use this instead. */
+extern int getrusage(int, struct rusage *);
+#endif /* __svr4__ && __sun__ */
+#endif
+
/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
make sure you are NOT using bcopy, index or rindex in the code */
/* solaris 10 it defines isnan such that only forte can compile it ... bad bad */
#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
-# undef isnan
+# undefine isnan
# define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
#endif
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h float.h strings.h)
+AC_CHECK_HEADERS( sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h float.h strings.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise madvise)
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+
+dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
+if test "x$enable_mmap" = "xyes"; then
+ case "$host" in
+ *cygwin*)
+ # the normal mmap test does not work in cygwin
+ AC_CHECK_FUNCS(mmap)
+ if test "x$ac_cv_func_mmap" = "xyes"; then
+ ac_cv_func_mmap_fixed_mapped=yes
+ fi
+ ;;
+ *)
+ AC_CHECK_HEADERS(sys/mman.h)
+ AC_FUNC_MMAP
+ AC_CHECK_FUNCS(mmap munmap msync)
+ AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
+ # include <sys/mman.h>
+ #endif])
+ if test "x$ac_cv_have_decl_madvise" = "xyes";
+ then
+ AC_CHECK_FUNCS(madvise)
+ else
+ AC_CHECK_FUNCS(posix_madvise)
+ if test "x$ac_cv_func_posix_madvise" != "xyes"; then
+ AC_MSG_WARN([madvise() nor posix_madvise() found.])
+ fi
+ fi
+ ;;
+ esac
+ if test "x$ac_cv_func_mmap" != "xyes";
+ then
+ AC_MSG_ERROR([--enable-mmap requested but mmap() was not detected])
+dnl enable_mmap="no"
+ fi
+fi
+
+dnl can we use posix_fadvise
AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
#include <fcntl.h>])
-AC_CHECK_DECLS(madvise, [], [], [#include <sys/mman.h>])
+AC_CHECK_FUNCS(posix_fadvise)
if test "x$enable_mmap" = xyes; then
case "$host" in
diff --git a/src/rrd_tool.h b/src/rrd_tool.h
index 852bfece11f4efe2b0d573214739d48132648a26..84ffc0adcc0cf6c9cc635f94edcb422a3ed83bfa 100644 (file)
--- a/src/rrd_tool.h
+++ b/src/rrd_tool.h
# include <sys/stat.h>
#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
#if HAVE_STRINGS_H
# include <strings.h>
#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-
-#if HAVE_SYS_TIMES_H
-# include <sys/times.h>
-#endif
-
-
-#if HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#if (defined(__svr4__) && defined(__sun__))
-/* Solaris headers (pre 2.6) don't have a getrusage prototype.
- Use this instead. */
-extern int getrusage(int, struct rusage *);
-#endif /* __svr4__ && __sun__ */
-#endif
-
#include "rrd.h"
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 08a2ce2c9ae9ad977e0edd0ed71c972264625388..9225fb08b0d3dda925d14e9ffbe79e05c0f80d95 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
#include "rrd_tool.h"
#include <sys/types.h>
#include <fcntl.h>
-#ifdef HAVE_MMAP
-# include <sys/mman.h>
-#endif
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#include <sys/locking.h>
@@ -427,10 +424,10 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
fclose(rrd_file);
return(-1);
}
-#ifdef HAVE_MADVISE
+#ifdef USE_MADVISE
/* when we use mmaping we tell the kernel the mmap equivalent
of POSIX_FADV_RANDOM */
- madvise(rrd_mmaped_file,rrd_filesize,POSIX_MADV_RANDOM);
+ madvise(rrd_mmaped_file,rrd_filesize,MADV_RANDOM);
#endif
#endif
/* loop through the arguments. */