#!/usr/bin/perl # Configure script for the sub-authentication daemon # Inspired by LibUCW examples use warnings; use strict; our($srcdir, $libdir); BEGIN { # Find the sources my $pkgfile = "server/subauthd.c"; if (!defined ($srcdir = $ENV{"SRCDIR"})) { if (-f $pkgfile) { $srcdir="."; } elsif ($0 =~ m@^(.*)/configure$@ && -f "$1/$pkgfile") { $srcdir=$1; } else { die "Don't know how to find myself. Please set SRCDIR manually.\n"; } } # Ask pkg-config if libucw is installed and find its configure modules `pkg-config libucw --atleast-version=3.13`; !$? or die "Package `libucw' (version 3.13 or newer) not found. Is PKG_CONFIG_PATH set properly?\n"; $libdir=`pkg-config libucw --variable=perl_modules_dir`; chomp $libdir; die "Unable to find the libucw configure system\n" if $? || not defined $libdir; } use lib $libdir; use UCW::Configure; Init($srcdir, 'default.cfg'); Log "### Configuring subauthd ###\n\n"; Include Get("CONFIG"); require UCW::Configure::Build; require UCW::Configure::Paths; require UCW::Configure::C; use UCW::Configure::Pkg; # Get some libraries PkgConfig("libucw") or Fail("libucw is required"); PkgConfig("libucw-json") or Fail("libucw-json is required"); TrivConfig("libgcrypt", script => "libgcrypt-config", minversion => '1.6') or Fail("libgcrypt is required"); if (IsSet("CONFIG_APACHE_MOD")) { Log "Checking for apxs2 ... "; my $cf = TryCmd("apxs2 -q CFLAGS"); my $ei = TryCmd("apxs2 -q EXTRA_INCLUDES"); my $id = TryCmd("apxs2 -q INCLUDEDIR"); if (!defined($cf) || !defined($id) || !defined($ei)) { Log "NO\n"; Fail "Apache's apxs2 utility is required to build the Apache module."; } Log "YES\n"; Set("APACHE2_CFLAGS" => "-g $cf $ei -I$id"); Set("INSTALL_APACHE2_MOD_DIR" => '$(INSTALL_LIB_DIR)/apache2/modules'); Set("INSTALL_APACHE2_CONFIG_DIR" => '$(INSTALL_PREFIX)etc/apache2'); } require UCW::Configure::Doc; Finish(); Log "\nConfigured, run `make' to build everything.\n";