]> mj.ucw.cz Git - subauth.git/blob - configure
Server: create_token returns the ident of the new token
[subauth.git] / configure
1 #!/usr/bin/perl
2 # Configure script for the sub-authentication daemon
3 # Inspired by LibUCW examples
4
5 use warnings;
6 use strict;
7
8 our($srcdir, $libdir);
9 BEGIN {
10         # Find the sources
11         my $pkgfile = "server/subauthd.c";
12         if (!defined ($srcdir = $ENV{"SRCDIR"})) {
13                 if (-f $pkgfile) {
14                         $srcdir=".";
15                 } elsif ($0 =~ m@^(.*)/configure$@ && -f "$1/$pkgfile") {
16                         $srcdir=$1;
17                 } else {
18                         die "Don't know how to find myself. Please set SRCDIR manually.\n";
19                 }
20         }
21         # Ask pkg-config if libucw is installed and find its configure modules
22         `pkg-config libucw --atleast-version=3.13`;
23         !$? or die "Package `libucw' (version 3.13 or newer) not found. Is PKG_CONFIG_PATH set properly?\n";
24         $libdir=`pkg-config libucw --variable=perl_modules_dir`;
25         chomp $libdir;
26         die "Unable to find the libucw configure system\n" if $? || not defined $libdir;
27 }
28 use lib $libdir;
29 use UCW::Configure;
30
31 Init($srcdir, 'default.cfg');
32 Log "### Configuring subauthd ###\n\n";
33 Include Get("CONFIG");
34 require UCW::Configure::Build;
35 require UCW::Configure::Paths;
36 require UCW::Configure::C;
37 use UCW::Configure::Pkg;
38
39 # Get some libraries
40 PkgConfig("libucw") or Fail("libucw is required");
41 PkgConfig("libucw-json") or Fail("libucw-json is required");
42 TrivConfig("libgcrypt", script => "libgcrypt-config", minversion => '1.6') or Fail("libgcrypt is required");
43
44 if (IsSet("CONFIG_APACHE_MOD")) {
45         Log "Checking for apxs2 ... ";
46         my $cf = TryCmd("apxs2 -q CFLAGS");
47         my $ei = TryCmd("apxs2 -q EXTRA_INCLUDES");
48         my $id = TryCmd("apxs2 -q INCLUDEDIR");
49         if (!defined($cf) || !defined($id) || !defined($ei)) {
50                 Log "NO\n";
51                 Fail "Apache's apxs2 utility is required to build the Apache module.";
52         }
53         Log "YES\n";
54         Set("APACHE2_CFLAGS" => "-g $cf $ei -I$id");
55         Set("INSTALL_APACHE2_MOD_DIR" => '$(INSTALL_LIB_DIR)/apache2/modules');
56         Set("INSTALL_APACHE2_CONFIG_DIR" => '$(INSTALL_PREFIX)etc/apache2');
57 }
58
59 require UCW::Configure::Doc;
60
61 Finish();
62
63 Log "\nConfigured, run `make' to build everything.\n";