-I/scratch/oetiker/lib/include/freetype2" \
LDFLAGS="-L/scratch/oetiker/lib/lib -R/scratch/oetiker/lib/lib \
-L/scratch/oetiker/cgilib-0.5" \
- ./configure --prefix=/scratch/oetiker/lib
+ ./configure --prefix=/scratch/oetiker/rrdtool
make <------ GNU make
RRDtool perl programs. If you do not care what happens to your site-perl
directory, you can also use
- make site-perl-install
+ --enable-perl-site-install
-this will install the perl modules whereever you keep your local perl
-modules. Doing this reliefs you from using 'use lib' in your scripts.
+when running configure to have the RRD perl modules installed whereever you
+keep your local perl modules. Doing this reliefs you from using 'use lib' in
+your scripts.
Configure will also look for an TCL installation on your system. If it finds
one it will build a TCL interface for RRDtool. If you keep tcl in a non
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ]])],[acx_pthread_ok=yes],[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
- [attr_name=$attr; break])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[int attr=$attr;]])],[attr_name=$attr; break],[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
+ x_rflag=no
case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ *-aix* | *-freebsd* | *-darwin*) x_rflag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) x_rflag="-D_REENTRANT";;
esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ AC_MSG_RESULT(${x_rflag})
+ if test "x$x_rflag" != xno; then
+ PTHREAD_CFLAGS="$x_rflag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
dnl FUNCTION-BODY, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
dnl
+dnl substitute them in all the files listed in AC_OUTPUT
+AC_SUBST(PERLFLAGS)
+
AC_DEFUN([AC_IEEE], [
AC_MSG_CHECKING([if IEEE math works $1])
AC_CACHE_VAL([rd_cv_ieee_$2],
-SUBDIRS = tcl
+SUBDIRS = tcl
# the following files are not mentioned in any other Makefile
EXTRA_DIST = $(shell for A in perl-*; do cat $$A/MANIFEST | sed -e s,^,$$A/, ; done)
-# lets schedule the perl stuff for installation
-# the special call to install-sh is because the -d switch is not portable
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(prefix)/lib/perl/auto/RRDs
- $(INSTALL) -m 644 perl-piped/RRDp.pm $(DESTDIR)$(prefix)/lib/perl
- $(INSTALL) -m 644 perl-shared/RRDs.pm $(DESTDIR)$(prefix)/lib/perl
- $(INSTALL) -m 644 perl-shared/blib/arch/auto/RRDs/RRDs.bs $(DESTDIR)$(prefix)/lib/perl/auto/RRDs
- $(INSTALL) -m 755 perl-shared/blib/arch/auto/RRDs/RRDs.@SO_EXT@ $(DESTDIR)$(prefix)/lib/perl/auto/RRDs
-
# add the following to the all target
-all-local: @COMP_PERL@
+all-local: @COMP_PERL@
+
+install-data-local:
+ cd perl-piped && test -f Makefile && $(MAKE) install || true
+ cd perl-shared && test -f Makefile && $(MAKE) install || true
# rules for building the perl module
perl_piped: perl-piped/Makefile
cd perl-piped && $(PERL) Makefile.PL $(PERL_MAKE_OPTIONS)
perl_shared: perl-shared/Makefile
- cd perl-shared && $(MAKE) RPATH=$(prefix)/lib
+ cd perl-shared && $(MAKE) RPATH=$(exec_prefix)/lib
perl-shared/Makefile: perl-shared/Makefile.PL
cd perl-shared && $(PERL) Makefile.PL $(PERLFLAGS) $(PERL_MAKE_OPTIONS)
AC_HEADER_TIME
AC_STRUCT_TM
-dnl substitute them in all the files listed in AC_OUTPUT
-AC_SUBST(PERLFLAGS)
-
dnl Checks for libraries.
AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
fi
AC_LANG_PUSH(C)
-dnl solaris has some odd define it need in order to propperly compile ctime_r
+dnl solaris has some odd defines it needs in order to propperly compile ctime_r
AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
AC_LINK_IFELSE(
AC_LANG_PROGRAM(
AC_ARG_ENABLE(pthread,[ --disable-pthread disable multithread support],
[],[enable_pthread=yes])
-
+
+dnl since we use lots of *_r functions all over the code we better
+dnl make sure they are known
+
+if test "x$x_rflag" != "xno"; then
+ CPPFLAGS="$CPPFLAGS $x_rflag"
+fi
+
if test $enable_pthread != no; then
ACX_PTHREAD([
MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
COMP_PERL=
else
COMP_PERL="perl_piped perl_shared"
- AC_MSG_CHECKING(for shared library extension)
- SO_EXT=`$PERL -e 'use Config; if (defined $Config{so} and $Config{so} ne 'a') {print "$Config{so}\n"} else {print "so\n"};'`
- AC_MSG_RESULT($SO_EXT)
+ AC_MSG_CHECKING(for the perl version you are running)
+ PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
+ AC_MSG_RESULT($PERL_VERSION)
AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
- PROBLEMCC=`$PERL -e 'use Config; ($cc = $Config{cc}) =~ s/\s.*//; exit 0 if -x $cc; map {if (-x "$_/$cc"){exit 0}} split /:/, $ENV{PATH};print $Config{cc}'`
- if test x$PROBLEMCC != x; then
- AC_MSG_RESULT(no)
- echo Could not find the Compiler: '"'$PROBLEMCC'"'
- echo which has been used to build perl. You may have to compile
- echo your own copy of perl to make this work. Binary perls often
- echo exhibit this problem
- exit 1
- else
- AC_MSG_RESULT(found)
+ perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
+ AC_MSG_RESULT($perlcc)
+ if test ! -x $perlcc; then
+ AC_PATH_PROG(PERLCC, ${perlcc}, no)
+ if test -x $"x$PERLCC" = "xno"; then
+ AC_MSG_WARN([
+I would not find the Compiler ($perlcc) that was originally used to compile your
+perl binary. You should either make sure that this compiler is available on your
+system, or use a different perl setup that was compiled with $CC.
+
+I will disable the compilation of the RRDs perl module.
+])
+ COMP_PERL="perl_piped"
+ fi
fi
fi
+AC_MSG_CHECKING(Perl Modules to build)
+AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
+
+# Options to pass when configuring perl module
+PERL_MAKE_OPTIONS="PREFIX=$prefix LIB=$prefix/lib/perl/$PERL_VERSION"
+
+dnl pass additional perl options when generating Makefile from Makefile.PL
+AC_ARG_ENABLE(perl-site-install,
+[ --enable-perl-site-install by default the rrdtool perl modules are installed
+ together with rrdtool in $prefix/lib/perl. You have to
+ put a 'use lib qw($prefix/lib/perl)' into your scripts
+ when you want to use them. When you set this option
+ the perl modules will get installed wherever
+ your perl setup thinks it is best.],
+[PERL_MAKE_OPTIONS=],[])
+
+AC_ARG_WITH(perl-options,
+[ --with-perl-options=[OPTIONS] options to pass on command-line when
+ generating Makefile from Makefile.PL. If you set this
+ option, interesting things may happen unless you know
+ what you are doing!],
+[PERL_MAKE_OPTIONS=$withval])
+
+AC_SUBST(PERL_MAKE_OPTIONS)
+AC_SUBST(PERL)
AC_SUBST(COMP_PERL)
-AC_SUBST(SO_EXT)
+AC_SUBST(PERL_VERSION)
dnl Check for Tcl.
withval=""
. $tcl_config
fi
-dnl Pass additional perl options when generating Makefile from Makefile.PL
-# Options to pass when configuring perl module
-AC_ARG_WITH(perl-options,
-[ --with-perl-options=[OPTIONS] options to pass on command-line when
- generating Makefile from Makefile.PL],
-[PERL_MAKE_OPTIONS=$withval])
-AC_SUBST(PERL_MAKE_OPTIONS)
AM_CONDITIONAL(COMP_TCL, test x$found = x1 )
#! @PERL@
#makes things work when run without install
-use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
-# this is for after install
-use lib qw( @prefix@/lib/perl ../lib/perl );
+use lib qw( @prefix@/lib/perl );
use RRDs;
#! @PERL@
-
-#makes things work when run without install
-use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
# this is for after install
-use lib qw( @prefix@/lib/perl ../lib/perl );
+use lib qw( @prefix@/lib/perl );
use RRDs;
my $start=time;
-#! @prefix@/bin/rrdcgi
+#! @exec_prefix@/bin/rrdcgi
<HTML>
<HEAD>
#! @PERL@
-#makes things work when run without install
-use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
-# this is for after install
-use lib qw( @prefix@/lib/perl ../lib/perl );
+use lib qw( @prefix@/lib/perl );
use RRDs;
my $start=time;
#! @PERL@
-#makes things work when run without install
-use lib qw( ../bindings/perl-piped/blib/lib ../lib/perl );
-
-#makes programm work AFTER install
use lib qw( @prefix@/lib/perl );
use RRDp;
$PNG = "piped-demo.png";
# some magic to find the correct rrdtol executable
-if ( -x "@prefix@/bin/rrdtool") {
- RRDp::start "@prefix@/bin/rrdtool";
+if ( -x "@exec_prefix@/bin/rrdtool") {
+ RRDp::start "@exec_prefix@/bin/rrdtool";
} elsif ( -x "../bin/rrdtool") {
RRDp::start "../bin/rrdtool";
} else {
$now = time;
($user1,$sys1,$real1) = ($RRDp::user,$RRDp::sys,$RRDp::real);
+my $local = "".localtime(time());
+$local =~ s/:/\\:/g;
+
for ($i=0;$i<$GRUNS;$i++) {
RRDp::cmd "graph $PNG ", "--title 'Test GRAPH' ",
"--imgformat PNG --height 150 --vertical-label 'Dummy Units' ".
"GPRINT:calc:MAX:'Max calc\\: %1.2lf %S'",
"VRULE:".($now-3600)."#008877:'60 Minutes ago'",
"COMMENT:'\\s'",
- "COMMENT:'Graph created on\\: ".localtime(time())."\\c'";
+ "COMMENT:'Graph created on\\: $local\\c'";
$answer = RRDp::read;
}
print "ok $ok_count $what\n";
}
-#makes things work when run without install
-use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
-
#makes programm work AFTER install
-use lib qw( @prefix@/lib/perl ../lib/perl );
+use lib qw( @prefix@/lib/perl );
use strict;
use vars qw(@ISA $loaded);
#! @PERL@
-
-#makes things work when run without install
-use lib qw( ../bindings/perl-shared/blib/lib ../bindings/perl-shared/blib/arch );
-
-#makes programm work AFTER install
-use lib qw( @prefix@/lib/perl ../lib/perl );
+use lib qw( @prefix@/lib/perl );
use strict;
use vars qw(@ISA $loaded);
int rrd_restore(int, char **);
int rrd_dump(int, char **);
int rrd_tune(int, char **);
-time_t rrd_last(int, const char **);
+time_t rrd_last(int, char **);
int rrd_resize(int, char **);
int rrd_xport(int, char **, int *, time_t *, time_t *,
unsigned long *, unsigned long *,
#include "rrd_tool.h"
time_t
-rrd_last(int argc, const char **argv)
+rrd_last(int argc, char **argv)
{
if(argc < 2){
rrd_set_error("please specify an rrd");
unsigned long u_cnt;
rrd_value_t u_val;
char *u_str;
- int u_int;
+ int u_int;
} infoval;
typedef struct info_t {