2007-07-16 17:14:45 +00:00
|
|
|
#!/usr/bin/perl
###################################################
# InspIRCd Configuration Script
#
# Copyright 2002-2007 The InspIRCd Development Team
# http://www.inspircd.org/wiki/index.php/Credits
#
# Licensed under GPL, please see the COPYING file
# for more information
#
# $Id$
#
###################################################
require 5.6.0;
use Socket;
use Cwd;
use Getopt::Long;
# Utility functions for our buildsystem
use make::utilities;
use make::configure;
use make::gnutlscert;
use make::opensslcert;
GetOptions (
'enable-gnutls' => \$opt_use_gnutls,
'rebuild' => \$opt_rebuild,
'enable-openssl' => \$opt_use_openssl,
'disable-interactive' => \$opt_nointeractive,
'with-nick-length=i' => \$opt_nick_length,
'with-channel-length=i' => \$opt_chan_length,
'with-max-clients=i' => \$opt_maxclients,
'enable-ports' => \$opt_ports,
'enable-epoll' => \$opt_epoll,
'enable-kqueue' => \$opt_kqueue,
'disable-ports' => \$opt_noports,
'disable-epoll' => \$opt_noepoll,
'disable-kqueue' => \$opt_nokqueue,
'enable-ipv6' => \$opt_ipv6,
'enable-remote-ipv6' => \$opt_ipv6links,
'disable-remote-ipv6' => \$opt_noipv6links,
'with-cc=s' => \$opt_cc,
'with-ident-length=i' => \$opt_ident,
'with-quit-length=i' => \$opt_quit,
'with-topic-length=i' => \$opt_topic,
'with-maxbuf=i' => \$opt_maxbuf,
'with-kick-length=i' => \$opt_kick,
'with-gecos-length=i' => \$opt_gecos,
'with-away-length=i' => \$opt_away,
'with-max-modes=i' => \$opt_modes,
'prefix=s' => \$opt_base_dir,
'config-dir=s' => \$opt_config_dir,
'module-dir=s' => \$opt_module_dir,
'binary-dir=s' => \$opt_binary_dir,
'library-dir=s' => \$opt_library_dir,
'disable-debuginfo' => sub { $opt_disable_debug = 1 },
'help' => sub { showhelp(); },
'modupdate' => sub { modupdate(); },
'update' => sub { update(); },
'svnupdate' => sub { svnupdate(); },
'clean' => sub { clean(); },
);
my $non_interactive = (
(defined $opt_library_dir) ||
(defined $opt_base_dir) ||
(defined $opt_config_dir) ||
(defined $opt_module_dir) ||
(defined $opt_base_dir) ||
(defined $opt_binary_dir) ||
(defined $opt_nointeractive) ||
(defined $opt_away) ||
(defined $opt_gecos) ||
(defined $opt_kick) ||
(defined $opt_maxclients) ||
(defined $opt_modes) ||
(defined $opt_topic) ||
(defined $opt_quit) ||
(defined $opt_ident) ||
(defined $opt_cc) ||
(defined $opt_ipv6) ||
(defined $opt_ipv6links) ||
(defined $opt_noipv6links) ||
(defined $opt_kqueue) ||
(defined $opt_epoll) ||
(defined $opt_ports) ||
(defined $opt_maxchans) ||
(defined $opt_opermaxchans) ||
(defined $opt_chan_length) ||
(defined $opt_nick_length) ||
(defined $opt_use_openssl) ||
(defined $opt_nokqueue) ||
(defined $opt_noepoll) ||
(defined $opt_noports) ||
(defined $opt_maxbuf) ||
(defined $opt_use_gnutls)
);
my $interactive = !$non_interactive;
chomp($topdir = getcwd());
$this = resolve_directory($topdir); # PWD, Regardless.
@modlist = (); # Declare for Module List..
%config = (); # Initiate Configuration Hash..
$config{ME} = resolve_directory($topdir); # Present Working Directory
$config{BASE_DIR} = $config{ME};
if (defined $opt_base_dir)
{
$config{BASE_DIR} = $opt_base_dir;
}
$config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
$config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
$config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
$config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
if (defined $opt_config_dir)
{
$config{CONFIG_DIR} = $opt_config_dir;
}
if (defined $opt_module_dir)
{
$config{MODULE_DIR} = $opt_module_dir;
}
if (defined $opt_binary_dir)
{
$config{BINARY_DIR} = $opt_binary_dir;
}
if (defined $opt_library_dir)
{
$config{LIBRARY_DIR} = $opt_library_dir;
}
chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
chomp($config{HAS_OPENSSL} = `pkg-config --modversion openssl 2>/dev/null`); # Openssl version
chomp($gnutls_ver = $c
|