]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Move some stuff from using userrec cached stuff to using stuff in the connect classes
[user/henk/code/inspircd.git] / configure
index 68dd5029306a97a6985c14cdcd05119bc5d4f5c3..ba44b745cf9ae616e0f7e3bce3dbddfe57166898 100755 (executable)
--- a/configure
+++ b/configure
@@ -49,6 +49,10 @@ my @immutabledeps = (
 #
 ###############################################################################################
 
+# List of commands that make up 'make install'
+
+my $install_list = "";
+
 # This is a list of all files in the core. Each cpp file is mapped to a shared object file,
 # whos file extension is omitted (these can vary from system to system). Auto detected by
 # scanning the src/*.cpp files for files containing /* $Core: */ identifiers.
@@ -1003,13 +1007,13 @@ sub dir_check {
 sub getosflags {
 
        $config{LDLIBS} = "-lstdc++";
-       $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}";
-       $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated -g";
+       $config{FLAGS}  = "-fPIC -Wall -Wextra -pedantic $config{OPTIMISATI}";
+       $config{DEVELOPER} = "-fPIC -Wall -Wextra -pedantic -g";
        $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared";
        $config{MAKEPROG} = "make";
 
        if ($config{OSNAME} =~ /darwin/i) {
-               $config{FLAGS}  = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}";
+               $config{FLAGS}  = "-DDARWIN -frtti -fPIC -Wall -Wextra -pedantic $config{OPTIMISATI}";
                $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
                $config{LDLIBS} = "-ldl -lstdc++";
        }
@@ -1030,7 +1034,7 @@ sub getosflags {
 
        if ($config{OSNAME} =~ /Linux/i) {
                $config{LDLIBS} = "-ldl -lstdc++";
-               $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}";
+               $config{FLAGS}  = "-fPIC -Wall -Wextra -pedantic $config{OPTIMISATI}";
                $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
                $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
                $config{MAKEPROG} = "make";
@@ -1162,7 +1166,7 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
 #ifndef __CONFIGURATION_SOCKETENGINE__
 #define __CONFIGURATION_SOCKETENGINE__
 
-#include "$se.h"
+#include "socketengines/$se.h"
 
 #endif
 EOF
@@ -1195,8 +1199,6 @@ EOF
        my $file = "";
        my $exe = "inspircd";
 
-       opendir(DIRHANDLE, $this);
-
        # Do this once here, and cache it in the .*.inc files,
        # rather than attempting to read src/version.sh from
        # compiled code -- we might not have the source to hand.
@@ -1206,14 +1208,15 @@ EOF
        chomp(my $revision = getrevision());
        $version = "$version(r$revision)";
 
-       my $LIBEXT = "so";
-       if ($config{IS_DARWIN} eq "YES")
-       {
-               $LIBEXT = "dylib";
-       }
        # We can actually parse any file starting with . and ending with .inc,
        # but right now we only parse .inspircd.inc to form './inspircd'
 
+        print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
+       write_dynamic_makefile();
+       write_dynamic_modules_makefile();
+
+       opendir(DIRHANDLE, $this);
+
        foreach $name (sort readdir(DIRHANDLE)) {
                if ($name =~ /^\.(.+)\.inc$/) {
                        $file = $1;
@@ -1223,12 +1226,13 @@ EOF
 
                        # All .name.inc files need parsing!
                        $tmp = "";
-                       open(FILEHANDLE, ".$file.inc");
+                       open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc");
                        while (<FILEHANDLE>) {
                                $tmp .= $_;
                        }
                        close(FILEHANDLE);
 
+                       print "Writing \033[1;32m$file\033[0m ...\n";
                        $tmp =~ s/\@CC\@/$config{CC}/;
                        $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
                        $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
@@ -1239,7 +1243,6 @@ EOF
                        $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
                        $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
                        $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
-                       $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/;
                        $tmp =~ s/\@MODULES\@/$modules/;
                        $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/;
                        $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/;
@@ -1247,8 +1250,8 @@ EOF
                        $tmp =~ s/\@EXECUTABLE\@/$exe/;
                        $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
                        $tmp =~ s/\@VERSION\@/$version/;
+                       $tmp =~ s/\@INSTALL_LIST\@/$install_list/;
 
-                       print "Writing \033[1;32m$file\033[0m\n";
                        open(FILEHANDLE, ">$file");
                        print FILEHANDLE $tmp;
                }
@@ -1257,10 +1260,6 @@ EOF
 
        # Make inspircd executable!
        chmod 0744, 'inspircd';
-
-       print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
-       write_dynamic_makefile();
-       write_dynamic_modules_makefile();
 }
 
 sub write_dynamic_modules_makefile {
@@ -1290,13 +1289,13 @@ EOF
 if ($config{OSNAME} =~ /darwin/) {
                print FILEHANDLE <<EOCHEESE;
 
-PICLDFLAGS = -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle
+PICLDFLAGS = -twolevel_namespace -undefined dynamic_lookup -bundle
 
 EOCHEESE
 } else {
                print FILEHANDLE <<EOCHEESE;
 
-PICLDFLAGS = -fPIC -DPIC -shared \$(FLAGS)
+PICLDFLAGS = -fPIC -DPIC -shared
 
 EOCHEESE
 }
@@ -1321,10 +1320,24 @@ EOCHEESE
        
                #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
        
-               print FILEHANDLE <<EOCHEESE;
+
+               $nicerflags = $config{FLAGS};
+               $nicerflags =~ s/-pedantic//g;
+
+               if (nopedantic("src/modules/m_".$i.".cpp"))
+               {
+                       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 $nicerflags $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
-EOCHEESE
+";
+               }
                $crud = $crud . "       install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
 ###
                # End Write Entry to the MakeFile
@@ -1433,6 +1446,7 @@ sub write_dynamic_makefile
                if ($name =~ /^cmd_(.+)\.cpp$/)
                {
                        $cmdlist[$i++] = $1;
+                       $install_list = $install_list . "       -install -m \$(INSTMODE) src/commands/cmd_" . $1 . ".so \$(LIBPATH)\n";
                }
        }
        closedir(DIRHANDLE);
@@ -1482,7 +1496,7 @@ sub write_dynamic_makefile
                                }
                                elsif ($line =~ /\/\* \$If: (\w+) \*\//i)
                                {
-                                       if (($config{$1} ne "y") and ($config{$1} ne "yes") and ($config{$1} ne "1"))
+                                       if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
                                        {
                                                # Skip to 'endif'
                                                while (chomp($line = <CPP>))
@@ -1519,6 +1533,7 @@ sub write_dynamic_makefile
        {
                $all = $all . $filelist{$cpp} . "." . $libraryext . " ";
                $all_libsonly = $all_libsonly . $filelist{$cpp} . "." . $libraryext . " ";
+               $install_list = $install_list . "       -install -m \$(INSTMODE) src/" . $filelist{$cpp} . "." . $libraryext . " \$(LIBPATH)\n";
        }
        $all = $all . "moo inspircd\n";