Code

Merge branch 'upstream'
[pkg-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.28])
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.2028
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 #undef _BSD_SOURCE /* comment to prevent configure from modifying this line */   
65 #define _BSD_SOURCE 1
66 # include <features.h>
67 #endif
69 #ifdef HAVE_ERRNO_H
70 # include <errno.h>
71 #endif
73 #if defined(HAVE_SYS_MMAN_H)
74 #include <sys/mman.h>
75 #endif
77 #ifdef HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
81 #ifdef HAVE_SYS_PARAM_H
82 # include <sys/param.h>
83 #endif
84 #ifndef MAXPATH
85 # ifdef PATH_MAX
86 #  define MAXPATH PATH_MAX
87 # endif
88 #endif
89 #ifndef MAXPATH
90 /* else try the BSD variant */
91 # ifdef MAXPATHLEN
92 #  define MAXPATH MAXPATHLEN
93 # endif
94 #endif
96 #if !defined HAVE_MADVISE && defined HAVE_POSIX_MADVISE
97 /* use posix_madvise family */
98 # define madvise posix_madvise
99 # define MADV_NORMAL POSIX_MADV_NORMAL
100 # define MADV_RANDOM POSIX_MADV_RANDOM
101 # define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
102 # define MADV_WILLNEED POSIX_MADV_WILLNEED
103 # define MADV_DONTNEED POSIX_MADV_DONTNEED
104 #endif
106 #if defined POSIX_MADV_RANDOM && !defined MADV_RANDOM
107 #define MADV_RANDOM POSIX_MADV_RANDOM
108 #endif
112 #if defined HAVE_MADVISE || defined HAVE_POSIX_MADVISE
113 # define USE_MADVISE 1
114 #endif
116 #ifdef HAVE_SYS_STAT_H
117 # include <sys/stat.h>
118 #endif
120 #ifdef HAVE_FCNTL_H
121 #include <fcntl.h>
122 #endif
124 #ifdef HAVE_UNISTD_H
125 # include <unistd.h>
126 #endif
128 #ifdef TIME_WITH_SYS_TIME
129 # include <sys/time.h>
130 # include <time.h>
131 #else
132 # ifdef HAVE_SYS_TIME_H
133 #  include <sys/time.h>
134 # else
135 #  include <time.h>
136 # endif
137 #endif
139 #ifdef HAVE_SYS_TIMES_H
140 # include <sys/times.h>
141 #endif
143 #ifdef HAVE_SYS_RESOURCE_H
144 # include <sys/resource.h>
145 #if (defined(__svr4__) && defined(__sun__))
146 /* Solaris headers (pre 2.6) don't have a getrusage prototype.
147    Use this instead. */
148 extern int getrusage(int, struct rusage *);
149 #endif /* __svr4__ && __sun__ */
150 #endif
152 /* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
153    make sure you are NOT using bcopy, index or rindex in the code */
154       
155 #ifdef STDC_HEADERS
156 # include <string.h>
157 #else
158 # ifndef HAVE_STRCHR
159 #  define strchr index
160 #  define strrchr rindex
161 # endif
162 char *strchr (), *strrchr ();
163 # ifndef HAVE_MEMMOVE
164 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
165 #  define memmove(d, s, n) bcopy ((s), (d), (n))
166 # endif
167 #endif
169 #ifdef NO_NULL_REALLOC
170 # define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
171 #else
172 # define rrd_realloc(a,b) realloc((a), (b))
173 #endif
175 #ifdef NEED_MALLOC_MALLOC_H
176 #  include <malloc/malloc.h>
177 #endif
179 #ifdef HAVE_MATH_H
180 #  include <math.h>
181 #endif
183 #ifdef HAVE_FLOAT_H
184 #  include <float.h>
185 #endif
187 #ifdef HAVE_IEEEFP_H
188 #  include <ieeefp.h>
189 #endif
191 #ifdef HAVE_FP_CLASS_H
192 #  include <fp_class.h>
193 #endif
195 /* for Solaris */
196 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
197 #  define HAVE_ISINF 1
198 #  ifdef isinf
199 #  undef isinf /* confuse autoconf */
200 #  endif
201 #  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
202 #endif
204 /* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
205 #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
206 #  undef isnan  /* confuse autoconf to NOT remove this */
207 #  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
208 #endif
210 /* for OSF1 Digital Unix */
211 #if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
212 #  define HAVE_ISINF 1
213 #  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
214 #endif
216 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
217 #  define HAVE_ISINF 1
218 #  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
219 #endif
221 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
222 #  define HAVE_ISINF 1
223 #  define isinf(a) (fpclassify(a) == FP_INFINITE)
224 #endif
226 /* for AIX */
227 #if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
228 #  define HAVE_ISINF 1
229 #  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
230 #endif
232 #if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
233 #  define HAVE_FINITE 1
234 #  define finite(a) isfinite(a)
235 #endif
237 #if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
238 #  define HAVE_FINITE 1
239 #  define finite(a) (! isnan(a) && ! isinf(a))
240 #endif
242 #ifndef HAVE_FINITE
243 #error "Can't compile without finite function"
244 #endif
246 #ifndef HAVE_ISINF
247 #error "Can't compile without isinf function"
248 #endif
250 #endif /* RRD_CONFIG_H */
251 ])
253 dnl Process Special Options
254 dnl -----------------------------------
256 dnl How the vertical axis label is printed
257 AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
258  [Vertical label angle: 90.0 (default) or 270.0])
259 AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0},
260  [Vertical label angle: 90.0 (default) or 270.0])
262 AC_ARG_ENABLE(rrdcgi,[  --disable-rrdcgi        disable building of rrdcgi],
263 [],[enable_rrdcgi=yes])
265 dnl Check if we run on a system that has fonts
266 AC_ARG_WITH(rrd-default-font,
267 [  --with-rrd-default-font=[OPTIONS]  set the full path to your default font.],
268 [RRD_DEFAULT_FONT=$withval],[
269   if test -d ${WINDIR:-nodir}/cour.ttf ; then
270         RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
271   else
272         RRD_DEFAULT_FONT='$(fontsdir)/$(fonts_DATA)'
273   fi
274 ])
276 dnl Use mmap in rrd_update instead of seek+write
277 AC_ARG_ENABLE([mmap],
278 [  --disable-mmap          disable mmap in rrd_update, use seek+write instead],
279 [],
280 [enable_mmap=yes])
283  AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
284 [],[enable_pthread=yes])
288 CONFIGURE_PART(Audit Compilation Environment)
291 dnl Check for the compiler and static/shared library creation.
292 AC_PROG_CC
293 AC_PROG_CPP
294 AC_PROG_LIBTOOL
296 dnl which flags does the compile support?
297 if test "$GCC" = "yes"; then
298   for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W; do
299     oCFLAGS=$CFLAGS
300     CFLAGS="$CFLAGS $flag"
301     cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
302     AC_CACHE_CHECK([if gcc likes the $flag flag], $cachename,
303        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0 ]])],[eval $cachename=yes],[eval $cachename=no])])
304     if eval test \$$cachename = no; then
305          CFLAGS=$oCFLAGS
306     fi
307   done
308 fi
312 AC_SUBST(RRD_DEFAULT_FONT)
314 CONFIGURE_PART(Checking for Header Files)
315  
316 dnl Checks for header files.
317 AC_HEADER_STDC
318 AC_HEADER_DIRENT
319 AC_CHECK_HEADERS( 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 float.h strings.h)
321 dnl Checks for typedefs, structures, and compiler characteristics.
322 AC_C_CONST
323 AC_HEADER_TIME
324 AC_STRUCT_TM
326 dnl Checks for libraries.
327 AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
329 dnl add pic flag in any case this makes sure all our code is relocatable
330 eval `./libtool --config | grep pic_flag`
331 CFLAGS="$CFLAGS $pic_flag"
333 CONFIGURE_PART(Test Library Functions)
335 dnl Checks for library functions.
336 AC_FUNC_STRFTIME
337 AC_FUNC_VPRINTF
339 AC_C_BIGENDIAN
341 dnl for each function found we get a definition in config.h 
342 dnl of the form HAVE_FUNCTION
344 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)
346 AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
348 dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
349 if test "x$enable_mmap" = "xyes"; then
350   case "$host" in
351   *cygwin*)
352     # the normal mmap test does not work in cygwin
353     AC_CHECK_FUNCS(mmap)
354     if test "x$ac_cv_func_mmap" = "xyes"; then
355       ac_cv_func_mmap_fixed_mapped=yes
356     fi
357   ;;
358   *)
359     AC_CHECK_HEADERS(sys/mman.h)
360     AC_FUNC_MMAP
361     AC_CHECK_FUNCS(mmap munmap msync)
362     AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
363                                      # include <sys/mman.h>
364                                      #endif])
365     if test "x$ac_cv_have_decl_madvise" = "xyes";
366     then
367       AC_CHECK_FUNCS(madvise)
368     else
369       AC_CHECK_FUNCS(posix_madvise)
370       if test "x$ac_cv_func_posix_madvise" != "xyes"; then
371         AC_MSG_WARN([madvise() nor posix_madvise() found.])
372       fi
373     fi
374   ;;
375   esac
376   if test "x$ac_cv_func_mmap" != "xyes";
377   then
378     AC_MSG_ERROR([--enable-mmap requested but mmap() was not detected])
379 dnl enable_mmap="no"
380   fi
381 fi
383 dnl can we use posix_fadvise
384 AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
385 #include <fcntl.h>])
386 AC_CHECK_FUNCS(posix_fadvise)   
388 if test "x$enable_mmap" = xyes; then
389   case "$host" in
390     *cygwin*)
391        # the normal mmap test does not work in cygwin
392        AC_CHECK_FUNCS(mmap)
393        if [ "x${ac_cv_func_mmap}" = xyes ]; then
394          ac_cv_func_mmap_fixed_mapped=yes
395        fi
396     ;;
397     *)
398        AC_FUNC_MMAP
399     ;;
400   esac
401 fi
404 CONFIGURE_PART(IEEE Math Checks)
405  
406 dnl HP-UX 11.00 does not have finite but does have isfinite as a macro so we need
407 dnl actual code to check if this works
408 AC_CHECK_FUNCS(fpclassify, ,
409   [AC_MSG_CHECKING(for fpclassify with <math.h>)
410     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
411 volatile int x;volatile float f; ]], [[x = fpclassify(f)]])],[AC_MSG_RESULT(yes)
412       AC_DEFINE(HAVE_FPCLASSIFY)],[AC_MSG_RESULT(no)])])
413 AC_CHECK_FUNCS(finite, ,
414   [AC_CHECK_FUNCS(isfinite, ,
415     [AC_MSG_CHECKING(for isfinite with <math.h>)
416     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
417 volatile int x;volatile float f;  ]], [[x = isfinite(f)]])],[AC_MSG_RESULT(yes)
418       AC_DEFINE(HAVE_ISFINITE)],[AC_MSG_RESULT(no)])])])
419 AC_CHECK_FUNCS(isinf, ,
420   [AC_MSG_CHECKING(for isinf with <math.h>)
421     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
422 volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
423       AC_DEFINE(HAVE_ISINF)],[AC_MSG_RESULT(no)])])
425 AC_FULL_IEEE
427 CONFIGURE_PART(Resolve Portability Issues)
429 dnl what does realloc do if it gets called with a NULL pointer
431 AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc,
432 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
433               int main(void){
434               char *x = NULL;
435               x = realloc (x,10);
436               if (x==NULL) return 1;
437               return 0;
438              }]])],[rd_cv_null_realloc=yes],[rd_cv_null_realloc=nope],[:])])
440 if test x"$rd_cv_null_realloc" = xnope; then
441 AC_DEFINE(NO_NULL_REALLOC)
442 fi
444 AC_LANG_PUSH(C)
445 dnl solaris has some odd defines it needs in order to propperly compile ctime_r
446 AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
447 AC_LINK_IFELSE(
448     AC_LANG_PROGRAM(
449            [[#include <time.h>]],
450            [[ctime_r(NULL,NULL,0)]]
451                    ),
452     [ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
453       AC_LINK_IFELSE(
454           AC_LANG_PROGRAM(
455                 [[#include <time.h>]],
456                 [[ctime_r(NULL,NULL)]]
457                          ),
458           [AC_MSG_RESULT([yes, this seems to be solaris style])],
459           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
460       )
461     ],  
462     [ AC_LINK_IFELSE(
463           AC_LANG_PROGRAM(
464                 [[#include <time.h>]],
465                 [[ctime_r(NULL,NULL)]]
466                          ),
467           [AC_MSG_RESULT(no)],
468           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
469       )
470     ]  
472 AC_LANG_POP(C)
474 dnl Check for pthreads
475 dnl http://autoconf-archive.cryp.to/acx_pthread.m4
476  
477 AC_SUBST(MULTITHREAD_CFLAGS)
478 AC_SUBST(MULTITHREAD_LDFLAGS)
480 if test $enable_pthread != no; then 
481  ACX_PTHREAD([
482     MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
483     MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
484              ],
485              [])
486 fi
488 dnl since we use lots of *_r functions all over the code we better
489 dnl make sure they are known
491 if test  "x$x_rflag" != "xno"; then
492    CPPFLAGS="$CPPFLAGS $x_rflag"
493 fi
495 AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
497 AC_LANG_PUSH(C)
498 dnl see if we have to include malloc/malloc.h
499 AC_MSG_CHECKING([do we need malloc/malloc.h])
500 AC_LINK_IFELSE(
501     AC_LANG_PROGRAM(
502            [[#include <stdlib.h>]],
503            [[malloc(1)]]
504                    ),
505     [ AC_MSG_RESULT([nope, works out of the box]) ],
506     [ AC_LINK_IFELSE(
507           AC_LANG_PROGRAM(
508                 [[#include <stdlib.h>
509                   #include <malloc/malloc.h>]],
510                 [[malloc(1)]]
511                          ),
512           [AC_DEFINE(NEED_MALLOC_MALLOC_H)
513            AC_MSG_RESULT([yes we do])],
514           [AC_MSG_ERROR([Can not figure how to compile malloc])]
515       )
516     ]  
518 AC_LANG_POP(C)
520 CONFIGURE_PART(Find 3rd-Party Libraries)
523 AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
525 CORE_LIBS="$LIBS"
527 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)
528 EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
529 EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
530 EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,             freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
532 if test "$EX_CHECK_ALL_ERR" = "YES"; then
533   AC_MSG_ERROR([Please fix the library issues listed above and try again.])
534 fi
536 ALL_LIBS="$LIBS"
537 LIBS=
539 AC_SUBST(CORE_LIBS)
540 AC_SUBST(ALL_LIBS)
542 CONFIGURE_PART(Prep for Building Language Bindings)
543   
544 dnl Check for Perl.
545 AC_PATH_PROG(PERL, perl, no)
547 AC_ARG_ENABLE(perl,[  --disable-perl          do not build the perl modules],
548 [],[enable_perl=yes])
551 AC_ARG_VAR(PERLCC, [[] C compiler for Perl modules])
552 AC_ARG_VAR(PERLCCFLAGS, [[] CC flags for Perl modules])
553 AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules])
554 AC_ARG_VAR(PERLLDFLAGS, [[] LD flags for Perl modules])
556 if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
557         COMP_PERL=
558 else
559         COMP_PERL="perl_piped perl_shared"
560         AC_MSG_CHECKING(for the perl version you are running)
561         PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
562         AC_MSG_RESULT($PERL_VERSION)
563         if test -z "$PERLCC"; then
564             AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
565             perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
566             AC_MSG_RESULT($perlcc)
567             if test ! -x "$perlcc"; then
568                 AC_PATH_PROG(PERL_CC, ${perlcc}, no)
569                 if test "$PERL_CC" = "no"; then
570                     AC_MSG_WARN([
571 I would not find the Compiler ($perlcc) that was originally used to compile
572 your perl binary. You should either make sure that this compiler is
573 available on your system, pick an other compiler and set PERLCC
574 appropriately, or use a different perl setup that was compiled locally.
576 I will disable the compilation of the RRDs perl module for now.
577 ])
578                     COMP_PERL="perl_piped"
579                 fi
580             fi    
581         fi
582 fi
584 AC_MSG_CHECKING(Perl Modules to build)
585 AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
587 # Options to pass when configuring perl module
588 ppref=$prefix
589 test "$ppref" = "NONE" && ppref=$ac_default_prefix
591 PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
593 dnl pass additional perl options when generating Makefile from Makefile.PL
594 AC_ARG_ENABLE(perl-site-install,
595 [  --enable-perl-site-install   by default the rrdtool perl modules are installed
596                           together with rrdtool in $prefix/lib/perl. You have to
597                           put a 'use lib qw($prefix/lib/perl)' into your scripts
598                           when you want to use them. When you set this option
599                           the perl modules will get installed wherever
600                           your perl setup thinks it is best.],
601 [PERL_MAKE_OPTIONS=],[])
603 if test ! -z "$PERLCC"; then
604    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
606    if test ! -z "$PERLCCFLAGS"; then
607        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
608    fi
609    
610    if test -z "$PERLLD"; then
611        PERLLD=$PERLCC
612    fi
613    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
614   
615    if test ! -z "$PERLLDFLAGS"; then
616        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
617    fi
618 fi
619         
620 AC_ARG_WITH(perl-options,
621 [  --with-perl-options=[OPTIONS]  options to pass on command-line when
622                           generating Makefile from Makefile.PL. If you set this
623                           option, interesting things may happen unless you know
624                           what you are doing!],
625 [PERL_MAKE_OPTIONS=$withval])
627 AC_SUBST(PERL_MAKE_OPTIONS)
628 AC_SUBST(PERL)
629 AC_SUBST(COMP_PERL)
630 AC_SUBST(PERL_VERSION)
632 dnl Check for Ruby.
633 AC_PATH_PROG(RUBY, ruby, no)
635 AC_ARG_ENABLE(ruby,[  --disable-ruby          do not build the ruby modules],
636 [],[enable_ruby=yes])
638 AC_MSG_CHECKING(if ruby modules can be built)
640 if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
641         COMP_RUBY=
642         AC_MSG_RESULT(No .. Ruby not found or disabled)
643 else
644         if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
645                 COMP_RUBY="ruby"
646                 AC_MSG_RESULT(YES)
647         else
648                 COMP_RUBY=
649                 AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)         
650         fi                              
651 fi
654 dnl pass additional ruby options when generating Makefile from Makefile.PL
655 AC_ARG_ENABLE(ruby-site-install,
656 [  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
657                           together with rrdtool in $prefix/lib/ruby. You have to
658                           add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
659                           for ruby to find the RRD.so file.],
660 [RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir="'$(DESTDIR)'"$prefix/lib/ruby"])
662     
663 AC_ARG_WITH(ruby-options,
664 [  --with-ruby-options=[OPTIONS]  options to pass on command-line when
665                           generating Makefile from extconf.rb. If you set this
666                           option, interesting things may happen unless you know
667                           what you are doing!],
668 [RUBY_MAKE_OPTIONS=$withval])
670 AC_SUBST(RUBY_MAKE_OPTIONS)
671 AC_SUBST(RUBY)
672 AC_SUBST(COMP_RUBY)
675 enable_tcl_site=no
677 AC_ARG_ENABLE(tcl,[  --disable-tcl           do not build the tcl modules],
678 [],[enable_tcl=yes])
680 if test  "$enable_tcl" = "yes"; then
681   dnl Check for Tcl.
682   withval=""
683   AC_ARG_WITH(tcllib,[  --with-tcllib=DIR       location of the tclConfig.sh])
684   enable_tcl=no
685   for dir in $withval /usr/lib /usr/local/lib; do
686     AC_MSG_CHECKING(for tclConfig.sh in $dir)
687     if test -f "$dir/tclConfig.sh" ; then
688         tcl_config=$dir/tclConfig.sh
689         enable_tcl=yes
690         AC_MSG_RESULT(yes)
691         break
692     else
693         AC_MSG_RESULT(no)
694     fi
695   done
697   if test "$enable_tcl" = "no"; then
698         AC_MSG_WARN([tclConfig.sh not found - Tcl interface won't be built])
699   else
700         . $tcl_config
701         TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
702   fi
703   AC_ARG_ENABLE(tcl,[  --enable-tcl-site        install the tcl extension in the tcl tree],
704   [],[enable_tcl_site=yes])
706 fi
708 AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
709 AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
711 AC_SUBST(TCL_PREFIX)
712 AC_SUBST(TCL_SHLIB_CFLAGS)
713 AC_SUBST(TCL_SHLIB_LD)
714 AC_SUBST(TCL_SHLIB_SUFFIX)
715 AC_SUBST(TCL_PACKAGE_PATH)
716 AC_SUBST(TCL_LD_SEARCH_FLAGS)
717 AC_SUBST(TCL_STUB_LIB_SPEC)
718 AC_SUBST(TCL_VERSION)
719 AC_SUBST(TCL_PACKAGE_DIR)
721 AC_ARG_ENABLE(python,[  --disable-python        do not build the python modules],
722 [],[enable_python=yes])
724 if test  "$enable_python" = "yes"; then
725 dnl Check for python
726 AM_PATH_PYTHON(2.3,[],[enable_python=no])
727 AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
728 fi
730 if test  x$enable_python = xno; then
731         COMP_PYTHON=
732 else
733         COMP_PYTHON="python"
734 fi
736 AC_SUBST(COMP_PYTHON)
738 dnl Check for nroff
739 AC_PATH_PROGS(NROFF, gnroff nroff)
740 AC_PATH_PROGS(TROFF, groff troff)
742 AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory])
743 if test -z "$RRDDOCDIR"; then
744    RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
747 CONFIGURE_PART(Apply Configuration Information)
748  
749 AC_CONFIG_FILES([examples/shared-demo.pl])
750 AC_CONFIG_FILES([examples/piped-demo.pl])
751 AC_CONFIG_FILES([examples/stripes.pl])
752 AC_CONFIG_FILES([examples/bigtops.pl])
753 AC_CONFIG_FILES([examples/minmax.pl])
754 AC_CONFIG_FILES([examples/4charts.pl])
755 AC_CONFIG_FILES([examples/perftest.pl])
756 AC_CONFIG_FILES([examples/Makefile])
757 AC_CONFIG_FILES([doc/Makefile])
758 AC_CONFIG_FILES([src/Makefile])
759 AC_CONFIG_FILES([bindings/Makefile])
760 AC_CONFIG_FILES([bindings/tcl/Makefile])
761 AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl])
762 AC_CONFIG_FILES([Makefile])          
764 AC_CONFIG_COMMANDS([default],[[ chmod +x examples/*.pl]],[[]])
765 AC_OUTPUT
767 AC_MSG_CHECKING(in)
768 AC_MSG_RESULT(and out again)
770 echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
771 sleep 1
772 echo $ECHO_N ".$ECHO_C" 1>&6
773 sleep 1
774 echo $ECHO_N ".$ECHO_C" 1>&6
775 sleep 1
776 echo $ECHO_N ".$ECHO_C" 1>&6
777 sleep 1
778 echo $ECHO_N ".$ECHO_C" 1>&6
779 sleep 1
780 AC_MSG_RESULT([ just kidding ;-)])
781 echo
782 echo "----------------------------------------------------------------"
783 echo "Config is DONE!"
784 echo
785 echo "          With MMAP IO: $ac_cv_func_mmap_fixed_mapped"
786 echo "          Perl Modules: $COMP_PERL"
787 echo "           Perl Binary: $PERL"
788 echo "          Perl Version: $PERL_VERSION"
789 echo "          Perl Options: $PERL_MAKE_OPTIONS"
790 echo "          Ruby Modules: $COMP_RUBY"
791 echo "           Ruby Binary: $RUBY"
792 echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
793 echo "    Build Tcl Bindings: $enable_tcl"
794 echo " Build Python Bindings: $enable_python"
795 echo "          Build rrdcgi: $enable_rrdcgi"
796 echo "       Build librrd MT: $enable_pthread"
797 echo
798 echo
799 echo "Type 'make' to compile the software and use 'make install' to "
800 echo "install everything to: $prefix."
801 echo 
802 echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
803 echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
804 echo "place an order."
805 echo 
806 echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
807 echo "----------------------------------------------------------------"