X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=45bb0e911f68f65d20bab8b39ebbe6f513a52880;hb=db248e7d99636809a88f0ddb5ccf9a8034cbdf36;hp=6fba700ceb4e4ce4f5043abb0b2ee908ccdc4bb5;hpb=3070548ceeffd3c09ce26d816a1d225dbe9d137e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 6fba700ce..45bb0e911 100755 --- a/configure +++ b/configure @@ -101,13 +101,12 @@ our $interactive = !( (defined $opt_use_gnutls) ); -our $topdir = getcwd(); our %config = read_configure_cache(); print "Checking for cache from previous configure... "; print %config ? "found\n" : "not found\n"; -$config{BASE_DIR} = $topdir."/run"; +$config{BASE_DIR} = getcwd()."/run"; if (defined $opt_base_dir) { $config{BASE_DIR} = $opt_base_dir; @@ -116,19 +115,17 @@ if (defined $opt_base_dir) { } if (defined $opt_system) { - $config{UID} = $opt_uid || 'ircd'; + $config{UID} = defined $opt_uid ? $opt_uid : 'ircd'; $config{CONFIG_DIR} = '/etc/inspircd'; $config{MODULE_DIR} = '/usr/lib/inspircd'; $config{BINARY_DIR} = '/usr/sbin/'; - $config{BUILD_DIR} = $topdir."/build"; $config{DATA_DIR} = '/var/inspircd'; $config{LOG_DIR} = '/var/log/inspircd'; } else { - $config{UID} = $opt_uid || $<; + $config{UID} = defined $opt_uid ? $opt_uid : $<; $config{CONFIG_DIR} = rel2abs($config{BASE_DIR}."/conf"); $config{MODULE_DIR} = rel2abs($config{BASE_DIR}."/modules"); $config{BINARY_DIR} = rel2abs($config{BASE_DIR}."/bin"); - $config{BUILD_DIR} = rel2abs($topdir."/build"); $config{DATA_DIR} = rel2abs($config{BASE_DIR}."/data"); $config{LOG_DIR} = rel2abs($config{BASE_DIR}."/logs"); } @@ -153,19 +150,17 @@ chomp($config{HAS_OPENSSL} = `pkg-config --modversion openssl 2>/dev/null`); chomp(our $gnutls_ver = $config{HAS_GNUTLS}); chomp(our $openssl_ver = $config{HAS_OPENSSL}); -$config{USE_GNUTLS} = "n"; +$config{USE_GNUTLS} = 0; if (defined $opt_use_gnutls) { $config{USE_GNUTLS} = "y"; # Use gnutls. } -$config{USE_OPENSSL} = "n"; # Use openssl. +$config{USE_OPENSSL} = 0; # Use openssl. if (defined $opt_use_openssl) { $config{USE_OPENSSL} = "y"; } -$config{STARTSCRIPT} = $^O eq 'darwin' ? 'org.inspircd.plist' : 'inspircd'; - $config{CXX} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler(); if ($config{CXX} eq "") { print "A C++ compiler could not be detected on your system!\n"; @@ -258,12 +253,11 @@ if ($interactive) # Clear the screen. system 'tput', 'clear'; - my $revision = get_revision(); - chomp(my $version = `sh src/version.sh`); + my %version = get_version(); # Display Introduction Message.. print <<"STOP" ; -Welcome to the \e[1mInspIRCd\e[0m Configuration program! (\e[1minteractive mode\e[0m) +Welcome to the \e[1mInspIRCd\e[0m configuration program! (\e[1minteractive mode\e[0m) \e[1mPackage maintainers: Type ./configure --help for non-interactive help\e[0m *** If you are unsure of any of these values, leave it blank for *** @@ -277,10 +271,25 @@ dir, otherwise you won't have a config file! Your operating system is: \e[1;32m$^O\e[0m STOP print "Your InspIRCd version is: \e[1;32m"; - print $revision eq 'release' ? substr($version, 9) : substr($revision, 1); + print "$version{MAJOR}.$version{MINOR}.$version{PATCH}+$version{LABEL}"; print "\e[0m\n\n"; print "The following compiler has been detected: \e[1;32m$cxx{NAME} $cxx{VERSION}\e[0m ($config{CXX})\n\n"; + # Check that the user actually wants this version. + if ($version{LABEL} ne 'release') { + print <<"EOW" ; +\e[1;31mWARNING!\e[0m You are building a development version. This contains code which has +not been tested as heavily and may contain various faults which could seriously +affect the running of your server. It is recommended that you use a stable +version instead. + +You can obtain the latest stable version from https://github.com/inspircd/inspircd/releases +or by running `git checkout insp20` if you are installing from Git. + +EOW + exit 1 unless prompt_bool(1, 'I understand this warning and want to continue anyway.', 0); + } + # Directory Settings.. my $tmpbase = $config{BASE_DIR}; $config{BASE_DIR} = prompt_dir(1, 'What directory do you wish to install the InspIRCd base?', $config{BASE_DIR}); @@ -297,7 +306,6 @@ STOP $config{DATA_DIR} = prompt_dir(1, 'In what directory are variable data files to be stored?', $config{DATA_DIR}); $config{LOG_DIR} = prompt_dir(1, 'In what directory are log files to be stored?', $config{LOG_DIR}); $config{MODULE_DIR} = prompt_dir(1, 'In what directory are the modules to be placed?', $config{MODULE_DIR}); - $config{BUILD_DIR} = prompt_dir(1, 'In what directory do you want the build to take place?', $config{BUILD_DIR}); my $chose_hiperf = 0; if ($config{HAS_KQUEUE}) { @@ -377,12 +385,12 @@ symlink "extra/m_regex_posix.cpp", "src/modules/m_regex_posix.cpp"; if (($config{USE_GNUTLS}) && ($config{HAS_GNUTLS} ne "y")) { - print "Sorry, but i couldn't detect gnutls. Make sure pkg-config is in your path.\n"; + print "Sorry, but I couldn't detect GnuTLS. Make sure pkg-config is in your path.\n"; exit 1; } if (($config{USE_OPENSSL}) && ($config{HAS_OPENSSL} ne "y")) { - print "Sorry, but i couldn't detect openssl. Make sure pkg-config is in your path.\n"; + print "Sorry, but I couldn't detect OpenSSL. Make sure pkg-config is in your path.\n"; exit 1; } @@ -397,7 +405,7 @@ if ($config{USE_GNUTLS} || $config{USE_OPENSSL}) { print "Done.\n\n"; } } else { - print "SSL Certificates found, skipping.\n\n" + print "SSL certificates found, skipping.\n\n" } } else { print "Skipping SSL certificate generation in non-interactive mode.\n\n"; @@ -408,7 +416,7 @@ if ($config{USE_GNUTLS} || $config{USE_OPENSSL}) { print "Writing \e[1;32m.config.cache\e[0m ...\n"; write_configure_cache(%config); -writefiles(); +parse_templates(\%config, \%cxx); dump_hash(); print "\n"; @@ -416,121 +424,11 @@ print "To build your server with these settings, please run '\e[1;32mmake\e[0m' if ($config{USE_GNUTLS} || $config{USE_OPENSSL}) { print "Please note: for \e[1;32mSSL support\e[0m you will need to load required\n"; print "modules in your config. This configure script has added those modules to the\n"; - print "build process. For more info please refer to:\n"; + print "build process. For more info, please refer to:\n"; print "\e[1;32mhttp://wiki.inspircd.org/Installation_From_Tarball\e[0m\n"; } print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n"; -sub writefiles { - chomp(my $incos = `uname -n -s -r`); - chomp(my $version = `sh src/version.sh`); - my $revision = get_revision(); - my $branch = "InspIRCd-0.0"; - if ($version =~ /^(InspIRCd-[0-9]+\.[0-9]+)\.[0-9]+/) - { - $branch = $1; - } - print "Writing \e[1;32mconfig.h\e[0m\n"; - open(FILEHANDLE, ">include/config.h.tmp"); - print FILEHANDLE <; - close(FILEHANDLE); - - $config{BUILD_DIR} ||= rel2abs($topdir."/build"); - $config{COMPILER} = lc $cxx{NAME}; - $config{SYSTEM} = lc $^O; - - for my $var (qw( - CXX COMPILER SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR DATA_DIR UID - STARTSCRIPT SOCKETENGINE - )) { - s/\@$var\@/$config{$var}/g; - } - - s/\@VERSION\@/$version/ if defined $version; - - if ($file eq 'main.mk') { - print "Writing \e[1;32mGNUmakefile\e[0m ...\n"; - - my $mk_tmp = $_; - s/\@IFDEF (\S+)/ifdef $1/g; - s/\@IFNDEF (\S+)/ifndef $1/g; - s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g; - s/\@IFNEQ (\S+) (\S+)/ifneq ($1,$2)/g; - s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g; - s/\@ELSE/else/g; - s/\@ENDIF/endif/g; - s/ *\@BSD_ONLY .*\n//g; - s/\@GNU_ONLY //g; - s/\@DO_EXPORT (.*)/export $1/g; - open MKF, '>GNUmakefile' or die "Can't write to GNUmakefile: $!"; - print MKF $_; - close MKF; - - print "Writing \e[1;32mBSDmakefile\e[0m ...\n"; - $_ = $mk_tmp; - s/\@IFDEF (\S+)/.if defined($1)/g; - s/\@IFNDEF (\S+)/.if !defined($1)/g; - s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g; - s/\@IFNEQ (\S+) (\S+)/.if $1 != $2/g; - s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g; - s/\@ELSE/.else/g; - s/\@ENDIF/.endif/g; - s/\@BSD_ONLY //g; - s/ *\@GNU_ONLY .*\n//g; - $mk_tmp = $_; - $mk_tmp =~ s#\@DO_EXPORT (.*)#"MAKEENV += ".join ' ', map "$_='\${$_}'", split /\s/, $1#eg; - open MKF, '>BSDmakefile' or die "Can't write to BSDmakefile: $!"; - print MKF $mk_tmp; - close MKF; - } else { - print "Writing \e[1;32m$file\e[0m ...\n"; - open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n"); - print FILEHANDLE $_; - close(FILEHANDLE); - } - } - - chmod 0750, 'inspircd'; -} - # Routine to list out the extra/ modules that have been enabled. # Note: when getting any filenames out and comparing, it's important to lc it if the # file system is not case-sensitive (== Epoc, MacOS, OS/2 (incl DOS/DJGPP), VMS, Win32