Code

e3d16d75b26f161e3a6e55c8c996d18ad6586ce3
[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 #  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
198 #endif
200 /* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
201 #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
202 #  undefine isnan
203 #  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
204 #endif
206 /* for OSF1 Digital Unix */
207 #if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
208 #  define HAVE_ISINF 1
209 #  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
210 #endif
212 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
213 #  define HAVE_ISINF 1
214 #  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
215 #endif
217 #if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
218 #  define HAVE_ISINF 1
219 #  define isinf(a) (fpclassify(a) == FP_INFINITE)
220 #endif
222 /* for AIX */
223 #if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
224 #  define HAVE_ISINF 1
225 #  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
226 #endif
228 #if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
229 #  define HAVE_FINITE 1
230 #  define finite(a) isfinite(a)
231 #endif
233 #if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
234 #  define HAVE_FINITE 1
235 #  define finite(a) (! isnan(a) && ! isinf(a))
236 #endif
238 #ifndef HAVE_FINITE
239 #error "Can't compile without finite function"
240 #endif
242 #ifndef HAVE_ISINF
243 #error "Can't compile without isinf function"
244 #endif
246 #endif /* RRD_CONFIG_H */
247 ])
249 dnl Process Special Options
250 dnl -----------------------------------
252 dnl How the vertical axis label is printed
253 AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
254  [Vertical label angle: 90.0 (default) or 270.0])
255 AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0},
256  [Vertical label angle: 90.0 (default) or 270.0])
258 AC_ARG_ENABLE(rrdcgi,[  --disable-rrdcgi        disable building of rrdcgi],
259 [],[enable_rrdcgi=yes])
261 dnl Check if we run on a system that has fonts
262 AC_ARG_WITH(rrd-default-font,
263 [  --with-rrd-default-font=[OPTIONS]  set the full path to your default font.],
264 [RRD_DEFAULT_FONT=$withval],[
265   if test -d ${WINDIR:-nodir}/cour.ttf ; then
266         RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
267   else
268         RRD_DEFAULT_FONT='$(fontsdir)/$(fonts_DATA)'
269   fi
270 ])
272 dnl Use mmap in rrd_update instead of seek+write
273 AC_ARG_ENABLE([mmap],
274 [  --disable-mmap          disable mmap in rrd_update, use seek+write instead],
275 [],
276 [enable_mmap=yes])
279  AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
280 [],[enable_pthread=yes])
284 CONFIGURE_PART(Audit Compilation Environment)
287 dnl Check for the compiler and static/shared library creation.
288 AC_PROG_CC
289 AC_PROG_CPP
290 AC_PROG_LIBTOOL
292 dnl which flags does the compile support?
293 if test "$GCC" = "yes"; then
294   for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W; do
295     oCFLAGS=$CFLAGS
296     CFLAGS="$CFLAGS $flag"
297     cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
298     AC_CACHE_CHECK([if gcc likes the $flag flag], $cachename,
299        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0 ]])],[eval $cachename=yes],[eval $cachename=no])])
300     if eval test \$$cachename = no; then
301          CFLAGS=$oCFLAGS
302     fi
303   done
304 fi
308 AC_SUBST(RRD_DEFAULT_FONT)
310 CONFIGURE_PART(Checking for Header Files)
311  
312 dnl Checks for header files.
313 AC_HEADER_STDC
314 AC_HEADER_DIRENT
315 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)
317 dnl Checks for typedefs, structures, and compiler characteristics.
318 AC_C_CONST
319 AC_HEADER_TIME
320 AC_STRUCT_TM
322 dnl Checks for libraries.
323 AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
325 dnl add pic flag in any case this makes sure all our code is relocatable
326 eval `./libtool --config | grep pic_flag`
327 CFLAGS="$CFLAGS $pic_flag"
329 CONFIGURE_PART(Test Library Functions)
331 dnl Checks for library functions.
332 AC_FUNC_STRFTIME
333 AC_FUNC_VPRINTF
335 AC_C_BIGENDIAN
337 dnl for each function found we get a definition in config.h 
338 dnl of the form HAVE_FUNCTION
340 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)
342 AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
344 dnl XXX: dunno about windows.. add AC_CHECK_FUNCS(munmap) there too?
345 if test "x$enable_mmap" = "xyes"; then
346   case "$host" in
347   *cygwin*)
348     # the normal mmap test does not work in cygwin
349     AC_CHECK_FUNCS(mmap)
350     if test "x$ac_cv_func_mmap" = "xyes"; then
351       ac_cv_func_mmap_fixed_mapped=yes
352     fi
353   ;;
354   *)
355     AC_CHECK_HEADERS(sys/mman.h)
356     AC_FUNC_MMAP
357     AC_CHECK_FUNCS(mmap munmap msync)
358     AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
359                                      # include <sys/mman.h>
360                                      #endif])
361     if test "x$ac_cv_have_decl_madvise" = "xyes";
362     then
363       AC_CHECK_FUNCS(madvise)
364     else
365       AC_CHECK_FUNCS(posix_madvise)
366       if test "x$ac_cv_func_posix_madvise" != "xyes"; then
367         AC_MSG_WARN([madvise() nor posix_madvise() found.])
368       fi
369     fi
370   ;;
371   esac
372   if test "x$ac_cv_func_mmap" != "xyes";
373   then
374     AC_MSG_ERROR([--enable-mmap requested but mmap() was not detected])
375 dnl enable_mmap="no"
376   fi
377 fi
379 dnl can we use posix_fadvise
380 AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
381 #include <fcntl.h>])
382 AC_CHECK_FUNCS(posix_fadvise)   
384 if test "x$enable_mmap" = xyes; then
385   case "$host" in
386     *cygwin*)
387        # the normal mmap test does not work in cygwin
388        AC_CHECK_FUNCS(mmap)
389        if [ "x${ac_cv_func_mmap}" = xyes ]; then
390          ac_cv_func_mmap_fixed_mapped=yes
391        fi
392     ;;
393     *)
394        AC_FUNC_MMAP
395     ;;
396   esac
397 fi
400 CONFIGURE_PART(IEEE Math Checks)
401  
402 dnl HP-UX 11.00 does not have finite but does have isfinite as a macro so we need
403 dnl actual code to check if this works
404 AC_CHECK_FUNCS(fpclassify, ,
405   [AC_MSG_CHECKING(for fpclassify with <math.h>)
406     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
407 volatile int x;volatile float f; ]], [[x = fpclassify(f)]])],[AC_MSG_RESULT(yes)
408       AC_DEFINE(HAVE_FPCLASSIFY)],[AC_MSG_RESULT(no)])])
409 AC_CHECK_FUNCS(finite, ,
410   [AC_CHECK_FUNCS(isfinite, ,
411     [AC_MSG_CHECKING(for isfinite with <math.h>)
412     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
413 volatile int x;volatile float f;  ]], [[x = isfinite(f)]])],[AC_MSG_RESULT(yes)
414       AC_DEFINE(HAVE_ISFINITE)],[AC_MSG_RESULT(no)])])])
415 AC_CHECK_FUNCS(isinf, ,
416   [AC_MSG_CHECKING(for isinf with <math.h>)
417     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
418 volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
419       AC_DEFINE(HAVE_ISINF)],[AC_MSG_RESULT(no)])])
421 AC_FULL_IEEE
423 CONFIGURE_PART(Resolve Portability Issues)
425 dnl what does realloc do if it gets called with a NULL pointer
427 AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc,
428 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
429               int main(void){
430               char *x = NULL;
431               x = realloc (x,10);
432               if (x==NULL) return 1;
433               return 0;
434              }]])],[rd_cv_null_realloc=yes],[rd_cv_null_realloc=nope],[:])])
436 if test x"$rd_cv_null_realloc" = xnope; then
437 AC_DEFINE(NO_NULL_REALLOC)
438 fi
440 AC_LANG_PUSH(C)
441 dnl solaris has some odd defines it needs in order to propperly compile ctime_r
442 AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
443 AC_LINK_IFELSE(
444     AC_LANG_PROGRAM(
445            [[#include <time.h>]],
446            [[ctime_r(NULL,NULL,0)]]
447                    ),
448     [ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
449       AC_LINK_IFELSE(
450           AC_LANG_PROGRAM(
451                 [[#include <time.h>]],
452                 [[ctime_r(NULL,NULL)]]
453                          ),
454           [AC_MSG_RESULT([yes, this seems to be solaris style])],
455           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
456       )
457     ],  
458     [ AC_LINK_IFELSE(
459           AC_LANG_PROGRAM(
460                 [[#include <time.h>]],
461                 [[ctime_r(NULL,NULL)]]
462                          ),
463           [AC_MSG_RESULT(no)],
464           [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
465       )
466     ]  
468 AC_LANG_POP(C)
470 dnl Check for pthreads
471 dnl http://autoconf-archive.cryp.to/acx_pthread.m4
472  
473 AC_SUBST(MULTITHREAD_CFLAGS)
474 AC_SUBST(MULTITHREAD_LDFLAGS)
476 if test $enable_pthread != no; then 
477  ACX_PTHREAD([
478     MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
479     MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
480              ],
481              [])
482 fi
484 dnl since we use lots of *_r functions all over the code we better
485 dnl make sure they are known
487 if test  "x$x_rflag" != "xno"; then
488    CPPFLAGS="$CPPFLAGS $x_rflag"
489 fi
491 AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
493 AC_LANG_PUSH(C)
494 dnl see if we have to include malloc/malloc.h
495 AC_MSG_CHECKING([do we need malloc/malloc.h])
496 AC_LINK_IFELSE(
497     AC_LANG_PROGRAM(
498            [[#include <stdlib.h>]],
499            [[malloc(1)]]
500                    ),
501     [ AC_MSG_RESULT([nope, works out of the box]) ],
502     [ AC_LINK_IFELSE(
503           AC_LANG_PROGRAM(
504                 [[#include <stdlib.h>
505                   #include <malloc/malloc.h>]],
506                 [[malloc(1)]]
507                          ),
508           [AC_DEFINE(NEED_MALLOC_MALLOC_H)
509            AC_MSG_RESULT([yes we do])],
510           [AC_MSG_ERROR([Can not figure how to compile malloc])]
511       )
512     ]  
514 AC_LANG_POP(C)
516 CONFIGURE_PART(Find 3rd-Party Libraries)
519 AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
521 CORE_LIBS="$LIBS"
523 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)
524 EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
525 EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
526 EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,             freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
528 if test "$EX_CHECK_ALL_ERR" = "YES"; then
529   AC_MSG_ERROR([Please fix the library issues listed above and try again.])
530 fi
532 ALL_LIBS="$LIBS"
533 LIBS=
535 AC_SUBST(CORE_LIBS)
536 AC_SUBST(ALL_LIBS)
538 CONFIGURE_PART(Prep for Building Language Bindings)
539   
540 dnl Check for Perl.
541 AC_PATH_PROG(PERL, perl, no)
543 AC_ARG_ENABLE(perl,[  --disable-perl          do not build the perl modules],
544 [],[enable_perl=yes])
547 AC_ARG_VAR(PERLCC, [[] C compiler for Perl modules])
548 AC_ARG_VAR(PERLCCFLAGS, [[] CC flags for Perl modules])
549 AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules])
550 AC_ARG_VAR(PERLLDFLAGS, [[] LD flags for Perl modules])
552 if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
553         COMP_PERL=
554 else
555         COMP_PERL="perl_piped perl_shared"
556         AC_MSG_CHECKING(for the perl version you are running)
557         PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
558         AC_MSG_RESULT($PERL_VERSION)
559         if test -z "$PERLCC"; then
560             AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
561             perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
562             AC_MSG_RESULT($perlcc)
563             if test ! -x "$perlcc"; then
564                 AC_PATH_PROG(PERL_CC, ${perlcc}, no)
565                 if test "$PERL_CC" = "no"; then
566                     AC_MSG_WARN([
567 I would not find the Compiler ($perlcc) that was originally used to compile
568 your perl binary. You should either make sure that this compiler is
569 available on your system, pick an other compiler and set PERLCC
570 appropriately, or use a different perl setup that was compiled locally.
572 I will disable the compilation of the RRDs perl module for now.
573 ])
574                     COMP_PERL="perl_piped"
575                 fi
576             fi    
577         fi
578 fi
580 AC_MSG_CHECKING(Perl Modules to build)
581 AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
583 # Options to pass when configuring perl module
584 ppref=$prefix
585 test "$ppref" = "NONE" && ppref=$ac_default_prefix
587 PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
589 dnl pass additional perl options when generating Makefile from Makefile.PL
590 AC_ARG_ENABLE(perl-site-install,
591 [  --enable-perl-site-install   by default the rrdtool perl modules are installed
592                           together with rrdtool in $prefix/lib/perl. You have to
593                           put a 'use lib qw($prefix/lib/perl)' into your scripts
594                           when you want to use them. When you set this option
595                           the perl modules will get installed wherever
596                           your perl setup thinks it is best.],
597 [PERL_MAKE_OPTIONS=],[])
599 if test ! -z "$PERLCC"; then
600    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
602    if test ! -z "$PERLCCFLAGS"; then
603        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
604    fi
605    
606    if test -z "$PERLLD"; then
607        PERLLD=$PERLCC
608    fi
609    PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
610   
611    if test ! -z "$PERLLDFLAGS"; then
612        PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
613    fi
614 fi
615         
616 AC_ARG_WITH(perl-options,
617 [  --with-perl-options=[OPTIONS]  options to pass on command-line when
618                           generating Makefile from Makefile.PL. If you set this
619                           option, interesting things may happen unless you know
620                           what you are doing!],
621 [PERL_MAKE_OPTIONS=$withval])
623 AC_SUBST(PERL_MAKE_OPTIONS)
624 AC_SUBST(PERL)
625 AC_SUBST(COMP_PERL)
626 AC_SUBST(PERL_VERSION)
628 dnl Check for Ruby.
629 AC_PATH_PROG(RUBY, ruby, no)
631 AC_ARG_ENABLE(ruby,[  --disable-ruby          do not build the ruby modules],
632 [],[enable_ruby=yes])
634 AC_MSG_CHECKING(if ruby modules can be built)
636 if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
637         COMP_RUBY=
638         AC_MSG_RESULT(No .. Ruby not found or disabled)
639 else
640         if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
641                 COMP_RUBY="ruby"
642                 AC_MSG_RESULT(YES)
643         else
644                 COMP_RUBY=
645                 AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)         
646         fi                              
647 fi
650 dnl pass additional ruby options when generating Makefile from Makefile.PL
651 AC_ARG_ENABLE(ruby-site-install,
652 [  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
653                           together with rrdtool in $prefix/lib/ruby. You have to
654                           add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
655                           for ruby to find the RRD.so file.],
656 [RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir=$prefix/lib/ruby"])
658     
659 AC_ARG_WITH(ruby-options,
660 [  --with-ruby-options=[OPTIONS]  options to pass on command-line when
661                           generating Makefile from extconf.rb. If you set this
662                           option, interesting things may happen unless you know
663                           what you are doing!],
664 [RUBY_MAKE_OPTIONS=$withval])
666 AC_SUBST(RUBY_MAKE_OPTIONS)
667 AC_SUBST(RUBY)
668 AC_SUBST(COMP_RUBY)
671 enable_tcl_site=no
673 AC_ARG_ENABLE(tcl,[  --disable-tcl           do not build the tcl modules],
674 [],[enable_tcl=yes])
676 if test  "$enable_tcl" = "yes"; then
677   dnl Check for Tcl.
678   withval=""
679   AC_ARG_WITH(tcllib,[  --with-tcllib=DIR       location of the tclConfig.sh])
680   enable_tcl=no
681   for dir in $withval /usr/lib /usr/local/lib; do
682     AC_MSG_CHECKING(for tclConfig.sh in $dir)
683     if test -f "$dir/tclConfig.sh" ; then
684         tcl_config=$dir/tclConfig.sh
685         enable_tcl=yes
686         AC_MSG_RESULT(yes)
687         break
688     else
689         AC_MSG_RESULT(no)
690     fi
691   done
693   if test "$enable_tcl" = "no"; then
694         AC_MSG_WARN([tclConfig.sh not found - Tcl interface won't be built])
695   else
696         . $tcl_config
697         TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
698   fi
699   AC_ARG_ENABLE(tcl,[  --enable-tcl-site        install the tcl extension in the tcl tree],
700   [],[enable_tcl_site=yes])
702 fi
704 AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
705 AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
707 AC_SUBST(TCL_PREFIX)
708 AC_SUBST(TCL_SHLIB_CFLAGS)
709 AC_SUBST(TCL_SHLIB_LD)
710 AC_SUBST(TCL_SHLIB_SUFFIX)
711 AC_SUBST(TCL_PACKAGE_PATH)
712 AC_SUBST(TCL_LD_SEARCH_FLAGS)
713 AC_SUBST(TCL_STUB_LIB_SPEC)
714 AC_SUBST(TCL_VERSION)
715 AC_SUBST(TCL_PACKAGE_DIR)
717 AC_ARG_ENABLE(python,[  --disable-python        do not build the python modules],
718 [],[enable_python=yes])
720 if test  "$enable_python" = "yes"; then
721 dnl Check for python
722 AM_PATH_PYTHON(2.3,[],[enable_python=no])
723 AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
724 fi
726 if test  x$enable_python = xno; then
727         COMP_PYTHON=
728 else
729         COMP_PYTHON="python"
730 fi
732 AC_SUBST(COMP_PYTHON)
734 dnl Check for nroff
735 AC_PATH_PROGS(NROFF, gnroff nroff)
736 AC_PATH_PROGS(TROFF, groff troff)
738 AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory])
739 if test -z "$RRDDOCDIR"; then
740    RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
743 CONFIGURE_PART(Apply Configuration Information)
744  
745 AC_CONFIG_FILES([examples/shared-demo.pl])
746 AC_CONFIG_FILES([examples/piped-demo.pl])
747 AC_CONFIG_FILES([examples/stripes.pl])
748 AC_CONFIG_FILES([examples/bigtops.pl])
749 AC_CONFIG_FILES([examples/minmax.pl])
750 AC_CONFIG_FILES([examples/4charts.pl])
751 AC_CONFIG_FILES([examples/perftest.pl])
752 AC_CONFIG_FILES([examples/Makefile])
753 AC_CONFIG_FILES([doc/Makefile])
754 AC_CONFIG_FILES([src/Makefile])
755 AC_CONFIG_FILES([bindings/Makefile])
756 AC_CONFIG_FILES([bindings/tcl/Makefile])
757 AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl])
758 AC_CONFIG_FILES([Makefile])          
760 AC_CONFIG_COMMANDS([default],[[ chmod +x examples/*.pl]],[[]])
761 AC_OUTPUT
763 AC_MSG_CHECKING(in)
764 AC_MSG_RESULT(and out again)
766 echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
767 sleep 1
768 echo $ECHO_N ".$ECHO_C" 1>&6
769 sleep 1
770 echo $ECHO_N ".$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 AC_MSG_RESULT([ just kidding ;-)])
777 echo
778 echo "----------------------------------------------------------------"
779 echo "Config is DONE!"
780 echo
781 echo "          With MMAP IO: $ac_cv_func_mmap_fixed_mapped"
782 echo "          Perl Modules: $COMP_PERL"
783 echo "           Perl Binary: $PERL"
784 echo "          Perl Version: $PERL_VERSION"
785 echo "          Perl Options: $PERL_MAKE_OPTIONS"
786 echo "          Ruby Modules: $COMP_RUBY"
787 echo "           Ruby Binary: $RUBY"
788 echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
789 echo "    Build Tcl Bindings: $enable_tcl"
790 echo " Build Python Bindings: $enable_python"
791 echo "          Build rrdcgi: $enable_rrdcgi"
792 echo "       Build librrd MT: $enable_pthread"
793 echo
794 echo
795 echo "Type 'make' to compile the software and use 'make install' to "
796 echo "install everything to: $prefix."
797 echo 
798 echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
799 echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
800 echo "place an order."
801 echo 
802 echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
803 echo "----------------------------------------------------------------"