]> mj.ucw.cz Git - moe.git/blobdiff - configure
mo-create-logins: Do not transliterate user names
[moe.git] / configure
index d8c25e2236a61b16f48bc2ca11eda68a6c9db644..bcc8e5d4ac356d23f6b97381fa92e2c344b9bffb 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
-# Configure script for MO-Eval
-# (c) 2008 Martin Mares <mj@ucw.cz>
+# Configure script for Moe
+# (c) 2008--2009 Martin Mares <mj@ucw.cz>
 
 use warnings;
 use strict;
@@ -17,15 +17,58 @@ BEGIN {
                        die "Don't know how to find myself. Please set SRCDIR manually.";
                }
        }
-       require "$srcdir/lib/perl/Configure.pm";
-       UCW::Configure::import UCW::Configure;
 }
 
+use lib "$srcdir/ucw/perl";
+use UCW::Configure;
+use UCW::Configure::Pkg;
+
 Init($srcdir, "default.cfg");
-Include "lib/default.cfg";
-Log "### Configuring MO-Eval ###\n\n";
+Include "ucw/default.cfg";
+Log "### Configuring Moe ###\n\n";
 Include Get("CONFIG");
-Include "lib/autoconf.cfg";
+require UCW::Configure::Paths;
+require UCW::Configure::C;
+require UCW::Configure::LibUCW;
+require UCW::Configure::Doc;
+
+Test("KERNEL_ARCH", "Checking for kernel architecture", sub {
+       my $u = `uname -m`;
+       chomp $u;
+       if ($u =~ m{^i[3-6]86$}) {
+               return 'i386';
+       } elsif ($u eq 'x86_64') {
+               return 'amd64';
+       } else {
+               return $u;
+       }
+});
+
+Log "Selecting sandbox kernel architecture ... ";
+my $karch = Get("CONFIG_BOX_KERNEL_ARCH") // "auto";
+if ($karch eq 'i386' || $karch eq 'amd64') {
+       Log "$karch (set manually)\n";
+} elsif ($karch eq 'auto') {
+       $karch = Get('KERNEL_ARCH');
+       Set('CONFIG_BOX_KERNEL_ARCH', $karch);
+       Log "$karch\n";
+} else {
+       Fail "Unrecognized architecture $karch";
+}
+Set('CONFIG_BOX_KERNEL_AMD64') if $karch eq 'amd64';
+
+Log "Selecting sandbox user-space architecture ... ";
+my $uarch = Get("CONFIG_BOX_USER_ARCH") // "auto";
+if ($uarch eq 'i386' || $uarch eq 'amd64') {
+       Log "$uarch (set manually)\n";
+} elsif ($uarch eq 'auto') {
+       $uarch = Get('ARCH');
+       Set('CONFIG_BOX_USER_ARCH', $karch);
+       Log "$uarch\n";
+} else {
+       Fail "Unrecognized architecture $uarch";
+}
+Set('CONFIG_BOX_USER_AMD64') if $uarch eq 'amd64';
 
 if (Get("CONFIG_SUBMIT") || Get("CONFIG_MOP")) {
        # Build libucw only if it is needed
@@ -34,7 +77,7 @@ if (Get("CONFIG_SUBMIT") || Get("CONFIG_MOP")) {
 
 if (Get("CONFIG_SUBMIT")) {
        # Submit server needs crypto libraries
-       if (!TrivConfig("libgnutls", script => "libgnutls-config") ||
+       if (!PkgConfig("gnutls") && !TrivConfig("libgnutls", script => "libgnutls-config") ||
            !TrivConfig("libgcrypt", script => "libgcrypt-config")) {
                Fail "The libgnutls and libgcrypt libraries are required to build the submit server.";
        }