-$config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/;
-$config{HAS_OPENSSL} = $1;
+if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/) {
+ $config{HAS_OPENSSL} = $1;
+} else {
+ $config{HAS_OPENSSL} = "";
+}
if ($config{GCCVER} eq "") {
print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
if ($config{GCCVER} eq "") {
print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
- print "
-Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
-\033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
+ print <<"STOP" ;
+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 ***
*** standard settings that will work, and your server will run ***
*** using them. Please consult your IRC network admin if in doubt. ***
*** If you are unsure of any of these values, leave it blank for ***
*** standard settings that will work, and your server will run ***
*** using them. Please consult your IRC network admin if in doubt. ***
-Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
-a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
+Press \e[1m<RETURN>\e[0m to accept the default for any option, or enter
+a new value. Please note: You will \e[1mHAVE\e[0m to read the docs
-Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
-Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
-Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
+Your operating system is: \e[1;32m$config{OSNAME}\e[0m ($wholeos)
+Maximum file descriptors: \e[1;32m$config{MAX_CLIENT_T}\e[0m
+Your InspIRCd revision ID is \e[1;32mr$rev\e[0m
+STOP
should NOT be used. You should probably specify a newer compiler.\n\n";
yesno('CHANGE_COMPILER',"Do you want to change the compiler?");
if ($config{CHANGE_COMPILER} =~ /y/i) {
print "What command do you want to use to invoke your compiler?\n";
should NOT be used. You should probably specify a newer compiler.\n\n";
yesno('CHANGE_COMPILER',"Do you want to change the compiler?");
if ($config{CHANGE_COMPILER} =~ /y/i) {
print "What command do you want to use to invoke your compiler?\n";
chomp(my $foo = `$config{CC} -dumpversion | cut -c 1`);
if ($foo ne "") {
chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
chomp(my $foo = `$config{CC} -dumpversion | cut -c 1`);
if ($foo ne "") {
chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
- yesno('SUPPORT_IP6LINKS',"You have chosen to build an \033[1;32mIPV4-only\033[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers?\nIf you are using a recent operating\nsystem and are unsure, answer yes.\nIf you answer 'no' here, your InspIRCd server will be unable\nto parse IPV6 addresses (e.g. for CIDR bans)");
+ yesno('SUPPORT_IP6LINKS',"You have chosen to build an \e[1;32mIPV4-only\e[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers?\nIf you are using a recent operating\nsystem and are unsure, answer yes.\nIf you answer 'no' here, your InspIRCd server will be unable\nto parse IPV6 addresses (e.g. for CIDR bans)");
print "I will default to GnuTLS. If you wish to use OpenSSL\n";
print "instead, you should enable the OpenSSL module yourself\n";
print "by copying it from src/modules/extra to src/modules.\n\n";
print "I will default to GnuTLS. If you wish to use OpenSSL\n";
print "instead, you should enable the OpenSSL module yourself\n";
print "by copying it from src/modules/extra to src/modules.\n\n";
- print "Detected GnuTLS version: \033[1;32m" . $gnutls_ver . "\033[0m\n";
- print "Detected OpenSSL version: \033[1;32m" . $openssl_ver . "\033[0m\n\n";
+ print "Detected GnuTLS version: \e[1;32m" . $gnutls_ver . "\e[0m\n";
+ print "Detected OpenSSL version: \e[1;32m" . $openssl_ver . "\e[0m\n\n";
- $failed = 0;
- open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
- close(TMP);
- open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
- close(TMP);
- if ($failed) {
+ unless (-r "$config{CONFIG_DIR}/key.pem" && -r "$config{CONFIG_DIR}/cert.pem") {
print "SSL Certificates Not found, Generating.. \n\n
*************************************************************
* Generating the Private Key may take some time, go grab a *
print "SSL Certificates Not found, Generating.. \n\n
*************************************************************
* Generating the Private Key may take some time, go grab a *
- system("mv key.pem $config{CONFIG_DIR}/key.pem");
- system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
+ File::Copy::move("key.pem", "$config{CONFIG_DIR}/key.pem") or print STDERR "Could not copy key.pem!\n";
+ File::Copy::move("cert.pem", "$config{CONFIG_DIR}/cert.pem") or print STDERR "Could not copy cert.pem!\n";
print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
}
} elsif ($config{USE_OPENSSL} eq "y") {
print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
}
} elsif ($config{USE_OPENSSL} eq "y") {
- open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
- close(TMP);
- open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
- close(TMP);
- if ($failed) {
+ unless (-r "$config{CONFIG_DIR}/key.pem" && -r "$config{CONFIG_DIR}/cert.pem") {
print "SSL Certificates Not found, Generating.. \n\n
*************************************************************
* Generating the certificates may take some time, go grab a *
print "SSL Certificates Not found, Generating.. \n\n
*************************************************************
* Generating the certificates may take some time, go grab a *
*************************************************************\n\n";
make_openssl_cert();
print "\nCertificate generation complete, copying to config directory... ";
*************************************************************\n\n";
make_openssl_cert();
print "\nCertificate generation complete, copying to config directory... ";
- system("mv key.pem $config{CONFIG_DIR}/key.pem");
- system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
- system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
+ File::Copy::move("key.pem", "$config{CONFIG_DIR}/key.pem") or print STDERR "Could not copy key.pem!\n";
+ File::Copy::move("cert.pem", "$config{CONFIG_DIR}/cert.pem") or print STDERR "Could not copy cert.pem!\n";
+ File::Copy::move("dhparams.pem", "$config{CONFIG_DIR}/dhparams.pem") or print STDERR "Could not copy dhparams.pem!\n";
print "load the required modules in your config. This configure process\n";
print "has just prepared these modules to be compiled for you, and has not\n";
print "configured them to be compiled into the core of the ircd.\n";
}
print "load the required modules in your config. This configure process\n";
print "has just prepared these modules to be compiled for you, and has not\n";
print "configured them to be compiled into the core of the ircd.\n";
}
- print "\033[1;32mWARNING!\033[0m You are running OpenBSD but you are using the base gcc package\nrather than eg++. This compile will most likely fail, but i'm letting you\ngo ahead with it anyway, just in case i'm wrong :-)\n";
+ print "\e[1;32mWARNING!\e[0m You are running OpenBSD but you are using the base gcc package\nrather than eg++. This compile will most likely fail, but i'm letting you\ngo ahead with it anyway, just in case i'm wrong :-)\n";
GCC 2.x series compilers only had partial (read as broken) C++ support, and
your compile will most likely fail horribly! If you have any problems, do NOT
report them to the bugtracker or forums without first upgrading your compiler
GCC 2.x series compilers only had partial (read as broken) C++ support, and
your compile will most likely fail horribly! If you have any problems, do NOT
report them to the bugtracker or forums without first upgrading your compiler
open(FILEHANDLE, ">.config.cache");
foreach my $key (keys %config) {
print FILEHANDLE "$key=\"$config{$key}\"\n";
open(FILEHANDLE, ">.config.cache");
foreach my $key (keys %config) {
print FILEHANDLE "$key=\"$config{$key}\"\n";
chomp(my $tmp = <STDIN>);
if (($tmp eq "") || ($tmp =~ /^y/i)) {
# Attempt to Create the Dir..
chomp(my $tmp = <STDIN>);
if (($tmp eq "") || ($tmp =~ /^y/i)) {
# Attempt to Create the Dir..
-
- system("mkdir -p \"$var\" >> /dev/null 2>&1");
- my $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
- if ($chk != 0) {
+ my $chk = eval {
+ use File::Path ();
+ File::Path::mkpath($var, 0, 0777);
+ 1;
+ };
+ unless (defined($chk) && -d $var) {
- $config{LDLIBS} = "-lstdc++";
- $config{FLAGS} = "-fPIC -Wall $config{OPTIMISATI}";
- $config{DEVELOPER} = "-fPIC -Wall -g";
+ $config{LDLIBS} = "-pthread -lstdc++";
+ $config{FLAGS} = "-fPIC -Wshadow -Wall $config{OPTIMISATI}";
+ $config{DEVELOPER} = "-fPIC -Wshadow -Wall -g";
$SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared" unless defined $opt_disablerpath;
$config{MAKEPROG} = "make";
if ($config{OSNAME} =~ /darwin/i) {
$config{FLAGS} = "-DDARWIN -frtti -fPIC -Wall $config{OPTIMISATI}";
$SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
$SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared" unless defined $opt_disablerpath;
$config{MAKEPROG} = "make";
if ($config{OSNAME} =~ /darwin/i) {
$config{FLAGS} = "-DDARWIN -frtti -fPIC -Wall $config{OPTIMISATI}";
$SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
$config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
$config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
$config{MAKEPROG} = "make";
$config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
$config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
$config{MAKEPROG} = "make";
# rt = POSIX realtime extensions
# resolv = inet_aton only (why isnt this in nsl?!)
$config{MAKEPROG} = "gmake";
# rt = POSIX realtime extensions
# resolv = inet_aton only (why isnt this in nsl?!)
$config{MAKEPROG} = "gmake";
open(FILEHANDLE, ">include/inspircd_config.h");
my $NL = $config{NICK_LENGT}+1;
my $CL = $config{CHAN_LENGT}+1;
open(FILEHANDLE, ">include/inspircd_config.h");
my $NL = $config{NICK_LENGT}+1;
my $CL = $config{CHAN_LENGT}+1;
# We can actually parse any file starting with . and ending with .inc,
# but right now we only parse .inspircd.inc to form './inspircd'
# We can actually parse any file starting with . and ending with .inc,
# but right now we only parse .inspircd.inc to form './inspircd'
$tmp =~ s/\@CC\@/$config{CC}/ if defined $config{CC};
$tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/ if defined $config{MAKEPROG};
$tmp =~ s/\@FLAGS\@/$config{FLAGS}/ if defined $config{FLAGS};
$tmp =~ s/\@CC\@/$config{CC}/ if defined $config{CC};
$tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/ if defined $config{MAKEPROG};
$tmp =~ s/\@FLAGS\@/$config{FLAGS}/ if defined $config{FLAGS};
# A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) {
read_module_directory("src/modules/$name", $name);
# A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) {
read_module_directory("src/modules/$name", $name);
print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $mobjs\n";
if ($config{IS_DARWIN} eq "YES") {
print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $mobjs\n";
if ($config{IS_DARWIN} eq "YES") {
foreach my $dir (("src","src/commands","src/modes","src/socketengines","src/modules"))
{
foreach my $dir (("src","src/commands","src/modes","src/socketengines","src/modules"))
{
opendir(DIRHANDLE, $dir);
foreach my $name (sort readdir(DIRHANDLE))
{
opendir(DIRHANDLE, $dir);
foreach my $name (sort readdir(DIRHANDLE))
{
- chomp($line);
- die ("\$If buildsystem instruction within another \$If in file $dir/$name") if ($line =~ /\/\* \$If: (\w+) \*\//i);
- last if ($line =~ /\/\* \$EndIf \*\//i);
+ # Skip to 'endif'
+ while (defined($line = <CPP>))
+ {
+ chomp($line);
+ die ("\$If buildsystem instruction within another \$If in file $dir/$name") if ($line =~ /\/\* \$If: (\w+) \*\//i);
+ last if ($line =~ /\/\* \$EndIf \*\//i);
+ }
foreach my $cmd (@cmdlist) {
print FH <<ITEM;
cmd_$cmd.so: cmd_$cmd.cpp ../../include/base.h ../../include/modules.h ../../include/inspircd.h ../../include/channels.h ../../include/users.h ../../include/globals.h ../../include/inspircd_config.h ../../include/commands/cmd_$cmd.h
foreach my $cmd (@cmdlist) {
print FH <<ITEM;
cmd_$cmd.so: cmd_$cmd.cpp ../../include/base.h ../../include/modules.h ../../include/inspircd.h ../../include/channels.h ../../include/users.h ../../include/globals.h ../../include/inspircd_config.h ../../include/commands/cmd_$cmd.h
- \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
- \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
+ \@../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
+ \@../../make/run-cc.pl \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
-# \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
-# \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
+# @../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
+# @../../make/run-cc.pl \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
my $extrapath = "src/modules/extra/$extra";
if (!-e $extrapath) {
print STDERR "Cannot enable \e[32;1m$extra\e[0m : No such file or directory in src/modules/extra\n";
my $extrapath = "src/modules/extra/$extra";
if (!-e $extrapath) {
print STDERR "Cannot enable \e[32;1m$extra\e[0m : No such file or directory in src/modules/extra\n";