]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/autoconf.pm
Implement source directory switching support (Closes: #530597).
[debhelper.git] / Debian / Debhelper / Buildsystem / autoconf.pm
1 # A buildsystem plugin for handling autoconf based projects
2 #
3 # Copyright: © 2008 Joey Hess
4 #            © 2008-2009 Modestas Vainius
5 # License: GPL-2+
6
7 package Debian::Debhelper::Buildsystem::autoconf;
8
9 use strict;
10 use base 'Debian::Debhelper::Buildsystem::makefile';
11
12 sub DESCRIPTION {
13         "GNU Autoconf (configure)"
14 }
15
16 sub check_auto_buildable {
17         my $this=shift;
18         my ($step)=@_;
19
20         # Handle configure; the rest - next class
21         if ($step eq "configure") {
22                 return -x $this->get_sourcepath("configure");
23         }
24         return 0;
25 }
26
27 sub configure {
28         my $this=shift;
29
30         # Standard set of options for configure.
31         my @opts;
32         push @opts, "--build=" . dpkg_architecture_value("DEB_BUILD_GNU_TYPE");
33         push @opts, "--prefix=/usr";
34         push @opts, "--includedir=\${prefix}/include";
35         push @opts, "--mandir=\${prefix}/share/man";
36         push @opts, "--infodir=\${prefix}/share/info";
37         push @opts, "--sysconfdir=/etc";
38         push @opts, "--localstatedir=/var";
39         push @opts, "--libexecdir=\${prefix}/lib/" . sourcepackage();
40         push @opts, "--disable-maintainer-mode";
41         push @opts, "--disable-dependency-tracking";
42         # Provide --host only if different from --build, as recommended in
43         # autotools-dev README.Debian: When provided (even if equal)
44         # autoconf 2.52+ switches to cross-compiling mode.
45         if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
46             ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
47                 push @opts, "--host=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE");
48         }
49
50         $this->mkdir_builddir();
51         $this->doit_in_builddir($this->get_source_rel2builddir("configure"), @opts, @_);
52 }
53
54 1;