#
###################################################
-require 5.8.0;
+BEGIN {
+ require 5.8.0;
+}
use strict;
use warnings FATAL => qw(all);
$config{MAX_AWAY} = $opt_away;
}
-$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";
$fail = 0;
open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
if (!$fail) {
- while (defiined(my $line = <KQUEUE>)) {
+ while (defined(my $line = <KQUEUE>)) {
chomp($line);
# try and find the delcaration of:
# int kqueue(void);
$config{HAS_KQUEUE} = $has_kqueue;
printf "Checking for libgnutls... ";
-if (($config{HAS_GNUTLS}) || ($config{HAS_GNUTLS} eq "y")) {
+if (defined($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS}) || ($config{HAS_GNUTLS} eq "y"))) {
print "yes\n";
$config{HAS_GNUTLS} = "y";
} else {
}
printf "Checking for openssl... ";
-if (($config{HAS_OPENSSL}) || ($config{HAS_OPENSSL} eq "y")) {
+if (defined($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL}) || ($config{HAS_OPENSSL} eq "y"))) {
print "yes\n";
$config{HAS_OPENSSL} = "y";
} else {
print "\n\n";
print "To build your server with these settings, please type '\e[1;32m$config{MAKEPROG}\e[0m' now.\n";
if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
- print "Please remember that to enable \e[1;32mSSL support\e[0m you must\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 "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 "\e[1;32mhttp://www.inspircd.org/wiki/Installation_From_Tarball\e[0m\n";
}
print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n\n";
if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
sub getosflags {
- $config{LDLIBS} = "-lstdc++";
- $config{FLAGS} = "-fPIC -Wall $config{OPTIMISATI}";
- $config{DEVELOPER} = "-fPIC -Wall -g";
+ # Beware: Linux sets it's own cflags below for some retarded reason
+ $config{LDLIBS} = "-pthread -lstdc++";
+ $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
+ $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -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";
- $config{LDLIBS} = "-ldl -lstdc++";
+ $config{LDLIBS} = "-ldl -pthread -lstdc++";
}
if ($config{OSNAME} =~ /OpenBSD/i) {
}
if ($config{OSNAME} =~ /Linux/i) {
- $config{LDLIBS} = "-ldl -lstdc++";
- $config{FLAGS} = "-fPIC -Wall $config{OPTIMISATI}";
+ $config{LDLIBS} = "-ldl -lstdc++ -pthread";
+ $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
$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";
- $config{LDLIBS} .= " -lsocket -lnsl -lrt -lresolv";
+ $config{LDLIBS} .= " -lsocket -lnsl -lrt -lresolv -pthread";
return "Solaris";
}
#define OPTIMISATION $config{OPTIMITEMP}
#define LIBRARYDIR "$config{LIBRARY_DIR}"
#define SYSTEM "$incos"
+
EOF
print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
print FILEHANDLE "#define USE_SELECT\n";
$se = "socketengine_select";
}
- print FILEHANDLE "\n#endif\n";
+ print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n\n#endif\n";
close(FILEHANDLE);
}
{
print FILEHANDLE "
m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps
- \$(CC) -pipe -I../../include \$(NICEFLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
+ \@../../make/run-cc.pl \$(CC) -pipe -I../../include \$(NICEFLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
"
}
else
{
print FILEHANDLE "
m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps
- \$(CC) -pipe -I../../include \$(FLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
+ \@../../make/run-cc.pl \$(CC) -pipe -I../../include \$(FLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
";
}
$install_list = $install_list . " install -m \$(INSTMODE) src/modules/m_$i.so \$(MODPATH)\n";
print "Composing Makefile rules for directory \e[1;32m$name\e[0m... (\e[1;32m$mfcount files found\e[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";
if ($config{IS_DARWIN} eq "YES") {
- print FILEHANDLE " \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) $mliflags -bundle -o $name.so $mobjs\n";
+ print FILEHANDLE " \@../../make/run-cc.pl \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) $mliflags -bundle -o $name.so $mobjs\n";
} else {
- print FILEHANDLE " \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $mobjs\n";
+ print FILEHANDLE " \@../../make/run-cc.pl \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $mobjs\n";
}
print FILEHANDLE "\n$mfrules\n";
closedir(MDIRHANDLE);
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";
+ $mfrules = $mfrules . " \@../../make/run-cc.pl \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $reldpath/$oname -c $reldpath/$fname\n\n";
$mobjs = $mobjs . " $reldpath/$oname";
$mfcount++;
}
}
elsif ($line =~ /\/\* \$If: (\w+) \*\//i)
{
- if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
+ if (defined $config{$1})
{
- # Skip to 'endif'
- while (defined($line = <CPP>))
+ if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
{
- 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);
+ }
}
}
}
if ($config{IS_DARWIN} eq "YES")
{
$libraryext = "dylib";
- $othercrap = " \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd.cpp\n \$(CC) -pipe -dynamic -bind_at_load -L. -o inspircd \$(LDLIBS) inspircd.o "
+ $othercrap = " \@../make/run-cc.pl \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd.cpp\n \@../make/run-cc.pl \$(CC) -pipe -dynamic -bind_at_load -L. -o inspircd \$(LDLIBS) inspircd.o "
}
else
{
$libraryext = "so";
$RPATH = "-Wl,--rpath -Wl,$config{LIBRARY_DIR}" unless defined $opt_disablerpath;
- $othercrap = " \$(CC) -pipe -I../include $RPATH \$(FLAGS) $freebsd4libs -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) ";
+ $othercrap = " \@../make/run-cc.pl \$(CC) -pipe -I../include $RPATH \$(FLAGS) $freebsd4libs -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) ";
}
foreach my $cpp (sort keys %filelist)
}
}
print FH $thislib . ": $cpp $deps ". (defined($specialdeps{$cpp}) ? $specialdeps{$cpp} : "") . "\n";
- print FH " \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c $rawcpp\n";
+ print FH " \@../make/run-cc.pl \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c $rawcpp\n";
if (exists($extrabuildlines{$cpp}))
{
print FH " " . $extrabuildlines{$cpp} . "\n";
}
- print FH " \$(CC) -pipe $libcrap -o " . $thislib . " " . $objs . "\n\n";
+ print FH " \@../make/run-cc.pl \$(CC) -pipe $libcrap -o " . $thislib . " " . $objs . "\n\n";
}
- print FH "moo:\n \${MAKE} -C \"commands\" DIRNAME=\"src/commands\" CC=\"\$(CC)\" \$(MAKEARGS)\n\n";
+ print FH "moo:\n \@\${MAKE} -C \"commands\" DIRNAME=\"src/commands\" CC=\"\$(CC)\" \$(MAKEARGS)\n\n";
# close main makefile
close(FH);
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 $SHARED -o cmd_$cmd.so cmd_$cmd.cpp
ITEM
}
-#try build a .so, no intermediate .o
-# \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic $SHARED -o cmd_$cmd.so
-
-#this works for sure
-# \$(CC) -pipe -I../../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
-# \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
}
# Routine to list out the extra/ modules that have been enabled.