Code

complete segfault fix for second axis %s format begun in r2123 (thanks Martin Pelikan...
[rrdtool.git] / configure.ac
1 dnl RRDtool AutoConf script ... 
2 dnl ---------------------------
3 dnl
4 dnl Created by Jeff Allen, Tobi Oetiker, Blair Zajac
5 dnl
6 dnl Inspiration from http://autoconf-archive.cryp.to
7  
8 dnl tell automake the this script is for rrdtool
10 dnl Minimum Autoconf version required.
11 AC_PREREQ(2.59)
13 dnl the official version number is
14 dnl a.b.c
15 AC_INIT([rrdtool],[1.3.9])
17 dnl for testing a numberical version number comes handy
18 dnl the released version are
19 dnl a.bccc
20 dnl the devel versions will be something like
21 dnl a.b999yymmddhh 
22 NUMVERS=1.3009
23 AC_SUBST(NUMVERS)
25 dnl for the linker to understand which versions the library are compatible with
26 dnl each other we must keep a separate library version cout of the format c:r:a.
27 dnl - if only implementation changed but all interfaces are kept, do r++
28 dnl - if only functionality was added do c++,r=0,a++
29 dnl - if any functionality was removed do c++,r=0,a=0.
30 dnl
31 dnl see http://sourceware.org/autobook/autobook/autobook_91.html
32 dnl 
33 LIBVERS=4:8:0
34 AC_SUBST(LIBVERS)
35 AC_CANONICAL_TARGET
36 m4_version_prereq(2.60, [AC_USE_SYSTEM_EXTENSIONS], [#])
37 AM_INIT_AUTOMAKE(m4_version_prereq(2.63, [silent-rules], [[]]))
38 AM_MAINTAINER_MODE
39 m4_version_prereq(2.63, [AM_SILENT_RULES([yes])], [#])
41 AC_CONFIG_MACRO_DIR([m4])
42 AC_CONFIG_HEADERS([rrd_config.h])
44 dnl all our local stuff like install scripts and include files
45 dnl is in there
48 dnl determine the type of system we are running on
50 AC_SUBST(VERSION)
52 AC_PREFIX_DEFAULT( /usr/local/rrdtool-$PACKAGE_VERSION )
54 dnl At the TOP of the HEADER
56 AH_TOP([
57 #ifndef RRD_CONFIG_H
58 #define RRD_CONFIG_H
60 /* IEEE can be prevented from raising signals with fpsetmask(0) */
61 #undef MUST_DISABLE_FPMASK
63 /* IEEE math only works if SIGFPE gets actively set to IGNORE */
64 #undef MUST_DISABLE_SIGFPE
66 /* realloc does not support NULL as argument */
67 #undef NO_NULL_REALLOC
69 /* lets enable madvise defines in NetBSD */ 
70 #if defined(__NetBSD__)
71 # if !defined(_NETBSD_SOURCE)
72 #  define _NETBSD_SOURCE
73 # endif
74 #endif
76 ])
78 AH_BOTTOM([
80 #ifdef MUST_HAVE_MALLOC_MALLOC_H
81 #  include <malloc/malloc.h>
82 #endif
84 #include <rrd_config_bottom.h>
86 #endif
87 ])
89 dnl Process Special Options
90 dnl -----------------------------------
92 dnl How the vertical axis label is printed
93 AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
94  [Vertical label angle: -90.0 (default) or 90.0])
95 AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0},
96  [Vertical label angle: -90.0 (default) or 90.0])
98 AC_ARG_ENABLE(rrdcgi,[  --disable-rrdcgi        disable building of rrdcgi],
99 [],[enable_rrdcgi=yes])
101 dnl Check if we run on a system that has fonts
102 AC_ARG_WITH(rrd-default-font,
103 [  --with-rrd-default-font=[OPTIONS]  set the full path to your default font.],
104 [RRD_DEFAULT_FONT=$withval],[
105   if test -d ${WINDIR:-nodir}/cour.ttf ; then
106         RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
107   else
108         RRD_DEFAULT_FONT='"DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier"'
109   fi
110 ])
112 dnl Use mmap in rrd_update instead of seek+write
113 AC_ARG_ENABLE([mmap],
114 [  --disable-mmap          disable mmap in rrd_update, use seek+write instead],
115 [],
116 [enable_mmap=yes])
118 AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
119 [],[enable_pthread=yes])
121 AC_ARG_ENABLE(static-programs,
122      [  --enable-static-programs  Build static programs],
123      [case "${enableval}" in
124        yes) staticprogs=yes ;;
125        no)  staticprogs=no ;;
126        *) AC_MSG_ERROR(bad value ${enableval} for --enable-static-programs) ;;
127      esac],[staticprogs=no])
128 AM_CONDITIONAL(STATIC_PROGRAMS,[test "x$staticprogs" = "xyes"])
131 CONFIGURE_PART(Audit Compilation Environment)
134 dnl Check for the compiler and static/shared library creation.
135 AC_PROG_CC
136 AC_PROG_CPP
137 AC_PROG_LIBTOOL
139 dnl Try to detect/use GNU features
140 CFLAGS="$CFLAGS -D_GNU_SOURCE"
142 dnl which flags does the compiler support?
143 if test "x$GCC" = "xyes"; then
144   for flag in -fno-strict-aliasing -Wall -std=c99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wold-style-definition -W; do
145     oCFLAGS="$CFLAGS"
146     CFLAGS="$CFLAGS $flag"
147     cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
148     AC_CACHE_CHECK([if gcc likes the $flag flag], $cachename,
149        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0 ]])],[eval $cachename=yes],[eval $cachename=no])])
150     if eval test \$$cachename = no; then
151          CFLAGS="$oCFLAGS"
152     fi
153   done
154 fi
158 AC_SUBST(RRD_DEFAULT_FONT)
160 CONFIGURE_PART(Checking for Header Files)
161  
162 dnl Checks for header files.
163 AC_HEADER_STDC
164 AC_HEADER_DIRENT
165 AC_CHECK_HEADERS(libgen.h features.h 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 signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h)
167 dnl Checks for typedefs, structures, and compiler characteristics.
168 AC_C_CONST
169 AC_HEADER_TIME
170 AC_STRUCT_TM
172 CONFIGURE_PART(Test Library Functions)
174 dnl Checks for libraries.
175 AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
178 dnl add pic flag in any case this makes sure all our code is relocatable
179 eval `./libtool --config | grep pic_flag=` 
180 CFLAGS="$CFLAGS $pic_flag"
183 dnl Checks for library functions.
184 AC_FUNC_STRFTIME
185 AC_FUNC_VPRINTF
187 AC_C_BIGENDIAN
189 dnl for each function found we get a definition in config.h 
190 dnl of the form HAVE_FUNCTION
192 AC_CHECK_FUNCS(tzset fsync mbstowcs opendir readdir chdir chroot getuid setlocale strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
194 AC_FUNC_STRERROR_R
196 CONFIGURE_PART(Map/Fadvis/Madvise checking)
198 dnl Could use these to know if we need to provide a prototype
199 dnl AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
201 dnl check for fdatasync. Solaris has fdatasync in the librt
203 AC_CHECK_FUNCS(fdatasync, [],  AC_CHECK_LIB(rt, fdatasync, [LIBS="${LIBS} -lrt"; AC_DEFINE(HAVE_FDATASYNC)],[]))
204 dnl if there is no fdatasync we may get lucky with fsync
205 AC_CHECK_FUNCS(fsync)
208 dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
209 if test "x$enable_mmap" = "xyes"; then
210   case "$host" in
211   *cygwin*)
212     # the normal mmap test does not work in cygwin
213     AC_CHECK_FUNCS(mmap)
214     if test "x$ac_cv_func_mmap" = "xyes"; then
215       ac_cv_func_mmap_fixed_mapped=yes
216     fi
217   ;;
218   *)
219     AC_CHECK_HEADERS(sys/mman.h)
220     AC_FUNC_MMAP
221     AC_CHECK_FUNCS(mmap munmap msync)
222     AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
223                                      # include <sys/mman.h>
224                                      #endif])
225     if test "x$ac_cv_have_decl_madvise" = "xyes";
226     then
227       AC_CHECK_FUNCS(madvise)
228     else
229       AC_CHECK_FUNCS(posix_madvise)
230       if test "x$ac_cv_func_posix_madvise" != "xyes"; then
231         AC_MSG_WARN([madvise() nor posix_madvise() found.])
232       fi
233     fi
234   ;;
235   esac
236   if test "x$ac_cv_func_mmap" != "xyes";
237   then
238     AC_MSG_ERROR([--enable-mmap requested but mmap() was not detected])
239 dnl enable_mmap="no"
240   fi
241 fi
243 dnl can we use posix_fadvise
244 AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
245 #include <fcntl.h>])
246 AC_CHECK_FUNCS(posix_fadvise)
248 CONFIGURE_PART(Libintl Processing)
250 AM_GNU_GETTEXT_VERSION(0.18)
251 AM_GNU_GETTEXT(external)
253 CONFIGURE_PART(IEEE Math Checks)
254  
256 dnl actual code to check if this works
257 AC_CHECK_FUNCS(fpclassify, ,
258   [AC_MSG_CHECKING(for fpclassify with <math.h>)
259     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
260 volatile int x;volatile float f; ]], [[x = fpclassify(f)]])],[AC_MSG_RESULT(yes)
261       AC_DEFINE(HAVE_FPCLASSIFY)],[AC_MSG_RESULT(no)])])
263 AC_CHECK_FUNCS(isinf, ,
264   [AC_MSG_CHECKING(for isinf with <math.h>)
265     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
266 volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
267       AC_DEFINE(HAVE_ISINF)],[AC_MSG_RESULT(no)])])
269 dnl finite is BSD, isfinite is C99, so prefer the latter
270 AC_CACHE_CHECK([whether isfinite is broken],[ac_cv_have_broken_isfinite],[
271 AC_TRY_RUN([
272 #ifdef HAVE_MATH_H
273 #include <math.h>
274 #endif
275 #ifdef HAVE_FLOAT_H
276 #include <float.h>
277 #endif
278 int main ()
280 #ifdef isfinite
281 #ifdef LDBL_MAX
282   if (!isfinite(LDBL_MAX)) return 1;
283 #endif
284 #ifdef DBL_MAX
285   if (!isfinite(DBL_MAX)) return 1;
286 #endif
287 #endif
288 return 0;
289 }],[ac_cv_have_broken_isfinite=no],[ac_cv_have_broken_isfinite=yes],[
290 case "${target}" in
291   hppa*-*-hpux*) ac_cv_have_broken_isfinite=yes ;;
292   *-solaris2.8) ac_cv_have_broken_isfinite=yes ;;
293   *-solaris2.9) ac_cv_have_broken_isfinite=yes ;;
294   *) ac_cv_have_broken_isfinite=no ;;
295 esac])
296 ])
298 dnl the test does not seem to work on solaris 2.8/9
299 dnl so lets fix this by hand
300 case "${target}" in
301   *-solaris2.8) ac_cv_have_broken_isfinite=yes ;;
302   *-solaris2.9) ac_cv_have_broken_isfinite=yes ;;
303 esac
305 if test "x$ac_cv_have_broken_isfinite" = "xno"; then
306   AC_DEFINE(HAVE_ISFINITE)
307 else
308   AC_CHECK_FUNCS(finite,[],
309       [AC_CHECK_FUNCS(isfinite,[],
310          [AC_MSG_CHECKING(for isfinite with <math.h>)
311           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
312 volatile int x;volatile float f;  ]],[[x = isfinite(f)]])],[AC_MSG_RESULT(yes)
313                 AC_DEFINE(HAVE_ISFINITE)],[AC_MSG_RESULT(no)])])])
314 fi  
316 AC_FULL_IEEE
318 CONFIGURE_PART(Resolve Portability Issues)
320 CHECK_FOR_WORKING_MS_ASYNC
322 dnl Do we need getopt_long
324 dnl even when including our own getopt implementation
325 dnl we may want to make sure we use the external
326 dnl defined by libc to not run into linker resolve trouble
328 AC_CACHE_CHECK([for opterr], rd_cv_var_int_opterr,
329 [AC_TRY_LINK([#include <unistd.h>],
330   [extern int opterr; opterr = 1;],
331   [rd_cv_var_int_opterr=yes],
332   [rd_cv_var_int_opterr=no])])
333 if test x"$rd_cv_var_int_opterr" = x"yes"; then
334   AC_DEFINE(HAVE_INT_OPTERR, 1, [Define to 1 if you have the global variable 'int opterr'.])
335 fi
337 build_getopt=no
338 RRD_GETOPT_LONG="LIBC_HAS_GETOPT_LONG"
339 AC_CHECK_FUNC(getopt_long,[],[
340 RRD_GETOPT_LONG="getopt_long"
341 build_getopt=yes
342 ])
343 AC_SUBST(RRD_GETOPT_LONG)
344 AM_CONDITIONAL(BUILD_GETOPT,[test $build_getopt = yes])
346 dnl what does realloc do if it gets called with a NULL pointer
348 AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc,
349 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
350               int main(void){
351               char *x = NULL;
352               x = realloc (x,10);
353               if (x==NULL) return 1;
354               return 0;
355              }]])],[rd_cv_null_realloc=yes],[rd_cv_null_realloc=nope],[:])])
357 if test x"$rd_cv_null_realloc" = xnope; then
358 AC_DEFINE(NO_NULL_REALLOC)
359 fi
361 AC_LANG_PUSH(C)
362 dnl solaris has some odd defines it needs in order to propperly compile ctime_r
363 AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
364 AC_LINK_IFELSE(
365     AC_LANG_PROGRAM(
366            [[#include <time.h>]],
367            [[ctime_r(NULL,NULL,0)]]
368                    ),
369     [ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
370       AC_LINK_IFELSE(
371           AC_LANG_PROGRAM(
372                 [[#include <time.h>]],
373                 [[ctime_r(NULL,NULL)]]
374                          ),
375           [AC_MSG_RESULT([yes, this seems to be solaris style])],
376           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
377       )
378     ],  
379     [ AC_LINK_IFELSE(
380           AC_LANG_PROGRAM(
381                 [[#include <time.h>]],
382                 [[ctime_r(NULL,NULL)]]
383                          ),
384           [AC_MSG_RESULT(no)],
385           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
386       )
387     ]  
389 AC_LANG_POP(C)
391 dnl Check for pthreads
392 dnl http://autoconf-archive.cryp.to/acx_pthread.m4
393  
394 AC_SUBST(MULTITHREAD_CFLAGS)
395 AC_SUBST(MULTITHREAD_LDFLAGS)
397 if test $enable_pthread != no; then 
398  ACX_PTHREAD([
399     MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
400     MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
401              ],
402              [])
403 fi
405 dnl since we use lots of *_r functions all over the code we better
406 dnl make sure they are known
408 if test  "x$x_rflag" != "xno"; then
409    CPPFLAGS="$CPPFLAGS $x_rflag"
410 fi
412 AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
414 AC_LANG_PUSH(C)
415 dnl see if we have to include malloc/malloc.h
416 AC_MSG_CHECKING([do we need malloc/malloc.h])
417 AC_LINK_IFELSE(
418     AC_LANG_PROGRAM(
419            [[#include <stdlib.h>]],
420            [[malloc(1)]]
421                    ),
422     [ AC_MSG_RESULT([nope, works out of the box]) ],
423     [ AC_LINK_IFELSE(
424           AC_LANG_PROGRAM(
425                 [[#include <stdlib.h>
426                   #include <malloc/malloc.h>]],
427                 [[malloc(1)]]
428                          ),[
429            AC_DEFINE([MUST_HAVE_MALLOC_MALLOC_H])
430            AC_MSG_RESULT([yes we do])],
431           [AC_MSG_ERROR([Can not figure how to compile malloc])]
432       )
433     ]  
435 AC_LANG_POP(C)
437 CONFIGURE_PART(Find 3rd-Party Libraries)
440 AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
443 CORE_LIBS="$LIBS"
445 dnl EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
446 dnl EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
447 dnl EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,             freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
448 dnl EX_CHECK_ALL(fontconfig, FcInit,                    fontconfig.h,           fontconfig,  2.3.1,  http://fontconfig.org/release/, /usr/include)
449 EX_CHECK_ALL(cairo,      cairo_font_options_create,     cairo.h,                cairo-png,   1.4.6,  http://cairographics.org/releases/, "")
450 EX_CHECK_ALL(cairo,      cairo_svg_surface_create,      cairo-svg.h,            cairo-svg,   1.4.6,  http://cairographics.org/releases/, "")
451 EX_CHECK_ALL(cairo,      cairo_pdf_surface_create,      cairo-pdf.h,            cairo-pdf,   1.4.6,  http://cairographics.org/releases/, "")
452 EX_CHECK_ALL(cairo,      cairo_ps_surface_create,       cairo-ps.h,             cairo-ps,    1.4.6,  http://cairographics.org/releases/, "")
453 dnl EX_CHECK_ALL(glib-2.0,   glib_check_version,        glib.h,                 glib-2.0,    2.12.12, ftp://ftp.gtk.org/pub/glib/2.12/, "")
454 EX_CHECK_ALL(pango-1.0,  pango_cairo_context_set_font_options,  pango/pango.h,  pangocairo,  1.17,    http://ftp.gnome.org/pub/GNOME/sources/pango/1.17, "")
455 EX_CHECK_ALL(xml2,       xmlParseFile,                  libxml/parser.h,        libxml-2.0,        2.6.31,  http://xmlsoft.org/downloads.html, /usr/include/libxml2)
457 if test "$EX_CHECK_ALL_ERR" = "YES"; then
458   AC_MSG_ERROR([Please fix the library issues listed above and try again.])
459 fi
461 ALL_LIBS="$LIBS"
462 LIBS=
464 AC_SUBST(CORE_LIBS)
465 AC_SUBST(ALL_LIBS)
467 CONFIGURE_PART(Prep for Building Language Bindings)
468   
469 dnl Check for Perl and friends
470 PATH=$PATH:/usr/perl5/bin
471 export PATH
472 AC_PATH_PROG(PERL, perl, no)
473 AC_PATH_PROG(POD2MAN, pod2man, no)
474 AC_PATH_PROG(POD2HTML, pod2html, no)
477 AC_ARG_ENABLE(perl,[  --disable-perl          do not build the perl modules],
478 [],[enable_perl=yes])
481 AC_ARG_VAR(PERLCC, [[] C compiler for Perl modules])
482 AC_ARG_VAR(PERLCCFLAGS, [[] CC flags for Perl modules])
483 AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules])
484 AC_ARG_VAR(PERLLDFLAGS, [[] LD flags for Perl modules])
486 if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
487         COMP_PERL=
488 else
489         COMP_PERL="perl_piped perl_shared"
490         AC_MSG_CHECKING(for the perl version you are running)
491         PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
492         AC_MSG_RESULT($PERL_VERSION)
493         if test -z "$PERLCC"; then
494             AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
495             perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
496             AC_MSG_RESULT($perlcc)
497             if test ! -x "$perlcc"; then
498                 AC_PATH_PROG(PERL_CC, ${perlcc}, no)
499                 if test "$PERL_CC" = "no"; then
500                     AC_MSG_WARN([
501 I would not find the Compiler ($perlcc) that was originally used to compile
502 your perl binary. You should either make sure that this compiler is
503 available on your system, pick an other compiler and set PERLCC
504 appropriately, or use a different perl setup that was compiled locally.
506 I will disable the compilation of the RRDs perl module for now.
507 ])
508                     COMP_PERL="perl_piped"
509                 fi
510             fi    
511         fi
512 fi
514 AC_MSG_CHECKING(Perl Modules to build)
515 AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
517 # Options to pass when configuring perl module
518 ppref=$prefix
519 test "$ppref" = 'NONE' && ppref=$ac_default_prefix
521 PERL_MAKE_OPTIONS="PREFIX="'$(DESTDIR)'"$ppref LIB="'$(DESTDIR)'"$ppref/lib/perl/$PERL_VERSION"
523 dnl pass additional perl options when generating Makefile from Makefile.PL
524 AC_ARG_ENABLE(perl-site-install,
525 [  --enable-perl-site-install   by default the rrdtool perl modules are installed
526                           together with rrdtool in $prefix/lib/perl. You have to
527                           put a 'use lib qw($prefix/lib/perl)' into your scripts
528                           when you want to use them. When you set this option
529                           the perl modules will get installed wherever
530                           your perl setup thinks it is best.],
531 [PERL_MAKE_OPTIONS=],[])
533 if test ! -z "$PERLCC"; then
534    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
536    if test ! -z "$PERLCCFLAGS"; then
537        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
538    fi
539    
540    if test -z "$PERLLD"; then
541        PERLLD=$PERLCC
542    fi
543    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
544   
545    if test ! -z "$PERLLDFLAGS"; then
546        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
547    fi
548 fi
549         
550 AC_ARG_WITH(perl-options,
551 [  --with-perl-options=[OPTIONS]  options to pass on command-line when
552                           generating Makefile from Makefile.PL. If you set this
553                           option, interesting things may happen unless you know
554                           what you are doing!],
555 [PERL_MAKE_OPTIONS=$withval])
557 AC_SUBST(PERL_MAKE_OPTIONS)
558 AC_SUBST(PERL)
559 AC_SUBST(COMP_PERL)
560 AC_SUBST(PERL_VERSION)
562 dnl Check for Ruby.
563 AC_PATH_PROG(RUBY, ruby, no)
565 AC_ARG_ENABLE(ruby,[  --disable-ruby          do not build the ruby modules],
566 [],[enable_ruby=yes])
568 AC_MSG_CHECKING(if ruby modules can be built)
570 if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
571         COMP_RUBY=
572         AC_MSG_RESULT(No .. Ruby not found or disabled)
573 else
574         if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
575                 COMP_RUBY="ruby"
576                 AC_MSG_RESULT(YES)
577         else
578                 COMP_RUBY=
579                 AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)         
580         fi                              
581 fi
583 rpref=$prefix
584 test "$rpref" = 'NONE' && rpref=$ac_default_prefix
586 dnl pass additional ruby options when generating Makefile from Makefile.PL
587 AC_ARG_ENABLE(ruby-site-install,
588 [  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
589                           together with rrdtool in $prefix/lib/ruby. You have to
590                           add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
591                           for ruby to find the RRD.so file.],
592 [RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir="'$(DESTDIR)'"$rpref/lib/ruby"])
594     
595 AC_ARG_WITH(ruby-options,
596 [  --with-ruby-options=[OPTIONS]  options to pass on command-line when
597                           generating Makefile from extconf.rb. If you set this
598                           option, interesting things may happen unless you know
599                           what you are doing!],
600 [RUBY_MAKE_OPTIONS=$withval])
602 AC_SUBST(RUBY_MAKE_OPTIONS)
603 AC_SUBST(RUBY)
604 AC_SUBST(COMP_RUBY)
607 enable_tcl_site=no
609 AC_ARG_ENABLE(tcl,[  --disable-tcl           do not build the tcl modules],
610 [],[enable_tcl=yes])
612 if test  "$enable_tcl" = "yes"; then
613   dnl Check for Tcl.
614   withval=""
615   AC_ARG_WITH(tcllib,[  --with-tcllib=DIR       location of the tclConfig.sh])
616   enable_tcl=no
617   for dir in $withval /usr/lib /usr/local/lib /usr/lib/tcl8.4 /usr/lib/tcl8.3 ; do
618     AC_MSG_CHECKING(for tclConfig.sh in $dir)
619     if test -f "$dir/tclConfig.sh" ; then
620         tcl_config=$dir/tclConfig.sh
621         enable_tcl=yes
622         AC_MSG_RESULT(yes)
623         break
624     else
625         AC_MSG_RESULT(no)
626     fi
627   done
629   if test "$enable_tcl" = "no"; then
630         AC_MSG_WARN([tclConfig.sh not found - Tcl interface will not be built])
631   else
632         . $tcl_config
633         TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
634         if test -n "$TCL_INC_DIR"; then
635           TCL_INCLUDE_SPEC="$TCL_INCLUDE_SPEC -I$TCL_INC_DIR"
636         fi
637   fi
638   AC_ARG_ENABLE(tcl,[  --enable-tcl-site        install the tcl extension in the tcl tree],
639   [],[enable_tcl_site=yes])
641 fi
643 AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
644 AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
647 AC_SUBST(TCL_PREFIX)
648 AC_SUBST(TCL_SHLIB_CFLAGS)
649 AC_SUBST(TCL_SHLIB_LD)
650 AC_SUBST(TCL_SHLIB_SUFFIX)
651 AC_SUBST(TCL_PACKAGE_PATH)
652 AC_SUBST(TCL_LD_SEARCH_FLAGS)
653 AC_SUBST(TCL_STUB_LIB_SPEC)
654 AC_SUBST(TCL_VERSION)
655 AC_SUBST(TCL_PACKAGE_DIR)
656 AC_SUBST(TCL_INCLUDE_SPEC)
658 AC_ARG_ENABLE(python,[  --disable-python        do not build the python modules],
659 [],[enable_python=yes])
661 if test  "$enable_python" = "yes"; then
662 dnl Check for python
663 AM_PATH_PYTHON(2.3,[],[enable_python=no])
664 AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
665 fi
667 if test  x$enable_python = xno; then
668         COMP_PYTHON=
669 else
670         COMP_PYTHON="python"
671 fi
673 AC_SUBST(COMP_PYTHON)
675 dnl Check for nroff
676 AC_PATH_PROGS(NROFF, gnroff nroff)
677 AC_PATH_PROGS(TROFF, groff troff)
679 AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory])
680 if test -z "$RRDDOCDIR"; then
681    RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
684 CONFIGURE_PART(Apply Configuration Information)
685  
686 AC_CONFIG_FILES([examples/shared-demo.pl])
687 AC_CONFIG_FILES([examples/piped-demo.pl])
688 AC_CONFIG_FILES([examples/stripes.pl])
689 AC_CONFIG_FILES([examples/bigtops.pl])
690 AC_CONFIG_FILES([examples/minmax.pl])
691 AC_CONFIG_FILES([examples/4charts.pl])
692 AC_CONFIG_FILES([examples/perftest.pl])
693 AC_CONFIG_FILES([examples/Makefile])
694 AC_CONFIG_FILES([doc/Makefile])
695 AC_CONFIG_FILES([po/Makefile.in])
696 AC_CONFIG_FILES([src/Makefile])
697 AC_CONFIG_FILES([src/librrd.sym.in])
698 AC_CONFIG_FILES([src/librrd.pc])          
699 AC_CONFIG_FILES([bindings/Makefile])
700 AC_CONFIG_FILES([bindings/tcl/Makefile])
701 AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl])
702 AC_CONFIG_FILES([Makefile])          
704 AC_CONFIG_COMMANDS([default],[[ chmod +x examples/*.pl]],[[]])
706 dnl intl requires our config to be called config.h. indulge it.
707 AC_CONFIG_COMMANDS_POST([ test -f config.h || ln -s rrd_config.h config.h ])
709 AC_OUTPUT
711 AC_MSG_CHECKING(in)
712 AC_MSG_RESULT(and out again)
714 echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
715 sleep 1
716 echo $ECHO_N ".$ECHO_C" 1>&6
717 sleep 1
718 echo $ECHO_N ".$ECHO_C" 1>&6
719 sleep 1
720 echo $ECHO_N ".$ECHO_C" 1>&6
721 sleep 1
722 echo $ECHO_N ".$ECHO_C" 1>&6
723 sleep 1
724 AC_MSG_RESULT([ just kidding ;-)])
725 echo
726 echo "----------------------------------------------------------------"
727 echo "Config is DONE!"
728 echo
729 echo "          With MMAP IO: $enable_mmap"
730 echo "      Build rrd_getopt: $build_getopt"
731 echo "       Static programs: $staticprogs"
732 echo "          Perl Modules: $COMP_PERL"
733 echo "           Perl Binary: $PERL"
734 echo "          Perl Version: $PERL_VERSION"
735 echo "          Perl Options: $PERL_MAKE_OPTIONS"
736 echo "          Ruby Modules: $COMP_RUBY"
737 echo "           Ruby Binary: $RUBY"
738 echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
739 echo "    Build Tcl Bindings: $enable_tcl"
740 echo " Build Python Bindings: $enable_python"
741 echo "          Build rrdcgi: $enable_rrdcgi"
742 echo "       Build librrd MT: $enable_pthread"
743 echo "           Use gettext: $USE_NLS"
744 echo
745 echo "             Libraries: $ALL_LIBS"
746 echo
747 echo "Type 'make' to compile the software and use 'make install' to "
748 echo "install everything to: $prefix."
749 echo 
750 echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
751 echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
752 echo "place an order."
753 echo 
754 echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
755 echo "----------------------------------------------------------------"