]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Fix indentation
[user/henk/code/inspircd.git] / configure
index 57de80ff0c80e729998dc23589887c5654c81048..7897aec2d66f2af2e1044fb137e477f828217473 100755 (executable)
--- a/configure
+++ b/configure
@@ -512,8 +512,6 @@ if ($has_epoll) {
 print "yes\n" if $has_epoll == 1;
 print "no\n" if $has_epoll == 0;
 
-exit;
-
 printf "Checking if Solaris I/O completion ports are available... ";
 $has_ports = 0;
 my $system = `uname -s`;
@@ -962,6 +960,7 @@ sub getosflags {
 
        if ($config{OSNAME} =~ /OpenBSD/i) {
                $config{MAKEPROG} = "gmake";
+               $config{LDLIBS} = $config{LDLIBS} . " -lunwind";
                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
@@ -1231,6 +1230,21 @@ sub write_dynamic_modules_makefile {
 all: \$(MODULES)
 
 EOF
+
+if ($config{OSNAME} =~ /darwin/) {
+               print FILEHANDLE <<EOCHEESE;
+
+PICLDFLAGS = -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle
+
+EOCHEESE
+} else {
+               print FILEHANDLE <<EOCHEESE;
+
+PICLDFLAGS = -fPIC -DPIC -shared \$(FLAGS)
+
+EOCHEESE
+}
+
        ###
        # End Module Makefile Header
        ###
@@ -1253,20 +1267,8 @@ EOF
        
                print FILEHANDLE <<EOCHEESE;
 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 -export-dynamic -c m_$i.cpp
+       \$(CC) -pipe -I../../include \$(FLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
 EOCHEESE
-
-if ($config{OSNAME} =~ /darwin/) {
-               print FILEHANDLE <<EOCHEESE;
-       \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle $liflags -o m_$i.so m_$i.o
-
-EOCHEESE
-} else {
-               print FILEHANDLE <<EOCHEESE;
-       \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o
-
-EOCHEESE
-}
                $crud = $crud . "       install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
 ###
                # End Write Entry to the MakeFile
@@ -1276,34 +1278,21 @@ EOCHEESE
        opendir(DIRHANDLE, "src/modules");
        foreach $name (sort readdir(DIRHANDLE)) {
                if ($name =~ /^m_(.+?)$/) {
-                       $crapola = "";
-                       $crap3 = "";
+                       $mfrules = "";
+                       $mobjs = "";
                        $mliflags = "";
+                       $mfcount = 0;
                        # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
                        if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
-                               my $i = 0;
-                               print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h"; 
-                               foreach $fname (sort readdir(MDIRHANDLE)) {
-                                       if ($fname =~ /\.cpp$/) {
-                                               $cmflags = getcompilerflags("src/modules/$name/$fname");
-                                               $mliflags = $mliflags . " " . getlinkerflags("src/modules/$name/$fname");
-                                               $deps = getdependencies("src/modules/$name/$fname");
-                                               $oname = $fname;
-                                               $oname =~ s/\.cpp$/.o/g;
-                                               print FILEHANDLE " $name/$oname";
-                                               $crapola = $crapola .  "$name/$oname: $name/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
-                                               $crapola = $crapola .  "        \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
-                                               $crap3 = $crap3 . " $name/$oname";
-                                               $i++;
-                                       }
-                               }
-                               print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$i files found\033[0m)\n";
+                               read_module_directory("src/modules/$name", $name);
+                               print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$mfcount files found\033[0m)\n";
+                               print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $mobjs\n"; 
                                if ($config{IS_DARWIN} eq "YES") {
-                                       print FILEHANDLE "\n    \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle -o $name.so $crap3\n"; 
+                                       print FILEHANDLE "      \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) $mliflags -bundle -o $name.so $mobjs\n"; 
                                } else {
-                                       print FILEHANDLE "\n    \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $crap3\n";
+                                       print FILEHANDLE "      \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $mobjs\n";
                                }
-                               print FILEHANDLE "\n$crapola\n";
+                               print FILEHANDLE "\n$mfrules\n";
                                closedir(MDIRHANDLE);
                                $crud = $crud . "       install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
                        }
@@ -1314,6 +1303,31 @@ EOCHEESE
        print FILEHANDLE "modinst:\n    \@echo \"Installing modules...\"\n" . $crud;
 }
 
+sub read_module_directory {
+       my ($dpath, $reldpath) = @_;
+       
+       if (opendir(MDIRHANDLE, $dpath) == 0) {
+               return;
+       }
+       
+       foreach $fname (sort readdir(MDIRHANDLE)) {
+               if ($fname =~ /\.cpp$/) {
+                       $cmflags = getcompilerflags("$dpath/$fname");
+                       $mliflags = $mliflags . " " . getlinkerflags("$dpath/$fname");
+                       $deps = getdependencies("$dpath/$fname");
+                       $oname = $fname;
+                       $oname =~ s/\.cpp$/.o/g;
+                       $mfrules = $mfrules .  "$reldpath/$oname: $reldpath/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
+                       $mfrules = $mfrules .  "        \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $reldpath/$oname -c $reldpath/$fname\n\n";
+                       $mobjs = $mobjs . " $reldpath/$oname";
+                       $mfcount++;
+               }
+               elsif ((-d "$dpath/$fname") && !($fname eq ".") && !($fname eq "..")) {
+                       read_module_directory($dpath."/".$fname, $reldpath."/".$fname);
+               }
+       }
+}
+
 sub write_dynamic_makefile {
 
        my $i = 0;