summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure45
-rw-r--r--docs/conf/modules.conf.example1
-rw-r--r--make/configure.pm20
-rw-r--r--make/test/clock_gettime.cpp1
-rw-r--r--make/test/compiler.cpp2
-rw-r--r--make/test/compiler_info.cpp41
-rw-r--r--src/modules/m_md5.cpp26
-rw-r--r--src/modules/m_permchannels.cpp4
8 files changed, 77 insertions, 63 deletions
diff --git a/configure b/configure
index 51100a4f7..ca2e2f19b 100755
--- a/configure
+++ b/configure
@@ -130,7 +130,7 @@ our $interactive = !(
my %version = get_version $opt_distribution_label;
print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
-our %config;
+my %config;
if ($interactive) {
%config = read_config_file(CONFIGURE_CACHE_FILE);
run_test CONFIGURE_CACHE_FILE, %config;
@@ -159,41 +159,22 @@ my %compiler = get_compiler_info($config{CXX});
$config{HAS_CLOCK_GETTIME} = run_test 'clock_gettime()', test_file($config{CXX}, 'clock_gettime.cpp', $^O eq 'darwin' ? undef : '-lrt');
$config{HAS_EVENTFD} = run_test 'eventfd()', test_file($config{CXX}, 'eventfd.cpp');
-if ($config{HAS_EPOLL} = run_test 'epoll', test_header($config{CXX}, 'sys/epoll.h')) {
- $config{SOCKETENGINE} //= 'epoll';
-}
-
-if ($config{HAS_KQUEUE} = run_test 'kqueue', test_file($config{CXX}, 'kqueue.cpp')) {
- $config{SOCKETENGINE} //= 'kqueue';
-}
-
-if ($config{HAS_PORTS} = run_test 'Solaris IOCP', test_header($config{CXX}, 'port.h')) {
- $config{SOCKETENGINE} //= 'ports';
-}
-
-if ($config{HAS_POLL} = run_test 'poll', test_header($config{CXX}, 'poll.h')) {
- $config{SOCKETENGINE} //= 'poll';
-}
-
-# Select is available on all platforms
-$config{HAS_SELECT} = 1;
-$config{SOCKETENGINE} //= 'select';
+my @socketengines;
+push @socketengines, 'epoll' if run_test 'epoll', test_header $config{CXX}, 'sys/epoll.h';
+push @socketengines, 'kqueue' if run_test 'kqueue', test_file $config{CXX}, 'kqueue.cpp';
+push @socketengines, 'ports' if run_test 'Solaris IOCP', test_header $config{CXX}, 'port.h';
+push @socketengines, 'poll' if run_test 'poll', test_header $config{CXX}, 'poll.h';
+push @socketengines, 'select';
if (defined $opt_socketengine) {
- my $cfgkey = 'HAS_' . uc $opt_socketengine;
- if ($config{$cfgkey} && -f "src/socketengines/socketengine_$opt_socketengine.cpp") {
- $config{SOCKETENGINE} = $opt_socketengine;
- } else {
- print "Unable to use a socket engine which is not supported on this platform ($opt_socketengine)!\n";
- print "Available socket engines are:";
- foreach (<src/socketengines/socketengine_*.cpp>) {
- s/src\/socketengines\/socketengine_(\w+)\.cpp/$1/;
- print " $1" if $config{'HAS_' . uc $1};
- }
- print "\n";
- exit 1;
+ unless (grep { $_ eq $opt_socketengine } @socketengines) {
+ my $reason = -f "src/socketengines/socketengine_$opt_socketengine.cpp" ? 'is not available on this platform' : 'does not exist';
+ print_error "The socket engine you requested ($opt_socketengine) $reason!",
+ 'Available socket engines are:',
+ map { " * $_" } @socketengines;
}
}
+$config{SOCKETENGINE} = $opt_socketengine // $socketengines[0];
if (defined $opt_system) {
$config{BASE_DIR} = $opt_prefix // '/var/lib/inspircd';
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 835e31795..33da80c56 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -1434,7 +1434,6 @@
#<include file="permchannels.conf">
#
# You may also create channels on startup by using the <permchannels> block.
-# Don't forget to set them +P in the modes, or they won't stay permanent.
#<permchannels channel="#opers" modes="isP" topic="Opers only.">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/make/configure.pm b/make/configure.pm
index a10493318..48bd8db38 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -227,19 +227,15 @@ sub write_configure_cache(%) {
sub get_compiler_info($) {
my $binary = shift;
- my $version = `$binary -v 2>&1`;
- if ($version =~ /Apple\sLLVM\sversion\s(\d+\.\d+)/i) {
- # Apple version their LLVM releases slightly differently to the mainline LLVM.
- # See https://trac.macports.org/wiki/XcodeVersionInfo for more information.
- return (NAME => 'AppleClang', VERSION => $1);
- } elsif ($version =~ /clang\sversion\s(\d+\.\d+)/i) {
- return (NAME => 'Clang', VERSION => $1);
- } elsif ($version =~ /gcc\sversion\s(\d+\.\d+)/i) {
- return (NAME => 'GCC', VERSION => $1);
- } elsif ($version =~ /(?:icc|icpc)\sversion\s(\d+\.\d+).\d+\s\(gcc\sversion\s(\d+\.\d+).\d+/i) {
- return (NAME => 'ICC', VERSION => $1);
+ my %info = (NAME => 'Unknown', VERSION => '0.0');
+ return %info if system "$binary -o __compiler_info make/test/compiler_info.cpp ${\CONFIGURE_ERROR_PIPE}";
+ open(my $fh, '-|', './__compiler_info 2>/dev/null');
+ while (my $line = <$fh>) {
+ $info{$1} = $2 if $line =~ /^([A-Z]+)\s(.+)$/;
}
- return (NAME => $binary, VERSION => '0.0');
+ close $fh;
+ unlink './__compiler_info';
+ return %info;
}
sub find_compiler {
diff --git a/make/test/clock_gettime.cpp b/make/test/clock_gettime.cpp
index 91d8cd412..d111d591f 100644
--- a/make/test/clock_gettime.cpp
+++ b/make/test/clock_gettime.cpp
@@ -1,6 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2013 Peter Powell <petpow@saberuk.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
diff --git a/make/test/compiler.cpp b/make/test/compiler.cpp
index e2cbd9f64..f01423325 100644
--- a/make/test/compiler.cpp
+++ b/make/test/compiler.cpp
@@ -1,6 +1,8 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2014-2015 Peter Powell <petpow@saberuk.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
diff --git a/make/test/compiler_info.cpp b/make/test/compiler_info.cpp
new file mode 100644
index 000000000..10b156fc8
--- /dev/null
+++ b/make/test/compiler_info.cpp
@@ -0,0 +1,41 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ * Copyright (C) 2017 Peter Powell <petpow@saberuk.com>
+ *
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <iostream>
+
+#if defined __INTEL_COMPILER // Also defines __clang__ and __GNUC__
+# define INSPIRCD_COMPILER_NAME "Intel"
+# define INSPIRCD_COMPILER_VERSION (__INTEL_COMPILER / 100) << '.' << (__INTEL_COMPILER % 100)
+#elif defined __clang__ // Also defines __GNUC__
+# if defined __apple_build_version__
+# define INSPIRCD_COMPILER_NAME "AppleClang"
+# else
+# define INSPIRCD_COMPILER_NAME "Clang"
+# endif
+# define INSPIRCD_COMPILER_VERSION __clang_major__ << '.' << __clang_minor__
+#elif defined __GNUC__
+# define INSPIRCD_COMPILER_NAME "GCC"
+# define INSPIRCD_COMPILER_VERSION __GNUC__ << '.' << __GNUC_MINOR__
+#endif
+
+int main() {
+ std::cout << "NAME " << INSPIRCD_COMPILER_NAME << std::endl
+ << "VERSION " << INSPIRCD_COMPILER_VERSION << std::endl;
+ return 0;
+}
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp
index 6cec05a18..26ff4cffc 100644
--- a/src/modules/m_md5.cpp
+++ b/src/modules/m_md5.cpp
@@ -61,23 +61,13 @@ class MD5Provider : public HashProvider
} while (--words);
}
- void MD5Init(MD5Context *ctx, unsigned int* ikey = NULL)
+ void MD5Init(MD5Context *ctx)
{
/* These are the defaults for md5 */
- if (!ikey)
- {
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
- }
- else
- {
- ctx->buf[0] = ikey[0];
- ctx->buf[1] = ikey[1];
- ctx->buf[2] = ikey[2];
- ctx->buf[3] = ikey[3];
- }
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
ctx->bytes[0] = 0;
ctx->bytes[1] = 0;
@@ -236,10 +226,10 @@ class MD5Provider : public HashProvider
}
- void MyMD5(void *dest, void *orig, int len, unsigned int* ikey)
+ void MyMD5(void *dest, void *orig, int len)
{
MD5Context context;
- MD5Init(&context, ikey);
+ MD5Init(&context);
MD5Update(&context, (const unsigned char*)orig, len);
MD5Final((unsigned char*)dest, &context);
}
@@ -248,7 +238,7 @@ class MD5Provider : public HashProvider
std::string GenerateRaw(const std::string& data)
{
char res[16];
- MyMD5(res, (void*)data.data(), data.length(), NULL);
+ MyMD5(res, (void*)data.data(), data.length());
return std::string(res, 16);
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 9e77bd60e..d514e62a5 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -244,6 +244,10 @@ public:
mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true);
}
}
+
+ // We always apply the permchannels mode to permanent channels.
+ par.clear();
+ p.OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true);
}
}
}