]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Add building of inspircd_version.h to windows port and remove the overlapping values...
[user/henk/code/inspircd.git] / configure
index e64e194adb81be17f9355cdac147e38ebf398f64..cd21375b5dd06557f0d977a858a982a6bb51d28b 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) ||
@@ -143,7 +139,7 @@ if (defined $opt_base_dir)
 $config{CONFIG_DIR}     = resolve_directory($config{BASE_DIR}."/conf");        # Configuration Directory
 $config{MODULE_DIR}     = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
 $config{BINARY_DIR}     = resolve_directory($config{BASE_DIR}."/bin");         # Binary Directory
-$config{LIBRARY_DIR}   = resolve_directory($config{BASE_DIR}."/lib");          # Library Directory
+$config{BUILD_DIR}      = resolve_directory($config{ME}."/build");         # Build Directory
 
 if (defined $opt_config_dir)
 {
@@ -157,10 +153,6 @@ if (defined $opt_binary_dir)
 {
        $config{BINARY_DIR} = $opt_binary_dir;
 }
-if (defined $opt_library_dir)
-{
-       $config{LIBRARY_DIR} = $opt_library_dir;
-}
 chomp($config{HAS_GNUTLS}   = `pkg-config --modversion gnutls 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
 
 if (defined $opt_freebsd_port)
@@ -238,19 +230,10 @@ if (defined $opt_noports)
 {
        $config{USE_PORTS} = "n";
 }
-$config{IPV6}         = "n";                                           # IPv6 support (experimental)
-if (defined $opt_ipv6)
-{
-       $config{IPV6} = "y";
-}
-$config{SUPPORT_IP6LINKS}   = "y";                                     # IPv4 supporting IPv6 links (experimental)
-if (defined $opt_ipv6links)
+$config{IPV6}         = "y";                                   # IPv6 support
+if (defined $opt_noipv6)
 {
-       $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`);
@@ -536,8 +519,10 @@ if ($config{OSNAME} =~ /FreeBSD/i)
        my $version = `uname -r`;
        if ($version =~ /^4\./)
        {
-               print "yes\n";
-               exit 1;
+               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
        {
@@ -622,13 +607,12 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
                $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");           # Configuration Dir
                $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
                $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");     # Binary Directory
-               $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");      # Library Directory
        }
 
        dir_check("are the configuration files", "CONFIG_DIR");
        dir_check("are the modules to be compiled to", "MODULE_DIR");
        dir_check("is the IRCd binary to be placed", "BINARY_DIR");
-       dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
+       dir_check("do you want the build to take place", "BUILD_DIR");
 
        my $chose_hiperf = 0;
        if ($has_kqueue) {
@@ -654,7 +638,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";
@@ -662,17 +646,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 "")
@@ -817,11 +793,12 @@ if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
        print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
 }
 
+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";
@@ -951,11 +928,8 @@ sub writefiles {
 #define CoreExport /**/
 #define DllExport /**/
 
-#define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
 #define MOD_PATH "$config{MODULE_DIR}"
 #define SOMAXCONN_S "$config{_SOMAXCONN}"
-#define OPTIMISATION $config{OPTIMITEMP}
-#define LIBRARYDIR "$config{LIBRARY_DIR}"
 #define ENTRYPOINT int main(int argc, char** argv)
 
 EOF
@@ -986,9 +960,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";
                }
@@ -1026,18 +997,6 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
                print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n\n#endif\n";
                close(FILEHANDLE);
 
-               open(FILEHANDLE, ">include/inspircd_se_config.h.tmp");
-               print FILEHANDLE <<EOF;
-/* Auto generated by configure, do not modify or commit to svn! */
-#ifndef __CONFIGURATION_SOCKETENGINE__
-#define __CONFIGURATION_SOCKETENGINE__
-
-#include "socketengines/$config{SOCKETENGINE}.h"
-
-#endif
-EOF
-               close(FILEHANDLE);
-
                open(FILEHANDLE, ">include/inspircd_version.h.tmp");
                print FILEHANDLE <<EOF;
 #define VERSION "$version"
@@ -1046,7 +1005,7 @@ EOF
 EOF
                close FILEHANDLE;
 
-               for my $file (qw(include/inspircd_config.h include/inspircd_se_config.h include/inspircd_version.h)) {
+               for my $file (qw(include/inspircd_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: $!";
@@ -1105,9 +1064,12 @@ EOF
                        close(FILEHANDLE);
 
                        print "Writing \e[1;32m$file\e[0m ...\n";
+
+                       $config{BUILD_DIR} ||= resolve_directory($config{ME}."/build");
+
                        for my $var (qw(
-                               CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR
-                               STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE CORE_FLAGS
+                               CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR
+                               STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE
                        )) {
                                s/\@$var\@/$config{$var}/g;
                        }
@@ -1155,6 +1117,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;