X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=f332e73959314ac42ce66c3fc8d066863a6722dc;hb=3a554ef1e9be9dbcf3de3301a4a6c2938d643bea;hp=16c4547583298eeee883f5fcc77b6a21563b4b3d;hpb=ddb55c296c5b76bc048c7328af1a6b01485092b8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 16c454758..f332e7395 100755 --- a/configure +++ b/configure @@ -12,6 +12,7 @@ # ######################################## + require 5.6.0; use Cwd; use Getopt::Long; @@ -45,6 +46,7 @@ GetOptions ( 'module-dir=s' => \$opt_module_dir, 'binary-dir=s' => \$opt_binary_dir, 'library-dir=s' => \$opt_library_dir, + 'disable-debuginfo' => sub { $opt_disable_debug = 1 }, 'help' => sub { showhelp(); }, 'modupdate' => sub { modupdate(); }, 'update' => sub { update(); }, @@ -135,7 +137,14 @@ if (defined $opt_use_openssl) # no, let's not change these. $config{OPTIMITEMP} = "0"; # Default Optimisation Value -$config{OPTIMISATI} = "-g"; # Optimisation Flag +if (!defined $opt_disable_debug) +{ + $config{OPTIMISATI} = "-g"; # Optimisation Flag +} +else +{ + $config{OPTIMISATI} = ""; # DEBUGGING OFF! +} $config{NICK_LENGT} = "31"; # Default Nick Length if (defined $opt_nick_length) @@ -302,6 +311,12 @@ sub update # We've Loaded the cache file and all our variables.. print "Updating Files..\n"; getosflags(); + if ($opt_disable_debug == 1) + { + print "Disabling debug information (-g).\n"; + $config{OPTIMISATI} = ""; + getosflags(); + } $has_epoll = $config{HAS_EPOLL}; $has_kqueue = $config{HAS_KQUEUE}; writefiles(1); @@ -1054,34 +1069,37 @@ sub dir_check { } sub getosflags { - if ($config{OSNAME} =~ /BSD$/) { - $config{LDLIBS} = "-lstdc++"; - $config{FLAGS} = "-fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + + $config{LDLIBS} = "-lstdc++"; + $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{MAKEPROG} = "make"; + + if ($config{OSNAME} eq "OpenBSD") { $config{MAKEPROG} = "gmake"; - if ($config{OSNAME} eq "OpenBSD") { - 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 - # 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 - } - return "OpenBSD"; + 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 + # 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 } - return $config{OSNAME}; - } else { + return "OpenBSD"; + } + + if ($config{OSNAME} =~ /Linux/) { $config{LDLIBS} = "-ldl -lstdc++"; - $config{FLAGS} = "-fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); $config{MAKEPROG} = "make"; if ($config{OSNAME} =~ /CYGWIN/) { - $config{FLAGS} = "-Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}"; $config{LDLIBS} = ""; $config{MAKEPROG} = "/usr/bin/make"; $config{MAKEORDER} = "ircd mods"; return "Cygwin"; } elsif ($config{OSNAME} eq "CYG-STATIC") { - $config{FLAGS} = "-Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}"; $config{LDLIBS} = ""; $config{MAKEPROG} = "/usr/bin/make"; $config{MAKEORDER} = "mods ircd"; @@ -1089,7 +1107,7 @@ sub getosflags { $config{STATIC_LINK} = "yes"; return "Cygwin-Static"; } - return "Linux"; + $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); } if ($config{OSNAME} =~ /SunOS/) @@ -1099,6 +1117,7 @@ sub getosflags { # nsl = dns stuff # rt = POSIX realtime extensions # resolv = inet_aton only (why isnt this in nsl?!) + $config{MAKEPROG} = "gmake"; $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv"; return "Solaris"; } @@ -1109,6 +1128,8 @@ sub getosflags { $config{FLAGS} =~ s/-fPIC //; return "MinGW"; } + + return $config{OSNAME}; } sub is_dir { @@ -1294,6 +1315,18 @@ EOF 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. + # Fix for bug#177 by Brain. + + chomp(my $version = `sh ./src/version.sh`); + chomp(my $revision = getrevision()); + $version = "$version(r$revision)"; + + # We can actually parse any file starting with . and ending with .inc, + # but right now we only parse .inspircd.inc to form './inspircd' + foreach $name (sort readdir(DIRHANDLE)) { if ($name =~ /^\.(.+)\.inc$/) { $file = $1; @@ -1318,6 +1351,7 @@ EOF $tmp =~ s/\@EXECUTABLE\@/$exe/; $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/; $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/; + $tmp =~ s/\@VERSION\@/$version/; print "Writing \033[1;32m$file\033[0m\n"; open(FILEHANDLE, ">$file"); @@ -1541,7 +1575,7 @@ EOF print FILEHANDLE <