]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Remove unneeded Extensible inheritance and remove "age" field from classbase
[user/henk/code/inspircd.git] / configure
index 09dbafd2d074a593f502cf4957c0ee64e4e8bc64..514ddee81d5bae22ad23d8159e72a0d447c798cf 100755 (executable)
--- a/configure
+++ b/configure
@@ -44,7 +44,7 @@ use make::opensslcert;
 
 our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_ports,
     $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue,
-    $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_maxbuf, $opt_disable_debug, $opt_freebsd_port);
+    $opt_noipv6, $opt_maxbuf, $opt_disable_debug, $opt_freebsd_port);
 
 our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir,
     $opt_library_dir);
@@ -69,9 +69,7 @@ GetOptions (
        'disable-ports' => \$opt_noports,
        'disable-epoll' => \$opt_noepoll,
        'disable-kqueue' => \$opt_nokqueue,
-       'enable-ipv6' => \$opt_ipv6,
-       'enable-remote-ipv6' => \$opt_ipv6links,
-       'disable-remote-ipv6' => \$opt_noipv6links,
+       'disable-ipv6' => \$opt_noipv6,
        'with-cc=s' => \$opt_cc,
        'with-maxbuf=i' => \$opt_maxbuf,
        'enable-freebsd-ports-openssl' => \$opt_freebsd_port,
@@ -111,9 +109,7 @@ our $non_interactive = (
        (defined $opt_binary_dir) ||
        (defined $opt_nointeractive) ||
        (defined $opt_cc) ||
-       (defined $opt_ipv6) ||
-       (defined $opt_ipv6links) ||
-       (defined $opt_noipv6links) ||
+       (defined $opt_noipv6) ||
        (defined $opt_kqueue) ||
        (defined $opt_epoll) ||
        (defined $opt_ports) ||
@@ -238,19 +234,10 @@ if (defined $opt_noports)
 {
        $config{USE_PORTS} = "n";
 }
-$config{IPV6}         = "n";                                           # IPv6 support (experimental)
-if (defined $opt_ipv6)
+$config{IPV6}         = "y";                                   # IPv6 support
+if (defined $opt_noipv6)
 {
-       $config{IPV6} = "y";
-}
-$config{SUPPORT_IP6LINKS}   = "y";                                     # IPv4 supporting IPv6 links (experimental)
-if (defined $opt_ipv6links)
-{
-       $config{SUPPORT_IP6LINKS} = "y";
-}
-if (defined $opt_noipv6links)
-{
-       $config{SUPPORT_IP6LINKS} = "n";
+       $config{IPV6} = "n";
 }
 chomp($config{GCCVER}       = `g++ -dumpversion | cut -c 1`);          # Major GCC Version
 chomp($config{GCCMINOR}     = `g++ -dumpversion | cut -c 3`);
@@ -313,12 +300,10 @@ sub update
                } else {
                        # We've Loaded the cache file and all our variables..
                        print "Updating files...\n";
-                       getosflags();
                        if (defined($opt_disable_debug) && $opt_disable_debug == 1)
                        {
                                print "Disabling debug information (-g).\n";
                                $config{OPTIMISATI} = "";
-                               getosflags();
                        }
                        $has_epoll = $config{HAS_EPOLL};
                        $has_ports = $config{HAS_PORTS};
@@ -427,8 +412,8 @@ sub test_compile {
 print "Running non-interactive configure...\n" unless $interactive;
 print "Checking for cache from previous configure... ";
 print ((!getcache()) ? "not found\n" : "found\n");
-print "Checking operating system version... ";
-print getosflags() . "\n";
+$config{SYSTEM} = lc $^O;
+print "Checking operating system version... $config{SYSTEM}\n";
 
 printf "Checking if stdint.h exists... ";
 $config{HAS_STDINT} = "true";
@@ -538,27 +523,18 @@ if ($config{OSNAME} =~ /FreeBSD/i)
        my $version = `uname -r`;
        if ($version =~ /^4\./)
        {
-               my $foundit = `ls -l /usr/local/lib/libgnugetopt* | wc -l`;
-               if ($foundit > 0)
-               {
-                       # ICKY ICKY ICK, FREEBSD 4.x! GET AN UPGRADE!
-                       $config{CRAQ} = "-L/usr/local/lib -lgnugetopt -DHAVE_DECL_GETOPT=1";
-                       print "yes (upgrade ffs, freebsd 4 is *way* out of date)\n";
-               }
-               else
-               {
-                       print "\n\nERROR: You require libgnugetopt (from ports or packages) to build InspIRCd on FreeBSD 4.11.\n";
-               }
+               print "yes.\n";
+               print "FreeBSD 4.x is no longer supported. By ANYONE.\n";
+               print "To build, you will need to add the following to CXXFLAGS:\n";
+               print "\t-L/usr/local/lib -lgnugetopt -DHAVE_DECL_GETOPT=1\n";
        }
        else
        {
-               $config{CRAQ} = " ";
                print "no ($version)\n";
        }
 }
 else
 {
-       $config{CRAQ} = " ";
        print "no ($config{OSNAME})\n";
 }
 
@@ -667,7 +643,7 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
        }
 
        if (!$chose_hiperf) {
-               yesno('USE_POLL', "Would you like to use poll?\n This is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable poll?\n");
+               yesno('USE_POLL', "Would you like to use poll?\n This is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable poll?");
                if ($config{USE_POLL} ne "y")
                {
                        print "No high-performance socket engines are available, or you chose\n";
@@ -675,17 +651,9 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
                }
        }
 
-       yesno('IPV6',"Would you like to build InspIRCd with IPv6 support?");
+       yesno('IPV6',"Would you like to build InspIRCd with IPv6 support?\nYou can still use IPv4 addresses in your port bindings.\n\nEnable IPv6?");
        print "\n";
 
-       if ($config{IPV6} eq "y") {
-               print "You have chosen to build an \e[1;32mIPV6-enabled\e[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 \e[1;32mIPV4-only\e[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers? If you are using a recent operating system and are\nunsure, answer yes. If you answer 'no' here, your InspIRCd server will\nbe unable to parse IPV6 addresses (e.g. for CIDR bans)\n\nEnable linking to servers which have IPV6 enabled?");
-               print "\n";
-       }
-
        $config{USE_FREEBSD_BASE_SSL} = "n";
        $config{USE_FREEBSD_PORTS_SSL} = "n";
        if ($config{HAS_OPENSSL_PORT} ne "")
@@ -830,12 +798,12 @@ if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
        print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
 }
 
-getosflags();
+depcheck();
 writefiles(1);
 makecache();
 
 print "\n\n";
-print "To build your server with these settings, please type '\e[1;32m$config{MAKEPROG}\e[0m' now.\n";
+print "To build your server with these settings, please run '\e[1;32mmake\e[0m' now.\n";
 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
        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";
@@ -944,74 +912,6 @@ sub dir_check {
 
 our $SHARED = "";
 
-sub getosflags {
-
-       # Beware: Linux sets it's own cflags below for some retarded reason
-       $config{LDLIBS} = "-pthread -lstdc++";
-       $config{FLAGS}  = "-pipe -fPIC -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall $config{OPTIMISATI}";
-       $config{DEVELOPER} = "-pipe -fPIC -Woverloaded-virtual -Wshadow -Wall -Wformat=2 -Wmissing-format-attribute -g";
-       $SHARED = "-shared -export-dynamic";
-       $config{MAKEPROG} = "make";
-
-       if ($config{OSNAME} =~ /darwin/i) {
-               $config{FLAGS}  = "-pipe -DDARWIN -frtti -fPIC -Wall $config{OPTIMISATI}";
-               $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
-               $config{LDLIBS} = "-ldl -pthread -lstdc++";
-       }
-
-       if ($config{OSNAME} =~ /OpenBSD/i) {
-               $config{MAKEPROG} = "gmake";
-# apparantly (Dagonet says) that this causes problems, so let's try without it.
-#              $config{LDLIBS} = $config{LDLIBS} . " -lunwind";
-               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!
-               if ($foo ne "") {
-                       $config{CC} = "eg++";
-                       chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
-                       chomp($config{GCCMINOR}     = `eg++ -dumpversion | cut -c 3`);
-               }
-               return "OpenBSD";
-       }
-
-       if ($config{OSNAME} =~ /Linux/i) {
-               $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{LDLIBS} .= " " . $ENV{LDFLAGS} if exists($ENV{LDFLAGS});
-               $config{MAKEPROG} = "make";
-       }
-
-       if ($config{OSNAME} =~ /FreeBSD/i) {
-               $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
-               $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
-               $config{LDLIBS} .= " " . $ENV{LDFLAGS} if exists($ENV{LDFLAGS});
-       }
-
-       if ($config{OSNAME} =~ /SunOS/i or $config{OSNAME} =~ /solaris/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} .= " -lsocket -lnsl -lrt -lresolv -pthread";
-               return "Solaris";
-       }
-
-       if($config{OSNAME} =~ /MINGW32/i)
-       {
-               # All code is position-independent on windows
-               $config{FLAGS} =~ s/-fPIC //;
-               return "MinGW";
-       }
-
-       return $config{OSNAME};
-}
-
 my ($mliflags, $mfrules, $mobjs, $mfcount) = ("", "", "", 0);
 
 sub writefiles {
@@ -1035,12 +935,9 @@ sub writefiles {
 
 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
 #define MOD_PATH "$config{MODULE_DIR}"
-#define VERSION "$version"
-#define REVISION "$revision2"
 #define SOMAXCONN_S "$config{_SOMAXCONN}"
 #define OPTIMISATION $config{OPTIMITEMP}
 #define LIBRARYDIR "$config{LIBRARY_DIR}"
-#define SYSTEM "$incos"
 #define ENTRYPOINT int main(int argc, char** argv)
 
 EOF
@@ -1071,9 +968,6 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
                if ($config{IPV6} =~ /y/i) {
                        print FILEHANDLE "#define IPV6\n";
                }
-               if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
-                       print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
-               }
                if ($config{HAS_EVENTFD} eq 'true') {
                        print FILEHANDLE "#define HAS_EVENTFD\n";
                }
@@ -1123,7 +1017,15 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
 EOF
                close(FILEHANDLE);
 
-               for my $file (qw(include/inspircd_config.h include/inspircd_se_config.h)) {
+               open(FILEHANDLE, ">include/inspircd_version.h.tmp");
+               print FILEHANDLE <<EOF;
+#define VERSION "$version"
+#define REVISION "$revision2"
+#define SYSTEM "$incos"
+EOF
+               close FILEHANDLE;
+
+               for my $file (qw(include/inspircd_config.h include/inspircd_se_config.h include/inspircd_version.h)) {
                        my $diff = 0;
                        open my $fh1, $file or $diff = 1;
                        open my $fh2, $file.'.tmp' or die "Can't read $file.tmp that we just wrote: $!";
@@ -1183,7 +1085,7 @@ EOF
 
                        print "Writing \e[1;32m$file\e[0m ...\n";
                        for my $var (qw(
-                               CC FLAGS DEVELOPER LDLIBS BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR
+                               CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR
                                STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE CORE_FLAGS
                        )) {
                                s/\@$var\@/$config{$var}/g;
@@ -1195,6 +1097,8 @@ EOF
                                my $mk_tmp = $_;
                                s/\@IFDEF (\S+)/ifdef $1/g;
                                s/\@IFNDEF (\S+)/ifndef $1/g;
+                               s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g;
+                               s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g;
                                s/\@ELSE/else/g;
                                s/\@ENDIF/endif/g;
                                s/ *\@BSD_ONLY .*\n//g;
@@ -1206,6 +1110,8 @@ EOF
                                $_ = $mk_tmp;
                                s/\@IFDEF (\S+)/.if defined($1)/g;
                                s/\@IFNDEF (\S+)/.if !defined($1)/g;
+                               s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g;
+                               s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g;
                                s/\@ELSE/.else/g;
                                s/\@ENDIF/.endif/g;
                                s/\@BSD_ONLY //g;
@@ -1228,6 +1134,15 @@ EOF
        chmod 0744, 'inspircd';
 }
 
+sub depcheck
+{
+       getmodules();
+       for my $mod (@modlist) {
+               getcompilerflags("src/modules/m_$mod.cpp");
+               getlinkerflags("src/modules/m_$mod.cpp");
+       }
+}
+
 sub prepare_dynamic_makefile
 {
        my $i = 0;
@@ -1244,15 +1159,6 @@ sub prepare_dynamic_makefile
        {
                $config{USE_PORTS} = 0;
        }
-
-       if ($config{IS_DARWIN} eq "YES")
-       {
-               $config{CORE_FLAGS} = '-dynamic -bind_at_load -L.';
-       }
-       else
-       {
-               $config{CORE_FLAGS} = (defined $config{CRAQ} ? $config{CRAQ}. ' ' : "").'-rdynamic -L.'
-       }
 }
 
 # Routine to list out the extra/ modules that have been enabled.