+AC_MSG_CHECKING(Perl Modules to build)
+AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
+
+# Options to pass when configuring perl module
+ppref=$prefix
+test "$ppref" = "NONE" && ppref=$ac_default_prefix
+
+PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
+
+dnl pass additional perl options when generating Makefile from Makefile.PL
+AC_ARG_ENABLE(perl-site-install,
+[ --enable-perl-site-install by default the rrdtool perl modules are installed
+ together with rrdtool in $prefix/lib/perl. You have to
+ put a 'use lib qw($prefix/lib/perl)' into your scripts
+ when you want to use them. When you set this option
+ the perl modules will get installed wherever
+ your perl setup thinks it is best.],
+[PERL_MAKE_OPTIONS=],[])
+
+if test ! -z "$PERLCC"; then
+ PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
+
+ if test ! -z "$PERLCCFLAGS"; then
+ PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
+ fi
+
+ if test -z "$PERLLD"; then
+ PERLLD=$PERLCC
+ fi
+ PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
+
+ if test ! -z "$PERLLDFLAGS"; then
+ PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
+ fi
+fi
+
+AC_ARG_WITH(perl-options,
+[ --with-perl-options=[OPTIONS] options to pass on command-line when
+ generating Makefile from Makefile.PL. If you set this
+ option, interesting things may happen unless you know
+ what you are doing!],
+[PERL_MAKE_OPTIONS=$withval])
+
+AC_SUBST(PERL_MAKE_OPTIONS)
+AC_SUBST(PERL)
+AC_SUBST(COMP_PERL)
+AC_SUBST(PERL_VERSION)
+
+dnl Check for Ruby.
+AC_PATH_PROG(RUBY, ruby, no)
+
+AC_ARG_ENABLE(ruby,[ --disable-ruby do not build the ruby modules],
+[],[enable_ruby=yes])
+
+AC_MSG_CHECKING(if ruby modules can be built)
+
+if test "x$RUBY" = "xno" -o x$enable_ruby = xno; then
+ COMP_RUBY=
+ AC_MSG_RESULT(No .. Ruby not found or disabled)
+else
+ if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
+ COMP_RUBY="ruby"
+ AC_MSG_RESULT(YES)
+ else
+ COMP_RUBY=
+ AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)
+ fi
+fi
+
+
+dnl pass additional ruby options when generating Makefile from Makefile.PL
+AC_ARG_ENABLE(ruby-site-install,
+[ --enable-ruby-site-install by default the rrdtool ruby modules are installed
+ together with rrdtool in $prefix/lib/ruby. You have to
+ add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
+ for ruby to find the RRD.so file.],
+[RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir="'$(DESTDIR)'"$prefix/lib/ruby"])
+
+
+AC_ARG_WITH(ruby-options,
+[ --with-ruby-options=[OPTIONS] options to pass on command-line when
+ generating Makefile from extconf.rb. If you set this
+ option, interesting things may happen unless you know
+ what you are doing!],
+[RUBY_MAKE_OPTIONS=$withval])
+
+AC_SUBST(RUBY_MAKE_OPTIONS)
+AC_SUBST(RUBY)
+AC_SUBST(COMP_RUBY)
+
+
+enable_tcl_site=no
+
+AC_ARG_ENABLE(tcl,[ --disable-tcl do not build the tcl modules],
+[],[enable_tcl=yes])
+
+if test "$enable_tcl" = "yes"; then
+ dnl Check for Tcl.
+ withval=""
+ AC_ARG_WITH(tcllib,[ --with-tcllib=DIR location of the tclConfig.sh])
+ enable_tcl=no
+ for dir in $withval /usr/lib /usr/local/lib /usr/lib/tcl8.4 /usr/lib/tcl8.3 ; do
+ AC_MSG_CHECKING(for tclConfig.sh in $dir)
+ if test -f "$dir/tclConfig.sh" ; then
+ tcl_config=$dir/tclConfig.sh
+ enable_tcl=yes
+ AC_MSG_RESULT(yes)
+ break
+ else
+ AC_MSG_RESULT(no)
+ fi
+ done
+
+ if test "$enable_tcl" = "no"; then
+ AC_MSG_WARN([tclConfig.sh not found - Tcl interface will not be built])
+ else
+ . $tcl_config
+ TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
+ if test -n "$TCL_INC_DIR"; then
+ TCL_INCLUDE_SPEC="$TCL_INCLUDE_SPEC -I$TCL_INC_DIR"
+ fi
+ fi
+ AC_ARG_ENABLE(tcl,[ --enable-tcl-site install the tcl extension in the tcl tree],
+ [],[enable_tcl_site=yes])
+
+fi
+
+AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
+AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
+
+
+AC_SUBST(TCL_PREFIX)
+AC_SUBST(TCL_SHLIB_CFLAGS)
+AC_SUBST(TCL_SHLIB_LD)
+AC_SUBST(TCL_SHLIB_SUFFIX)
+AC_SUBST(TCL_PACKAGE_PATH)
+AC_SUBST(TCL_LD_SEARCH_FLAGS)
+AC_SUBST(TCL_STUB_LIB_SPEC)
+AC_SUBST(TCL_VERSION)
+AC_SUBST(TCL_PACKAGE_DIR)
+AC_SUBST(TCL_INCLUDE_SPEC)
+
+AC_ARG_ENABLE(python,[ --disable-python do not build the python modules],
+[],[enable_python=yes])
+
+if test "$enable_python" = "yes"; then
+dnl Check for python
+AM_PATH_PYTHON(2.3,[],[enable_python=no])
+AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
+fi
+
+if test x$enable_python = xno; then
+ COMP_PYTHON=
+else
+ COMP_PYTHON="python"
+fi