X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=278bc9bbd5a5002a776988e3af25a29dedc5d959;hb=c51f8c8fe906ca0eb8f2d45d8c592f397d6729d9;hp=5c51f2e960c2fe35a863c64e49bde2f0d76d88cb;hpb=6edfe13e49a4dc49fb349f47c9dfff1c58d6e96f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 5c51f2e96..278bc9bbd 100755 --- a/configure +++ b/configure @@ -12,7 +12,7 @@ # ################################################### -require 5.6.0; +require 5.8.0; use Socket; use Cwd; use Getopt::Long; @@ -467,10 +467,16 @@ if ($has_epoll) { { # Suggestion from nenolod, weed out odd systems which have glibc built # against 2.4 kernels (ick) - + my $kernel_arch = `uname -p`; + chomp($kernel_arch); $libcv = 0.0; $kernelv = 0.0; - open (FH,"/lib/libc.so.6|") or $has_epoll = 0; + if ($kernel_arch =~ /x86_64/) { + open (FH,"/lib64/libc.so.6|") or $has_epoll = 0; + } + else { + open (FH,"/lib/libc.so.6|") or $has_epoll = 0; + } if ($has_epoll) { while (chomp($line = )) @@ -478,14 +484,14 @@ if ($has_epoll) { if ($line =~ /GNU C Library .* version (.*?) /) { $libcv = $1; - $libcv =~ /([0-9\.\-])+/; + $libcv =~ /(\d+\.\d+)/; $libcv = $1; } elsif ($line =~ /Compiled on a Linux (.*?\..*?)\.* system/) { $kernelv = $1; # Fix for some retarded libc builds, strip off >> and << etc. - $kernelv =~ /([0-9\.\-])+/; + $kernelv =~ /(\d+\.\d+)/; $kernelv = $1; } } @@ -543,6 +549,36 @@ if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPE $config{HAS_OPENSSL} = "n"; } +printf "Checking if you are running an ancient, unsupported OS... "; +if ($config{OSNAME} =~ /FreeBSD/i) +{ + $version = `uname -r`; + if ($version =~ /^4\./) + { + $foundit = `ls -l /usr/local/lib/libgnugetopt* | wc -l`; + if ($foundit > 0) + { + # ICKY ICKY ICK, FREEBSD 4.x! GET AN UPGRADE! + $config{CRAQ} = "-L/usr/local/lib -lgnugetopt -DHAVE_DECL_GETOPT=1"; + print "yes\n"; + } + else + { + print "\n\nERROR: You require libgnugetopt (from ports or packages) to build InspIRCd on FreeBSD 4.11.\n"; + } + } + else + { + $config{CRAQ} = " "; + print "no ($version)\n"; + } +} +else +{ + $config{CRAQ} = " "; + print "no ($config{OSNAME})\n"; +} + ################################################################################ # BEGIN INTERACTIVE PART # ################################################################################ @@ -1238,34 +1274,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"; } @@ -1276,6 +1299,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; @@ -1306,6 +1354,8 @@ sub write_dynamic_makefile { $se = "socketengine_ports"; } + $freebsd4libs = $config{CRAQ}; + open(FH,">src/Makefile") or die("Could not write src/Makefile"); print FH <