(defined $opt_use_gnutls)
);
-our $topdir = getcwd();
our %config = read_configure_cache();
print "Checking for cache from previous configure... ";
print %config ? "found\n" : "not found\n";
-$config{BASE_DIR} = $topdir."/run";
+$config{BASE_DIR} = getcwd()."/run";
if (defined $opt_base_dir) {
$config{BASE_DIR} = $opt_base_dir;
$config{CONFIG_DIR} = '/etc/inspircd';
$config{MODULE_DIR} = '/usr/lib/inspircd';
$config{BINARY_DIR} = '/usr/sbin/';
- $config{BUILD_DIR} = $topdir."/build";
$config{DATA_DIR} = '/var/inspircd';
$config{LOG_DIR} = '/var/log/inspircd';
} else {
$config{CONFIG_DIR} = rel2abs($config{BASE_DIR}."/conf");
$config{MODULE_DIR} = rel2abs($config{BASE_DIR}."/modules");
$config{BINARY_DIR} = rel2abs($config{BASE_DIR}."/bin");
- $config{BUILD_DIR} = rel2abs($topdir."/build");
$config{DATA_DIR} = rel2abs($config{BASE_DIR}."/data");
$config{LOG_DIR} = rel2abs($config{BASE_DIR}."/logs");
}
$config{USE_OPENSSL} = "y";
}
-$config{STARTSCRIPT} = $^O eq 'darwin' ? 'org.inspircd.plist' : 'inspircd';
-
$config{CXX} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler();
if ($config{CXX} eq "") {
print "A C++ compiler could not be detected on your system!\n";
# Clear the screen.
system 'tput', 'clear';
- my $revision = get_revision();
- chomp(my $version = `sh src/version.sh`);
+ my %version = get_version();
# Display Introduction Message..
print <<"STOP" ;
-Welcome to the \e[1mInspIRCd\e[0m Configuration program! (\e[1minteractive mode\e[0m)
+Welcome to the \e[1mInspIRCd\e[0m configuration program! (\e[1minteractive mode\e[0m)
\e[1mPackage maintainers: Type ./configure --help for non-interactive help\e[0m
*** If you are unsure of any of these values, leave it blank for ***
Your operating system is: \e[1;32m$^O\e[0m
STOP
print "Your InspIRCd version is: \e[1;32m";
- print $revision eq 'release' ? substr($version, 9) : substr($revision, 1);
+ print "$version{MAJOR}.$version{MINOR}.$version{PATCH}+$version{LABEL}";
print "\e[0m\n\n";
print "The following compiler has been detected: \e[1;32m$cxx{NAME} $cxx{VERSION}\e[0m ($config{CXX})\n\n";
# Check that the user actually wants this version.
- if (index($version, '+') != -1) {
+ if ($version{LABEL} ne 'release') {
print <<"EOW" ;
\e[1;31mWARNING!\e[0m You are building a development version. This contains code which has
not been tested as heavily and may contain various faults which could seriously
$config{DATA_DIR} = prompt_dir(1, 'In what directory are variable data files to be stored?', $config{DATA_DIR});
$config{LOG_DIR} = prompt_dir(1, 'In what directory are log files to be stored?', $config{LOG_DIR});
$config{MODULE_DIR} = prompt_dir(1, 'In what directory are the modules to be placed?', $config{MODULE_DIR});
- $config{BUILD_DIR} = prompt_dir(1, 'In what directory do you want the build to take place?', $config{BUILD_DIR});
my $chose_hiperf = 0;
if ($config{HAS_KQUEUE}) {
if (($config{USE_GNUTLS}) && ($config{HAS_GNUTLS} ne "y"))
{
- print "Sorry, but i couldn't detect gnutls. Make sure pkg-config is in your path.\n";
+ print "Sorry, but I couldn't detect GnuTLS. Make sure pkg-config is in your path.\n";
exit 1;
}
if (($config{USE_OPENSSL}) && ($config{HAS_OPENSSL} ne "y"))
{
- print "Sorry, but i couldn't detect openssl. Make sure pkg-config is in your path.\n";
+ print "Sorry, but I couldn't detect OpenSSL. Make sure pkg-config is in your path.\n";
exit 1;
}
print "Done.\n\n";
}
} else {
- print "SSL Certificates found, skipping.\n\n"
+ print "SSL certificates found, skipping.\n\n"
}
} else {
print "Skipping SSL certificate generation in non-interactive mode.\n\n";
print "Writing \e[1;32m.config.cache\e[0m ...\n";
write_configure_cache(%config);
-writefiles();
+parse_templates(\%config, \%cxx);
dump_hash();
print "\n";
if ($config{USE_GNUTLS} || $config{USE_OPENSSL}) {
print "Please note: for \e[1;32mSSL support\e[0m you will need to load required\n";
print "modules in your config. This configure script has added those modules to the\n";
- print "build process. For more info please refer to:\n";
+ print "build process. For more info, please refer to:\n";
print "\e[1;32mhttp://wiki.inspircd.org/Installation_From_Tarball\e[0m\n";
}
print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n";
-sub writefiles {
- chomp(my $incos = `uname -n -s -r`);
- chomp(my $version = `sh src/version.sh`);
- my $revision = get_revision();
- my $branch = "InspIRCd-0.0";
- if ($version =~ /^(InspIRCd-[0-9]+\.[0-9]+)\.[0-9]+/)
- {
- $branch = $1;
- }
- print "Writing \e[1;32mconfig.h\e[0m\n";
- open(FILEHANDLE, ">include/config.h.tmp");
- print FILEHANDLE <<EOF;
-/* Auto generated by configure, do not modify! */
-#pragma once
-
-#define BRANCH "$branch"
-#define VERSION "$version"
-#define REVISION "$revision"
-#define SYSTEM "$incos"
-#define INSPIRCD_SOCKETENGINE_NAME "$config{SOCKETENGINE}"
-
-#define CONFIG_PATH "$config{CONFIG_DIR}"
-#define DATA_PATH "$config{DATA_DIR}"
-#define LOG_PATH "$config{LOG_DIR}"
-#define MOD_PATH "$config{MODULE_DIR}"
-
-EOF
-
- if ($config{HAS_EVENTFD}) {
- print FILEHANDLE "#define HAS_EVENTFD\n";
- }
- if ($config{HAS_CLOCK_GETTIME}) {
- print FILEHANDLE "#define HAS_CLOCK_GETTIME\n";
- }
-
- print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n";
- close(FILEHANDLE);
-
- unlink 'include/config.h';
- rename 'include/config.h.tmp', 'include/config.h';
-
- # Do this once here, and cache it in the .*.inc files,
- # rather than attempting to read src/version.sh from
- # compiled code -- we might not have the source to hand.
-
- my @dotfiles = qw(main.mk inspircd);
- push @dotfiles, 'org.inspircd.plist' if $^O eq 'darwin';
-
- foreach my $file (@dotfiles) {
- open(FILEHANDLE, "make/template/$file") or die "Can't open make/template/$file: $!";
- $_ = join '', <FILEHANDLE>;
- close(FILEHANDLE);
-
- $config{BUILD_DIR} ||= rel2abs($topdir."/build");
- $config{COMPILER} = lc $cxx{NAME};
- $config{SYSTEM} = lc $^O;
-
- for my $var (qw(
- CXX COMPILER SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR DATA_DIR UID
- STARTSCRIPT SOCKETENGINE
- )) {
- s/\@$var\@/$config{$var}/g;
- }
-
- s/\@VERSION\@/$version/ if defined $version;
-
- if ($file eq 'main.mk') {
- print "Writing \e[1;32mGNUmakefile\e[0m ...\n";
-
- my $mk_tmp = $_;
- s/\@IFDEF (\S+)/ifdef $1/g;
- s/\@IFNDEF (\S+)/ifndef $1/g;
- s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g;
- s/\@IFNEQ (\S+) (\S+)/ifneq ($1,$2)/g;
- s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g;
- s/\@ELSE/else/g;
- s/\@ENDIF/endif/g;
- s/ *\@BSD_ONLY .*\n//g;
- s/\@GNU_ONLY //g;
- s/\@DO_EXPORT (.*)/export $1/g;
- open MKF, '>GNUmakefile' or die "Can't write to GNUmakefile: $!";
- print MKF $_;
- close MKF;
-
- print "Writing \e[1;32mBSDmakefile\e[0m ...\n";
- $_ = $mk_tmp;
- s/\@IFDEF (\S+)/.if defined($1)/g;
- s/\@IFNDEF (\S+)/.if !defined($1)/g;
- s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g;
- s/\@IFNEQ (\S+) (\S+)/.if $1 != $2/g;
- s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g;
- s/\@ELSE/.else/g;
- s/\@ENDIF/.endif/g;
- s/\@BSD_ONLY //g;
- s/ *\@GNU_ONLY .*\n//g;
- $mk_tmp = $_;
- $mk_tmp =~ s#\@DO_EXPORT (.*)#"MAKEENV += ".join ' ', map "$_='\${$_}'", split /\s/, $1#eg;
- open MKF, '>BSDmakefile' or die "Can't write to BSDmakefile: $!";
- print MKF $mk_tmp;
- close MKF;
- } else {
- print "Writing \e[1;32m$file\e[0m ...\n";
- open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n");
- print FILEHANDLE $_;
- close(FILEHANDLE);
- }
- }
-
- chmod 0750, 'inspircd';
-}
-
# Routine to list out the extra/ modules that have been enabled.
# Note: when getting any filenames out and comparing, it's important to lc it if the
# file system is not case-sensitive (== Epoc, MacOS, OS/2 (incl DOS/DJGPP), VMS, Win32