Code

aa8c5203ead755d7894c2c9dc1520e79e4675d82
[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
9 dnl the official version number is
10 dnl a.b.c
11 AC_INIT([rrdtool],[1.2.26])
12 dnl for testing a numberical version number comes handy
13 dnl the released version are
14 dnl a.bccc
15 dnl the devl versions will be something like
16 dnl a.b999yymmddhh 
17 NUMVERS=1.2026
18 AC_SUBST(NUMVERS)
19 AC_CANONICAL_TARGET
20 AM_INIT_AUTOMAKE
21 AC_CONFIG_HEADERS([rrd_config.h])
23 dnl all our local stuff like install scripts and include files
24 dnl is in there
27 dnl determine the type of system we are running on
29 AC_SUBST(VERSION)
31 AC_PREFIX_DEFAULT( /usr/local/rrdtool-$PACKAGE_VERSION )
33 dnl Minimum Autoconf version required.
34 AC_PREREQ(2.59)
36 dnl At the TOP of the HEADER
38 AH_TOP([
40 #ifndef RRD_CONFIG_H
41 #define RRD_CONFIG_H
42 /* IEEE can be prevented from raising signals with fpsetmask(0) */
43 #undef MUST_DISABLE_FPMASK
45 /* IEEE math only works if SIGFPE gets actively set to IGNORE */
47 #undef MUST_DISABLE_SIGFPE
49 /* realloc does not support NULL as argument */
50 #undef NO_NULL_REALLOC
52 /* lets enable madvise defines in NetBSD */
53 #if defined(__NetBSD__)
54 # if !defined(_NETBSD_SOURCE)
55 #  define _NETBSD_SOURCE
56 # endif
57 #endif
59  ])
61 AH_BOTTOM([
62 #ifdef HAVE_FEATURES_H
63 #define _XOPEN_SOURCE 600   
64 #define _BSD_SOURCE 1
65 # include <features.h>
66 #endif
68 #ifdef HAVE_ERRNO_H
69 # include <errno.h>
70 #endif
72 #if defined(HAVE_SYS_MMAN_H)
73 #include <sys/mman.h>
74 #endif
76 #ifdef HAVE_SYS_TYPES_H
77 # include <sys/types.h>
78 #endif
80 #ifdef HAVE_SYS_PARAM_H
81 # include <sys/param.h>
82 #endif
83 #ifndef MAXPATH
84 # ifdef PATH_MAX
85 #  define MAXPATH PATH_MAX
86 # endif
87 #endif
88 #ifndef MAXPATH
89 /* else try the BSD variant */
90 # ifdef MAXPATHLEN
91 #  define MAXPATH MAXPATHLEN
92 # endif
93 #endif
95 #if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
96 /* use posix_madvise family */
97 # define madvise posix_madvise
98 # define MADV_NORMAL POSIX_MADV_NORMAL
99 # define MADV_RANDOM POSIX_MADV_RANDOM
100 # define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
101 # define MADV_WILLNEED POSIX_MADV_WILLNEED
102 # define MADV_DONTNEED POSIX_MADV_DONTNEED
103 #endif
105 #if defined POSIX_MADV_RANDOM && !defined MADV_RANDOM
106 #define MADV_RANDOM POSIX_MADV_RANDOM
107 #endif
111 #if defined HAVE_MADVISE || defined HAVE_POSIX_MADVISE
112 # define USE_MADVISE 1
113 #endif
115 #ifdef HAVE_SYS_STAT_H
116 # include <sys/stat.h>
117 #endif
119 #ifdef HAVE_FCNTL_H
120 #include <fcntl.h>
121 #endif
123 #ifdef HAVE_UNISTD_H
124 # include <unistd.h>
125 #endif
127 #ifdef TIME_WITH_SYS_TIME
128 # include <sys/time.h>
129 # include <time.h>
130 #else
131 # ifdef HAVE_SYS_TIME_H
132 #  include <sys/time.h>
133 # else
134 #  include <time.h>
135 # endif
136 #endif
138 #ifdef HAVE_SYS_TIMES_H
139 # include <sys/times.h>
140 #endif
142 #ifdef HAVE_SYS_RESOURCE_H
143 # include <sys/resource.h>
144 #if (defined(__svr4__) && defined(__sun__))
145 /* Solaris headers (pre 2.6) don't have a getrusage prototype.
146    Use this instead. */
147 extern int getrusage(int, struct rusage *);
148 #endif /* __svr4__ && __sun__ */
149 #endif
151 /* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
152    make sure you are NOT using bcopy, index or rindex in the code */
153       
154 #ifdef STDC_HEADERS
155 # include <string.h>
156 #else
157 # ifndef HAVE_STRCHR
158 #  define strchr index
159 #  define strrchr rindex
160 # endif
161 char *strchr (), *strrchr ();
162 # ifndef HAVE_MEMMOVE
163 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
164 #  define memmove(d, s, n) bcopy ((s), (d), (n))
165 # endif
166 #endif
168 #ifdef NO_NULL_REALLOC
169 # define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
170 #else
171 # define rrd_realloc(a,b) realloc((a), (b))
172 #endif
174 #ifdef NEED_MALLOC_MALLOC_H
175 #  include <malloc/malloc.h>
176 #endif
178 #ifdef HAVE_MATH_H
179 #  include <math.h>
180 #endif
182 #ifdef HAVE_FLOAT_H
183 #  include <float.h>
184 #endif
186 #ifdef HAVE_IEEEFP_H
187 #  include <ieeefp.h>
188 #endif
190 #ifdef HAVE_FP_CLASS_H
191 #  include <fp_class.h>
192 #endif
194 /* for Solaris */
195 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
196 #  define HAVE_ISINF 1
197 #  ifdef isinf
198 #  undef isinf /* confuse autoconf */
199 #  endif
200 #  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
201 #endif
203 /* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
204 #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
205 #  undef isnan  /* confuse autoconf to NOT remove this */
206 #  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
207 #endif
209 /* for OSF1 Digital Unix */
210 #if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
211 #  define HAVE_ISINF 1
212 #  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
213 #endif
215 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
216 #  define HAVE_ISINF 1
217 #  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
218 #endif
220 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
221 #  define HAVE_ISINF 1
222 #  define isinf(a) (fpclassify(a) == FP_INFINITE)
223 #endif
225 /* for AIX */
226 #if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
227 #  define HAVE_ISINF 1
228 #  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
229 #endif
231 #if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
232 #  define HAVE_FINITE 1
233 #  define finite(a) isfinite(a)
234 #endif
236 #if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
237 #  define HAVE_FINITE 1
238 #  define finite(a) (! isnan(a) && ! isinf(a))
239 #endif
241 #ifndef HAVE_FINITE
242 #error "Can't compile without finite function"
243 #endif
245 #ifndef HAVE_ISINF
246 #error "Can't compile without isinf function"
247 #endif
249 #endif /* RRD_CONFIG_H */
250 ])
252 dnl Process Special Options
253 dnl -----------------------------------
255 dnl How the vertical axis label is printed
256 AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
257  [Vertical label angle: 90.0 (default) or 270.0])
258 AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0},
259  [Vertical label angle: 90.0 (default) or 270.0])
261 AC_ARG_ENABLE(rrdcgi,[  --disable-rrdcgi        disable building of rrdcgi],
262 [],[enable_rrdcgi=yes])
264 dnl Check if we run on a system that has fonts
265 AC_ARG_WITH(rrd-default-font,
266 [  --with-rrd-default-font=[OPTIONS]  set the full path to your default font.],
267 [RRD_DEFAULT_FONT=$withval],[
268   if test -d ${WINDIR:-nodir}/cour.ttf ; then
269         RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
270   else
271         RRD_DEFAULT_FONT='$(fontsdir)/$(fonts_DATA)'
272   fi
273 ])
275 dnl Use mmap in rrd_update instead of seek+write
276 AC_ARG_ENABLE([mmap],
277 [  --disable-mmap          disable mmap in rrd_update, use seek+write instead],
278 [],
279 [enable_mmap=yes])
282  AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
283 [],[enable_pthread=yes])
287 CONFIGURE_PART(Audit Compilation Environment)
290 dnl Check for the compiler and static/shared library creation.
291 AC_PROG_CC
292 AC_PROG_CPP
293 AC_PROG_LIBTOOL
295 dnl which flags does the compile support?
296 if test "$GCC" = "yes"; then
297   for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W; do
298     oCFLAGS=$CFLAGS
299     CFLAGS="$CFLAGS $flag"
300     cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
301     AC_CACHE_CHECK([if gcc likes the $flag flag], $cachename,
302        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0 ]])],[eval $cachename=yes],[eval $cachename=no])])
303     if eval test \$$cachename = no; then
304          CFLAGS=$oCFLAGS
305     fi
306   done
307 fi
311 AC_SUBST(RRD_DEFAULT_FONT)
313 CONFIGURE_PART(Checking for Header Files)
314  
315 dnl Checks for header files.
316 AC_HEADER_STDC
317 AC_HEADER_DIRENT
318 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)
320 dnl Checks for typedefs, structures, and compiler characteristics.
321 AC_C_CONST
322 AC_HEADER_TIME
323 AC_STRUCT_TM
325 dnl Checks for libraries.
326 AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
328 dnl add pic flag in any case this makes sure all our code is relocatable
329 eval `./libtool --config | grep pic_flag`
330 CFLAGS="$CFLAGS $pic_flag"
332 CONFIGURE_PART(Test Library Functions)
334 dnl Checks for library functions.
335 AC_FUNC_STRFTIME
336 AC_FUNC_VPRINTF
338 AC_C_BIGENDIAN
340 dnl for each function found we get a definition in config.h 
341 dnl of the form HAVE_FUNCTION
343 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)
345 AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
347 dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
348 if test "x$enable_mmap" = "xyes"; then
349   case "$host" in
350   *cygwin*)
351     # the normal mmap test does not work in cygwin
352     AC_CHECK_FUNCS(mmap)
353     if test "x$ac_cv_func_mmap" = "xyes"; then
354       ac_cv_func_mmap_fixed_mapped=yes
355     fi
356   ;;
357   *)
358     AC_CHECK_HEADERS(sys/mman.h)
359     AC_FUNC_MMAP
360     AC_CHECK_FUNCS(mmap munmap msync)
361     AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
362                                      # include <sys/mman.h>
363                                      #endif])
364     if test "x$ac_cv_have_decl_madvise" = "xyes";
365     then
366       AC_CHECK_FUNCS(madvise)
367     else
368       AC_CHECK_FUNCS(posix_madvise)
369       if test "x$ac_cv_func_posix_madvise" != "xyes"; then
370         AC_MSG_WARN([madvise() nor posix_madvise() found.])
371       fi
372     fi
373   ;;
374   esac
375   if test "x$ac_cv_func_mmap" != "xyes";
376   then
377     AC_MSG_ERROR([--enable-mmap requested but mmap() was not detected])
378 dnl enable_mmap="no"
379   fi
380 fi
382 dnl can we use posix_fadvise
383 AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
384 #include <fcntl.h>])
385 AC_CHECK_FUNCS(posix_fadvise)   
387 if test "x$enable_mmap" = xyes; then
388   case "$host" in
389     *cygwin*)
390        # the normal mmap test does not work in cygwin
391        AC_CHECK_FUNCS(mmap)
392        if [ "x${ac_cv_func_mmap}" = xyes ]; then
393          ac_cv_func_mmap_fixed_mapped=yes
394        fi
395     ;;
396     *)
397        AC_FUNC_MMAP
398     ;;
399   esac
400 fi
403 CONFIGURE_PART(IEEE Math Checks)
404  
405 dnl HP-UX 11.00 does not have finite but does have isfinite as a macro so we need
406 dnl actual code to check if this works
407 AC_CHECK_FUNCS(fpclassify, ,
408   [AC_MSG_CHECKING(for fpclassify with <math.h>)
409     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
410 volatile int x;volatile float f; ]], [[x = fpclassify(f)]])],[AC_MSG_RESULT(yes)
411       AC_DEFINE(HAVE_FPCLASSIFY)],[AC_MSG_RESULT(no)])])
412 AC_CHECK_FUNCS(finite, ,
413   [AC_CHECK_FUNCS(isfinite, ,
414     [AC_MSG_CHECKING(for isfinite with <math.h>)
415     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
416 volatile int x;volatile float f;  ]], [[x = isfinite(f)]])],[AC_MSG_RESULT(yes)
417       AC_DEFINE(HAVE_ISFINITE)],[AC_MSG_RESULT(no)])])])
418 AC_CHECK_FUNCS(isinf, ,
419   [AC_MSG_CHECKING(for isinf with <math.h>)
420     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
421 volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
422       AC_DEFINE(HAVE_ISINF)],[AC_MSG_RESULT(no)])])
424 AC_FULL_IEEE
426 CONFIGURE_PART(Resolve Portability Issues)
428 dnl what does realloc do if it gets called with a NULL pointer
430 AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc,
431 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
432               int main(void){
433               char *x = NULL;
434               x = realloc (x,10);
435               if (x==NULL) return 1;
436               return 0;
437              }]])],[rd_cv_null_realloc=yes],[rd_cv_null_realloc=nope],[:])])
439 if test x"$rd_cv_null_realloc" = xnope; then
440 AC_DEFINE(NO_NULL_REALLOC)
441 fi
443 AC_LANG_PUSH(C)
444 dnl solaris has some odd defines it needs in order to propperly compile ctime_r
445 AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
446 AC_LINK_IFELSE(
447     AC_LANG_PROGRAM(
448            [[#include <time.h>]],
449            [[ctime_r(NULL,NULL,0)]]
450                    ),
451     [ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
452       AC_LINK_IFELSE(
453           AC_LANG_PROGRAM(
454                 [[#include <time.h>]],
455                 [[ctime_r(NULL,NULL)]]
456                          ),
457           [AC_MSG_RESULT([yes, this seems to be solaris style])],
458           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
459       )
460     ],  
461     [ AC_LINK_IFELSE(
462           AC_LANG_PROGRAM(
463                 [[#include <time.h>]],
464                 [[ctime_r(NULL,NULL)]]
465                          ),
466           [AC_MSG_RESULT(no)],
467           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
468       )
469     ]  
471 AC_LANG_POP(C)
473 dnl Check for pthreads
474 dnl http://autoconf-archive.cryp.to/acx_pthread.m4
475  
476 AC_SUBST(MULTITHREAD_CFLAGS)
477 AC_SUBST(MULTITHREAD_LDFLAGS)
479 if test $enable_pthread != no; then 
480  ACX_PTHREAD([
481     MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
482     MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
483              ],
484              [])
485 fi
487 dnl since we use lots of *_r functions all over the code we better
488 dnl make sure they are known
490 if test  "x$x_rflag" != "xno"; then
491    CPPFLAGS="$CPPFLAGS $x_rflag"
492 fi
494 AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
496 AC_LANG_PUSH(C)
497 dnl see if we have to include malloc/malloc.h
498 AC_MSG_CHECKING([do we need malloc/malloc.h])
499 AC_LINK_IFELSE(
500     AC_LANG_PROGRAM(
501            [[#include <stdlib.h>]],
502            [[malloc(1)]]
503                    ),
504     [ AC_MSG_RESULT([nope, works out of the box]) ],
505     [ AC_LINK_IFELSE(
506           AC_LANG_PROGRAM(
507                 [[#include <stdlib.h>
508                   #include <malloc/malloc.h>]],
509                 [[malloc(1)]]
510                          ),
511           [AC_DEFINE(NEED_MALLOC_MALLOC_H)
512            AC_MSG_RESULT([yes we do])],
513           [AC_MSG_ERROR([Can not figure how to compile malloc])]
514       )
515     ]  
517 AC_LANG_POP(C)
519 CONFIGURE_PART(Find 3rd-Party Libraries)
522 AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
524 CORE_LIBS="$LIBS"
526 EX_CHECK_ALL(art_lgpl_2, art_vpath_add_point,       libart_lgpl/libart.h,   libart-2.0,  2.3.17, ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/, /usr/include/libart-2.0)
527 EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
528 EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
529 EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,             freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
531 if test "$EX_CHECK_ALL_ERR" = "YES"; then
532   AC_MSG_ERROR([Please fix the library issues listed above and try again.])
533 fi
535 ALL_LIBS="$LIBS"
536 LIBS=
538 AC_SUBST(CORE_LIBS)
539 AC_SUBST(ALL_LIBS)
541 CONFIGURE_PART(Prep for Building Language Bindings)
542   
543 dnl Check for Perl.
544 AC_PATH_PROG(PERL, perl, no)
546 AC_ARG_ENABLE(perl,[  --disable-perl          do not build the perl modules],
547 [],[enable_perl=yes])
550 AC_ARG_VAR(PERLCC, [[] C compiler for Perl modules])
551 AC_ARG_VAR(PERLCCFLAGS, [[] CC flags for Perl modules])
552 AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules])
553 AC_ARG_VAR(PERLLDFLAGS, [[] LD flags for Perl modules])
555 if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
556         COMP_PERL=
557 else
558         COMP_PERL="perl_piped perl_shared"
559         AC_MSG_CHECKING(for the perl version you are running)
560         PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
561         AC_MSG_RESULT($PERL_VERSION)
562         if test -z "$PERLCC"; then
563             AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
564             perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
565             AC_MSG_RESULT($perlcc)
566             if test ! -x "$perlcc"; then
567                 AC_PATH_PROG(PERL_CC, ${perlcc}, no)
568                 if test "$PERL_CC" = "no"; then
569                     AC_MSG_WARN([
570 I would not find the Compiler ($perlcc) that was originally used to compile
571 your perl binary. You should either make sure that this compiler is
572 available on your system, pick an other compiler and set PERLCC
573 appropriately, or use a different perl setup that was compiled locally.
575 I will disable the compilation of the RRDs perl module for now.
576 ])
577                     COMP_PERL="perl_piped"
578                 fi
579             fi    
580         fi
581 fi
583 AC_MSG_CHECKING(Perl Modules to build)
584 AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
586 # Options to pass when configuring perl module
587 ppref=$prefix
588 test "$ppref" = "NONE" && ppref=$ac_default_prefix
590 PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
592 dnl pass additional perl options when generating Makefile from Makefile.PL
593 AC_ARG_ENABLE(perl-site-install,
594 [  --enable-perl-site-install   by default the rrdtool perl modules are installed
595                           together with rrdtool in $prefix/lib/perl. You have to
596                           put a 'use lib qw($prefix/lib/perl)' into your scripts
597                           when you want to use them. When you set this option
598                           the perl modules will get installed wherever
599                           your perl setup thinks it is best.],
600 [PERL_MAKE_OPTIONS=],[])
602 if test ! -z "$PERLCC"; then
603    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
605    if test ! -z "$PERLCCFLAGS"; then
606        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
607    fi
608    
609    if test -z "$PERLLD"; then
610        PERLLD=$PERLCC
611    fi
612    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
613   
614    if test ! -z "$PERLLDFLAGS"; then
615        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
616    fi
617 fi
618         
619 AC_ARG_WITH(perl-options,
620 [  --with-perl-options=[OPTIONS]  options to pass on command-line when
621                           generating Makefile from Makefile.PL. If you set this
622                           option, interesting things may happen unless you know
623                           what you are doing!],
624 [PERL_MAKE_OPTIONS=$withval])
626 AC_SUBST(PERL_MAKE_OPTIONS)
627 AC_SUBST(PERL)
628 AC_SUBST(COMP_PERL)
629 AC_SUBST(PERL_VERSION)
631 dnl Check for Ruby.
632 AC_PATH_PROG(RUBY, ruby, no)
634 AC_ARG_ENABLE(ruby,[  --disable-ruby          do not build the ruby modules],
635 [],[enable_ruby=yes])
637 AC_MSG_CHECKING(if ruby modules can be built)
639 if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
640         COMP_RUBY=
641         AC_MSG_RESULT(No .. Ruby not found or disabled)
642 else
643         if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
644                 COMP_RUBY="ruby"
645                 AC_MSG_RESULT(YES)
646         else
647                 COMP_RUBY=
648                 AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)         
649         fi                              
650 fi
653 dnl pass additional ruby options when generating Makefile from Makefile.PL
654 AC_ARG_ENABLE(ruby-site-install,
655 [  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
656                           together with rrdtool in $prefix/lib/ruby. You have to
657                           add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
658                           for ruby to find the RRD.so file.],
659 [RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir=$prefix/lib/ruby"])
661     
662 AC_ARG_WITH(ruby-options,
663 [  --with-ruby-options=[OPTIONS]  options to pass on command-line when
664                           generating Makefile from extconf.rb. If you set this
665                           option, interesting things may happen unless you know
666                           what you are doing!],
667 [RUBY_MAKE_OPTIONS=$withval])
669 AC_SUBST(RUBY_MAKE_OPTIONS)
670 AC_SUBST(RUBY)
671 AC_SUBST(COMP_RUBY)
674 enable_tcl_site=no
676 AC_ARG_ENABLE(tcl,[  --disable-tcl           do not build the tcl modules],
677 [],[enable_tcl=yes])
679 if test  "$enable_tcl" = "yes"; then
680   dnl Check for Tcl.
681   withval=""
682   AC_ARG_WITH(tcllib,[  --with-tcllib=DIR       location of the tclConfig.sh])
683   enable_tcl=no
684   for dir in $withval /usr/lib /usr/local/lib; do
685     AC_MSG_CHECKING(for tclConfig.sh in $dir)
686     if test -f "$dir/tclConfig.sh" ; then
687         tcl_config=$dir/tclConfig.sh
688         enable_tcl=yes
689         AC_MSG_RESULT(yes)
690         break
691     else
692         AC_MSG_RESULT(no)
693     fi
694   done
696   if test "$enable_tcl" = "no"; then
697         AC_MSG_WARN([tclConfig.sh not found - Tcl interface won't be built])
698   else
699         . $tcl_config
700         TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
701   fi
702   AC_ARG_ENABLE(tcl,[  --enable-tcl-site        install the tcl extension in the tcl tree],
703   [],[enable_tcl_site=yes])
705 fi
707 AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
708 AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
710 AC_SUBST(TCL_PREFIX)
711 AC_SUBST(TCL_SHLIB_CFLAGS)
712 AC_SUBST(TCL_SHLIB_LD)
713 AC_SUBST(TCL_SHLIB_SUFFIX)
714 AC_SUBST(TCL_PACKAGE_PATH)
715 AC_SUBST(TCL_LD_SEARCH_FLAGS)
716 AC_SUBST(TCL_STUB_LIB_SPEC)
717 AC_SUBST(TCL_VERSION)
718 AC_SUBST(TCL_PACKAGE_DIR)
720 AC_ARG_ENABLE(python,[  --disable-python        do not build the python modules],
721 [],[enable_python=yes])
723 if test  "$enable_python" = "yes"; then
724 dnl Check for python
725 AM_PATH_PYTHON(2.3,[],[enable_python=no])
726 AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
727 fi
729 if test  x$enable_python = xno; then
730         COMP_PYTHON=
731 else
732         COMP_PYTHON="python"
733 fi
735 AC_SUBST(COMP_PYTHON)
737 dnl Check for nroff
738 AC_PATH_PROGS(NROFF, gnroff nroff)
739 AC_PATH_PROGS(TROFF, groff troff)
741 AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory])
742 if test -z "$RRDDOCDIR"; then
743    RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
746 CONFIGURE_PART(Apply Configuration Information)
747  
748 AC_CONFIG_FILES([examples/shared-demo.pl])
749 AC_CONFIG_FILES([examples/piped-demo.pl])
750 AC_CONFIG_FILES([examples/stripes.pl])
751 AC_CONFIG_FILES([examples/bigtops.pl])
752 AC_CONFIG_FILES([examples/minmax.pl])
753 AC_CONFIG_FILES([examples/4charts.pl])
754 AC_CONFIG_FILES([examples/perftest.pl])
755 AC_CONFIG_FILES([examples/Makefile])
756 AC_CONFIG_FILES([doc/Makefile])
757 AC_CONFIG_FILES([src/Makefile])
758 AC_CONFIG_FILES([bindings/Makefile])
759 AC_CONFIG_FILES([bindings/tcl/Makefile])
760 AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl])
761 AC_CONFIG_FILES([Makefile])          
763 AC_CONFIG_COMMANDS([default],[[ chmod +x examples/*.pl]],[[]])
764 AC_OUTPUT
766 AC_MSG_CHECKING(in)
767 AC_MSG_RESULT(and out again)
769 echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
770 sleep 1
771 echo $ECHO_N ".$ECHO_C" 1>&6
772 sleep 1
773 echo $ECHO_N ".$ECHO_C" 1>&6
774 sleep 1
775 echo $ECHO_N ".$ECHO_C" 1>&6
776 sleep 1
777 echo $ECHO_N ".$ECHO_C" 1>&6
778 sleep 1
779 AC_MSG_RESULT([ just kidding ;-)])
780 echo
781 echo "----------------------------------------------------------------"
782 echo "Config is DONE!"
783 echo
784 echo "          With MMAP IO: $ac_cv_func_mmap_fixed_mapped"
785 echo "          Perl Modules: $COMP_PERL"
786 echo "           Perl Binary: $PERL"
787 echo "          Perl Version: $PERL_VERSION"
788 echo "          Perl Options: $PERL_MAKE_OPTIONS"
789 echo "          Ruby Modules: $COMP_RUBY"
790 echo "           Ruby Binary: $RUBY"
791 echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
792 echo "    Build Tcl Bindings: $enable_tcl"
793 echo " Build Python Bindings: $enable_python"
794 echo "          Build rrdcgi: $enable_rrdcgi"
795 echo "       Build librrd MT: $enable_pthread"
796 echo
797 echo
798 echo "Type 'make' to compile the software and use 'make install' to "
799 echo "install everything to: $prefix."
800 echo 
801 echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
802 echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
803 echo "place an order."
804 echo 
805 echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
806 echo "----------------------------------------------------------------"