# InspIRCd Configuration Script
#
-# Copyright 2002-2006 The ChatSpike Development Team
+# Copyright 2002-2007 The ChatSpike Development Team
# <brain@chatspike.net>
# <Craig@chatspike.net>
#
require 5.6.0;
+use Socket;
use Cwd;
use Getopt::Long;
'with-channel-length=i' => \$opt_chan_length,
'with-max-channels=i' => \$opt_maxchans,
'with-max-oper-channels=i' => \$opt_opermaxchans,
- 'with-max-clients' => \$opt_maxclients,
+ 'with-max-clients=i' => \$opt_maxclients,
'enable-epoll' => \$opt_epoll,
'enable-kqueue' => \$opt_kqueue,
'disable-epoll' => \$opt_noepoll,
chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
-chomp($config{OSNAME} = `uname`); # Operating System Name
+$config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
+$config{OSNAME} = $^O; # Operating System Name
$config{CC} = "g++"; # C++ compiler
if (defined $opt_cc)
{
# Keep my dynamic module experiments here for later
# concideration!
-if ($config{OSNAME} =~ /CYGWIN/)
+if ($config{OSNAME} =~ /CYGWIN/i)
{
$config{OSNAME} = "CYG-STATIC";
}
-elsif($config{OSNAME} =~ /^MINGW32/)
-{
- $config{OSNAME} = "MINGW32";
-}
-elsif ((!$config{OSNAME}) || ($config{OSNAME} eq ""))
-{
- chomp($config{OSNAME} = `/usr/bin/uname`);
-
- if((!$config{OSNAME}) || ($config{OSNAME} eq ""))
- {
- $config{OSNAME} = "Unknown";
- }
-}
if (!$config{MAX_CLIENT_T}) {
$config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
sub clean
{
- if ($arg eq "-clean") {
- system("rm -rf .config.cache");
- }
+ system("rm -rf .config.cache");
}
sub update
if ($interactive)
{
system("clear");
- chomp($wholeos = `uname -sr`);
+ $wholeos = $^O;
my $rev = getrevision();
# Display Introduction Message..
# Convert it to a full path..
$var = resolve_directory($ENV{HOME} . "/" . $1);
}
- elsif ((($config{OSNAME} == "MINGW32") and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
+ elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
{
# Assume relative Path was given.. fill in the rest.
$var = $this . "/$var";
}
sub getosflags {
- if ($config{OSNAME} =~ /BSD$/) {
- $config{LDLIBS} = "-lstdc++";
- $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
+
+ $config{LDLIBS} = "-lstdc++";
+ $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
+ $config{MAKEPROG} = "make";
+
+ if ($config{OSNAME} =~ /OpenBSD/i) {
$config{MAKEPROG} = "gmake";
- if ($config{OSNAME} eq "OpenBSD") {
- chomp($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!
- if ($foo ne "") {
- $config{CC} = "eg++";
- chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
- }
- return "OpenBSD";
+ chomp($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!
+ if ($foo ne "") {
+ $config{CC} = "eg++";
+ chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
}
- return $config{OSNAME};
- } else {
+ return "OpenBSD";
+ }
+
+ if ($config{OSNAME} =~ /Linux/i) {
$config{LDLIBS} = "-ldl -lstdc++";
$config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
$config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
return "Cygwin-Static";
}
$config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
- return "Linux";
}
- if ($config{OSNAME} =~ /SunOS/)
+ if ($config{OSNAME} =~ /SunOS/i)
{
# solaris/sunos needs these
# socket = bsd sockets api
# nsl = dns stuff
# rt = POSIX realtime extensions
# resolv = inet_aton only (why isnt this in nsl?!)
+ $config{MAKEPROG} = "gmake";
$config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
return "Solaris";
}
- if($config{OSNAME} eq "MINGW32")
+ if($config{OSNAME} =~ /MINGW32/i)
{
# All code is position-independent on windows
$config{FLAGS} =~ s/-fPIC //;
return "MinGW";
}
+
+ return $config{OSNAME};
}
sub is_dir {
#define VERSION "$version"
#define REVISION "$revision2"
#define MAXCLIENTS $config{MAX_CLIENT}
+#define MAXCLIENTS_S "$config{MAX_CLIENT}"
+#define SOMAXCONN_S "$config{_SOMAXCONN}"
#define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
#define NICKMAX $NL
#define CHANMAX $CL
#define SYSTEM "$incos"
#define MAXBUF 514
EOF
- if ($config{OSNAME} =~ /SunOS/) {
+ if ($config{OSNAME} =~ /SunOS/i) {
print FILEHANDLE "#define IS_SOLARIS\n";
}
- if ($config{OSNAME} =~ /CYGWIN/) {
+ if ($config{OSNAME} =~ /CYGWIN/i) {
print FILEHANDLE "#define IS_CYGWIN\n";
print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
}
- if ($config{OSNAME} eq "MINGW32") {
+ if ($config{OSNAME} =~ /MINGW32/i) {
print FILEHANDLE "#define IS_MINGW\n";
}
- if ($config{OSNAME} eq "CYG-STATIC") {
+ if ($config{OSNAME} =~ /CYG-STATIC/i) {
print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
}
if ($config{STATIC_LINK} eq "yes") {
my $file = "";
my $exe = "inspircd";
- if ($config{OSNAME} =~ /CYGWIN/) {
+ if ($config{OSNAME} =~ /CYGWIN/i) {
$exe = "inspircd.exe";
}
print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
write_static_makefile();
write_static_modules_makefile();
- } elsif ($config{OSNAME} =~ /CYGWIN/) {
+ } elsif ($config{OSNAME} =~ /CYGWIN/i) {
print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
write_static_makefile();
write_dynamic_modules_makefile();
open(FILEHANDLE, ">src/modules/Makefile");
my $extra = "";
- if ($config{OSNAME} =~ /CYGWIN/) {
+ if ($config{OSNAME} =~ /CYGWIN/i) {
$extra = "../inspircd.dll.a";
}
\$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
EOCHEESE
- $crud = $crud . " install -m 0700 m_$i.so \$(MODPATH)\n";
+ $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
###
# End Write Entry to the MakeFile
###
# make this work :)
###
- if ($config{OSNAME} =~ /CYGWIN/) {
+ if ($config{OSNAME} =~ /CYGWIN/i) {
print FH <<EOM;
all: timer.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o inspircd.exe
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
mode.o: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES) modes/modeclasses.a
- \${MAKE} -C "modes" DIRNAME="src/modes" \$(MAKEARGS)
+ \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
xline.o: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
inspstring.o: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
-dns.o: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+dns.o: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
configreader.o: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
-commands.o: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h $srcobjs
+commands.o: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h $srcobjs
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
dynamic.o: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
-users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
-modules.o: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+modules.o: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
wildcard.o: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
-inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
+inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
-timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
+timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
EOM
libIRCDmode.so: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
- \${MAKE} -C "modes" DIRNAME="src/modes" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
+ \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
-libIRCDxline.so: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+libIRCDxline.so: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
-libIRCDasyncdns.so: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+libIRCDasyncdns.so: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
-libIRCDcommands.so: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+libIRCDcommands.so: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
-libIRCDusers.so: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+libIRCDusers.so: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
-libIRCDmodules.so: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
+libIRCDmodules.so: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
-libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
+libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
-libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
+libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
\$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o