]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Remove hardcoded MAXBUF constant.
[user/henk/code/inspircd.git] / configure
index d86229afbb7752ba20d1ccac81da2c7c9b0ccb15..0af698ed0eb1b39b454ef9c7d083b15be6b0005e 100755 (executable)
--- a/configure
+++ b/configure
@@ -40,7 +40,6 @@ BEGIN {
 };
 
 use File::Copy ();
-use Socket;
 use Cwd;
 use Getopt::Long;
 
@@ -54,10 +53,8 @@ use make::configure;
 #
 ###############################################################################################
 
-our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_ports,
-    $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue,
-    $opt_noipv6, $opt_maxbuf, $opt_disable_debug, $opt_freebsd_port,
-       $opt_system, $opt_uid);
+our ($opt_use_gnutls, $opt_use_openssl, $opt_nointeractive, $opt_ports, $opt_epoll, $opt_kqueue,
+     $opt_noports, $opt_noepoll, $opt_nokqueue, $opt_freebsd_port, $opt_system, $opt_uid);
 
 our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir, $opt_data_dir, $opt_log_dir);
 
@@ -72,7 +69,6 @@ my @opt_disableextras;
 
 GetOptions (
        'enable-gnutls' => \$opt_use_gnutls,
-       'rebuild' => \$opt_rebuild,
        'system' => \$opt_system,
        'uid=s' => \$opt_uid,
        'enable-openssl' => \$opt_use_openssl,
@@ -83,9 +79,7 @@ GetOptions (
        'disable-ports' => \$opt_noports,
        'disable-epoll' => \$opt_noepoll,
        'disable-kqueue' => \$opt_nokqueue,
-       'disable-ipv6' => \$opt_noipv6,
        'with-cc=s' => \$opt_cc,
-       'with-maxbuf=i' => \$opt_maxbuf,
        'enable-freebsd-ports-openssl' => \$opt_freebsd_port,
        'prefix=s' => \$opt_base_dir,
        'config-dir=s' => \$opt_config_dir,
@@ -93,15 +87,12 @@ GetOptions (
        'binary-dir=s' => \$opt_binary_dir,
        'data-dir=s' => \$opt_data_dir,
        'log-dir=s' => \$opt_log_dir,
-       'disable-debuginfo' => sub { $opt_disable_debug = 1 },
        'help'  => sub { showhelp(); },
        'update' => sub { update(); },
        'clean' => sub { clean(); },
        'list-extras' => sub { list_extras; exit 0; }, # This, --enable-extras, and --disable-extras are for non-interactive managing.
        'enable-extras=s@' => \@opt_enableextras, # ^
        'disable-extras=s@' => \@opt_disableextras, # ^
-       'generate-openssl-cert' => sub { exec './tools/genssl openssl'; },
-       'generate-gnutls-cert' => sub { exec './tools/genssl gnutls'; }
 );
 
 if (scalar(@opt_enableextras) + scalar(@opt_disableextras) > 0) {
@@ -124,7 +115,6 @@ our $interactive = !(
        (defined $opt_log_dir) ||
        (defined $opt_nointeractive) ||
        (defined $opt_cc) ||
-       (defined $opt_noipv6) ||
        (defined $opt_kqueue) ||
        (defined $opt_epoll) ||
        (defined $opt_ports) ||
@@ -132,7 +122,6 @@ our $interactive = !(
        (defined $opt_nokqueue) ||
        (defined $opt_noepoll) ||
        (defined $opt_noports) ||
-       (defined $opt_maxbuf) ||
        (defined $opt_system) ||
        (defined $opt_uid) ||
        (defined $opt_use_gnutls) ||
@@ -187,7 +176,7 @@ if (defined $opt_data_dir) {
 if (defined $opt_log_dir) {
        $config{LOG_DIR} = $opt_log_dir;
 }
-chomp($config{HAS_GNUTLS}   = `pkg-config --modversion gnutls 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
+chomp($config{HAS_GNUTLS}   = `pkg-config --modversion gnutls 2>/dev/null`); # GNUTLS Version.
 
 if (defined $opt_freebsd_port)
 {
@@ -223,12 +212,6 @@ if (defined $opt_use_openssl)
        $config{USE_OPENSSL} = "y";
 }
 
-if (!defined $opt_disable_debug) {
-       $config{OPTIMISATI}      = "-g1";                               # Optimisation Flag
-} else {
-       $config{OPTIMISATI}      = "-O2";
-}
-
 $config{HAS_STDINT}     = "false";                                     # stdint.h check
 $config{USE_KQUEUE}     = "y";                                         # kqueue enabled
 if (defined $opt_nokqueue) {
@@ -245,14 +228,11 @@ if (defined $opt_noports)
 {
        $config{USE_PORTS} = "n";
 }
-$config{_SOMAXCONN} = SOMAXCONN;                                       # Max connections in accept queue
 $config{OSNAME}            = $^O;                                      # Operating System Name
-$config{IS_DARWIN}       = "NO";                                       # Is OSX?
 $config{STARTSCRIPT}     = "inspircd";                 # start script?
 $config{DESTINATION}     = "BASE";                             # Is target path.
 if ($config{OSNAME} =~ /darwin/i)
 {
-       $config{IS_DARWIN} = "YES";
        $config{STARTSCRIPT}      = "org.inspircd.plist";               # start script for OSX.
        $config{CC}                 = "xcrun clang++";                                  # C++ compiler for OSX.
 }
@@ -268,7 +248,6 @@ our $exec = $config{CC} . " -dumpversion | cut -c 1";
 chomp($config{GCCVER}          = `$exec`);                             # Major GCC Version
 $exec = $config{CC} . " -dumpversion | cut -c 3";
 chomp($config{GCCMINOR}                = `$exec`);
-$config{MAXBUF}                        = "512";                                # Max buffer size
 
 if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)(?:[a-z])?(?:\-[a-z][0-9])?/) {
        $config{HAS_OPENSSL} = $1;
@@ -277,7 +256,7 @@ if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)(?:[a-z])?(?:\-[a-z][0-9])?/) {
 }
 
 if (($config{GCCVER} eq "") || ($config{GCCMINOR} eq "")) {
-       if ($config{IS_DARWIN} eq "YES") {
+       if ($config{OSNAME} eq 'darwin') {
                print $config{CC} . " was not found! You require clang++ (the LLVM C++ compiler, part of the OSX developer tools) to build InspIRCd!\n";
        } else {
                print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";         
@@ -309,11 +288,6 @@ sub update
                } else {
                        # We've Loaded the cache file and all our variables..
                        print "Updating files...\n";
-                       if (defined($opt_disable_debug) && $opt_disable_debug == 1)
-                       {
-                               print "Disabling debug information (-g).\n";
-                               $config{OPTIMISATI} = "";
-                       }
                        $has_epoll = $config{HAS_EPOLL};
                        $has_ports = $config{HAS_PORTS};
                        $has_kqueue = $config{HAS_KQUEUE};
@@ -369,6 +343,18 @@ if (test_file($config{CC}, "eventfd.cpp")) {
        print "no\n";
 }
 
+printf "Checking if a TCP deferring mechanism is available... ";
+if (test_file($config{CC}, "tcp_defer_accept.cpp")) {
+       $config{HAS_DEFER} = "TCP_DEFER_ACCEPT";
+       print "yes (TCP_DEFER_ACCEPT)\n";
+} elsif (test_file($config{CC}, "so_acceptfilter.cpp")) {
+       $config{HAS_DEFER} = "SO_ACCEPTFILTER";
+       print "yes (SO_ACCEPTFILTER)\n";
+} else {
+       $config{HAS_DEFER} = "false";
+       print "no\n";
+}
+
 print "Checking whether epoll is available... ";
 $has_epoll = test_header($config{CC}, "sys/epoll.h");
 print $has_epoll ? "yes\n" : "no\n";
@@ -484,8 +470,8 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
                                chomp($config{GCCVER}       = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
                                chomp($config{GCCMINOR}     = `$config{CC} -dumpversion | cut -c 3`);
                                print "Queried compiler: \e[1;32m$config{CC}\e[0m (version \e[1;32m$config{GCCVER}.$config{GCCMINOR}\e[0m)\n";
-                               if ($config{GCCVER} < 3) {
-                                       print "\e[1;32mGCC 2.x WILL NOT WORK!\e[0m. Let's try that again, shall we?\n";
+                               if ($config{GCCVER} < 4 || $config{GCCVER} == 4 && $config{GCCMINOR} < 1) {
+                                       print "\e[1;32mGCC 4.1 and earlier WILL NOT WORK!\e[0m. Let's try that again, shall we?\n";
                                }
                        }
                        else {
@@ -845,11 +831,8 @@ sub writefiles {
 #define DATA_PATH "$config{DATA_DIR}"
 #define LOG_PATH "$config{LOG_DIR}"
 #define MOD_PATH "$config{MODULE_DIR}"
-#define SOMAXCONN_S "$config{_SOMAXCONN}"
-#define ENTRYPOINT int main(int argc, char** argv)
 
 EOF
-print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
 
                if ($config{OSNAME} =~ /SunOS/i) {
                        print FILEHANDLE "#define IS_SOLARIS\n";
@@ -900,6 +883,13 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
                                $config{SOCKETENGINE} = "socketengine_select";
                        }
                }
+
+               if ($config{HAS_DEFER} eq "TCP_DEFER_ACCEPT") {
+                       print FILEHANDLE "#define USE_TCP_DEFER_ACCEPT";
+               } elsif ($config{HAS_DEFER} eq "SO_ACCEPTFILTER") {
+                       print FILEHANDLE "#define USE_SO_ACCEPTFILTER"
+               }
+
                print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n";
                close(FILEHANDLE);