File: z69.html

package info (click to toggle)
ebook-dev-ggad 199908-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,264 kB
  • ctags: 1,163
  • sloc: sh: 44; makefile: 35
file content (403 lines) | stat: -rw-r--r-- 16,298 bytes parent folder | download | duplicates (2)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>
      configure.in
    </title>
    <meta name="GENERATOR" content=
    "Modular DocBook HTML Stylesheet Version 1.45">
    <link rel="HOME" title="GTK+ / Gnome Application Development"
    href="ggad.html">
    <link rel="UP" title="Creating Your Source Tree" href= 
    "cha-source.html">
    <link rel="PREVIOUS" title="Source Tree Checklist" href= 
    "z68.html">
    <link rel="NEXT" title="Makefile.am" href="z70.html">
  </head>
  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink= 
  "#840084" alink="#0000FF">
    <div class="NAVHEADER">
      <table width="100%" border="0" bgcolor="#ffffff" cellpadding= 
      "1" cellspacing="0">
        <tr>
          <th colspan="4" align="center">
            <font color="#000000" size="2">GTK+ / Gnome Application
            Development</font>
          </th>
        </tr>
        <tr>
          <td width="25%" bgcolor="#ffffff" align="left">
            <a href="z68.html"><font color="#0000ff" size="2"><b>
            &lt;&lt;&lt; Previous</b></font></a>
          </td>
          <td width="25%" colspan="2" bgcolor="#ffffff" align= 
          "center">
            <font color="#0000ff" size="2"><b><a href="ggad.html">
            <font color="#0000ff" size="2"><b>
            Home</b></font></a></b></font>
          </td>
          <td width="25%" bgcolor="#ffffff" align="right">
            <a href="z70.html"><font color="#0000ff" size="2"><b>
            Next &gt;&gt;&gt;</b></font></a>
          </td>
        </tr>
      </table>
    </div>
    <div class="SECT1">
      <h1 class="SECT1">
        <a name="Z69"><tt class="FILENAME">configure.in</tt></a>
      </h1>
      <p>
        <tt class="APPLICATION">autoconf</tt> processes <tt class= 
        "FILENAME">configure.in</tt> to produce a <tt class= 
        "FILENAME">configure</tt> script. <tt class="FILENAME">
        configure</tt> is a portable shell script which examines
        the build environment to determine which libraries are
        available, which features the platform has, where libraries
        and headers are located, and so on. Based on this
        information, it modifies compiler flags, generates
        makefiles, and/or outputs the file <tt class="FILENAME">
        config.h</tt> with appropriate preprocessor symbols
        defined. Again, <tt class="FILENAME">configure</tt> does
        not require <tt class="APPLICATION">autoconf</tt> to run;
        you generate it before distributing your software, so users
        do not have to have <tt class="APPLICATION">autoconf</tt>.
      </p>
      <p>
        Your job is to write <tt class="FILENAME">
        configure.in</tt>. The file is basically a series of <tt
        class="APPLICATION">m4</tt> macros, which expand to
        snippets of shell script according to the parameters you
        pass them. You can also write shell code manually. Really
        understanding how to write a <tt class="FILENAME">
        configure.in</tt> requires some knowledge of <tt class= 
        "APPLICATION">m4</tt> (which is pretty simple) and some
        knowledge of the Bourne shell (which is a black art).
        Fortunately, you can cheat: start with an existing <tt
        class="FILENAME">configure.in</tt> and modify it slightly
        to suit your application. There's also an extensive <tt
        class="APPLICATION">autoconf</tt> manual, which describes
        the many pre-written macros shipped with <tt class= 
        "APPLICATION">autoconf</tt>.
      </p>
      <p>
        The GTK+ and Gnome developers have simplified things still
        further, by providing macros to locate GTK+ and Gnome on
        the user's system.
      </p>
      <p>
        Here is a sample <tt class="FILENAME">configure.in</tt>,
        from a Gnome version of "Hello, World":
      </p>
      <table border="0" bgcolor="#E0E0E0" width="100%">
        <tr>
          <td>
<pre class="PROGRAMLISTING">
&#13;AC_INIT(src/hello.c)

AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE(GnomeHello, 0.1)

AM_MAINTAINER_MODE

AM_ACLOCAL_INCLUDE(macros)

GNOME_INIT

AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_ARG_PROGRAM
AM_PROG_LIBTOOL

GNOME_COMPILE_WARNINGS

ALL_LINGUAS="da de es fr gl nl no pl ru sv fi uk"
AM_GNU_GETTEXT

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

AC_OUTPUT([
Makefile
macros/Makefile
src/Makefile
intl/Makefile
po/Makefile.in
pixmaps/Makefile
doc/Makefile
doc/C/Makefile
doc/es/Makefile
])


&#13;
</pre>
          </td>
        </tr>
      </table>
      <p>
        Before describing each macro, some general points should be
        made. First, those macros that begin with <tt class= 
        "APPLICATION">AC</tt> come with <tt class="APPLICATION">
        autoconf</tt>, and those that begin with <tt class= 
        "APPLICATION">AM</tt> usually come with <tt class= 
        "APPLICATION">automake</tt>. (This is useful when you're
        trying to find documentation for them.) The macros that
        begin with <tt class="APPLICATION">GNOME</tt> come in the
        Gnome <tt class="FILENAME">macros</tt> directory. These
        macros are written in <tt class="APPLICATION">m4</tt>; the
        standard ones from <tt class="APPLICATION">
        autoconf</tt>/<tt class="APPLICATION">automake</tt> reside
        in <tt class="FILENAME">/usr/share/aclocal</tt>, if you
        installed <tt class="APPLICATION">autoconf</tt>/<tt class= 
        "APPLICATION">automake</tt> under <tt class="FILENAME">
        /usr</tt>. (An aside: the <tt class="FILENAME">macros</tt>
        directory is not a good thing; each Gnome package should
        install its own <tt class="APPLICATION">m4</tt> files to
        <tt class="FILENAME">/usr/share/aclocal</tt>. Newer Gnome
        versions attempt to fix the problem.)
      </p>
      <ul>
        <li>
          <p>
            <span class="SYMBOL">AC_INIT</span> is always the first
            macro in <tt class="FILENAME">configure.in</tt>. It
            expands to a lot of boilerplate code shared by all <tt
            class="FILENAME">configure</tt> scripts; this code
            parses the command line arguments to <tt class=
            "FILENAME">configure</tt>. The macro's one argument is
            a file that should be present in the source directory;
            this is used as a sanity check, to be sure <tt class= 
            "FILENAME">configure</tt> has correctly located the
            source directory. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_CONFIG_HEADER</span> specifies
            a header file to create; this will almost always be <tt
            class="FILENAME">config.h</tt>. The created header file
            will contain C preprocessor symbols defined by <tt
            class="FILENAME">configure</tt>. At a minimum, the
            symbols <span class="STRUCTNAME">PACKAGE</span> and
            <span class="STRUCTNAME">VERSION</span> will be
            defined, which makes it easy to put the name and
            version of your program in your code without
            hard-coding them. (Your non-public source files should
            <tt class="APPLICATION">#include &lt;config.h&gt;</tt>
            to take advantage of its definitions; however, <tt
            class="APPLICATION">config.h</tt> should never be
            installed, because it would conflict with other
            packages.) &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_INIT_AUTOMAKE</span>
            initializes <tt class="APPLICATION">automake</tt>; the
            arguments to this macro are the name and version of the
            package being compiled. (These arguments become the
            values of <span class="STRUCTNAME">PACKAGE</span> and
            <span class="STRUCTNAME">VERSION</span>, defined in <tt
            class="FILENAME">config.h</tt>.) &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_MAINTAINER_MODE</span> turns
            off maintainer-only makefile targets by default, and
            changes <tt class="FILENAME">configure</tt> to
            understand a <tt class="APPLICATION">
            --enable-maintainer-mode</tt> option. <tt class= 
            "APPLICATION">--enable-maintainer-mode</tt> turns the
            maintainer-only targets back on. The maintainer-only
            makefile targets permit end users to clean
            automatically-generated files such as <tt class= 
            "FILENAME">configure</tt>, which means they have to
            have <tt class="APPLICATION">autoconf</tt> and <tt
            class="APPLICATION">automake</tt> installed to repair
            the damage. <span class="SYMBOL">
            AM_MAINTAINER_MODE</span> makes it a bit harder for
            users to shoot themselves in the foot. Note, however,
            that the <tt class="FILENAME">autogen.sh</tt> script
            used in Gnome automatically passes <tt class= 
            "APPLICATION">--enable-maintainer-mode</tt> to <tt
            class="FILENAME">configure</tt>, since <tt class= 
            "FILENAME">autogen.sh</tt> is intended for developers
            to use. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_ACLOCAL_INCLUDE</span>
            specifies an additional directory in which to search
            for <tt class="APPLICATION">m4</tt> macros. In this
            case, it specifies the <tt class="FILENAME">macros</tt>
            subdirectory, where you should have copied the Gnome
            macros. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">GNOME_INIT</span> adds a number of
            Gnome-related command-line arguments to <tt class= 
            "FILENAME">configure</tt>, and defines makefile
            variables containing the necessary preprocessor and
            linker flags for Gnome programs. These flags are
            obtained from a <tt class="APPLICATION">
            gnome-config</tt> script installed by the <tt class= 
            "APPLICATION">gnome-libs</tt> package. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_PROG_CC</span> locates the C
            compiler. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_ISC_POSIX</span> adds some
            flags needed for POSIX compatibility on certain
            platforms. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_HEADER_STDC</span> checks
            whether the present system has the standard ANSI header
            files, and defines <tt class="FUNCTION">
            STDC_HEADERS</tt> if so. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_ARG_PROGRAM</span> adds options
            to <tt class="FILENAME">configure</tt> so that users
            can modify the name of an installed program. (Useful if
            your program happens to have the same name as some
            locally-installed program on their system.) &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_PROG_LIBTOOL</span> is used by
            <tt class="APPLICATION">automake</tt> to set up its use
            of <tt class="APPLICATION">libtool</tt>. This is only
            required if you are planning to build a shared library
            or dynamically loadable modules; it is unnecessary for
            this early version of GnomeHello, but we're planning
            ahead. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">GNOME_COMPILE_WARNINGS</span> adds
            a number of warning options to the <tt class= 
            "APPLICATION">gcc</tt> command line, but does nothing
            for most other compilers. &#13;
          </p>
        </li>
        <li>
          <p>
            <tt class="APPLICATION">ALL_LINGUAS="es"</tt> is not a
            macro, just a bit of shell code. It contains a
            space-separated list of language abbreviations,
            corresponding to <tt class="APPLICATION">.po</tt> files
            in the <tt class="APPLICATION">po</tt> subdirectory.
            (<tt class="APPLICATION">.po</tt> files contain
            translations into other languages, so <tt class= 
            "APPLICATION">ALL_LINGUAS</tt> should list all
            languages your program has been translated into.) &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AM_GNU_GETTEXT</span> is used by
            <tt class="APPLICATION">automake</tt>, but the macro
            itself is distributed with the <tt class="APPLICATION">
            gettext</tt> package. It causes <tt class=
            "APPLICATION">automake</tt> to perform a number of
            internationalization-related tasks. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_SUBST</span> "exports" a
            variable into the files generated by <tt class=
            "FILENAME">configure</tt>. More on this below. &#13;
          </p>
        </li>
        <li>
          <p>
            <span class="SYMBOL">AC_OUTPUT</span> lists the files
            to be created by the <tt class="FILENAME">
            configure</tt> script. These will be created from a
            file with the same name, with <tt class="APPLICATION">
            .in</tt> appended. For example, the output file <tt
            class="APPLICATION">src/Makefile</tt> is generated from
            <tt class="APPLICATION">src/Makefile.in</tt>, and <tt
            class="APPLICATION">config.h</tt> comes from <tt class= 
            "APPLICATION">config.h.in</tt>. &#13;
          </p>
        </li>
      </ul>
      <p>
        In the <tt class="APPLICATION">AC_OUTPUT</tt> stage, <tt
        class="APPLICATION">configure</tt> processes files
        containing variables marked with two <tt class=
        "APPLICATION">@</tt> symbols; for example, <tt class= 
        "APPLICATION">@PACKAGE@</tt>. It recognizes such variables
        only if <span class="SYMBOL">AC_SUBST</span> was used to
        "export" the variable (many of the pre-written macros
        discussed above use <span class="SYMBOL">AC_SUBST</span> to
        define variables). Most commonly, this features is used to
        convert a <tt class="FILENAME">Makefile.in</tt> to a <tt
        class="FILENAME">Makefile</tt>. <tt class="FILENAME">
        Makefile.in</tt> is typically generated by <tt class= 
        "APPLICATION">automake</tt> from <tt class="FILENAME">
        Makefile.am</tt>. (However, you can use <tt class= 
        "APPLICATION">autoconf</tt> without <tt class=
        "APPLICATION">automake</tt>, and write <tt class=
        "FILENAME">Makefile.in</tt> yourself.)
      </p>
    </div>
    <div class="NAVFOOTER">
      <br>
      <br>
      <table width="100%" border="0" bgcolor="#ffffff" cellpadding= 
      "1" cellspacing="0">
        <tr>
          <td width="25%" bgcolor="#ffffff" align="left">
            <a href="z68.html"><font color="#0000ff" size="2"><b>
            &lt;&lt;&lt; Previous</b></font></a>
          </td>
          <td width="25%" colspan="2" bgcolor="#ffffff" align= 
          "center">
            <font color="#0000ff" size="2"><b><a href="ggad.html">
            <font color="#0000ff" size="2"><b>
            Home</b></font></a></b></font>
          </td>
          <td width="25%" bgcolor="#ffffff" align="right">
            <a href="z70.html"><font color="#0000ff" size="2"><b>
            Next &gt;&gt;&gt;</b></font></a>
          </td>
        </tr>
        <tr>
          <td colspan="2" align="left">
            <font color="#000000" size="2"><b>Source Tree
            Checklist</b></font>
          </td>
          <td colspan="2" align="right">
            <font color="#000000" size="2"><b><tt class="FILENAME">
            Makefile.am</tt></b></font>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>