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;
defined $opt_uid
);
-my %version = get_version();
+my %version = get_version $opt_distribution_label;
print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
our %config;
$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')) {
}
}
-# 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';
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;