5 dh_auto_configure - automatically configure a package prior to building
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_auto_configure> [S<I<debhelper options>>] [S<B<--> I<params>>]
18 dh_auto_configure is a debhelper program that tries to automatically
19 configure a package prior to building. It looks for and runs a ./configure
20 script, Makefile.PL, or Build.PL. A standard set of parameters is
21 determined and passed to the program that is run. If no program to run is
22 found, dh_auto_configure will exit without doing anything.
24 This is intended to work for about 90% of packages. If it doesn't work,
25 you're encouraged to skip using dh_auto_configure at all, and just run
26 ./configure or its equivalent manually.
34 Pass "params" to the program that is run, after the standard
35 parameters that dh_auto_configure passes. This can be used to supplement
36 or override those parameters. For example:
38 dh_auto_configure -- --with-foo --enable-bar
46 sub dpkg_architecture_value {
48 my $value=`dpkg-architecture -q$var 2>/dev/null` || error("dpkg-architecture failed");
54 open (CONTROL, 'debian/control') ||
55 error("cannot read debian/control: $!\n");
59 if (/^Source:\s*(.*)/) {
66 error("could not find Source: line in control file.");
70 # Standard set of options for configure.
72 push @opts, "--build=".dpkg_architecture_value("DEB_BUILD_GNU_TYPE");
73 push @opts, "--prefix=/usr";
74 push @opts, "--includedir=\${prefix}/include";
75 push @opts, "--mandir=\${prefix}/share/man";
76 push @opts, "--infodir=\${prefix}/share/info";
77 push @opts, "--sysconfdir=/etc";
78 push @opts, "--localstatedir=/var";
79 push @opts, "--libexecdir=\${prefix}/lib/".sourcepackage();
80 push @opts, "--disable-maintainer-mode";
81 push @opts, "--disable-dependency-tracking";
82 # Provide --host only if different from --build, as recommended in
83 # autotools-dev README.Debian: When provided (even if equal) autotools
84 # 2.52+ switches to cross-compiling mode.
85 if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE") ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
86 push @opts, "--host=".dpkg_architecture_value("DEB_HOST_GNU_TYPE");
88 doit("./configure", @opts, @{$dh{U_PARAMS}});
90 elsif (-e "Makefile.PL") {
91 # If set to a true value then MakeMaker's prompt function will
92 # always return the default without waiting for user input.
93 $ENV{PERL_MM_USE_DEFAULT}=1;
94 # This prevents Module::Install from interactive behavior.
95 $ENV{PERL_AUTOINSTALL}="--skipdeps";
97 doit("perl", "Makefile.PL", "INSTALLDIRS=vendor",
98 "create_packlist=0", @{$dh{U_PARAMS}});
100 elsif (-e "Build.PL") {
101 $ENV{PERL_MM_USE_DEFAULT}=1; # Module::Build can also use this.
102 $ENV{MODULEBUILDRC} = "/dev/null";
103 doit("perl", "Build.PL", "installdirs=vendor", @{$dh{U_PARAMS}});
110 This program is a part of debhelper.
114 Joey Hess <joeyh@debian.org>