]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - configure
Renamed core files to all be libIRCD*
[user/henk/code/inspircd.git] / configure
index b36e30b9cbb7f8c024ef3991e64bf808b86ab5d5..87d1d32d640f089e1ffe6686d09396b95f9448fd 100755 (executable)
--- a/configure
+++ b/configure
@@ -41,7 +41,6 @@ if (!$config{MAX_CLIENT_T}) {
 }
 
 # Get and Set some important vars..
-getosflags();
 getmodules();
 
 my $arg = $ARGV[0];                                            # Do Some Argument Checks..
@@ -56,13 +55,16 @@ if ($arg eq "-update") {
   } else {
     # We've Loaded the cache file and all our variables..
     print "Updating Files..\n";
+    getosflags();
     writefiles();
     print "Complete.\n";
     exit;
   }
 }
 
-getcache();                                                     # Load the config.cache file.
+
+getcache();
+getosflags();
 
 if (!$config{MAX_CLIENT}) { 
   # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
@@ -307,11 +309,11 @@ sub dir_check {
 sub getosflags {
   if ($config{OSNAME} eq "FreeBSD") {
     $config{LDLIBS} = "-Ldl";
-    $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wcomment -Wformat -Wunused -Wshadow -Werror -Wswitch -Wchar-subscripts -Wparentheses -Woverloaded-virtual";
+    $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual -g";
     $config{MAKEPROG} = "gmake";
   } else {
     $config{LDLIBS} = "-ldl";
-    $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wcomment -Wformat -Wunused -Wshadow -Werror -Wswitch -Wchar-subscripts -Wparentheses -Woverloaded-virtual";
+    $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual -g";
     $config{MAKEPROG} = "make";
   }
 }
@@ -364,10 +366,17 @@ sub writefiles {
 #define MAXBUF 514
 EOF
 
-  if ($config{GCCVER} == 3) {
+  if ($config{GCCVER} > 3) {
     print FILEHANDLE "#define GCC3\n";
-    if ($config{GCC34} > 3) {
-      print FILEHANDLE "#define GCC34\n";
+    print FILEHANDLE "#define GCC34\n";
+  }
+  else
+  {
+    if ($config{GCCVER} == 3) {
+      print FILEHANDLE "#define GCC3\n";
+      if ($config{GCC34} > 3) {
+        print FILEHANDLE "#define GCC34\n";
+      }
     }
   }
   if ($config{HAS_STRLCPY} eq "true") {
@@ -375,13 +384,6 @@ EOF
   }
   close(FILEHANDLE);
 
-  # Now the Makefile..
-  print "Writing \033[1;32mMakefile\033[0m\n";
-  my $makefile = "";
-  open(FILEHANDLE, ".Makefile.inc");
-  while (<FILEHANDLE>) {
-    $makefile .= $_;
-  }
   # Create a Modules List..
   my $modules = "";
   foreach $i (@modlist)
@@ -389,25 +391,49 @@ EOF
     $modules .= "m_".$i.".so ";
   }
   chomp($modules);   # Remove Redundant whitespace..
-  $makefile =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
-  $makefile =~ s/\@FLAGS\@/$config{FLAGS}/;
-  $makefile =~ s/\@LDLIBS\@/$config{LDLIBS}/;
-  $makefile =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
-  $makefile =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
-  $makefile =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
-  $makefile =~ s/\@MODULES\@/$modules/;
-
-  open(FILEHANDLE, ">Makefile");
-  print FILEHANDLE $makefile;
-  close(FILEHANDLE);
+
+
+  # Write all .in files.
+  my $tmp = "";
+  my $file = "";
+  opendir(DIRHANDLE, $this);
+  foreach $name (sort readdir(DIRHANDLE)) {
+    if ($name =~ /^\.(.+)\.inc$/)
+    {
+      $file = $1;
+      # All .name.inc files need parsing!
+      $tmp = "";
+      open(FILEHANDLE, ".$file.inc");
+      while (<FILEHANDLE>) {
+        $tmp .= $_;
+      }
+      close(FILEHANDLE);
+
+      $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
+      $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
+      $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
+      $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
+      $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
+      $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
+      $tmp =~ s/\@MODULES\@/$modules/;
+
+      print "Writing \033[1;32m$file\033[0m\n";
+      open(FILEHANDLE, ">$file");
+      print FILEHANDLE $tmp;
+    }
+  }
+  closedir(DIRHANDLE);
+
+  # Make inspircd executable!
+  chmod 0744, 'inspircd';
 
   # Modules Makefile..
   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
   open(FILEHANDLE, ">src/modules/Makefile");
   print FILEHANDLE <<EOF;
 # (C) ChatSpike development team
-# Makefile by <Craig@ChatSpike.net>
-# Many Thanks to Andrew Church <achurch@achurch.org>
+# Makefile by <Craig\@ChatSpike.net>
+# Many Thanks to Andrew Church <achurch\@achurch.org>
 #    for assisting with making this work right.
 #
 # Automatically Generated by ./configure to add a modules