summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-17 21:36:02 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-17 21:36:02 +0000
commit207af6fb2fede5788d2e99809b5b36d11aefa706 (patch)
treed95334bd048c41c7ddb0f29b8b7bee735b3776e3
parent89fffcee883763cff9d8d44605a54db1ec22feed (diff)
Aquanight's configure strict/fatal warnings patch
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8731 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xconfigure200
-rw-r--r--make/configure.pm23
-rw-r--r--make/gnutlscert.pm5
-rw-r--r--make/opensslcert.pm5
-rw-r--r--make/utilities.pm50
5 files changed, 167 insertions, 116 deletions
diff --git a/configure b/configure
index a13f59c81..07099c466 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,16 @@
###################################################
require 5.8.0;
+
+use strict;
+use warnings FATAL => qw(all);
+
+use Data::Dumper;
+BEGIN {
+ $Data::Dumper::Sortkeys = 1;
+ $Data::Dumper::Useqq = 1;
+};
+
use Socket;
use Cwd;
use Getopt::Long;
@@ -31,14 +41,14 @@ use make::opensslcert;
# If you wish to ignore a dependency throughout the entire core, add it here.
-my @ignoredeps = (
+our @ignoredeps = (
"inspircd_win32wrapper.h", # windows has its own configure program
);
# If you wish for all files in the entire core to have a given dependency, insert it here.
# You should keep this to an absolute minimum to avoid rebuilds that are not neccessary.
-my @immutabledeps = (
+our @immutabledeps = (
"inspircd_config.h", # auto re-generated by configure
"inspircd.h",
);
@@ -51,38 +61,47 @@ my @immutabledeps = (
# List of commands that make up 'make install' and 'make deinstall'
-my $install_list = "";
-my $uninstall_list = "";
+our $install_list = "";
+our $uninstall_list = "";
# This is a list of all files in the core. Each cpp file is mapped to a shared object file,
# whos file extension is omitted (these can vary from system to system). Auto detected by
# scanning the src/*.cpp files for files containing /* $Core: */ identifiers.
-my %filelist = ();
+our %filelist = ();
# If you wish for a file to have special dependencies in the makefile, add an entry here.
# Auto populated by /* $ExtraDeps: */ instruction
-my %specialdeps = ();
+our %specialdeps = ();
# If you wish for a file to have extra make lines (in between the compile and link steps)
# then insert them here.
# Auto populated by /* $ExtraBuild: */ instruction
-my %extrabuildlines = ();
+our %extrabuildlines = ();
# If you wish for a file to be linked against extra objects or arctives, insert them here.
# Auto populated by /* $ExtraObjects: */ instruction
-my %extraobjects = ();
+our %extraobjects = ();
# If you wish to compile extra cpp sources into an object, define them here.
# NOTE: Certain cpp files such as the socket engines have a value auto calculated
# for this table so that their derived class is built.
# Auto populated by /* $ExtraSources: */ instruction
-my %extrasources = ();
+our %extrasources = ();
+our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_nick_length,
+ $opt_chan_length, $opt_maxclients, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports,
+ $opt_noepoll, $opt_nokqueue, $opt_disablerpath, $opt_ipv6, $opt_ipv6links,
+ $opt_noipv6links, $opt_ident, $opt_quit, $opt_topic, $opt_maxbuf, $opt_kick,
+ $opt_gecos, $opt_away, $opt_modes, $opt_disable_debug, $opt_maxchans,
+ $opt_opermaxchans);
+
+our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir,
+ $opt_library_dir);
GetOptions (
'enable-gnutls' => \$opt_use_gnutls,
@@ -124,7 +143,7 @@ GetOptions (
'clean' => sub { clean(); },
);
-my $non_interactive = (
+our $non_interactive = (
(defined $opt_library_dir) ||
(defined $opt_base_dir) ||
(defined $opt_config_dir) ||
@@ -158,13 +177,12 @@ my $non_interactive = (
(defined $opt_maxbuf) ||
(defined $opt_use_gnutls)
);
-my $interactive = !$non_interactive;
-
+our $interactive = !$non_interactive;
-chomp($topdir = getcwd());
-$this = resolve_directory($topdir); # PWD, Regardless.
-@modlist = (); # Declare for Module List..
-%config = (); # Initiate Configuration Hash..
+chomp(our $topdir = getcwd());
+our $this = resolve_directory($topdir); # PWD, Regardless.
+our @modlist = (); # Declare for Module List..
+our %config = (); # Initiate Configuration Hash..
$config{ME} = resolve_directory($topdir); # Present Working Directory
$config{BASE_DIR} = $config{ME};
@@ -197,8 +215,8 @@ if (defined $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 = $config{HAS_GNUTLS});
-chomp($openssl_ver = $config{HAS_OPENSSL});
+chomp(our $gnutls_ver = $config{HAS_GNUTLS});
+chomp(our $openssl_ver = $config{HAS_OPENSSL});
$config{USE_GNUTLS} = "n";
if (defined $opt_use_gnutls)
{
@@ -300,7 +318,7 @@ if (defined $opt_cc)
{
$config{CC} = $opt_cc;
}
-$exec = $config{CC} . " -dumpversion | cut -c 1";
+our $exec = $config{CC} . " -dumpversion | cut -c 1";
chomp($config{GCCVER} = `$exec`); # Major GCC Version
$config{MAKEORDER} = "ircd mods"; # build order
$config{MAX_IDENT} = "12"; # max ident size
@@ -343,6 +361,7 @@ if ($config{GCCVER} eq "") {
exit;
}
+our $fd_scan_fail = "";
if (!$config{MAX_CLIENT_T}) {
$config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
$fd_scan_fail = "true"; # Used Later
@@ -356,6 +375,8 @@ sub clean
unlink(".config.cache");
}
+our ($has_epoll, $has_ports, $has_kqueue) = (0, 0, 0);
+
sub update
{
eval {
@@ -466,7 +487,7 @@ if (!$config{MAX_CLIENT}) {
printf "Checking if stdint.h exists... ";
$config{HAS_STDINT} = "true";
-my $fail = 0;
+our $fail = 0;
open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
if ($config{HAS_STDINT} eq "true") {
close(STDINT);
@@ -474,14 +495,14 @@ if ($config{HAS_STDINT} eq "true") {
print "yes\n" if $config{HAS_STDINT} eq "true";
print "no\n" if $config{HAS_STDINT} eq "false";
-
printf "Checking if strlcpy exists... ";
# Perform the strlcpy() test..
$config{HAS_STRLCPY} = "false";
-my $fail = 0;
+$fail = 0;
open(STRLCPY, "</usr/include/string.h") or $fail = 1;
if (!$fail) {
- while (chomp($line = <STRLCPY>)) {
+ while (defined(my $line = <STRLCPY>)) {
+ chomp($line);
# try and find the delcaration of:
# size_t strlcpy(...)
if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
@@ -493,13 +514,13 @@ if (!$fail) {
print "yes\n" if $config{HAS_STRLCPY} eq "true";
print "no\n" if $config{HAS_STRLCPY} eq "false";
-
printf "Checking if kqueue exists... ";
$has_kqueue = 0;
$fail = 0;
open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
if (!$fail) {
- while (chomp($line = <KQUEUE>)) {
+ while (defiined(my $line = <KQUEUE>)) {
+ chomp($line);
# try and find the delcaration of:
# int kqueue(void);
if ($line =~ /int(\0x9|\s)+kqueue/) {
@@ -531,8 +552,8 @@ if ($has_epoll) {
# against 2.4 kernels (ick)
my $kernel_arch = `uname -p`;
chomp($kernel_arch);
- $libcv = 0.0;
- $kernelv = 0.0;
+ my $libcv = 0.0;
+ my $kernelv = 0.0;
if ($kernel_arch =~ /x86_64/) {
open (FH,"/lib64/libc.so.6|") or $has_epoll = 0;
}
@@ -541,8 +562,9 @@ if ($has_epoll) {
}
if ($has_epoll)
{
- while (chomp($line = <FH>))
+ while (defined(my $line = <FH>))
{
+ chomp($line);
if ($line =~ /GNU C Library .* version (.*?) /)
{
$libcv = $1;
@@ -576,7 +598,7 @@ print "no\n" if $has_epoll == 0;
printf "Checking if Solaris I/O completion ports are available... ";
$has_ports = 0;
-my $system = `uname -s`;
+our $system = `uname -s`;
chomp ($system);
$has_ports = 1 if ($system eq "SunOS");
@@ -614,10 +636,10 @@ if (($config{HAS_OPENSSL}) || ($config{HAS_OPENSSL} eq "y")) {
printf "Checking if you are running an ancient, unsupported OS... ";
if ($config{OSNAME} =~ /FreeBSD/i)
{
- $version = `uname -r`;
+ my $version = `uname -r`;
if ($version =~ /^4\./)
{
- $foundit = `ls -l /usr/local/lib/libgnugetopt* | wc -l`;
+ my $foundit = `ls -l /usr/local/lib/libgnugetopt* | wc -l`;
if ($foundit > 0)
{
# ICKY ICKY ICK, FREEBSD 4.x! GET AN UPGRADE!
@@ -649,7 +671,7 @@ else
if ($interactive)
{
system("clear");
- $wholeos = $^O;
+ my $wholeos = $^O;
my $rev = getrevision();
# Display Introduction Message..
@@ -679,7 +701,7 @@ Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
should NOT be used. You should probably specify a newer compiler.\n\n";
- yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
+ 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";
print "[\033[1;32m$config{CC}\033[0m] -> ";
@@ -687,7 +709,7 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
if ($config{CC} eq "") {
$config{CC} = "g++";
}
- chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
+ 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
print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
@@ -719,31 +741,31 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
if ($has_kqueue) {
- yesno(USE_KQUEUE,"You are running a BSD operating system, and kqueue\nwas detected. Would you like to enable kqueue support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable kqueue?");
+ yesno('USE_KQUEUE',"You are running a BSD operating system, and kqueue\nwas detected. Would you like to enable kqueue support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable kqueue?");
print "\n";
}
if ($has_epoll) {
- yesno(USE_EPOLL,"You are running a Linux 2.6+ operating system, and epoll\nwas detected. Would you like to enable epoll support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable epoll?");
+ yesno('USE_EPOLL',"You are running a Linux 2.6+ operating system, and epoll\nwas detected. Would you like to enable epoll support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable epoll?");
print "\n";
}
if ($has_ports) {
- yesno(USE_PORTS,"You are running Solaris 10.\nWould you like to enable I/O completion ports support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable support for I/O completion ports?");
+ yesno('USE_PORTS',"You are running Solaris 10.\nWould you like to enable I/O completion ports support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable support for I/O completion ports?");
print "\n";
}
- $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y") || ($config{USE_PORTS} eq "y"));
+ my $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y") || ($config{USE_PORTS} eq "y"));
if (!$chose_hiperf) {
print "No high-performance socket engines are available, or you chose\n";
print "not to enable one. Defaulting to select() engine.\n\n";
}
- yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
+ yesno('IPV6',"Would you like to build InspIRCd with IPv6 support?");
print "\n";
if ($config{IPV6} eq "y") {
print "You have chosen to build an \033[1;32mIPV6-enabled\033[0m server.\nTo accept IPV4 users, you can still use IPV4 addresses\nin your port bindings..\n\n";
$config{SUPPORT_IP6LINKS} = "y";
} else {
- 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 \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)");
print "\n";
}
@@ -757,12 +779,12 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
}
if ($config{HAS_GNUTLS} eq "y") {
- yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
+ yesno('USE_GNUTLS', "Would you like to enable SSL Support?");
if ($config{USE_GNUTLS} eq "y") {
print "\nUsing GnuTLS SSL module.\n";
}
} elsif ($config{HAS_OPENSSL} eq "y") {
- yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
+ yesno('USE_OPENSSL', "Would you like to enable SSL Support?");
if ($config{USE_OPENSSL} eq "y") {
print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
}
@@ -807,6 +829,7 @@ if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
exit(0);
}
+our $failed = 0;
if ($config{USE_GNUTLS} eq "y") {
$failed = 0;
@@ -939,7 +962,7 @@ sub getcache {
# Do something with data here!
$config{$key} = $1;
}
- close(CONFIG);
+ close(CACHE);
return 1;
}
@@ -947,7 +970,7 @@ sub makecache {
# Dump the contents of %config
print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
open(FILEHANDLE, ">.config.cache");
- foreach $key (keys %config) {
+ foreach my $key (keys %config) {
print FILEHANDLE "$key=\"$config{$key}\"\n";
}
close(FILEHANDLE);
@@ -959,7 +982,7 @@ sub dir_check {
while (!$complete) {
print "In what directory $desc?\n";
print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
- chomp($var = <STDIN>);
+ chomp(my $var = <STDIN>);
if ($var eq "") {
$var = $config{$hash_key};
}
@@ -976,12 +999,12 @@ sub dir_check {
$var = resolve_directory($var);
if (! -e $var) {
print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
- chomp($tmp = <STDIN>);
+ chomp(my $tmp = <STDIN>);
if (($tmp eq "") || ($tmp =~ /^y/i)) {
# Attempt to Create the Dir..
system("mkdir -p \"$var\" >> /dev/null 2>&1");
- $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
+ my $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
if ($chk != 0) {
print "Unable to create directory. ($var)\n\n";
# Restart Loop..
@@ -1006,6 +1029,8 @@ sub dir_check {
}
}
+our $SHARED = "";
+
sub getosflags {
$config{LDLIBS} = "-lstdc++";
@@ -1023,7 +1048,7 @@ sub getosflags {
if ($config{OSNAME} =~ /OpenBSD/i) {
$config{MAKEPROG} = "gmake";
$config{LDLIBS} = $config{LDLIBS} . " -lunwind";
- chomp($foo = `eg++ -dumpversion | cut -c 1`);
+ chomp(my $foo = `eg++ -dumpversion | cut -c 1`);
# theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
# if theyre not running this, configure lets the build continue but they probably wont manage to
# compile as this standard version is 2.95.3!
@@ -1071,9 +1096,10 @@ sub getosflags {
sub writefiles {
my($writeheader) = @_;
+ my $se = "";
# First File.. inspircd_config.h
chomp(my $incos = `uname -n -s -r`);
- chomp($version = `sh src/version.sh`);
+ chomp(my $version = `sh src/version.sh`);
chomp(my $revision2 = getrevision());
if ($writeheader == 1)
{
@@ -1178,16 +1204,16 @@ EOF
# Create a Modules List..
my $modules = "";
- foreach $i (@modlist)
+ foreach my $i (@modlist)
{
$modules .= "m_".$i.".so ";
}
chomp($modules); # Remove Redundant whitespace..
opendir(DIRHANDLE, "src/modules");
- foreach $name (sort readdir(DIRHANDLE)) {
+ foreach my $name (sort readdir(DIRHANDLE)) {
if ($name =~ /^m_(.+?)$/) {
- if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
+ if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) {
closedir(MDIRHANDLE);
$modules .= "$name.so ";
$uninstall_list = $uninstall_list . " -rm \$(MODULES)/$name.so\n";
@@ -1207,7 +1233,7 @@ EOF
# compiled code -- we might not have the source to hand.
# Fix for bug#177 by Brain.
- chomp(my $version = `sh ./src/version.sh`);
+ chomp($version = `sh ./src/version.sh`);
chomp(my $revision = getrevision());
$version = "$version(r$revision)";
@@ -1220,7 +1246,7 @@ EOF
opendir(DIRHANDLE, $this);
- foreach $name (sort readdir(DIRHANDLE)) {
+ foreach my $name (sort readdir(DIRHANDLE)) {
if ($name =~ /^\.(.+)\.inc$/) {
$file = $1;
@@ -1312,18 +1338,18 @@ EOCHEESE
my $modules = "";
my $cmflags = "";
my $liflags = "";
- foreach $i (@modlist) {
+ foreach my $i (@modlist) {
###
# Write Entry to the MakeFile
###
$cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
$liflags = getlinkerflags("src/modules/m_".$i.".cpp");
- $deps = getdependencies("src/modules/m_".$i.".cpp");
+ my $deps = getdependencies("src/modules/m_".$i.".cpp");
#print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
- $nicerflags = $config{FLAGS};
+ my $nicerflags = $config{FLAGS};
$nicerflags =~ s/-pedantic//g;
if (nopedantic("src/modules/m_".$i.".cpp"))
@@ -1348,14 +1374,14 @@ m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/ch
}
opendir(DIRHANDLE, "src/modules");
- foreach $name (sort readdir(DIRHANDLE)) {
+ foreach my $name (sort readdir(DIRHANDLE)) {
if ($name =~ /^m_(.+?)$/) {
- $mfrules = "";
- $mobjs = "";
- $mliflags = "";
- $mfcount = 0;
+ my $mfrules = "";
+ my $mobjs = "";
+ my $mliflags = "";
+ my $mfcount = 0;
# A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
- if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
+ if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) {
read_module_directory("src/modules/$name", $name);
print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$mfcount files found\033[0m)\n";
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";
@@ -1380,12 +1406,13 @@ sub read_module_directory {
return;
}
- foreach $fname (sort readdir(MDIRHANDLE)) {
+ my ($mliflags, $mfrules, $mobjs, $mfcount) = ("", "", "", 0);
+ foreach my $fname (sort readdir(MDIRHANDLE)) {
if ($fname =~ /\.cpp$/) {
- $cmflags = getcompilerflags("$dpath/$fname");
+ my $cmflags = getcompilerflags("$dpath/$fname");
$mliflags = $mliflags . " " . getlinkerflags("$dpath/$fname");
- $deps = getdependencies("$dpath/$fname");
- $oname = $fname;
+ my $deps = getdependencies("$dpath/$fname");
+ my $oname = $fname;
$oname =~ s/\.cpp$/.o/g;
$mfrules = $mfrules . "$reldpath/$oname: $reldpath/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
$mfrules = $mfrules . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $reldpath/$oname -c $reldpath/$fname\n\n";
@@ -1422,8 +1449,9 @@ sub calcdeps($)
}
$immutable =~ s/ $//g;
- while (chomp($line = <CPP>))
+ while (defined(my $line = <CPP>))
{
+ chomp($line);
if ($line =~ /#include "(.+\.h)"/)
{
if (!exists($dupe{$1}))
@@ -1443,7 +1471,7 @@ sub write_dynamic_makefile
my @cmdlist = ();
my %existing_install_list = ();
opendir(DIRHANDLE, "src/commands");
- foreach $name (sort readdir(DIRHANDLE))
+ foreach my $name (sort readdir(DIRHANDLE))
{
if ($name =~ /^cmd_(.+)\.cpp$/)
{
@@ -1471,14 +1499,15 @@ sub write_dynamic_makefile
{
print "Scanning \033[1;32m$dir\033[0m for core files ";
opendir(DIRHANDLE, $dir);
- foreach $name (sort readdir(DIRHANDLE))
+ foreach my $name (sort readdir(DIRHANDLE))
{
if ($name =~ /\.cpp$/)
{
open (CPP, "<$dir/$name") or die("Can't open $dir/$name to scan it! oh bugger");
print ".";
- while (chomp($line = <CPP>))
+ while (defined(my $line = <CPP>))
{
+ chomp($line);
if ($line =~ /\/\* \$Core: (\w+) \*\//i)
{
$filelist{$name} = $1;
@@ -1504,8 +1533,9 @@ sub write_dynamic_makefile
if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
{
# Skip to 'endif'
- while (chomp($line = <CPP>))
+ 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);
}
@@ -1516,8 +1546,8 @@ sub write_dynamic_makefile
if (!exists($existing_install_list{$1}))
{
$existing_install_list{$1} = 1;
- $idir = (split(' ',$1))[1];
- $ifile = (split(' ',$1))[0];
+ my $idir = (split(' ',$1))[1];
+ my $ifile = (split(' ',$1))[0];
$install_list = $install_list . " -install -m \$(INSTMODE) $1\n";
$ifile =~ s/.*\///g;
$uninstall_list = $uninstall_list . " -rm $idir/$ifile\n";
@@ -1528,8 +1558,8 @@ sub write_dynamic_makefile
if (!exists($existing_install_list{$1}))
{
$existing_install_list{$1} = 1;
- $idir = (split(' ',$1))[1];
- $ifile = (split(' ',$1))[0];
+ my $idir = (split(' ',$1))[1];
+ my $ifile = (split(' ',$1))[0];
$install_list = $install_list . " -cp $1\n";
$ifile =~ s/.*\///g;
$uninstall_list = $uninstall_list . " -rm $idir/$ifile\n";
@@ -1543,10 +1573,14 @@ sub write_dynamic_makefile
print " done!\n";
}
- $freebsd4libs = $config{CRAQ};
+ my $freebsd4libs = $config{CRAQ};
my $all = "all: ";
- $all_libsonly = "";
+ my $all_libsonly = "";
+
+ my $libraryext;
+ my $othercrap;
+ my $RPATH;
if ($config{IS_DARWIN} eq "YES")
{
@@ -1583,7 +1617,7 @@ EOM
print FH "$all\n\n";
- $deps = calcdeps("src/inspircd.cpp");
+ my $deps = calcdeps("src/inspircd.cpp");
print FH "inspircd: inspircd.cpp $deps $all_libsonly\n";
print FH "$othercrap\n";
@@ -1592,6 +1626,7 @@ EOM
my $thislib = $filelist{$cpp} . "." . $libraryext;
my $objs = $cpp;
my $rawcpp = $cpp;
+ my $libcrap = "";
$objs =~ s/\.cpp$/.o/;
if (exists($extraobjects{$cpp}))
{
@@ -1621,14 +1656,14 @@ EOM
{
foreach my $seperate (sort split(' ',$extrasources{$cpp}))
{
- $d = calcdeps("src/$extrasources{$cpp}") . " ";
+ my $d = calcdeps("src/$extrasources{$cpp}") . " ";
if ($d ne "")
{
$deps = $deps . $d . " ";
}
}
}
- print FH $thislib . ": $cpp $deps ". $specialdeps{$cpp} . "\n";
+ print FH $thislib . ": $cpp $deps ". (defined($specialdeps{$cpp}) ? $specialdeps{$cpp} : "") . "\n";
print FH " \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c $rawcpp\n";
if (exists($extrabuildlines{$cpp}))
{
@@ -1642,6 +1677,7 @@ EOM
# close main makefile
close(FH);
+ my $cmdobjs = "";
# generate a list of .so
foreach my $cmd (@cmdlist) {
$cmdobjs = $cmdobjs . "cmd_$cmd.so ";
@@ -1651,7 +1687,7 @@ EOM
open(FH,">src/commands/Makefile") or die("Could not write src/commands/Makefile");
print FH <<ITEM;
CC = i am cornholio
-CXXFLAGS = -I../../include ${FLAGS}
+CXXFLAGS = -I../../include \${FLAGS}
all: $cmdobjs
diff --git a/make/configure.pm b/make/configure.pm
index d244a49d5..538dffcc8 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -14,17 +14,20 @@ package make::configure;
require 5.8.0;
+use strict;
+use warnings FATAL => qw(all);
+
use Exporter 'import';
use POSIX;
use make::utilities;
-@EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s);
+our @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s);
my $no_svn = 0;
sub yesno {
my ($flag,$prompt) = @_;
print "$prompt [\033[1;32m$main::config{$flag}\033[0m] -> ";
- chomp($tmp = <STDIN>);
+ chomp(my $tmp = <STDIN>);
if ($tmp eq "") { $tmp = $main::config{$flag} }
if (($tmp eq "") || ($tmp =~ /^y/i))
{
@@ -57,7 +60,7 @@ sub getrevision {
if ($data eq "")
{
$no_svn = 1;
- $rev = "0";
+ my $rev = "0";
return $rev;
}
$data =~ /Revision: (\d+)/;
@@ -79,7 +82,7 @@ sub getcompilerflags {
}
}
close(FLAGS);
- return undef;
+ return "";
}
sub getlinkerflags {
@@ -92,7 +95,7 @@ sub getlinkerflags {
}
}
close(FLAGS);
- return undef;
+ return "";
}
sub getdependencies {
@@ -105,7 +108,7 @@ sub getdependencies {
}
}
close(FLAGS);
- return undef;
+ return "";
}
sub nopedantic {
@@ -126,11 +129,11 @@ sub getmodules
my $i = 0;
print "Detecting modules ";
opendir(DIRHANDLE, "src/modules");
- foreach $name (sort readdir(DIRHANDLE))
+ foreach my $name (sort readdir(DIRHANDLE))
{
if ($name =~ /^m_(.+)\.cpp$/)
{
- $mod = $1;
+ my $mod = $1;
$main::modlist[$i++] = $mod;
print ".";
}
@@ -147,7 +150,7 @@ sub promptnumeric($$)
{
print "Please enter the maximum $prompt?\n";
print "[\033[1;32m$main::config{$configitem}\033[0m] -> ";
- chomp($var = <STDIN>);
+ chomp(my $var = <STDIN>);
if ($var eq "")
{
$var = $main::config{$configitem};
@@ -218,7 +221,7 @@ sub is_dir
sub showhelp
{
- chomp($PWD = `pwd`);
+ chomp(my $PWD = `pwd`);
print "Usage: configure [options]
*** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
diff --git a/make/gnutlscert.pm b/make/gnutlscert.pm
index 77328e233..1ab70420d 100644
--- a/make/gnutlscert.pm
+++ b/make/gnutlscert.pm
@@ -2,9 +2,12 @@ package make::gnutlscert;
require 5.8.0;
+use strict;
+use warnings FATAL => qw(all);
+
use Exporter 'import';
use make::configure;
-@EXPORT = qw(make_gnutls_cert);
+our @EXPORT = qw(make_gnutls_cert);
sub make_gnutls_cert()
diff --git a/make/opensslcert.pm b/make/opensslcert.pm
index 327b80378..1cadd9f82 100644
--- a/make/opensslcert.pm
+++ b/make/opensslcert.pm
@@ -2,9 +2,12 @@ package make::opensslcert;
require 5.8.0;
+use strict;
+use warnings FATAL => qw(all);
+
use Exporter 'import';
use make::configure;
-@EXPORT = qw(make_openssl_cert);
+our @EXPORT = qw(make_openssl_cert);
sub make_openssl_cert()
diff --git a/make/utilities.pm b/make/utilities.pm
index c3909c1e4..59c2905cb 100644
--- a/make/utilities.pm
+++ b/make/utilities.pm
@@ -14,10 +14,14 @@ package make::utilities;
require 5.8.0;
+use strict;
+use warnings FATAL => qw(all);
+
use Exporter 'import';
use POSIX;
use Getopt::Long;
-@EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs pkgconfig_check_version translate_functions promptstring vcheck);
+use Fcntl;
+our @EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs pkgconfig_check_version translate_functions promptstring vcheck);
# Parse the output of a *_config program,
# such as pcre_config, take out the -L
@@ -33,7 +37,7 @@ sub promptstring($$$$$)
my $var;
if (!$main::interactive)
{
- undef $opt_commandlineswitch;
+ my $opt_commandlineswitch;
GetOptions ("$commandlineswitch=s" => \$opt_commandlineswitch);
if (defined $opt_commandlineswitch)
{
@@ -61,11 +65,11 @@ sub promptstring($$$$$)
sub make_rpath($;$)
{
my ($executable, $module) = @_;
- chomp($data = `$executable`);
+ chomp(my $data = `$executable`);
my $output = "";
while ($data =~ /-L(\S+)/)
{
- $libpath = $1;
+ my $libpath = $1;
if (!exists $already_added{$libpath})
{
print "Adding extra library path to \033[1;32m$module\033[0m ... \033[1;32m$libpath\033[0m\n";
@@ -97,7 +101,7 @@ sub pkgconfig_get_include_dirs($$$;$)
if (exists $main::config{$key})
{
print "Locating include directory for package \033[1;32m$packagename\033[0m for module \033[1;32m$module\033[0m... ";
- $ret = $main::config{$key};
+ my $ret = $main::config{$key};
print "\033[1;32m$ret\033[0m (cached)\n";
return $ret;
}
@@ -106,14 +110,15 @@ sub pkgconfig_get_include_dirs($$$;$)
print "Locating include directory for package \033[1;32m$packagename\033[0m for module \033[1;32m$module\033[0m... ";
- $v = `pkg-config --modversion $packagename 2>/dev/null`;
- $ret = `pkg-config --cflags $packagename 2>/dev/null`;
+ my $v = `pkg-config --modversion $packagename 2>/dev/null`;
+ my $ret = `pkg-config --cflags $packagename 2>/dev/null`;
+ my $foo = "";
if ((!defined $v) || ($v eq ""))
{
$foo = `locate "$headername" | head -n 1`;
$foo =~ /(.+)\Q$headername\E/;
- $find = $1;
+ my $find = $1;
chomp($find);
if ((defined $find) && ($find ne "") && ($find ne $packagename))
{
@@ -167,17 +172,17 @@ sub pkgconfig_get_include_dirs($$$;$)
sub vcheck($$)
{
my ($version1, $version2) = @_;
- $version1 =~ s/\-r(\d+)/\.\1/g; # minor revs/patchlevels
- $version2 =~ s/\-r(\d+)/\.\1/g;
- $version1 =~ s/p(\d+)/\.\1/g;
- $version2 =~ s/p(\d+)/\.\1/g;
+ $version1 =~ s/\-r(\d+)/\.$1/g; # minor revs/patchlevels
+ $version2 =~ s/\-r(\d+)/\.$1/g;
+ $version1 =~ s/p(\d+)/\.$1/g;
+ $version2 =~ s/p(\d+)/\.$1/g;
$version1 =~ s/\-//g;
$version2 =~ s/\-//g;
- $version1 =~ s/a-z//g;
- $version2 =~ s/a-z//g;
+ $version1 =~ s/[a-z]//g;
+ $version2 =~ s/[a-z]//g;
my @v1 = split('\.', $version1);
my @v2 = split('\.', $version2);
- for ($curr = 0; $curr < scalar(@v1); $curr++)
+ for (my $curr = 0; $curr < scalar(@v1); $curr++)
{
if ($v1[$curr] < $v2[$curr])
{
@@ -195,7 +200,7 @@ sub pkgconfig_check_version($$;$)
print "Checking version of package \033[1;32m$packagename\033[0m is >= \033[1;32m$version\033[0m... ";
- $v = `pkg-config --modversion $packagename 2>/dev/null`;
+ my $v = `pkg-config --modversion $packagename 2>/dev/null`;
if (defined $v)
{
chomp($v);
@@ -228,7 +233,7 @@ sub pkgconfig_get_lib_dirs($$$;$)
if (exists $main::config{$key})
{
print "Locating library directory for package \033[1;32m$packagename\033[0m for module \033[1;32m$module\033[0m... ";
- $ret = $main::config{$key};
+ my $ret = $main::config{$key};
print "\033[1;32m$ret\033[0m (cached)\n";
return $ret;
}
@@ -237,14 +242,15 @@ sub pkgconfig_get_lib_dirs($$$;$)
print "Locating library directory for package \033[1;32m$packagename\033[0m for module \033[1;32m$module\033[0m... ";
- $v = `pkg-config --modversion $packagename 2>/dev/null`;
- $ret = `pkg-config --libs $packagename 2>/dev/null`;
+ my $v = `pkg-config --modversion $packagename 2>/dev/null`;
+ my $ret = `pkg-config --libs $packagename 2>/dev/null`;
+ my $foo = "";
if ((!defined $v) || ($v eq ""))
{
$foo = `locate "$libname" | head -n 1`;
$foo =~ /(.+)\Q$libname\E/;
- $find = $1;
+ my $find = $1;
chomp($find);
if ((defined $find) && ($find ne "") && ($find ne $packagename))
{
@@ -323,7 +329,7 @@ sub translate_functions($$)
}
while ($line =~ /execruntime\("(.+?)"\)/)
{
- $line =~ s/execruntime\("(.+?)"\)/`\1`/;
+ $line =~ s/execruntime\("(.+?)"\)/`$1`/;
}
while ($line =~ /eval\("(.+?)"\)/)
{
@@ -378,7 +384,7 @@ sub translate_functions($$)
};
if ($@)
{
- $err = $@;
+ my $err = $@;
$err =~ s/at .+? line \d+.*//g;
print "\n\nConfiguration failed. The following error occured:\n\n$err\n";
exit;