2 # Configure script for Moe
3 # (c) 2008--2009 Martin Mares <mj@ucw.cz>
10 my $pkgfile = "judge/token.c";
11 if (!defined ($srcdir = $ENV{"SRCDIR"})) {
14 } elsif ($0 =~ m@^(.*)/configure$@ && -f "$1/$pkgfile") {
17 die "Don't know how to find myself. Please set SRCDIR manually.";
22 use lib "$srcdir/ucw/perl";
24 use UCW::Configure::Pkg;
26 Init($srcdir, "default.cfg");
27 Include "ucw/default.cfg";
28 Log "### Configuring Moe ###\n\n";
29 Include Get("CONFIG");
30 require UCW::Configure::Paths;
31 require UCW::Configure::C;
32 require UCW::Configure::LibUCW;
33 require UCW::Configure::Doc;
35 Test("KERNEL_ARCH", "Checking for kernel architecture", sub {
38 if ($u =~ m{^i[3-6]86$}) {
40 } elsif ($u eq 'x86_64') {
47 Log "Selecting sandbox kernel architecture ... ";
48 my $karch = Get("CONFIG_BOX_KERNEL_ARCH") // "auto";
49 if ($karch eq 'i386' || $karch eq 'amd64') {
50 Log "$karch (set manually)\n";
51 } elsif ($karch eq 'auto') {
52 $karch = Get('KERNEL_ARCH');
53 Set('CONFIG_BOX_KERNEL_ARCH', $karch);
56 Fail "Unrecognized architecture $karch";
58 Set('CONFIG_BOX_KERNEL_AMD64') if $karch eq 'amd64';
60 Log "Selecting sandbox user-space architecture ... ";
61 my $uarch = Get("CONFIG_BOX_USER_ARCH") // "auto";
62 if ($uarch eq 'i386' || $uarch eq 'amd64') {
63 Log "$uarch (set manually)\n";
64 } elsif ($uarch eq 'auto') {
66 Set('CONFIG_BOX_USER_ARCH', $karch);
69 Fail "Unrecognized architecture $uarch";
71 Set('CONFIG_BOX_USER_AMD64') if $uarch eq 'amd64';
73 if (Get("CONFIG_SUBMIT") || Get("CONFIG_MOP")) {
74 # Build libucw only if it is needed
75 Set("CONFIG_UCW_LIBS" => 1);
78 if (Get("CONFIG_SUBMIT")) {
79 # Submit server needs crypto libraries
80 if (!PkgConfig("gnutls") && !TrivConfig("libgnutls", script => "libgnutls-config") ||
81 !TrivConfig("libgcrypt", script => "libgcrypt-config")) {
82 Fail "The libgnutls and libgcrypt libraries are required to build the submit server.";
87 Log "\nConfigured, run `make' to build everything.\n";