X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=8bcfcbe6405439caf63372aebb1c6e02aeec87ae;hb=d0d36795e807cf72295c6e73813e0c2daa0a71e7;hp=57eeb61ba458c534a9edfe60158b8915bcb859d9;hpb=cbb888a47064a8b70254047fd305bea73c2395ad;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 57eeb61ba..8bcfcbe64 100755 --- a/configure +++ b/configure @@ -1,21 +1,18 @@ #!/usr/bin/perl - +################################################### # InspIRCd Configuration Script # -# Copyright 2002-2007 The ChatSpike Development Team -# -# +# Copyright 2002-2007 The InspIRCd Development Team +# http://www.inspircd.org/wiki/index.php/Credits # # Licensed under GPL, please see the COPYING file # for more information # -# [14:21] Brain: i know perl-fu! -# # $Id$ # -######################################## +################################################### -require 5.6.0; +require 5.8.0; use Socket; use Cwd; use Getopt::Long; @@ -220,16 +217,21 @@ if (defined $opt_noipv6links) { $config{SUPPORT_IP6LINKS} = "n"; } -$config{STATIC_LINK} = "no"; # are doing static modules? 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 $config{IS_DARWIN} = "NO"; # Is OSX? +$config{STARTSCRIPT} = "inspircd"; # start script? +$config{DESTINATION} = "BASE"; # Is target path. +$config{EXTRA_DIR} = ""; # Is empty. if ($config{OSNAME} =~ /darwin/i) { $config{IS_DARWIN} = "YES"; + $config{STARTSCRIPT} = "org.inspircd.plist"; # start script for OSX. + $config{DESTINATION} = "LAUNCHDPATH"; # Is OSX target. + $config{EXTRA_DIR} = " launchd_dir"; # Is OSX specific path. } $config{CC} = "g++"; # C++ compiler if (defined $opt_cc) @@ -239,7 +241,6 @@ if (defined $opt_cc) $exec = $config{CC} . " -dumpversion | cut -c 1"; chomp($config{GCCVER} = `$exec`); # Major GCC Version $config{MAKEORDER} = "ircd mods"; # build order -$config{STATICLIBS} = ""; # library archive path $config{MAX_IDENT} = "12"; # max ident size $config{MAX_QUIT} = "255"; # max quit message size $config{MAX_TOPIC} = "307"; # max topic size @@ -280,15 +281,6 @@ if ($config{GCCVER} eq "") { exit; } -# Minihack! Convert Cygwin to 'Cyg-Static' so i can -# Keep my dynamic module experiments here for later -# consideration! - -if ($config{OSNAME} =~ /CYGWIN/i) -{ - $config{OSNAME} = "CYG-STATIC"; -} - if (!$config{MAX_CLIENT_T}) { $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default' $fd_scan_fail = "true"; # Used Later @@ -394,7 +386,7 @@ sub svnupdate print "Running non-interactive configure...\n" unless $interactive; print "Checking for cache from previous configure... "; -print ((getcache() eq "true") ? "found\n" : "not found\n"); +print ((!getcache()) ? "not found\n" : "found\n"); print "Checking operating system version... "; print getosflags() . "\n"; @@ -471,6 +463,51 @@ if ($has_epoll) { if (($kernel =~ /^2\.0\./) || ($kernel =~ /^2\.2\./) || ($kernel =~ /^2\.4\./)) { $has_epoll = 0; } + else + { + # 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; + 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 = )) + { + if ($line =~ /GNU C Library .* version (.*?) /) + { + $libcv = $1; + $libcv =~ /([0-9\.\-])+/; + $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 = $1; + } + } + close FH; + if ($libcv < 2.3) + { + $has_epoll = 0; + printf "libc too old: $libcv... "; + } + if ($kernelv < 2.6) + { + $has_epoll = 0; + printf "libc built against older kernel $kernelv... "; + } + } + } } print "yes\n" if $has_epoll == 1; print "no\n" if $has_epoll == 0; @@ -484,17 +521,13 @@ $has_ports = 1 if ($system eq "SunOS"); if ($has_ports) { my $kernel = `uname -r`; chomp($kernel); - if (($kernel !~ /^5\.10/)) { + if (($kernel !~ /^5\.1./)) { $has_ports = 0; } } print "yes\n" if $has_ports == 1; print "no\n" if $has_ports == 0; -if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) { - $config{HAS_STRLCPY} = "true"; -} - $config{HAS_EPOLL} = $has_epoll; $config{HAS_KQUEUE} = $has_kqueue; @@ -516,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 # ################################################################################ @@ -710,13 +773,18 @@ if ($config{USE_GNUTLS} eq "y") { * few times and get that HD going :) Then answer the * * Questions which follow. If you are unsure, just hit enter * *************************************************************\n\n"; - make_gnutls_cert(); - print "\nCertificate generation complete, copying to config directory... "; - system("mv key.pem $config{CONFIG_DIR}/key.pem"); - system("mv cert.pem $config{CONFIG_DIR}/cert.pem"); - print "Done.\n\n"; - } else { - print "SSL Certificates found, skipping.\n\n" + $failed = make_gnutls_cert(); + if ($failed) { + print "\n\033[1;32mCertificate generation failed!\033[0m\n\n"; + } else { + print "\nCertificate generation complete, copying to config directory... "; + system("mv key.pem $config{CONFIG_DIR}/key.pem"); + system("mv cert.pem $config{CONFIG_DIR}/cert.pem"); + print "Done.\n\n"; + } + } + else { + print "SSL Certificates found, skipping.\n\n"; } } else @@ -798,7 +866,7 @@ FOO2 ################################################################################ sub getcache { # Retrieves the .config.cache file, and loads values into the main config hash. - open(CACHE, ".config.cache") or return undef; + open(CACHE, ".config.cache") or return 0; while () { chomp; # Ignore Blank lines, and comments.. @@ -810,7 +878,7 @@ sub getcache { $config{$key} = $1; } close(CONFIG); - return "true"; + return 1; } sub makecache { @@ -879,13 +947,13 @@ sub dir_check { sub getosflags { $config{LDLIBS} = "-lstdc++"; - $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; - $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -g"; + $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}"; + $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated -g"; $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared"; $config{MAKEPROG} = "make"; if ($config{OSNAME} =~ /darwin/i) { - $config{FLAGS} = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}"; $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup"; $config{LDLIBS} = "-ldl -lstdc++"; } @@ -905,28 +973,18 @@ sub getosflags { if ($config{OSNAME} =~ /Linux/i) { $config{LDLIBS} = "-ldl -lstdc++"; - $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -Wno-deprecated $config{OPTIMISATI}"; $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); + $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS}); $config{MAKEPROG} = "make"; - if ($config{OSNAME} =~ /CYGWIN/) { - $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} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}"; - $config{LDLIBS} = ""; - $config{MAKEPROG} = "/usr/bin/make"; - $config{MAKEORDER} = "mods ircd"; - $config{STATICLIBS} = "modules/mods.a"; - $config{STATIC_LINK} = "yes"; - return "Cygwin-Static"; - } + } + + if ($config{OSNAME} =~ /FreeBSD/i) { $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); + $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS}); } - - if ($config{OSNAME} =~ /SunOS/i) + + if ($config{OSNAME} =~ /SunOS/i or $config{OSNAME} =~ /solaris/i) { # solaris/sunos needs these # socket = bsd sockets api @@ -934,7 +992,7 @@ sub getosflags { # rt = POSIX realtime extensions # resolv = inet_aton only (why isnt this in nsl?!) $config{MAKEPROG} = "gmake"; - $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv"; + $config{LDLIBS} .= " -lsocket -lnsl -lrt -lresolv"; return "Solaris"; } @@ -965,6 +1023,10 @@ sub writefiles { #ifndef __CONFIGURATION_AUTO__ #define __CONFIGURATION_AUTO__ +/* this is for windows support. */ +#define CoreExport /**/ +#define DllExport /**/ + #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf" #define MOD_PATH "$config{MODULE_DIR}" #define VERSION "$version" @@ -991,19 +1053,9 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n"; if ($config{OSNAME} =~ /SunOS/i) { print FILEHANDLE "#define IS_SOLARIS\n"; } - if ($config{OSNAME} =~ /CYGWIN/i) { - print FILEHANDLE "#define IS_CYGWIN\n"; - print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n"; - } if ($config{OSNAME} =~ /MINGW32/i) { print FILEHANDLE "#define IS_MINGW\n"; } - if ($config{OSNAME} =~ /CYG-STATIC/i) { - print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n"; - } - if ($config{STATIC_LINK} eq "yes") { - print FILEHANDLE "#define STATIC_LINK\n"; - } if ($config{GCCVER} >= 3) { print FILEHANDLE "#define GCC3\n"; } @@ -1065,12 +1117,7 @@ EOF my $modules = ""; foreach $i (@modlist) { - if ($config{STATIC_LINK} eq "yes") { - $modules .= "m_".$i.".o "; - } - else { - $modules .= "m_".$i.".so "; - } + $modules .= "m_".$i.".so "; } chomp($modules); # Remove Redundant whitespace.. @@ -1091,10 +1138,6 @@ EOF my $file = ""; my $exe = "inspircd"; - if ($config{OSNAME} =~ /CYGWIN/i) { - $exe = "inspircd.exe"; - } - opendir(DIRHANDLE, $this); # Do this once here, and cache it in the .*.inc files, @@ -1117,6 +1160,10 @@ EOF foreach $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"); @@ -1137,9 +1184,11 @@ EOF $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/; $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/; $tmp =~ s/\@MODULES\@/$modules/; + $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/; + $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/; + $tmp =~ s/\@EXTRA_DIR\@/$config{EXTRA_DIR}/; $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"; @@ -1152,139 +1201,30 @@ EOF # Make inspircd executable! chmod 0744, 'inspircd'; - if ($config{STATIC_LINK} eq "yes") { - print "Writing static-build \033[1;32msrc/Makefile\033[0m\n"; - write_static_makefile(); - write_static_modules_makefile(); - } elsif ($config{OSNAME} =~ /CYGWIN/i) { - print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n"; - write_static_makefile(); - write_dynamic_modules_makefile(); - } else { - print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n"; - write_dynamic_makefile(); - write_dynamic_modules_makefile(); - } -} - -sub write_static_modules_makefile { - # Modules Makefile.. - print "Writing \033[1;32msrc/modules/Makefile\033[0m\n"; - open(FILEHANDLE, ">src/modules/Makefile"); - - ### - # Module Makefile Header - ### - print FILEHANDLE < -# Many Thanks to Andrew Church -# for assisting with making this work right. -# -# Automatically Generated by ./configure to add a modules -# please run ./configure --update - -all: \$(MODULES) - -EOF - ### - # End Module Makefile Header - ### - - # Create a Modules List.. - my $modules = ""; - my $cmflags = ""; - my $liflags = ""; - - open(MODLIST,">include/modlist.h"); - - ### - # Include File Header - ### - print MODLIST <src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp"); - while (chomp($a = )) { - $a =~ s/init_module/$i\_init/g; - print MUNGED "$a\n"; - } - close(MODULE); - close(MUNGED); - print MODLIST <src/modules/Makefile"); - my $extra = ""; - - if ($config{OSNAME} =~ /CYGWIN/i) { - $extra = "../inspircd.dll.a"; - } ### # Module Makefile Header ### print FILEHANDLE < -# Many Thanks to Andrew Church -# for assisting with making this work right. +################################################### +# Copyright 2002-2007 The InspIRCd Development Team +# http://www.inspircd.org/wiki/index.php/Credits # -# Automatically Generated by ./configure to add a modules -# please run ./configure -update or ./configure -modupdate +# Thanks to Andrew Church +# for assisting with making this work right. +# +# Automatically Generated by ./configure to add a +# modules please run ./configure -modupdate +################################################### all: \$(MODULES) @@ -1316,12 +1256,12 @@ EOCHEESE if ($config{OSNAME} =~ /darwin/) { print FILEHANDLE <src/Makefile") or die("Could not write src/Makefile!"); - my $i = 0; - my @cmdlist = (); - opendir(DIRHANDLE, "src"); - foreach $name (sort readdir(DIRHANDLE)) { - if ($name =~ /^cmd_(.+)\.cpp$/) { - $cmdlist[$i++] = $1; - } - } - closedir(DIRHANDLE); - my $cmdobjs = ""; - my $srcobjs = ""; - foreach my $cmd (@cmdlist) { - $cmdobjs = $cmdobjs . "cmd_$cmd.o "; - $srcobjs = $srcobjs . "cmd_$cmd.cpp "; - } - print FH < -# Makefile version 2 (statically linked core) by -# - -CC = im a cheezeball - -CXXFLAGS = -I../include \${FLAGS} -CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn) -RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn) - -EOM - -$se = "socketengine_select"; -if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) { - $se = "socketengine_kqueue"; -} -elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) { - $se = "socketengine_epoll"; -} -elsif (($has_ports) && ($config{USE_PORTS} eq "y")) { - $se = "socketengine_ports"; -} - - ### - # This next section is for cygwin dynamic module builds. - # Basically, what we do, is build the inspircd core as a library - # then the main executable uses that. the library is capable of - # loading / unloading the modules dynamically :) - # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping - # make this work :) - ### - - if ($config{OSNAME} =~ /CYGWIN/i) { - print FH <src/Makefile") or die("Could not write src/Makefile"); print FH < -# Makefile version 2 (dynamically linked core) by +# Thanks to Andrew Church +# for assisting with making this work right. # +# This file is automagically generated by configure +# Any changes made will be lost on ./configure +################################################### CC = im a cheezeball @@ -1573,11 +1367,11 @@ EOM if ($config{IS_DARWIN} eq "YES") { print FH <