summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b1d628)
raw | patch | inline | side by side (parent: 5b1d628)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 10 Mar 2005 17:03:34 +0000 (17:03 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 10 Mar 2005 17:03:34 +0000 (17:03 +0000) |
but gets it to install the perl module in @prefix@/lib/perl such
that you can use the same use lib line for whatever platform and perlversion
you install into this directory. They all live neatly next to each other.
* fixed examples to work with new perl install system. Added a few exec_prefix lines
where appropriate
* fixed piped demo
* fixed VeraMono.ttf file. This somehow got damaged by cvs ...
* added thread defines to normal compile run, so that _r functions to not through errors.
* tested compilation and installation
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@307 a5681a0c-68f1-0310-ab6d-d61299d08faa
that you can use the same use lib line for whatever platform and perlversion
you install into this directory. They all live neatly next to each other.
* fixed examples to work with new perl install system. Added a few exec_prefix lines
where appropriate
* fixed piped demo
* fixed VeraMono.ttf file. This somehow got damaged by cvs ...
* added thread defines to normal compile run, so that _r functions to not through errors.
* tested compilation and installation
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@307 a5681a0c-68f1-0310-ab6d-d61299d08faa
14 files changed:
index 2eb96a6d2c4b1f9ec0e30737e07ddb8f0b7b11a2..b3631ba3eea626886d0761f894d0b6c34c4b1afe 100644 (file)
--- a/README
+++ b/README
-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
diff --git a/acinclude.m4 b/acinclude.m4
index 329501dd3e6ce6cbbb1050b6c566148f2ff3cba4..062216a2b689aed8355d73ff1da4ef4d56d89f9c 100644 (file)
--- a/acinclude.m4
+++ b/acinclude.m4
# 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],
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index f55119617a7383ec59e46ca0f5a8f124e8683262..48a7508b768d73bec45416f554a4cd2ccc566806 100644 (file)
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
-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)
diff --git a/configure.ac b/configure.ac
index 0c7790be773fcc6b7aa3585b04eddec1a67952a0..f385ebc54997a9a1cc391ea85499cf16869e48cc 100644 (file)
--- a/configure.ac
+++ b/configure.ac
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 )
diff --git a/examples/4charts.pl.in b/examples/4charts.pl.in
index 7249b07aac48a2d7d8f579d82870c00b1ea2ef3f..beeb6f4a2e6f218e10c24395aeb603269ff73a33 100755 (executable)
--- a/examples/4charts.pl.in
+++ b/examples/4charts.pl.in
#! @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;
diff --git a/examples/bigtops.pl.in b/examples/bigtops.pl.in
index 9bc39db9bb5806e3047bba13eb4d641047b3aa2a..b3fa6e41f8aeb18848db0bbf0c5092ecf201c748 100755 (executable)
--- a/examples/bigtops.pl.in
+++ b/examples/bigtops.pl.in
#! @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;
index 9ec15872e663d52cb2d4a2e94019b5549b99b296..c5c5a11938213830b2d1c1c67deabb2b7ef69f13 100755 (executable)
--- a/examples/cgi-demo.cgi.in
+++ b/examples/cgi-demo.cgi.in
-#! @prefix@/bin/rrdcgi
+#! @exec_prefix@/bin/rrdcgi
<HTML>
<HEAD>
diff --git a/examples/minmax.pl.in b/examples/minmax.pl.in
index 14faecbd11bbe6840ea99d9b4d910f0514adc448..29c016932497c9ef3d89726a71f554f18d86905e 100755 (executable)
--- a/examples/minmax.pl.in
+++ b/examples/minmax.pl.in
#! @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;
index 82232fb9d5f2c4c7f13b5c19bf12a4da57ae5ef5..71d69e7135cb93f33da20b8ec97e67eeb24f6482 100755 (executable)
#! @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;
}
index 9442196159ede46758e0fe273bf4db494b8cf514..6d9374f647f026e09a2e43a26afaf9968f62c468 100755 (executable)
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);
diff --git a/examples/stripes.pl.in b/examples/stripes.pl.in
index 5c4c6dfaa663fa758a26d1653a55449c52133820..5187a56cdf0130930162a6edc1ae5436c2579f4e 100755 (executable)
--- a/examples/stripes.pl.in
+++ b/examples/stripes.pl.in
#! @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);
diff --git a/src/rrd.h b/src/rrd.h
index f63d1178037c2bb14199321f7e73f69931812e2a..2868ebb9098d3f74e583174fd821390ed1a57308 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
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 *,
diff --git a/src/rrd_last.c b/src/rrd_last.c
index ad8075e8e90139b80a1cac46e8d5df8c304593bd..d50e7604b9b44262e7a015c5142d4071064c2383 100644 (file)
--- a/src/rrd_last.c
+++ b/src/rrd_last.c
#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");
diff --git a/src/rrd_tool.h b/src/rrd_tool.h
index dbfb26b06add6c1044baaf2df3a610450dc98516..56b4568dbd787468410391b3298748a84fdc8cfd 100644 (file)
--- a/src/rrd_tool.h
+++ b/src/rrd_tool.h
unsigned long u_cnt;
rrd_value_t u_val;
char *u_str;
- int u_int;
+ int u_int;
} infoval;
typedef struct info_t {