aboutsummaryrefslogtreecommitdiff
blob: 18d3e9e9b867f7f621fc997494f69e45559b84c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version="1.0"?>
<guide self="ebuild-writing/functions/src_configure/configuring/">
<chapter>
<title>Configuring a Package</title>

<body>
<p>
Many packages come with an autoconf-generated <c>./configure</c>
script for checking the build environment and configuring optional
support for libraries. The <c>econf</c> function should be used where
possible <d/> this will provide correct build and path specifications for
a Gentoo environment.
</p>

<p>
Often the configure script will try to automatically enable support
for optional components based upon installed packages. This
must <b>not</b> be allowed to happen. For example, if a user has Perl
installed but has <c>USE="-perl"</c>, packages with <e>optional</e>
Perl support must not link against Perl. This automatic detection can
usually be overridden using <c>--enable-</c> and <c>--disable</c>
or <c>--with-</c> and <c>--without-</c> switches (but note that these
don't always work <d/> make sure these are tested properly!).
</p>

<p>
The <c>use_enable</c> and <c>use_with</c> utility functions should,
where appropriate, be used to generate these switches.
</p>

<codesample lang="ebuild">
src_configure() {
	# We have optional perl, python and ruby support
	econf \
		$(use_enable perl) \
		$(use_enable python) \
		$(use_enable ruby)
}

src_configure() {
	# Our package optional IPv6 support which uses --with rather than
	# --enable / --disable

	econf $(use_with ipv6)
}
</codesample>

<p>
Sometimes the package's choice of name for the option will not exactly
match the name or case of the <c>USE</c> flag. This is very often the
case with the <c>X</c> flag. For these situations, there are two
argument forms:
</p>

<codesample lang="ebuild">
src_configure() {
	# Our package has optional perl, python and ruby support
	econf \
		$(use_enable perl perlinterp) \
		$(use_enable python pythoninterp) \
		$(use_enable ruby rubyinterp)

	# ...
}

src_configure() {
	econf $(use_with X x11)
}
</codesample>

<p>
To check for an unset <c>USE</c> flag, the <c>use_enable !flag</c>
form can be used.
</p>
</body>

<section>
<title><c>econf</c> Options</title>
<body>

<p>
<c>econf</c> is designed to work with configure scripts generated by
GNU Autoconf. It first passes the default options listed below to the configure
script, followed by any additional parameters passed to <c>econf</c>.
</p>

<ul>
  <li><c>--prefix="${EPREFIX}"/usr</c></li>
  <li><c>--mandir="${EPREFIX}"/usr/share/man</c></li>
  <li><c>--infodir="${EPREFIX}"/usr/share/info</c></li>
  <li><c>--datadir="${EPREFIX}"/usr/share</c></li>
  <li><c>--sysconfdir="${EPREFIX}"/etc</c></li>
  <li><c>--localstatedir="${EPREFIX}"/var/lib</c></li>
  <li>
    <c>--build="${CBUILD}"</c> (only passed if <c>CBUILD</c> is non-empty)
  </li>
  <li><c>--host="${CHOST}"</c></li>
  <li>
    <c>--target="${CTARGET}"</c> (only passed if <c>CTARGET</c> is non-empty)
  </li>
  <li>
    <c>--libdir</c> is set from the value of the <c>LIBDIR_${ABI}</c> variable
    in profiles.
  </li>
  <li><c>--disable-dependency-tracking</c></li>
  <li><c>--disable-silent-rules</c></li>
</ul>

<p>
In EAPI 6 and later, the following options are passed in addition:
</p>

<ul>
  <li><c>--docdir="${EPREFIX}"/usr/share/doc/${PF}</c></li>
  <li><c>--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html</c></li>
</ul>

<p>
In EAPI 7 and later, the following option is passed in addition:
</p>

<ul>
  <li><c>--with-sysroot="${ESYSROOT:-/}"</c></li>
</ul>

</body>
</section>
</chapter>
</guide>