]> mj.ucw.cz Git - libucw.git/blob - free/libs/examples/external-ucw-build/configure
Example: Request a new version of libucw.
[libucw.git] / free / libs / examples / external-ucw-build / configure
1 #!/usr/bin/perl
2 # Configure script for the libucw example (inspired by ../external/configure)
3 # (c) 2008 Michal Vaner <vorner@ucw.cz>
4
5 use warnings;
6 use strict;
7
8 our($srcdir, $libdir);
9 BEGIN {
10         # Find the sources
11         my $pkgfile = "test.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.";
19                 }
20         }
21         # Ask pkg-config for the rest of configure
22         $libdir=`pkg-config libucw --atleast-version=3.13 --variable=perl_modules_dir`;
23         chomp $libdir;
24         die "Package `libucw' (version 3.13 or newer) not found. Is PKG_CONFIG_PATH set properly?" if $? || not defined $libdir;
25 }
26 use lib $libdir;
27 use UCW::Configure;
28
29 Init($srcdir, 'default.cfg');
30 Log "### Configuring TestApp ###\n\n";
31 Include Get("CONFIG");
32 # What should be detected?
33 require UCW::Configure::Build;
34 require UCW::Configure::Paths;
35 require UCW::Configure::C;
36 require UCW::Configure::Pkg;
37 # You could generate your own documentation, too
38 # require UCW::Configure::Doc;
39
40 # Get some libraries
41 UCW::Configure::Pkg::PkgConfig("libucw") or Fail("libUCW is required");
42 Finish();
43
44 Log "\nConfigured, run `make' to build everything.\n";