From: oetiker Date: Thu, 31 Jan 2002 22:43:13 +0000 (+0000) Subject: allow use of libraries already installed on the system X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c0cb62da4ec2b5c7b3aef09adacb7f0a3189df28;p=rrdtool.git allow use of libraries already installed on the system git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@71 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..86b5441 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,25 @@ +# INCLUDED_LIB(LIBRARY, FUNCTION, OTHER-LIBRARIES = none) +# --------------------------------------------- +AC_DEFUN(INCLUDED_LIB, +[ +use_installed_lib$1= +AC_ARG_WITH([lib$1], + [AC_HELP_STRING([--with-lib$1], + [Use installed lib$1 (under PREFIX)])], + [if test -n "$withval"; then + if test "$withval" = yes; then + withval="default path" + else + CFLAGS="$CFLAGS -I${withval}/include" + LDFLAGS="$LDFLAGS -L${withval}/lib" + fi + fi + AC_CHECK_LIB([$1],[$2], + [AC_MSG_NOTICE([using lib$1 in ${withval}]) + use_installed_lib$1=yes], + [AC_MSG_ERROR([lib$1 not found in ${withval}])], + [$3])], + [AC_MSG_NOTICE([using included lib$1])]) +AM_CONDITIONAL([USE_INSTALLED_lib$1], + [test "$use_installed_lib$1" = yes]) +]) diff --git a/configure.ac b/configure.ac index c21395a..92b1168 100644 --- a/configure.ac +++ b/configure.ac @@ -137,11 +137,11 @@ char *strchr (), *strrchr (); dnl Define library subdirectory names here. -CGI_LIB_DIR=libraries/cgilib-0.4 -FREETYPE_LIB_DIR=libraries/freetype-2.0.5 -ART_LIB_DIR=libraries/libart_lgpl-2.3.7 -PNG_LIB_DIR=libraries/libpng-1.2.0 -ZLIB_LIB_DIR=libraries/zlib-1.1.3 +CGI_LIB_DIR=cgilib-0.4 +FREETYPE_LIB_DIR=freetype-2.0.5 +ART_LIB_DIR=libart_lgpl-2.3.7 +PNG_LIB_DIR=libpng-1.2.0 +ZLIB_LIB_DIR=zlib-1.1.3 dnl substitute them in all the files listed in AC_OUTPUT AC_SUBST(CGI_LIB_DIR) @@ -151,6 +151,12 @@ AC_SUBST(FREETYPE_LIB_DIR) AC_SUBST(ZLIB_LIB_DIR) AC_SUBST(PERLFLAGS) +INCLUDED_LIB(cgi,cgiInit) +INCLUDED_LIB(art_lgpl,art_vpath_add_point) +INCLUDED_LIB(png,png_access_version_number) +INCLUDED_LIB(freetype,FT_Init_FreeType) +INCLUDED_LIB(z,zlibVersion) + dnl Check for Perl. AC_PATH_PROG(PERL, perl, no) if test "x$PERL" = "xno"; then diff --git a/examples/minmax.pl b/examples/minmax.pl deleted file mode 100755 index 573d547..0000000 --- a/examples/minmax.pl +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/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( /usr/local/rrdtool-1.1.0/lib/perl ../lib/perl ); - -use RRDs; -my $start=time; -my $rrd="randome.rrd"; -my $name = $0; -$name =~ s/\.pl.*//g; - -RRDs::create ($rrd, "--start",$start-1, "--step",300, - "DS:a:GAUGE:600:U:U", - "RRA:AVERAGE:0.5:1:300", - "RRA:MIN:0.5:12:300", - "RRA:MAX:0.5:12:300", -); -my $ERROR = RRDs::error; -die "$0: unable to create `$rrd': $ERROR\n" if $ERROR; - -# dropt some data into the rrd -my $t; -for ($t=$start; $t<$start+300*300; $t+=300){ - RRDs::update $rrd, "$t:".(sin($t/3000)*50+50); - if ($ERROR = RRDs::error) { - die "$0: unable to update `$rrd': $ERROR\n"; - } -} - -RRDs::graph "$name.png", - "--title", uc($name)." Demo", - "--start", "now", - "--end", "start+1d", - "--lower-limit=0", - "--interlace", - "--zoom=2.5", - "--imgformat","PNG", - "--width=450", - "DEF:a=$rrd:a:AVERAGE", - "DEF:b=$rrd:a:MIN", - "DEF:c=$rrd:a:MAX", - "AREA:a#00b6e4:real", - "LINE1:b#0022e9:min", - "LINE1:c#00ee22:max", -; - -if ($ERROR = RRDs::error) { - print "ERROR: $ERROR\n"; -}; - - -print "This script has created $name.png in the current directory\n"; -print "This demonstrates the use of the TIME and % RPN operators\n"; diff --git a/libraries/Makefile.am b/libraries/Makefile.am index 3ca8123..4fe37bd 100644 --- a/libraries/Makefile.am +++ b/libraries/Makefile.am @@ -1 +1,25 @@ -SUBDIRS = cgilib-0.4 zlib-1.1.3 libpng-1.2.0 libart_lgpl-2.3.7 freetype-2.0.5 +CGILIB=@CGI_LIB_DIR@ +ZLIB=@ZLIB_LIB_DIR@ +LIBPNG=@PNG_LIB_DIR@ +LIBART=@ART_LIB_DIR@ +FREETYPE=@FREETYPE_LIB_DIR@ + +if !USE_INSTALLED_libcgi +BUILD_CGI=$(CGILIB) +endif +if !USE_INSTALLED_libz +BUILD_ZLIB=$(ZLIB) +endif +if !USE_INSTALLED_libpng +BUILD_LIBPNG=$(LIBPNG) +endif +if !USE_INSTALLED_libart_lgpl +BUILD_LIBART=$(LIBART) +endif +if !USE_INSTALLED_libfreetype +BUILD_FREETYPE=$(FREETYPE) +endif + +SUBDIRS=$(BUILD_CGI) $(BUILD_ZLIB) $(BUILD_LIBPNG) $(BUILD_LIBART) $(BUILD_FREETYPE) + +DIST_SUBDIRS=$(CGILIB) $(ZLIB) $(LIBPNG) $(LIBART) $(FREETYPE) diff --git a/src/Makefile.am b/src/Makefile.am index 47ecf13..18d16a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,14 +5,39 @@ #ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4 #AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config -CGI_LIB_DIR = $(top_srcdir)/@CGI_LIB_DIR@ -FREETYPE_LIB_DIR = $(top_srcdir)/@FREETYPE_LIB_DIR@ -ART_LIB_DIR = $(top_srcdir)/@ART_LIB_DIR@ -PNG_LIB_DIR = $(top_srcdir)/@PNG_LIB_DIR@ -ZLIB_LIB_DIR = $(top_srcdir)/@ZLIB_LIB_DIR@ - -INCLUDES = -I$(CGI_LIB_DIR) -I$(ART_LIB_DIR) \ - -I$(PNG_LIB_DIR) -I$(ZLIB_LIB_DIR) -I$(FREETYPE_LIB_DIR)/include +if USE_INSTALLED_libcgi +CGI_LIB = -lcgi +else +CGI_LIB = $(top_srcdir)/libraries/@CGI_LIB_DIR@/librrd_cgi.la +CGI_INCLUDES = -I$(top_srcdir)/libraries/@CGI_LIB_DIR@ +endif +if USE_INSTALLED_libfreetype +FREETYPE_LIB = -lfreetype +else +FREETYPE_LIB = $(top_srcdir)/libraries/@FREETYPE_LIB_DIR@/librrd_freetype.la +FREETYPE_INCLUDES = -I$(top_srcdir)/libraries/@FREETYPE_LIB_DIR@/include +endif +if USE_INSTALLED_libart_lgpl +ART_LIB = -lart_lgpl +else +ART_LIB = $(top_srcdir)/libraries/@ART_LIB_DIR@/librrd_art.la +ART_INCLUDES = -I$(top_srcdir)/libraries/@ART_LIB_DIR@ +endif +if USE_INSTALLED_libpng +PNG_LIB = -lpng +else +PNG_LIB = $(top_srcdir)/libraries/@PNG_LIB_DIR@/librrd_png.la +PNG_INCLUDES = -I$(top_srcdir)/libraries/@PNG_LIB_DIR@ +endif +if USE_INSTALLED_libz +ZLIB_LIB = -lz +else +ZLIB_LIB = $(top_srcdir)/libraries/@ZLIB_LIB_DIR@/librrd_z.la +ZLIB_INCLUDES = -I$(top_srcdir)/libraries/@ZLIB_LIB_DIR@ +endif + +INCLUDES = $(CGI_INCLUDES) $(FREETYPE_INCLUDES) $(ART_INCLUDES) \ + $(PNG_INCLUDES) $(ZLIB_INCLUDES) RRD_C_FILES = \ getopt.c \ @@ -49,11 +74,11 @@ RRD_C_FILES = \ # files. RRD_LIBS = \ - $(CGI_LIB_DIR)/librrd_cgi.la \ - $(FREETYPE_LIB_DIR)/librrd_freetype.la \ - $(ART_LIB_DIR)/librrd_art.la \ - $(PNG_LIB_DIR)/librrd_png.la \ - $(ZLIB_LIB_DIR)/librrd_z.la + $(CGI_LIB) \ + $(FREETYPE_LIB) \ + $(ART_LIB) \ + $(PNG_LIB) \ + $(ZLIB_LIB) lib_LTLIBRARIES = librrd.la noinst_LTLIBRARIES = librrd_private.la diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 6d9015e..c283a31 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -21,7 +21,7 @@ #ifndef RRD_DEFAULT_FONT -#define RRD_DEFAULT_FONT "/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf" +#define RRD_DEFAULT_FONT "/usr/share/fonts/truetype/openoffice/ariosor.ttf" /* #define RRD_DEFAULT_FONT "/usr/share/fonts/truetype/Arial.ttf" */ #endif