X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=7c0b4ef04f1cc96f6f1e047c77caefed5be7542f;hb=1ff26bac16487869af7a5e4ebfa1219096c9327b;hp=4622d97039e656c913be98d218a73a91d62b2ba2;hpb=461127296029af6c438c1366a029911f1ae1f395;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 4622d9703..7c0b4ef04 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ ################################################### # InspIRCd Configuration Script # -# Copyright 2002-2007 The InspIRCd Development Team +# Copyright 2002-2008 The InspIRCd Development Team # http://www.inspircd.org/wiki/index.php/Credits # # Licensed under GPL, please see the COPYING file @@ -98,7 +98,7 @@ our %extraobjects = (); our %extrasources = (); our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_nick_length, - $opt_chan_length, $opt_maxclients, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports, + $opt_chan_length, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue, $opt_disablerpath, $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_ident, $opt_quit, $opt_topic, $opt_maxbuf, $opt_kick, $opt_gecos, $opt_away, $opt_modes, $opt_disable_debug, $opt_maxchans, @@ -123,7 +123,6 @@ GetOptions ( 'disable-interactive' => \$opt_nointeractive, 'with-nick-length=i' => \$opt_nick_length, 'with-channel-length=i' => \$opt_chan_length, - 'with-max-clients=i' => \$opt_maxclients, 'enable-ports' => \$opt_ports, 'enable-epoll' => \$opt_epoll, 'enable-kqueue' => \$opt_kqueue, @@ -154,7 +153,6 @@ GetOptions ( 'update' => sub { update(); }, 'svnupdate' => sub { svnupdate(); }, 'clean' => sub { clean(); }, - 'update-root' => sub { update_root() }, 'list-extras' => sub { list_extras; exit 0; }, # This, --enable-extras, and --disable-extras are for non-interactive managing. 'enable-extras=s@' => \@opt_enableextras, # ^ 'disable-extras=s@' => \@opt_disableextras, # ^ @@ -182,7 +180,6 @@ our $non_interactive = ( (defined $opt_away) || (defined $opt_gecos) || (defined $opt_kick) || - (defined $opt_maxclients) || (defined $opt_modes) || (defined $opt_topic) || (defined $opt_quit) || @@ -210,7 +207,6 @@ our $interactive = !$non_interactive; chomp(our $topdir = getcwd()); our $this = resolve_directory($topdir); # PWD, Regardless. our @modlist = (); # Declare for Module List.. - our %config = (); # Initiate Configuration Hash.. $config{ME} = resolve_directory($topdir); # Present Working Directory @@ -326,8 +322,6 @@ if (defined $opt_noipv6links) { $config{SUPPORT_IP6LINKS} = "n"; } -chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit -chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version $config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue $config{OSNAME} = $^O; # Operating System Name @@ -393,12 +387,6 @@ if ($config{GCCVER} eq "") { exit; } -our $fd_scan_fail = ""; -if (!$config{MAX_CLIENT_T}) { - $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default' - $fd_scan_fail = "true"; # Used Later -} - # Get and Set some important vars.. getmodules(); @@ -409,42 +397,6 @@ sub clean our ($has_epoll, $has_ports, $has_kqueue) = (0, 0, 0); -sub update_root -{ - eval { - chomp($topdir = getcwd()); - $this = resolve_directory($topdir); # PWD, Regardless. - getmodules(); - # Does the cache file exist? - if (!getcache()) { - # No, No it doesn't.. *BASH* - print "You have not run ./configure before. Please do this before trying to run the update script.\n"; - exit 0; - } else { - print "Updating root files...\n"; - getosflags(); - if (defined($opt_disable_debug) && $opt_disable_debug == 1) - { - print "Disabling debug information (-g).\n"; - $config{OPTIMISATI} = ""; - getosflags(); - } - $has_epoll = $config{HAS_EPOLL}; - $has_ports = $config{HAS_PORTS}; - $has_kqueue = $config{HAS_KQUEUE}; - write_root_files(); - makecache(); - print "Complete.\n"; - exit 0; - } - }; - if ($@) - { - print "Configure update failed: $@\n"; - } - exit 1; -} - sub update { eval { @@ -521,14 +473,98 @@ sub svnupdate open(FH,"<.svn/entries") or $fail = 1; if ($fail) { print "This is not an SVN copy of InspIRCd.\n"; - exit; + exit 1; } else { close(FH); } - system("svn update"); - system("perl configure -update"); + open my $fd, "-|", "svn update"; + my $configurechanged = 0; # Needs ./configure -update + my $coredirchanged = 0; # Needs ./configure -update + my $moduledirchanged = 0; # Needs ./configure -modupdate + my $rootincchanged = 0; + my @conflicted = (); + while (defined(my $line = <$fd>)) + { + my ($action, $file); + print $line; + $line =~ m/^([ADUCG])\s+(.*)$/ or next; + ($action, $file) = ($1, $2); + if ($action eq "C") + { + push @conflicted, $file; + if ($file eq "configure") + { + $configurechanged = 1; + } + elsif ($file =~ m#^src/modules#) + { + $moduledirchanged = 1; + } + elsif ($file =~ m#^src/#) + { + $coredirchanged = 1; + } + elsif ($file =~ m/^\..*\.inc$/) + { + $rootincchanged = 1; + } + } + elsif ($action eq "U" || $action eq "G") + { + if ($file eq "configure") + { + $configurechanged = 1; + } + elsif ($file =~ m/^\..*\.inc$/) + { + $rootincchanged = 1; + } + } + elsif ($action eq "A" || $action eq "D") + { + if ($file =~ m#^src/modules#) + { + $moduledirchanged = 1; + } + elsif ($file =~ m#^src/#) + { + $coredirchanged = 1; + } + } + } + unless (close $fd) # close() waits for exit and returns false if the command failed + { + if ($! == 0) + { + print STDERR "Problem updating from SVN, please check above for errors\n"; + } + else + { + print STDERR "Failed to run SVN: $!\n"; + } + exit 1; + } + if (scalar(@conflicted) > 0) + { + print STDERR "\e[0;33;1mERROR:\e[0m You have local modifications which conflicted with the updates from SVN\n"; + printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate\n", (($coredirchanged || $configurechanged) ? "" : "mod"); + print "Conflicted files: " . join ", ", @conflicted . "\n"; + exit 1; + } + if ($configurechanged || $coredirchanged) + { + system("perl configure -update"); + } + elsif ($moduledirchanged || $rootincchanged) + { + system("perl configure -modupdate"); + } + else + { + print "No need to update Makefiles.\n"; + } if (defined $opt_rebuild) { system("make install"); } @@ -541,18 +577,6 @@ print ((!getcache()) ? "not found\n" : "found\n"); print "Checking operating system version... "; print getosflags() . "\n"; -if (defined $opt_maxclients) -{ - $config{MAX_CLIENT} = $opt_maxclients; -} - -if (!$config{MAX_CLIENT}) { - # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this - # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go - # higher than the found value" :)) - $config{MAX_CLIENT} = $config{MAX_CLIENT_T}; -} - printf "Checking if stdint.h exists... "; $config{HAS_STDINT} = "true"; our $fail = 0; @@ -756,7 +780,6 @@ a new value. Please note: You will \e[1mHAVE\e[0m to read the docs dir, otherwise you won't have a config file! Your operating system is: \e[1;32m$config{OSNAME}\e[0m ($wholeos) -Maximum file descriptors: \e[1;32m$config{MAX_CLIENT_T}\e[0m Your InspIRCd revision ID is \e[1;32mr$rev\e[0m STOP if ($rev eq "r0") { @@ -870,11 +893,6 @@ should NOT be used. You should probably specify a newer compiler.\n\n"; print "of the 'maximum number of clients' setting which may be different on\n"; print "different servers on the network.\n\n"; - # File Descriptor Settings.. - promptnumeric("number of clients at any one time", "MAX_CLIENT_T"); - $config{MAX_CLIENT} = $config{MAX_CLIENT_T}; - $config{MAX_DESCRIPTORS} = $config{MAX_CLIENT_T}; - promptnumeric("length of nicknames", "NICK_LENGT"); promptnumeric("length of channel names", "CHAN_LENGT"); promptnumeric("number of mode changes in one line", "MAXI_MODES"); @@ -1087,8 +1105,8 @@ sub getosflags { # Beware: Linux sets it's own cflags below for some retarded reason $config{LDLIBS} = "-pthread -lstdc++"; - $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; - $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -g"; + $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall $config{OPTIMISATI}"; + $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -Wformat=2 -Wmissing-format-attribute -g"; $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared" unless defined $opt_disablerpath; $config{MAKEPROG} = "make"; @@ -1114,7 +1132,7 @@ sub getosflags { if ($config{OSNAME} =~ /Linux/i) { $config{LDLIBS} = "-ldl -lstdc++ -pthread"; - $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; +# $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS}); $config{MAKEPROG} = "make"; @@ -1149,91 +1167,6 @@ sub getosflags { my ($mliflags, $mfrules, $mobjs, $mfcount) = ("", "", "", 0); -sub write_root_files { - # Create a Modules List.. - my $modules = ""; - foreach my $i (@modlist) - { - $modules .= "m_".$i.".so "; - } - chomp($modules); # Remove Redundant whitespace.. - - opendir(DIRHANDLE, "src/modules"); - foreach my $name (sort readdir(DIRHANDLE)) { - if ($name =~ /^m_(.+?)$/) { - if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) { - closedir(MDIRHANDLE); - $modules .= "$name.so "; - $uninstall_list = $uninstall_list . " -rm \$(MODULES)/$name.so\n"; - } - } - } - closedir(DIRHANDLE); - - # Write all .in files. - my $exe = "inspircd"; - - # 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' - - opendir(DIRHANDLE, $this); - - foreach my $name (sort readdir(DIRHANDLE)) { - if ($name =~ /^\.(.+)\.inc$/) { - my $file = $1; - - # Bug #353, omit this on non-darwin - next if (($config{OSNAME} !~ /darwin/) && ($file eq "org.inspircd.plist")); - - # All .name.inc files need parsing! - my $tmp = ""; - open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc"); - while () { - $tmp .= $_; - } - close(FILEHANDLE); - - print "Writing \e[1;32m$file\e[0m ...\n"; - $tmp =~ s/\@CC\@/$config{CC}/ if defined $config{CC}; - $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/ if defined $config{MAKEPROG}; - $tmp =~ s/\@FLAGS\@/$config{FLAGS}/ if defined $config{FLAGS}; - $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/ if defined $config{DEVELOPER}; - $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/ if defined $config{LDLIBS}; - $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/ if defined $config{BASE_DIR}; - $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/ if defined $config{CONFIG_DIR}; - $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/ if defined $config{MODULE_DIR}; - $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/ if defined $config{BINARY_DIR}; - $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/ if defined $config{LIBRARY_DIR}; - $tmp =~ s/\@MODULES\@/$modules/ if defined $modules; - $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/ if defined $config{STARTSCRIPT}; - $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/ if defined $config{DESTINATION}; - $tmp =~ s/\@EXTRA_DIR\@/$config{EXTRA_DIR}/ if defined $config{EXTRA_DIR}; - $tmp =~ s/\@EXECUTABLE\@/$exe/ if defined $exe; - $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/ if defined $config{MAKEORDER}; - $tmp =~ s/\@VERSION\@/$version/ if defined $version; - $tmp =~ s/\@INSTALL_LIST\@/$install_list/ if defined $install_list; - $tmp =~ s/\@UNINSTALL_LIST\@/$uninstall_list/ if defined $uninstall_list; - - open(FILEHANDLE, ">$file"); - print FILEHANDLE $tmp; - } - } - closedir(DIRHANDLE); - - # Make inspircd executable! - chmod 0744, 'inspircd'; - -} - sub writefiles { my($writeheader) = @_; my $se = ""; @@ -1260,10 +1193,7 @@ sub writefiles { #define MOD_PATH "$config{MODULE_DIR}" #define VERSION "$version" #define REVISION "$revision2" -#define MAXCLIENTS $config{MAX_CLIENT} -#define MAXCLIENTS_S "$config{MAX_CLIENT}" #define SOMAXCONN_S "$config{_SOMAXCONN}" -#define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS} #define NICKMAX $NL #define CHANMAX $CL #define MAXMODES $config{MAXI_MODES} @@ -1342,12 +1272,95 @@ EOF close(FILEHANDLE); } - write_root_files(); + + # Create a Modules List.. + my $modules = ""; + foreach my $i (@modlist) + { + $modules .= "m_".$i.".so "; + } + chomp($modules); # Remove Redundant whitespace.. + + opendir(DIRHANDLE, "src/modules"); + foreach my $name (sort readdir(DIRHANDLE)) { + if ($name =~ /^m_(.+?)$/) { + if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) { + closedir(MDIRHANDLE); + $modules .= "$name.so "; + $uninstall_list = $uninstall_list . " -rm \$(MODULES)/$name.so\n"; + } + } + } + closedir(DIRHANDLE); + + + # Write all .in files. + my $tmp = ""; + my $file = ""; + my $exe = "inspircd"; + + # 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($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' print "Writing \e[1;32mMakefiles\e[0m\n"; write_dynamic_modules_makefile(); write_dynamic_makefile(); + opendir(DIRHANDLE, $this); + + foreach my $name (sort readdir(DIRHANDLE)) { + if ($name =~ /^\.(.+)\.inc$/) { + $file = $1; + + # Bug #353, omit this on non-darwin + next if (($config{OSNAME} !~ /darwin/) && ($file eq "org.inspircd.plist")); + + # All .name.inc files need parsing! + $tmp = ""; + open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc"); + while () { + $tmp .= $_; + } + close(FILEHANDLE); + + print "Writing \e[1;32m$file\e[0m ...\n"; + $tmp =~ s/\@CC\@/$config{CC}/ if defined $config{CC}; + $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/ if defined $config{MAKEPROG}; + $tmp =~ s/\@FLAGS\@/$config{FLAGS}/ if defined $config{FLAGS}; + $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/ if defined $config{DEVELOPER}; + $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/ if defined $config{LDLIBS}; + $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/ if defined $config{BASE_DIR}; + $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/ if defined $config{CONFIG_DIR}; + $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/ if defined $config{MODULE_DIR}; + $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/ if defined $config{BINARY_DIR}; + $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/ if defined $config{LIBRARY_DIR}; + $tmp =~ s/\@MODULES\@/$modules/ if defined $modules; + $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/ if defined $config{STARTSCRIPT}; + $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/ if defined $config{DESTINATION}; + $tmp =~ s/\@EXTRA_DIR\@/$config{EXTRA_DIR}/ if defined $config{EXTRA_DIR}; + $tmp =~ s/\@EXECUTABLE\@/$exe/ if defined $exe; + $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/ if defined $config{MAKEORDER}; + $tmp =~ s/\@VERSION\@/$version/ if defined $version; + $tmp =~ s/\@INSTALL_LIST\@/$install_list/ if defined $install_list; + $tmp =~ s/\@UNINSTALL_LIST\@/$uninstall_list/ if defined $uninstall_list; + + open(FILEHANDLE, ">$file"); + print FILEHANDLE $tmp; + } + } + closedir(DIRHANDLE); + + # Make inspircd executable! + chmod 0744, 'inspircd'; } sub write_dynamic_modules_makefile { @@ -1634,7 +1647,6 @@ sub write_dynamic_makefile my $all = "all: "; my $all_libsonly = ""; - my $libraryext = ""; my $othercrap = ""; my $RPATH = "";