X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=62f7b341bf06374c91e1d5ac1737b81c57972074;hb=51ff3d67ed1b6f1594373d3745293ef155a26f44;hp=ef6846e50ad6545e60225e7542d1fc1b79142657;hpb=8f9ae4c55ec40fa92c229ba1c51c925cb2b6c3ce;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index ef6846e50..62f7b341b 100755 --- a/configure +++ b/configure @@ -37,12 +37,15 @@ use warnings FATAL => qw(all); use File::Basename qw(basename); use File::Copy (); use File::Spec::Functions qw(rel2abs); +use FindBin qw($RealDir); use Getopt::Long qw(GetOptions); use POSIX qw(getgid getuid); +use lib $RealDir; use make::common; use make::configure; use make::console; +use make::directive; my ($opt_binary_dir, $opt_config_dir, @@ -123,8 +126,8 @@ our $interactive = !( defined $opt_uid ); -my %version = get_version(); -print_format "<|BOLD Configuring InspIRCd $version{MAJOR}.$version{MINOR}.$version{PATCH}+$version{LABEL} on $^O.|>\n"; +my %version = get_version $opt_distribution_label; +print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n"; our %config; if ($interactive) { @@ -140,13 +143,19 @@ if ($interactive) { $config{CXX} = find_compiler($config{CXX} // $ENV{CXX}); unless ($config{CXX}) { - print "A suitable C++ compiler could not be detected on your system!\n"; - print "Set the CXX environment variable to the compiler binary path if this is incorrect.\n"; - exit 1; + say 'A suitable C++ compiler could not be detected on your system!'; + unless ($interactive) { + say 'Set the CXX environment variable to the path to a C++ compiler binary if this is incorrect.'; + exit 1; + } + until ($config{CXX}) { + my $compiler_path = prompt_string 1, 'Please enter the path to a C++ compiler binary:', 'c++'; + $config{CXX} = find_compiler $compiler_path; + } } my %compiler = get_compiler_info($config{CXX}); -$config{HAS_CLOCK_GETTIME} = run_test 'clock_gettime()', test_file($config{CXX}, 'clock_gettime.cpp', '-lrt'); +$config{HAS_CLOCK_GETTIME} = run_test 'clock_gettime()', test_file($config{CXX}, 'clock_gettime.cpp', $^O eq 'darwin' ? undef : '-lrt'); $config{HAS_EVENTFD} = run_test 'eventfd()', test_file($config{CXX}, 'eventfd.cpp'); if ($config{HAS_EPOLL} = run_test 'epoll', test_header($config{CXX}, 'sys/epoll.h')) { @@ -185,12 +194,6 @@ if (defined $opt_socketengine) { } } -# If the user has specified a distribution label then we use it in -# place of the label from src/version.sh or Git. -if (defined $opt_distribution_label) { - $version{LABEL} = $opt_distribution_label; -} - if (defined $opt_system) { $config{BASE_DIR} = $opt_prefix // '/var/lib/inspircd'; $config{BINARY_DIR} = $opt_binary_dir // '/usr/sbin'; @@ -298,6 +301,7 @@ if (prompt_bool $interactive, $question, 0) { # TODO: finish modulemanager rewrite and replace this code with: # system './modulemanager', 'enable', '--auto'; enable_extras 'm_ssl_gnutls.cpp' unless system 'pkg-config --exists gnutls >/dev/null 2>&1'; + enable_extras 'm_ssl_mbedtls.cpp' if -e '/usr/include/mbedtls/ssl.h'; enable_extras 'm_ssl_openssl.cpp' unless system 'pkg-config --exists openssl >/dev/null 2>&1'; } @@ -306,6 +310,9 @@ if ( && prompt_bool $interactive, 'Would you like to ge system './tools/genssl', 'auto'; } +# Cache the distribution label so that its not lost when --update is run. +$config{DISTRIBUTION} = $opt_distribution_label if $opt_distribution_label; + write_configure_cache %config; parse_templates \%config, \%compiler, \%version; @@ -408,7 +415,7 @@ EXTRA: for my $extra (@extras) { for my $extra (keys(%extras)) { next unless $extras{$extra} =~ m/enabled/; # only process enabled extras. my $abs_extra = File::Spec->catfile($abs_srcdir, "extra", $extra); - my @deps = split /\s+/, get_property($abs_extra, 'ModDep'); + my @deps = split /\s+/, get_directive($abs_extra, 'ModDep', ''); for my $dep (@deps) { if (exists($extras{$dep})) { my $ref = \$extras{$dep}; # Take reference. @@ -455,7 +462,7 @@ sub enable_extras (@) { next; } # Get dependencies, and add them to be processed. - my @deps = split /\s+/, get_property($extrapath, 'ModDep'); + my @deps = split /\s+/, get_directive($extrapath, 'ModDep', ''); for my $dep (@deps) { next if scalar(grep { $_ eq $dep } (@extras)) > 0; # Skip if we're going to be enabling it anyway. if (!-e "src/modules/$dep" && !-e "include/$dep") { @@ -491,7 +498,7 @@ EXTRA: for my $extra (@extras) { } # Check if anything needs this. for my $file (@files) { - my @deps = split /\s+/, get_property("src/modules/extra/$file", 'ModDep'); + my @deps = split /\s+/, get_directive("src/modules/extra/$file", 'ModDep', ''); # File depends on this extra... if (scalar(grep { $_ eq $extra } @deps) > 0) { # And is both enabled and not about to be disabled.