1 # German translation for the Anjuta build tutorial.
2 # Copyright (C) 2018 anjuta's COPYRIGHT HOLDER
3 # This file is distributed under the same license as the anjuta package.
4 # Mario Blättermann <mario.blaettermann@gmail.com>, 2018.
8 "Project-Id-Version: anjuta master\n"
9 "POT-Creation-Date: 2018-03-24 09:56+0000\n"
10 "PO-Revision-Date: 2018-04-22 17:33+0200\n"
11 "Language-Team: German <gnome-de@gnome.org>\n"
13 "Content-Type: text/plain; charset=UTF-8\n"
14 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17 "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
18 "X-Generator: Poedit 2.0.6\n"
20 #. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2
22 msgid "translator-credits"
25 #. (itstool) path: bookinfo/title
27 msgid "Anjuta build tutorial"
30 #. (itstool) path: bookinfo/edition
35 #. (itstool) path: bookinfo/copyright
37 msgid "<year>2004</year> <holder>Olivier Pinçon</holder>"
38 msgstr "<year>2004</year> <holder>Olivier Pinçon</holder>"
40 #. (itstool) path: bookinfo/copyright
42 msgid "<year>2008</year> <holder>Sébastien Granjoux</holder>"
43 msgstr "<year>2008</year> <holder>Sébastien Granjoux</holder>"
45 #. (itstool) path: legalnotice/para
48 "Permission is granted to copy, distribute and/or modify this document under the terms of the <citetitle>GNU Free "
49 "Documentation License</citetitle>, Version 1.1 or any later version published by the Free Software Foundation with "
50 "no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy of the <citetitle>GNU "
51 "Free Documentation License</citetitle> from the Free Software Foundation by visiting <ulink type=\"http\" url="
52 "\"http://www.fsf.org\">their Web site</ulink> or by writing to: Free Software Foundation, Inc., 51 Franklin "
53 "Street, Fifth Floor, Boston, MA 02110-1301, USA."
56 #. (itstool) path: legalnotice/para
59 "Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where "
60 "those names appear in any GNOME documentation, and those trademarks are made aware to the members of the GNOME "
61 "Documentation Project, the names have been printed in caps or initial caps."
64 #. (itstool) path: bookinfo/releaseinfo
66 msgid "This is version 0.2 of Anjuta build tutorial"
69 #. (itstool) path: chapter/title
74 #. (itstool) path: chapter/para
77 "If you come from the Windows world, when you first launched <application>Anjuta</application>, you can told "
78 "yourself : \"Hey, that looks like MS Visual C++, as I know it pretty well, understanding <application>Anjuta</"
79 "application> will be a piece of cake.\". <application>Anjuta</application> looks like <application>Microsoft "
80 "Visual Studio</application> or <application>Borland's C++ Builder</application>. but it has some significative "
81 "differences essentially in its build system."
84 #. (itstool) path: chapter/para
87 "If you are starting programming directly on GNU/Linux, you have probably already heard of the "
88 "<application>Autotools</application>. They are a major and probably a bit intimidating part of the development "
92 #. (itstool) path: chapter/para
95 "The goal of <application>Anjuta</application> is to make it easier to use the already existing development tools. "
96 "<application>Anjuta</application> main build system uses the standard Linux build system: <application>Autotools</"
97 "application>. This tutorial is an updated version of the <application>Anjuta</application> advanced tutorial from "
98 "Olivier Pinçon. It explains how the build system is working without <application>Anjuta</application> and how to "
99 "use it within <application>Anjuta</application>. It assumes that you have only a basic understanding of C or C++ "
100 "and have been written using <application>Anjuta 2.6 (September 2008)</application>."
103 #. (itstool) path: listitem/para
104 #: C/index.docbook:90
106 "Fill a bug in <ulink url=\"http://bugzilla.gnome.org/enter_bug.cgi?product=anjuta\"> <application>Anjuta</"
107 "application> bugzilla database</ulink>."
110 #. (itstool) path: listitem/para
111 #: C/index.docbook:94
113 "Send a message to <application>Anjuta</application> developer mailing list <email>anjuta-devel@lists.sourceforge."
117 #. (itstool) path: listitem/para
118 #: C/index.docbook:98
120 "Join <application>Anjuta</application> IRC channel <ulink url=\"irc://irc.gnome.org/anjuta\">#anjuta on irc.gnome."
124 #. (itstool) path: chapter/para
125 #: C/index.docbook:85
127 "If you find errors, need more explanations or have any idea for improvements on this tutorial or "
128 "<application>Anjuta</application> in general, you can: <_:itemizedlist-1/>"
131 #. (itstool) path: chapter/title
132 #: C/index.docbook:107
133 msgid "Building a project"
136 #. (itstool) path: chapter/para
137 #: C/index.docbook:108
139 "This chapter explains how to build a program starting from the most basic tool: the compiler. This order is "
140 "important to understand how is it working because each tool adds a new layer on top of the previous ones."
143 #. (itstool) path: sect1/title
144 #: C/index.docbook:114
145 msgid "Using <application>GCC</application>"
148 #. (itstool) path: sect1/para
149 #: C/index.docbook:115
150 msgid "Here is a typical command to generate an executable from C source files using <application>GCC</application>:"
153 #. (itstool) path: sect1/screen
154 #: C/index.docbook:119
158 "<prompt>$</prompt><userinput>gcc -g -Wall -I/usr/include/libxml2/libxml -lxml2 main.c aux.c -o tut_prog</userinput>"
161 #. (itstool) path: sect1/para
162 #: C/index.docbook:121
164 "This command tells <application>GCC</application> to compile the source files main.c and aux.c, and produce a "
165 "binary called 'tut_prog' (this stands for 'tutorial program'). The various switches have the following meaning :"
168 #. (itstool) path: varlistentry/term
169 #: C/index.docbook:128
170 msgid "<parameter>-g</parameter>"
173 #. (itstool) path: listitem/para
174 #: C/index.docbook:130
175 msgid "tells <application>GCC</application> to include debug information into the binary."
178 #. (itstool) path: varlistentry/term
179 #: C/index.docbook:134
180 msgid "<parameter>-Wall</parameter>"
183 #. (itstool) path: listitem/para
184 #: C/index.docbook:136
185 msgid "Warning all : print every warning. This switch is used by the C compiler only."
188 #. (itstool) path: varlistentry/term
189 #: C/index.docbook:140
190 msgid "<parameter>-Idir <replaceable>dir</replaceable></parameter>"
193 #. (itstool) path: listitem/para
194 #: C/index.docbook:142
196 "Look for included header files (like in #include <myheader.h>) in directory <replaceable>dir</replaceable>. "
197 "This switch is used by the C preprocessor only."
200 #. (itstool) path: varlistentry/term
201 #: C/index.docbook:148
202 msgid "<parameter>-llib <replaceable>lib</replaceable></parameter>"
205 #. (itstool) path: listitem/para
206 #: C/index.docbook:150
207 msgid "Link to library <replaceable>lib</replaceable>; here <application>libxml2</application>, used by the linker."
210 #. (itstool) path: sect1/para
211 #: C/index.docbook:155
213 "In fact, <application>GCC</application> does not do the compilation itself. It gets all arguments from the user "
214 "and calls other programs passing them the needed arguments with some default one to do the four stages involved in "
218 #. (itstool) path: figure/title
219 #: C/index.docbook:162
220 msgid "<application>GCC</application> compilation stage"
223 #. (itstool) path: imageobject/imagedata
224 #. This is a reference to an external file such as an image or video. When
225 #. the file changes, the md5 hash will change to let you know you need to
226 #. update your localized copy. The msgstr is not used at all. Set it to
227 #. whatever you like once you have updated your copy of the file.
228 #: C/index.docbook:165
230 msgid "external ref='figures/compilation-stages.png' md5='395d9386a3de8f8c479265c6c5c5421f'"
233 #. (itstool) path: sect2/title
234 #: C/index.docbook:170
238 #. (itstool) path: sect2/para
239 #: C/index.docbook:171
241 "Each C source file goes through the preprocessor, named <application>cpp</application>. In this stage, all include "
242 "files and macros are expanded to get preprocessed C source code. The resulting file .i is rarely generated but it "
243 "could be interesting to see how complex macros are expanded. You can do this by calling <application>cpp</"
244 "application> directly or using the <userinput>-E</userinput> switch of <application>GCC</application>. The later "
245 "option is better as it allows to run the preprocessor with all default options."
248 #. (itstool) path: sect2/title
249 #: C/index.docbook:183
253 #. (itstool) path: sect2/para
254 #: C/index.docbook:184
256 "In this stage each file is compiled into assembler code. The compiler depends on the language of the source file, "
257 "C here. It is a complex program because there is not a one to one correspondence between C instructions and "
258 "assembler instructions. By example, requesting the fastest or the smallest program will generate different "
259 "sequences of assembler instructions. The assembler is the language of your computer, the most common one is called "
260 "x86. The output is a, human readable, assembler source file ending with '.s'. Like the preprocessor output, the "
261 "assembler code is not normally written on the hard disk. You can stop the compilation at this stage to look at it "
262 "by running <application>GCC</application> with the <userinput>-S</userinput> switch."
265 #. (itstool) path: sect2/title
266 #: C/index.docbook:201
270 #. (itstool) path: sect2/para
271 #: C/index.docbook:202
273 "In this stage each file is assembled: the assembler code is transformed to an object file with .o extension. It is "
274 "much easier than the compilation as each assembler instruction corresponds to an unique code. The object file "
275 "contains additional information for debugging or linking the program. The object file is a binary format, called "
276 "ELF on recent Linux machine, you need to use special program to look in it like <application>objdump</"
277 "application>. It is possible to write directly assembler code and assemble it using the assembler ,"
278 "<application>as</application>, or <application>GCC</application> if your source file has a .s extension. These "
279 "object files are commonly written on your hard disk because it depends only of theirs corresponding C source file "
280 "(with all files included). If you modify only one source file, you need to regenerate only the corresponding "
281 "object file. You can stop at this stage, without linking by using <userinput>-c</userinput> switch with "
282 "<application>GCC</application>."
285 #. (itstool) path: sect2/title
286 #: C/index.docbook:221
290 #. (itstool) path: sect2/para
291 #: C/index.docbook:222
293 "This stage is used to combine all the object files and libraries into one executable file. The result is a binary "
294 "file in a format close to the object file, on Linux it is even the same format."
297 #. (itstool) path: sect1/title
298 #: C/index.docbook:230
299 msgid "Using <application>make</application>"
302 #. (itstool) path: sect1/para
303 #: C/index.docbook:231
305 "When a program is composed of lots of sources files, it is much faster to keep the object files and recompile each "
306 "source files only when needed. This can be automated using <application>make</application>. It executes a program "
307 "written in a makefile, normally named <filename>Makefile</filename>. A sample makefile for the previous tutorial "
311 #. (itstool) path: example/title
312 #: C/index.docbook:240
313 msgid "A simple Makefile file"
316 #. (itstool) path: example/programlisting
317 #: C/index.docbook:241
321 "CC=gcc \t# the C compiler is gcc\n"
322 "CFLAGS=-g -Wall -I/usr/include/libxml2\n"
323 "LIBS=-lxml2\t\t\t\t\t\n"
325 "tut_prog: main.o aux.o # what we need to have 'tut_prog'...\n"
326 "\t$(CC) $(LIBS) main.o aux.o -o tut_prog # ...and how to get it from the ingredients.\n"
329 "\t$(CC) -c $(CFLAGS) main.c\n"
332 "\t$(CC) -c $(CFLAGS) aux.c"
335 #. (itstool) path: sect1/para
336 #: C/index.docbook:255
338 "Makefiles are a kind of program but instead of writing what should be done sequentially to get the result, you "
339 "define some rules and <application>make</application> uses these rules in whatever order to achieve the result."
342 #. (itstool) path: sect2/title
343 #: C/index.docbook:262
347 #. (itstool) path: sect2/para
348 #: C/index.docbook:263
350 "Like in any programming language, you can define variables in a make file. All variables contains a string or a "
351 "list of strings separated by whitespace. A variable is defined using the following syntax: <replaceable>name</"
352 "replaceable>=<replaceable>value</replaceable>. You can get its value by writing $(<replaceable>name</replaceable>) "
353 "or ${<replaceable>name</replaceable>}. In the sample above, three variables are defined CC, CFLAGS and LIBS."
356 #. (itstool) path: varlistentry/term
357 #: C/index.docbook:280
358 msgid "<envar>CC</envar>"
361 #. (itstool) path: listitem/para
362 #: C/index.docbook:281
363 msgid "Program for compiling C programs, default 'cc'"
366 #. (itstool) path: varlistentry/term
367 #: C/index.docbook:284
368 msgid "<envar>CXX</envar>"
371 #. (itstool) path: listitem/para
372 #: C/index.docbook:285
373 msgid "Program for compiling C++ programs, default 'g++'"
376 #. (itstool) path: varlistentry/term
377 #: C/index.docbook:288
378 msgid "<envar>CPP</envar>"
381 #. (itstool) path: listitem/para
382 #: C/index.docbook:289
383 msgid "Program for running C preprocessor, default '$(CC) -E'"
386 #. (itstool) path: varlistentry/term
387 #: C/index.docbook:292
388 msgid "<envar>FC</envar>"
391 #. (itstool) path: listitem/para
392 #: C/index.docbook:293
393 msgid "Program for running Fortran compiler, default 'f77'"
396 #. (itstool) path: varlistentry/term
397 #: C/index.docbook:296
398 msgid "<envar>RM</envar>"
401 #. (itstool) path: listitem/para
402 #: C/index.docbook:297
403 msgid "Command to remove a file, default 'rm -f'"
406 #. (itstool) path: varlistentry/term
407 #: C/index.docbook:300
408 msgid "<envar>CFLAGS</envar>"
411 #. (itstool) path: listitem/para
412 #: C/index.docbook:301
413 msgid "Extra flags for the C compiler"
416 #. (itstool) path: varlistentry/term
417 #: C/index.docbook:304 C/index.docbook:312
418 msgid "<envar>CXXFLAGS</envar>"
421 #. (itstool) path: listitem/para
422 #: C/index.docbook:305 C/index.docbook:309
423 msgid "Extra flags for the C++ compiler"
426 #. (itstool) path: varlistentry/term
427 #: C/index.docbook:308
428 msgid "<envar>CPPFLAGS</envar>"
431 #. (itstool) path: listitem/para
432 #: C/index.docbook:313
433 msgid "Extra flags for the C preprocessor"
436 #. (itstool) path: varlistentry/term
437 #: C/index.docbook:316
438 msgid "<envar>FFLAGS</envar>"
441 #. (itstool) path: listitem/para
442 #: C/index.docbook:317
443 msgid "Extra flags for the Fortran compiler"
446 #. (itstool) path: varlistentry/term
447 #: C/index.docbook:320
448 msgid "<envar>LDFLAGS</envar>"
451 #. (itstool) path: listitem/para
452 #: C/index.docbook:321
453 msgid "Extra flags for the linker"
456 #. (itstool) path: sect2/para
457 #: C/index.docbook:272
459 "Variables can be redefined when calling <application>make</application> in the command line or using values from "
460 "environment. Moreover <application>make</application> includes some default rules using predefined variables. Here "
461 "is a list of the most common ones: <_:variablelist-1/>"
464 #. (itstool) path: sect2/title
465 #: C/index.docbook:327
469 #. (itstool) path: sect2/para
470 #: C/index.docbook:328
471 msgid "The basic syntax for make rules is:"
474 #. (itstool) path: sect2/programlisting
475 #: C/index.docbook:331
479 "<replaceable>target</replaceable>: <replaceable>prerequisites</replaceable>\n"
480 "\t<replaceable>commands</replaceable>\n"
481 "\t<replaceable>...</replaceable>"
484 #. (itstool) path: sect2/para
485 #: C/index.docbook:335
487 "The <replaceable>target</replaceable> and the <replaceable>prerequisites</replaceable> are normally files but they "
488 "could be actions. The rule is interpreted as in order to make the target or update it if it is older than its "
489 "prerequisites, you need to make all prerequisites and then run all commands."
492 #. (itstool) path: sect2/para
493 #: C/index.docbook:343
495 "<application>make</application> starts with the first target of the makefile or the one given in the command line "
496 "and looks for a rule. If this rules has no prerequisites, the associated commands are run and that's all. Else "
497 "before running the commands, for each prerequisite, <application>make</application> looks for a rule having it as "
498 "target and repeats the same process."
501 #. (itstool) path: para/programlisting
502 #: C/index.docbook:355
506 "Search a rule with tut_prog as target\n"
507 "Found with prerequisites main.o aux.o\n"
508 "\tSearch a rule with main.o as target\n"
509 "\tFound with prequisite main.c\n"
510 "\t\tSearch a rule with main.c as target\n"
511 "\t\tNot found (main.c is a source file)\n"
512 "\tIf main.o does not exist or is older than main.c\n"
513 "\t\tCompile main.c, do not link (-c switch)\n"
514 "\tSearch a rule with aux.o as target\n"
515 "\tFound with prequisite aux.c\n"
516 "\t\tSearch a rule with aux.c as target\n"
517 "\t\tNot found (aux.c is a source file)\n"
518 "\tIf aux.o does not exist or is older than aux.c\n"
519 "\t\tCompile aux.c, do not link (-c switch)\n"
520 "If tut_prog is older than main.o or aux.o\n"
521 "\tLink main.o, aux.o and libxml2"
524 #. (itstool) path: sect2/para
525 #: C/index.docbook:351
527 "In the sample above, if you run <userinput>make</userinput> or <userinput>make tut_prog</userinput>. "
528 "<application>make</application> does the following: <_:programlisting-1/>"
531 #. (itstool) path: sect2/para
532 #: C/index.docbook:373
533 msgid "Like for variables, several target names are commonly defined:"
536 #. (itstool) path: varlistentry/term
537 #: C/index.docbook:378
538 msgid "<parameter>all</parameter>"
541 #. (itstool) path: listitem/para
542 #: C/index.docbook:379
543 msgid "Do everything"
546 #. (itstool) path: varlistentry/term
547 #: C/index.docbook:382
548 msgid "<parameter>check</parameter>"
551 #. (itstool) path: listitem/para
552 #: C/index.docbook:383
553 msgid "Perform some self test after building the program"
556 #. (itstool) path: varlistentry/term
557 #: C/index.docbook:386
558 msgid "<parameter>clean</parameter>"
561 #. (itstool) path: listitem/para
562 #: C/index.docbook:387
563 msgid "Delete all files created by <application>make</application>"
566 #. (itstool) path: varlistentry/term
567 #: C/index.docbook:390
568 msgid "<parameter>distclean</parameter>"
571 #. (itstool) path: listitem/para
572 #: C/index.docbook:391
573 msgid "Delete more files than clean, could delete the Makefile itself"
576 #. (itstool) path: varlistentry/term
577 #: C/index.docbook:394
578 msgid "<parameter>dist</parameter>"
581 #. (itstool) path: listitem/para
582 #: C/index.docbook:395
583 msgid "Create a distribution package, a compressed tarball by example"
586 #. (itstool) path: varlistentry/term
587 #: C/index.docbook:398
588 msgid "<parameter>install</parameter>"
591 #. (itstool) path: listitem/para
592 #: C/index.docbook:399
594 "Install target created by <application>make</application>, need to be run as root to install in system directories"
597 #. (itstool) path: varlistentry/term
598 #: C/index.docbook:403
599 msgid "<parameter>uninstall</parameter>"
602 #. (itstool) path: listitem/para
603 #: C/index.docbook:404
604 msgid "Remove files installed by <application>make</application>"
607 #. (itstool) path: note/para
608 #: C/index.docbook:408
610 "Programs compiled from sources are installed by default in <filename class=\"directory\"> /usr/local</filename>. "
611 "If you want to install (or uninstall) a program in such system directory, you normally need to log as root using "
612 "<userinput>su</userinput> or <userinput>sudo</userinput> before running <userinput>make install</userinput>."
615 #. (itstool) path: sect1/title
616 #: C/index.docbook:417 C/index.docbook:706 C/index.docbook:1306
617 msgid "Using <application>Autotools</application>"
620 #. (itstool) path: sect1/para
621 #: C/index.docbook:418
623 "If you want to build your program on another system, using <application>make</application> only could be quite "
624 "difficult. The C compiler could be different. Some common C functions could be missing, have another name, "
625 "declared in a different header and so on. This can be handled by enabling difference piece of code in your sources "
626 "using preprocessor directive #if, #ifdef and others. But the user will have to define himself all these tuning "
627 "which is not easy as there is a lots of systems with a lots of variations."
630 #. (itstool) path: sect1/para
631 #: C/index.docbook:427
633 "Free softwares are mainly distributed as sources. It is crucial to be able to recompile them on various system "
634 "without much technical knowledge. <application>Autotools</application> is designed to solve this and you probably "
635 "have already use it using the magic combination <userinput> \"./configure; make; make install\"</userinput>. You "
636 "may have noticed that many files are involved in this build process; globally all that stuff seems very "
637 "complicated. So what's happening when you compile such software ?"
640 #. (itstool) path: sect2/title
641 #: C/index.docbook:438
645 #. (itstool) path: sect2/para
646 #: C/index.docbook:439
648 "An <application>Autotools</application> project comes at least with a configure script, named <filename>configure</"
649 "filename>, and a makefile template named <filename>Makefile.in</filename>. There is normally, one "
650 "<filename>Makefile.in</filename> in each directory of the project. There are several other files used by an "
651 "<application>Autotools</application> project but they are not stricly necessary or are generated automatically."
654 #. (itstool) path: tip/para
655 #: C/index.docbook:449
657 "If you look inside these files, you will see that they are quite complex. Do not worry, these files are generated "
658 "by <application>Autotools</application> from other templates easier to write as explained in <xref linkend="
659 "\"create-autotools\"/>. For the moment, we do not care, we consider these files exist as it is the case when you "
660 "get a source package."
663 #. (itstool) path: sect2/title
664 #: C/index.docbook:457 C/index.docbook:559
668 #. (itstool) path: sect2/para
669 #: C/index.docbook:458
671 "In fact, you don't need <application>Autotools</application> to build an autotools package, "
672 "<application>configure</application> is a shell script running on the most basic shell: <filename>sh</filename>. "
673 "It probes your system checking each characteristic and writes makefiles from the templates."
676 #. (itstool) path: important/para
677 #: C/index.docbook:466
679 "In order to build a project using a library, you need more information about it, so additional files. For a "
680 "library used in a C program, you need the corresponding header files. This has to be installed on your system and "
681 "is typically found in a so called development package. By example for the library <application>libxml2</"
682 "application>, there are two packages:"
685 #. (itstool) path: listitem/para
686 #: C/index.docbook:473
688 "<filename>libxml2</filename> necessary to run a program using it and installed automatically as a dependency of "
692 #. (itstool) path: listitem/para
693 #: C/index.docbook:478
695 "<filename>libxml2-devel</filename> necessary to build a program using it. If you don't have it "
696 "<application>configure</application> will display an error message."
699 #. (itstool) path: figure/title
700 #: C/index.docbook:485
701 msgid "Configure process"
704 #. (itstool) path: imageobject/imagedata
705 #. This is a reference to an external file such as an image or video. When
706 #. the file changes, the md5 hash will change to let you know you need to
707 #. update your localized copy. The msgstr is not used at all. Set it to
708 #. whatever you like once you have updated your copy of the file.
709 #: C/index.docbook:488
711 msgid "external ref='figures/configure-process.png' md5='ab9bee38a1f4104bd289df6a9d74ffb7'"
714 #. (itstool) path: sect2/para
715 #: C/index.docbook:492
717 "<application>configure</application> creates all files in the directory where it is called. This directory is the "
718 "<emphasis>build directory</emphasis>. If you run it from the source directory, using <userinput>./configure</"
719 "userinput>, the build directory will be the same."
722 #. (itstool) path: sect2/para
723 #: C/index.docbook:498
725 "<application>configure</application> accepts several options in the command line. They are used to install the "
726 "files in different directories, to disable some parts of the project in order to get a smaller executable or if "
727 "you haven't one needed library or force a value for some <application>make</application> variable (see <xref "
728 "linkend=\"build-make-vars\"/>). You can get a list of them by running <userinput>configure --help</userinput>. "
729 "Here is a list of the most common ones:"
732 #. (itstool) path: varlistentry/term
733 #: C/index.docbook:509
734 msgid "<parameter>--help</parameter>"
737 #. (itstool) path: listitem/para
738 #: C/index.docbook:510
739 msgid "List all available options"
742 #. (itstool) path: varlistentry/term
743 #: C/index.docbook:513
744 msgid "<parameter>--host <replaceable>host</replaceable></parameter>"
747 #. (itstool) path: listitem/para
748 #: C/index.docbook:514
749 msgid "Compile to run on another system (cross compilation)"
752 #. (itstool) path: varlistentry/term
753 #: C/index.docbook:517
754 msgid "<parameter>--prefix <replaceable>dir</replaceable></parameter>"
757 #. (itstool) path: listitem/para
758 #: C/index.docbook:518
759 msgid "Select the root directory for installing the project, default /usr/local"
762 #. (itstool) path: note/para
763 #: C/index.docbook:522
765 "<application>configure</application> generates a few additional files which are less important. <filename>config."
766 "log</filename> is a log file useful when something goes wrong to get more details. <filename>config.status</"
767 "filename> is another shell script, it can be run to restore the current configuration. <filename>config.h</"
768 "filename> is a header file generated like <filename>Makefile</filename> from a template <filename>config.h.in</"
769 "filename> if it exists."
772 #. (itstool) path: sect2/title
773 #: C/index.docbook:531
774 msgid "<application>make</application>"
777 #. (itstool) path: sect2/para
778 #: C/index.docbook:532
780 "The makefiles generated by <application>configure</application> are quite complex but are standard makefiles. They "
781 "define all standard targets needed by GNU standard."
784 #. (itstool) path: listitem/para
785 #: C/index.docbook:539
786 msgid "<userinput>make</userinput> or <userinput>make all</userinput> builds the program."
789 #. (itstool) path: listitem/para
790 #: C/index.docbook:542
791 msgid "<userinput>make install</userinput> installs the program."
794 #. (itstool) path: listitem/para
795 #: C/index.docbook:545
797 "<userinput>make distclean</userinput> removes all files generated by <application>configure</application>, to let "
798 "the project in the state it was when unpacking the distribution package."
801 #. (itstool) path: sect1/title
802 #: C/index.docbook:553 C/index.docbook:1055 C/index.docbook:1583
803 msgid "Using <application>Anjuta</application>"
806 #. (itstool) path: sect1/para
807 #: C/index.docbook:554
809 "Now, we will see the <application>Anjuta</application> interface allowing you to run all these commands without "
810 "using the command line."
813 #. (itstool) path: sect2/para
814 #: C/index.docbook:560
816 "As <application>Anjuta</application> is using <application>Autotools</application>, the first step is similar, you "
817 "need to run configure. Select <menuchoice><guisubmenu>Build</guisubmenu> <guimenuitem>Configure Project...</"
818 "guimenuitem></menuchoice>, to get the following dialog:"
821 #. (itstool) path: figure/title
822 #: C/index.docbook:568
823 msgid "Configure dialog"
826 #. (itstool) path: imageobject/imagedata
827 #. This is a reference to an external file such as an image or video. When
828 #. the file changes, the md5 hash will change to let you know you need to
829 #. update your localized copy. The msgstr is not used at all. Set it to
830 #. whatever you like once you have updated your copy of the file.
831 #: C/index.docbook:572
833 msgid "external ref='figures/configure-dialog.png' md5='c8ca3d93f18c8b680edf018d0a90a254'"
836 #. (itstool) path: sect2/para
837 #: C/index.docbook:577
839 "The <guilabel>Regenerate project</guilabel> checkbox will not be described now as it is related to project "
840 "creation (see in <xref linkend=\"create-autotools-generate\"/>)."
843 #. (itstool) path: sect2/para
844 #: C/index.docbook:581
846 "The <guilabel>Configuration</guilabel> field is an user name used to reference this particular configuration to "
847 "switch between different ones later. For <application>Anjuta</application> each configuration corresponds to one "
848 "build directory and a set of configure options. <application>Anjuta</application> already provides some default "
849 "configurations that you can select here."
852 #. (itstool) path: note/para
853 #: C/index.docbook:588
855 "It is recommended to use the Debug configuration for debugging. It will compile your program with all "
856 "optimizations disabled. When optimizations are enabled, some variables and functions are removed, you will not be "
857 "able to see them with the debugger. Moreover some lines in your source code are re-ordered, so some steps will go "
861 #. (itstool) path: sect2/para
862 #: C/index.docbook:594
864 "The <guilabel>Build Directory</guilabel> field allow to select the directory used to build the project. It must be "
865 "different for each configuration."
868 #. (itstool) path: important/para
869 #: C/index.docbook:599
871 "If you build the project in the source directory (leaving the <guilabel>Build Directory</guilabel> field empty), "
872 "you cannot create a new configuration. It is a limitation of <application>Autotools</application>. You need to "
873 "select <menuchoice><guisubmenu>Build</guisubmenu> <guimenuitem>Remove Configuration</guimenuitem></menuchoice> "
874 "that will run <userinput>make distclean</userinput> in the source directory first."
877 #. (itstool) path: sect2/para
878 #: C/index.docbook:606
879 msgid "The <guilabel>Configure Options</guilabel> field allow passing different options to the configure script."
882 #. (itstool) path: sect2/para
883 #: C/index.docbook:610
885 "Clicking on <guibutton>Execute</guibutton> will run the configure script. All the output will appears in the "
886 "message view of <application>Anjuta</application>. If the script runs without error, it will enable all other "
887 "entries in the <guisubmenu>Build</guisubmenu> menu."
890 #. (itstool) path: sect2/title
891 #: C/index.docbook:618
895 #. (itstool) path: sect2/para
896 #: C/index.docbook:619
898 "The build operations in <application>Anjuta</application>, rely on <application>make</application> only like "
899 "<application>Autotools</application>. It is working for non <application>Autotools</application> project too. The "
900 "compile command is even working with only a C source file because <application>make</application> has some builtin "
901 "rules to compile them. Here is the correspondence between the <application>Anjuta</application> menu item and "
902 "<application>make</application> commands."
905 #. (itstool) path: varlistentry/term
906 #: C/index.docbook:630
907 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Compile</guimenu></menuchoice>"
910 #. (itstool) path: listitem/para
911 #: C/index.docbook:631
912 msgid "make <replaceable>current_file</replaceable>"
915 #. (itstool) path: varlistentry/term
916 #: C/index.docbook:634
917 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Build</guimenu></menuchoice>"
920 #. (itstool) path: listitem/para
921 #: C/index.docbook:635
922 msgid "cd <userinput>current_file_directory</userinput>; make"
925 #. (itstool) path: varlistentry/term
926 #: C/index.docbook:638
927 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Build Project</guimenu></menuchoice>"
930 #. (itstool) path: listitem/para
931 #: C/index.docbook:639
932 msgid "cd <userinput>project_directory</userinput>; make"
935 #. (itstool) path: varlistentry/term
936 #: C/index.docbook:642
937 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Build Tarball</guimenu></menuchoice>"
940 #. (itstool) path: listitem/para
941 #: C/index.docbook:643
942 msgid "cd <userinput>project_directory</userinput>; make dist"
945 #. (itstool) path: varlistentry/term
946 #: C/index.docbook:646
947 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Install</guimenu></menuchoice>"
950 #. (itstool) path: listitem/para
951 #: C/index.docbook:647
952 msgid "cd <userinput>current_file_directory</userinput>; make install"
955 #. (itstool) path: varlistentry/term
956 #: C/index.docbook:650
957 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Install Project</guimenu></menuchoice>"
960 #. (itstool) path: listitem/para
961 #: C/index.docbook:651
962 msgid "cd <userinput>project_directory</userinput>; make install"
965 #. (itstool) path: varlistentry/term
966 #: C/index.docbook:654
967 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Clean</guimenu></menuchoice>"
970 #. (itstool) path: listitem/para
971 #: C/index.docbook:655
972 msgid "cd <userinput>current_file_directory</userinput>; make clean"
975 #. (itstool) path: varlistentry/term
976 #: C/index.docbook:658
977 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Clean Project</guimenu></menuchoice>"
980 #. (itstool) path: listitem/para
981 #: C/index.docbook:659
982 msgid "cd <userinput>project_directory</userinput>; make clean"
985 #. (itstool) path: varlistentry/term
986 #: C/index.docbook:662
987 msgid "<menuchoice><guisubmenu>Build</guisubmenu><guimenu>Remove Configuration</guimenu></menuchoice>"
990 #. (itstool) path: listitem/para
991 #: C/index.docbook:663
992 msgid "cd <userinput>project_directory</userinput>; make distclean"
995 #. (itstool) path: sect2/para
996 #: C/index.docbook:666
998 "The last menu entry not described above ,<menuchoice><guisubmenu>Build</guisubmenu> <guimenuitem>Select "
999 "Configuration</guimenuitem></menuchoice>, allows you to switch easily between different configurations and so "
1000 "between different build directories."
1003 #. (itstool) path: sect2/title
1004 #: C/index.docbook:674
1008 #. (itstool) path: sect2/para
1009 #: C/index.docbook:675
1011 "A few common build options are available in the preferences page that you can get by selecting "
1012 "<menuchoice><guisubmenu>Edit</guisubmenu> <guimenuitem>Preferences</guimenuitem><guimenuitem>Build autotools</"
1013 "guimenuitem> </menuchoice>."
1016 #. (itstool) path: figure/title
1017 #: C/index.docbook:682
1018 msgid "Build preferences"
1021 #. (itstool) path: imageobject/imagedata
1022 #. This is a reference to an external file such as an image or video. When
1023 #. the file changes, the md5 hash will change to let you know you need to
1024 #. update your localized copy. The msgstr is not used at all. Set it to
1025 #. whatever you like once you have updated your copy of the file.
1026 #: C/index.docbook:686
1028 msgid "external ref='figures/build_preferences.png' md5='684664b3114b36b3cc33d8b35f175e5d'"
1031 #. (itstool) path: chapter/title
1032 #: C/index.docbook:699
1033 msgid "Creating a project"
1036 #. (itstool) path: chapter/para
1037 #: C/index.docbook:700
1039 "This chapter explains how to create a new project. Like the previous, it starts with <application>Autotools</"
1040 "application> before looking at <application>Anjuta</application>."
1043 #. (itstool) path: sect1/para
1044 #: C/index.docbook:707
1046 "In the first chapter, we have not really used the <application>Autotools</application>. It is not need to compile "
1047 "a project from the sources. But all files in the build process are not written by hand but generated from "
1048 "templates using <application>Autotools</application>."
1051 #. (itstool) path: sect1/para
1052 #: C/index.docbook:712
1054 "<application>Autotools</application> is composed of several tools: <filename>aclocal</filename>, "
1055 "<filename>autoconf</filename>, <filename>automake</filename> and other that we will not see here, belonging to two "
1056 "packages: <application>Automake</application> and <application>Autoconf</application>."
1059 #. (itstool) path: listitem/para
1060 #: C/index.docbook:721
1062 "<application>Autoconf</application> is used to generate the configure script, from a template named "
1063 "<filename>configure.ac</filename>. The configure script will check all characteristics of the host system and "
1064 "generate the makefiles from Makefile.in templates."
1067 #. (itstool) path: listitem/para
1068 #: C/index.docbook:727
1070 "<application>Automake</application> is used to generate complete Makefile.in templates, following GNU standards "
1071 "from very simple Makefile.am templates."
1074 #. (itstool) path: figure/title
1075 #: C/index.docbook:732
1076 msgid "<application>Autotools</application> process"
1079 #. (itstool) path: imageobject/imagedata
1080 #. This is a reference to an external file such as an image or video. When
1081 #. the file changes, the md5 hash will change to let you know you need to
1082 #. update your localized copy. The msgstr is not used at all. Set it to
1083 #. whatever you like once you have updated your copy of the file.
1084 #: C/index.docbook:735
1086 msgid "external ref='figures/autotools-process.png' md5='6141be893d6036796e47dc50bbaba82b'"
1089 #. (itstool) path: sect1/para
1090 #: C/index.docbook:739
1091 msgid "Now let's see a minimal example to start grasping the relationships between the various files."
1094 #. (itstool) path: sect2/title
1095 #: C/index.docbook:744
1096 msgid "Write sources"
1099 #. (itstool) path: listitem/para
1100 #: C/index.docbook:747
1101 msgid "Create an empty directory called <filename>tut_prog</filename> and enter in it."
1104 #. (itstool) path: listitem/para
1105 #: C/index.docbook:750
1106 msgid "In this new directory, create a new file named <filename>main.c</filename> containing:"
1109 #. (itstool) path: example/title
1110 #: C/index.docbook:755
1114 #. (itstool) path: example/programlisting
1115 #: C/index.docbook:756
1119 "#include <stdio.h> \n"
1123 "\tprintf(\"Hello world!\\n\");\n"
1128 #. (itstool) path: sect2/title
1129 #: C/index.docbook:767
1130 msgid "Run <application>Autoconf</application>"
1133 #. (itstool) path: listitem/para
1134 #: C/index.docbook:770
1135 msgid "Write the following in a file named <filename>configure.ac</filename>:"
1138 #. (itstool) path: example/title
1139 #: C/index.docbook:774
1140 msgid "minimal configure.ac:"
1143 #. (itstool) path: example/programlisting
1144 #: C/index.docbook:775
1148 "AC_INIT([Tutorial Program], 1.0)\n"
1149 "AM_INIT_AUTOMAKE\n"
1151 "AC_CONFIG_FILES(Makefile)\n"
1155 #. (itstool) path: note/para
1156 #: C/index.docbook:783
1158 "The configure template script could be named <filename>configure.in</filename>. It is the name used in older "
1159 "version (before 2001) of <application>Autoconf</application>. Nevertheless, it is recommended to use "
1160 "<filename>configure.ac</filename> because the <filename>.in</filename> extension is already used by files "
1161 "processed by <application>configure</application> and generated by <application>Automake</application>: "
1162 "<filename>Makefile.in</filename> and <application>autoheader</application>: <filename>config.h.in</filename>."
1165 #. (itstool) path: sect2/para
1166 #: C/index.docbook:792
1168 "AC_INIT, AM_INIT_AUTOMAKE, etc... are <application>M4</application> macros. <application>M4</application> is a "
1169 "macro expanding software used by <application>Autotools</application>; we don't need to know about it. When "
1170 "<application>Autoconf</application> will process this configure.in, the macros will be expanded and we will get a "
1171 "fresh huge configure script."
1174 #. (itstool) path: varlistentry/term
1175 #: C/index.docbook:801
1179 #. (itstool) path: listitem/para
1180 #: C/index.docbook:803
1181 msgid "Is the first mandatory macro. We need to indicate the name of the project and its version."
1184 #. (itstool) path: varlistentry/term
1185 #: C/index.docbook:810 C/index.docbook:1194
1186 msgid "AM_INIT_AUTOMAKE"
1189 #. (itstool) path: listitem/para
1190 #: C/index.docbook:812
1192 "Initialize environment for <application>Automake</application>. It is needed in all projects using "
1193 "<application>Automake</application>."
1196 #. (itstool) path: varlistentry/term
1197 #: C/index.docbook:819
1201 #. (itstool) path: listitem/para
1202 #: C/index.docbook:821
1203 msgid "Determine the C compiler to use."
1206 #. (itstool) path: varlistentry/term
1207 #: C/index.docbook:827
1208 msgid "AC_CONFIG_FILES"
1211 #. (itstool) path: listitem/para
1212 #: C/index.docbook:829
1214 "Create each file by copying the corresponding template file (with .in extension) and substituting the output "
1218 #. (itstool) path: varlistentry/term
1219 #: C/index.docbook:836 C/index.docbook:1218
1223 #. (itstool) path: listitem/para
1224 #: C/index.docbook:838
1225 msgid "Marks the end of the configure template."
1228 #. (itstool) path: note/para
1229 #: C/index.docbook:845
1230 msgid "The use of some macros has changed between different versions of <application>Autoconf</application>:"
1233 #. (itstool) path: listitem/para
1234 #: C/index.docbook:848
1235 msgid "The package name and version was defined as arguments of AM_INIT_AUTOMAKE instead of AC_INIT."
1238 #. (itstool) path: listitem/para
1239 #: C/index.docbook:852
1240 msgid "AC_OUTPUT was getting the list of generated files instead of using the additional macro AC_CONFIG_FILES."
1243 #. (itstool) path: sect2/para
1244 #: C/index.docbook:857
1246 "<application>Autoconf</application> only knows its own macros but read additional ones in a file named "
1247 "<filename>aclocal.m4</filename>. These macros are used to extend <application>Autoconf</application>, it includes "
1248 "<application>Automake</application> macro (starting with AM_) and other third party macros. For instance, if you "
1249 "develop a library called foo, you might want to write an AC_CHECK_FOR_FOO macro so that developers using your "
1250 "library can check for its presence using <application>Autoconf</application>."
1253 #. (itstool) path: sect2/para
1254 #: C/index.docbook:866
1256 "<application>aclocal</application> scans <filename>configure.ac</filename> and create an <filename>aclocal.m4</"
1257 "filename> file which contains the macros mentioned in <filename>configure.ac</filename>. <application>aclocal</"
1258 "application> is part of the <application>Automake</application> package and search by default in "
1259 "<application>Automake</application> macros and in a system path typically <filename>/usr/share/aclocal</filename>."
1262 #. (itstool) path: listitem/para
1263 #: C/index.docbook:876
1265 "Launch <userinput>aclocal</userinput>. It will create a new file named <filename>aclocal.m4</filename> in the "
1266 "current directory."
1269 #. (itstool) path: listitem/para
1270 #: C/index.docbook:880
1271 msgid "Launch <userinput>autoconf</userinput>. It will create the configure script <filename>configure</filename>."
1274 #. (itstool) path: tip/para
1275 #: C/index.docbook:885
1277 "On my system, I actually get an extra directory called <filename>autom4te.cache</filename>. That is for "
1278 "<application>Autoconf</application> internal purposes. You do not need to care about it."
1281 #. (itstool) path: sect2/title
1282 #: C/index.docbook:891
1283 msgid "Run <application>Automake</application>"
1286 #. (itstool) path: listitem/para
1287 #: C/index.docbook:894
1288 msgid "Write the following in a file named <filename>Makefile.am</filename>:"
1291 #. (itstool) path: example/title
1292 #: C/index.docbook:898
1293 msgid "minimal Makefile.am:"
1296 #. (itstool) path: example/programlisting
1297 #: C/index.docbook:899
1301 "bin_PROGRAMS = tut_prog\t\t\t\n"
1302 "tut_prog_SOURCES = main.c"
1305 #. (itstool) path: sect2/para
1306 #: C/index.docbook:903
1308 "In Makefile.am are the very essential data needed to build the project: the target program, called tut_prog, will "
1309 "be put in a $prefix/bin/ directory; to build it we need main.c. Note that we don't specify <emphasis>how</"
1310 "emphasis> that will be built: <application>Automake</application> will figure it out. We haven't even mentioned "
1311 "the compiler in this pre-makefile."
1314 #. (itstool) path: sect2/para
1315 #: C/index.docbook:910
1317 "Makefile.am will be processed by <application>Automake</application>; the result will be a Makefile.in. This "
1318 "Makefile.in is close to being a real makefile, but it contains variable names which will be replaced when the "
1319 "configure script will run, resulting in a real makefile (called Makefile). For instance, <filename>configure</"
1320 "filename> will write in the final Makefile what compiler to use (it is the compiler it found using the AC_PROG_CC "
1324 #. (itstool) path: listitem/para
1325 #: C/index.docbook:921
1327 "Run the command <userinput>automake --add-missing --foreign</userinput>. It will create a new file named "
1328 "<filename>Makefile.in</filename> as expected. Moreover, due to the switch <parameter>--add-missing</parameter> you "
1329 "get a few links to scripts necessary for building the project: <filename>depcomp</filename>, <filename>install.sh</"
1330 "filename> and <filename>missing</filename>. The other option <parameter>--foreign</parameter> tells to "
1331 "<application>Automake</application> that you don't want to follow GNU standard and you don't need mandatory "
1332 "documentation files: <filename>INSTALL</filename>, <filename>NEWS</filename>, <filename>README</filename>, "
1333 "<filename>AUTHORS</filename>, <filename>ChangeLog</filename> and <filename>COPYING</filename>. I have used it here "
1334 "to keep the number of created file to a minimum but else it is a good idea to provide these files, you can start "
1338 #. (itstool) path: sect2/title
1339 #: C/index.docbook:937
1340 msgid "Build project"
1343 #. (itstool) path: listitem/para
1344 #: C/index.docbook:940
1346 "Run now the new configure script: <userinput>./configure</userinput>. You get the following output and it create "
1347 "the makefile for your program."
1350 #. (itstool) path: listitem/screen
1351 #: C/index.docbook:942
1355 "checking for a BSD-compatible install... /usr/bin/install -c\n"
1356 "checking whether build environment is sane... yes\n"
1357 "checking for a thread-safe mkdir -p... /bin/mkdir -p\n"
1358 "checking for gawk... gawk\n"
1359 "checking whether make sets $(MAKE)... yes\n"
1360 "checking for gcc... gcc\n"
1361 "checking for C compiler default output file name... a.out\n"
1362 "checking whether the C compiler works... yes\n"
1363 "checking whether we are cross compiling... no\n"
1364 "checking for suffix of executables... \n"
1365 "checking for suffix of object files... o\n"
1366 "checking whether we are using the GNU C compiler... yes\n"
1367 "checking whether gcc accepts -g... yes\n"
1368 "checking for gcc option to accept ISO C89... none needed\n"
1369 "checking for style of include used by make... GNU\n"
1370 "checking dependency style of gcc... gcc3\n"
1371 "configure: creating ./config.status\n"
1372 "config.status: creating Makefile\n"
1373 "config.status: executing depfiles commands"
1376 #. (itstool) path: listitem/para
1377 #: C/index.docbook:964
1379 "Run now <userinput>make</userinput>, to build your program. You get the following output and a new tut_prog "
1383 #. (itstool) path: listitem/screen
1384 #: C/index.docbook:966
1388 "gcc -DPACKAGE_NAME=\\\"Tutorial\\ Program\\\" -DPACKAGE_TARNAME=\\\"tutorial-program\\\" \\\n"
1389 " -DPACKAGE_VERSION=\\\"1.0\\\" -DPACKAGE_STRING=\\\"Tutorial\\ Program\\ 1.0\\\" \\\n"
1390 " -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE=\\\"tutorial-program\\\" -DVERSION=\\\"1.0\\\" \\\n"
1391 " -I. -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c\n"
1392 "main.c: In function ‘main’:\n"
1393 "main.c:5: warning: return type of ‘main’ is not ‘int’\n"
1394 "mv -f .deps/main.Tpo .deps/main.Po\n"
1395 "gcc -g -O2 -o tut_prog main.o"
1398 #. (itstool) path: listitem/para
1399 #: C/index.docbook:977
1401 "Now, if you can write in <filename>/usr/local/bin</filename>, run <userinput>make install</userinput> to install "
1402 "your program. Else you need to log as root before or use <application>sudo</application> and run <userinput>sudo "
1403 "make install</userinput>. You should get."
1406 #. (itstool) path: listitem/screen
1407 #: C/index.docbook:982
1411 "make[1]: Entering directory `/home/seb/Projects/Tutorial'\n"
1412 "test -z \"/usr/local/bin\" || /bin/mkdir -p \"/usr/local/bin\"\n"
1413 " /usr/bin/install -c 'tut_prog' '/usr/local/bin/tut_prog'\n"
1414 "make[1]: Nothing to be done for `install-data-am'.\n"
1415 "make[1]: Leaving directory `/home/seb/Projects/Tutorial'"
1418 #. (itstool) path: listitem/para
1419 #: C/index.docbook:988
1420 msgid "Then, if <filename>/user/local/bin</filename> is in your path, you can run your program from everywhere."
1423 #. (itstool) path: sect2/title
1424 #: C/index.docbook:996
1425 msgid "Clean project"
1428 #. (itstool) path: listitem/para
1429 #: C/index.docbook:999
1431 "The program is installed, so you can clean the build directory running <userinput>make clean</userinput>. It "
1432 "removes all object files and the program but not the makefiles."
1435 #. (itstool) path: listitem/screen
1436 #: C/index.docbook:1002
1440 "test -z \"tut_prog\" || rm -f tut_prog\n"
1444 #. (itstool) path: listitem/para
1445 #: C/index.docbook:1005
1446 msgid "You can still run the program installed in <filename>/user/local/bin</filename>."
1449 #. (itstool) path: listitem/para
1450 #: C/index.docbook:1010
1452 "To remove the installed program, run <userinput>make uninstall</userinput>. Like for the installation, you need to "
1453 "use have the writing right in the directory or use <application>su</application> or <application>sudo</"
1457 #. (itstool) path: listitem/screen
1458 #: C/index.docbook:1013
1462 "rm -f '/usr/local/bin/tut_prog'"
1465 #. (itstool) path: sect2/title
1466 #: C/index.docbook:1019
1467 msgid "Generate project"
1470 #. (itstool) path: sect2/para
1471 #: C/index.docbook:1020
1473 "Running <userinput>aclocal</userinput>, <userinput>automake</userinput> and <userinput>autoconf</userinput> one by "
1474 "one is fine for a tutorial to understand exactly what's happen. But, for a real work, it's a bit tedious "
1475 "especially because there are other tools those could be needed like <userinput>autoheader</userinput>, "
1476 "<userinput>autopoint</userinput> or <userinput>libtoolize</userinput>. After creating the project, the makefiles "
1477 "generated by <application>configure</application> should take care of regenerating <filename>configure</filename> "
1478 "and all <filename>Makefile.in</filename>. Anyway, this lets a room for improvement and there are even two "
1479 "responses to this:"
1482 #. (itstool) path: varlistentry/term
1483 #: C/index.docbook:1034
1487 #. (itstool) path: listitem/para
1488 #: C/index.docbook:1036
1490 "It is another tool part of the <application>Autoconf</application> package which is running all scripts in the "
1491 "right order. To start a new project, you can just run <userinput>autoreconf --install</userinput> and it will call "
1492 "all necessary commands."
1495 #. (itstool) path: varlistentry/term
1496 #: C/index.docbook:1043
1500 #. (itstool) path: listitem/para
1501 #: C/index.docbook:1045
1503 "It is a script not part of <application>Autotools</application>, that it doing the same thing. There is one named "
1504 "<filename>gnome-autogen.sh</filename> which comes with GNOME common development package but other project can "
1505 "write their own ones."
1508 #. (itstool) path: sect1/para
1509 #: C/index.docbook:1056
1511 "Creating a project with <application>Anjuta</application> need just a few clicks but then we will take a look at "
1512 "the created files."
1515 #. (itstool) path: sect2/title
1516 #: C/index.docbook:1061
1517 msgid "Create a new project"
1520 #. (itstool) path: listitem/para
1521 #: C/index.docbook:1064
1523 "Click on <menuchoice><guisubmenu>File</guisubmenu><guisubmenu>New</guisubmenu> <guimenuitem>Project</guimenuitem></"
1524 "menuchoice>. The new project assistant appears."
1527 #. (itstool) path: listitem/para
1528 #: C/index.docbook:1069
1529 msgid "Click on <guibutton>Forward</guibutton>. The project selection page appears:"
1532 #. (itstool) path: figure/title
1533 #: C/index.docbook:1071
1534 msgid "Project selection page"
1537 #. (itstool) path: imageobject/imagedata
1538 #. This is a reference to an external file such as an image or video. When
1539 #. the file changes, the md5 hash will change to let you know you need to
1540 #. update your localized copy. The msgstr is not used at all. Set it to
1541 #. whatever you like once you have updated your copy of the file.
1542 #: C/index.docbook:1075
1544 msgid "external ref='figures/new-project-select.png' md5='f79e2454e7ccaf52b1b1b06aa04a4956'"
1547 #. (itstool) path: listitem/para
1548 #: C/index.docbook:1082
1549 msgid "Select <guilabel>Generic (minimal)</guilabel> project in the <guilabel>C</guilabel> page."
1552 #. (itstool) path: listitem/para
1553 #: C/index.docbook:1085 C/index.docbook:1121
1554 msgid "Click on <guibutton>Forward</guibutton>."
1557 #. (itstool) path: figure/title
1558 #: C/index.docbook:1087
1559 msgid "Project basic information page"
1562 #. (itstool) path: imageobject/imagedata
1563 #. This is a reference to an external file such as an image or video. When
1564 #. the file changes, the md5 hash will change to let you know you need to
1565 #. update your localized copy. The msgstr is not used at all. Set it to
1566 #. whatever you like once you have updated your copy of the file.
1567 #: C/index.docbook:1091
1569 msgid "external ref='figures/new-project-basic.png' md5='3e120013f61bdc811c7d3ace04201e33'"
1572 #. (itstool) path: listitem/para
1573 #: C/index.docbook:1096
1575 "Change <guilabel>Project Name</guilabel> to <userinput>tutprog</userinput>, the project name should contains only "
1576 "alpha numeric characters or underscore. Fill the remaining field."
1579 #. (itstool) path: listitem/para
1580 #: C/index.docbook:1103
1581 msgid "Click on <guilabel>Forward</guilabel>."
1584 #. (itstool) path: figure/title
1585 #: C/index.docbook:1105
1586 msgid "Project options page"
1589 #. (itstool) path: imageobject/imagedata
1590 #. This is a reference to an external file such as an image or video. When
1591 #. the file changes, the md5 hash will change to let you know you need to
1592 #. update your localized copy. The msgstr is not used at all. Set it to
1593 #. whatever you like once you have updated your copy of the file.
1594 #: C/index.docbook:1109
1596 msgid "external ref='figures/new-project-options.png' md5='4d386a284c3a40676f50c6dd6208bb1b'"
1599 #. (itstool) path: listitem/para
1600 #: C/index.docbook:1114
1602 "Click on <guilabel>Destination</guilabel> and create a new directory named tutprog for your new project. You need "
1603 "to avoid space in the directory name. Then, keep all other options to their default value to get a minimal project."
1606 #. (itstool) path: figure/title
1607 #: C/index.docbook:1123
1608 msgid "Project summary page"
1611 #. (itstool) path: imageobject/imagedata
1612 #. This is a reference to an external file such as an image or video. When
1613 #. the file changes, the md5 hash will change to let you know you need to
1614 #. update your localized copy. The msgstr is not used at all. Set it to
1615 #. whatever you like once you have updated your copy of the file.
1616 #: C/index.docbook:1127
1618 msgid "external ref='figures/new-project-summary.png' md5='79bca5475883f9c43bf404df815eff58'"
1621 #. (itstool) path: listitem/para
1622 #: C/index.docbook:1132
1623 msgid "This is the final page of the assistant, check that everything is right."
1626 #. (itstool) path: listitem/para
1627 #: C/index.docbook:1137
1629 "Click on <guibutton>Forward</guibutton>. <application>Anjuta</application> will create all needed files and "
1630 "directories, in the message window, you will see the following:"
1633 #. (itstool) path: figure/title
1634 #: C/index.docbook:1141
1635 msgid "Project creation messages"
1638 #. (itstool) path: imageobject/imagedata
1639 #. This is a reference to an external file such as an image or video. When
1640 #. the file changes, the md5 hash will change to let you know you need to
1641 #. update your localized copy. The msgstr is not used at all. Set it to
1642 #. whatever you like once you have updated your copy of the file.
1643 #: C/index.docbook:1145
1645 msgid "external ref='figures/new-project-message.png' md5='073f1d0fae8d7ed17a86f946077a6c18'"
1648 #. (itstool) path: listitem/para
1649 #: C/index.docbook:1150
1651 "Then, autogen.sh is called and run the configure script. Finally <application>Anjuta</application> open the new "
1652 "project. You can directly build the project, as the main source contains a few lines of C and configure has been "
1656 #. (itstool) path: sect2/title
1657 #: C/index.docbook:1160
1658 msgid "Looking at configure.ac"
1661 #. (itstool) path: example/title
1662 #: C/index.docbook:1162
1663 msgid "<application>Anjuta</application> minimal configure.ac:"
1666 #. (itstool) path: example/programlisting
1667 #: C/index.docbook:1163
1671 "dnl Process this file with autoconf to produce a configure script.\n"
1672 "dnl Created by Anjuta application wizard.\n"
1674 "AC_INIT(tutprog, 0.1)\n"
1676 "AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)\n"
1677 "AC_CONFIG_HEADERS([config.h])\n"
1686 #. (itstool) path: sect2/para
1687 #: C/index.docbook:1178
1688 msgid "It is still quite simple with a bit more macros. Let's look at all unknown ones:"
1691 #. (itstool) path: varlistentry/term
1692 #: C/index.docbook:1184
1696 #. (itstool) path: listitem/para
1697 #: C/index.docbook:1186
1699 "It is not a macros, just the marker to start a comment in <application>M4</application>, the language used to "
1700 "write <filename>configure.ac</filename>. It is like '#' is scripts or '//' in C++."
1703 #. (itstool) path: listitem/para
1704 #: C/index.docbook:1196
1706 "The AC_INIT macro uses the new form with package and version but AM_INIT_AUTOMAKE keeps the old one. It is not "
1710 #. (itstool) path: varlistentry/term
1711 #: C/index.docbook:1203
1712 msgid "AC_CONFIG_HEADERS"
1715 #. (itstool) path: listitem/para
1716 #: C/index.docbook:1205
1718 "This tells <application>Autoconf</application> to pass all defines in a file named <filename>config.h</filename> "
1719 "instead of using several -Dxxxx flags on the command line (see <xref linkend=\"create-autotools-build\"/>). It is "
1720 "easier when there are lots of them. A file named <filename>config.h.in</filename> is created automatically from "
1721 "the <filename>configure.ac</filename> using <application>autoheader</application>. Then <filename>config.h</"
1722 "filename> is created automatically like makefiles by <application>configure</application>. So it is painless for "
1726 #. (itstool) path: listitem/para
1727 #: C/index.docbook:1220
1728 msgid "This is the old form of the AC_OUTPUT, where you specify all output files instead of using AC_CONFIG_FILES."
1731 #. (itstool) path: sect2/title
1732 #: C/index.docbook:1229
1733 msgid "Looking at Makefile.am"
1736 #. (itstool) path: example/title
1737 #: C/index.docbook:1231
1738 msgid "<application>Anjuta</application> minimal Makefile.am:"
1741 #. (itstool) path: example/programlisting
1742 #: C/index.docbook:1232
1745 "## Process this file with automake to produce Makefile.in\n"
1746 "## Created by Anjuta\n"
1748 "AM_CPPFLAGS = \\\n"
1749 " -DPACKAGE_DATA_DIR=\\\"\"$(datadir)\"\\\"\n"
1755 "bin_PROGRAMS = tutprog\n"
1757 "tutprog_SOURCES = \\\n"
1760 "tutprog_LDFLAGS =\n"
1765 #. (itstool) path: sect2/para
1766 #: C/index.docbook:1251
1767 msgid "Not much things in the <filename>Makefile.am</filename> neither:"
1770 #. (itstool) path: varlistentry/term
1771 #: C/index.docbook:1256
1775 #. (itstool) path: listitem/para
1776 #: C/index.docbook:1258
1778 "It is used to give additional flags to the C preprocessor. Here it defines an additional PACKAGE_DATA_DIR constant "
1779 "set by <application>configure</application>"
1782 #. (itstool) path: varlistentry/term
1783 #: C/index.docbook:1266
1787 #. (itstool) path: listitem/para
1788 #: C/index.docbook:1268
1790 "It defines some additional flags for the C compiler: all warning and add debugging information that we have "
1791 "already seen at the beginning of this tutorial (see <xref linkend=\"build-gcc\"/>)"
1794 #. (itstool) path: varlistentry/term
1795 #: C/index.docbook:1276
1796 msgid "tutprog_LDFLAGS"
1799 #. (itstool) path: listitem/para
1800 #: C/index.docbook:1278
1801 msgid "It adds a places where you can put additional linker options for the tutprog program."
1804 #. (itstool) path: varlistentry/term
1805 #: C/index.docbook:1285
1806 msgid "tutprog_LDADD"
1809 #. (itstool) path: listitem/para
1810 #: C/index.docbook:1287
1811 msgid "It adds a places where you can put additional libraries for the tutprog program."
1814 #. (itstool) path: chapter/title
1815 #: C/index.docbook:1300
1816 msgid "Adding a library"
1819 #. (itstool) path: chapter/para
1820 #: C/index.docbook:1301
1822 "This chapter explains how to add a new library to a project. It starts with <application>Autotools</application> "
1823 "before looking at <application>Anjuta</application>."
1826 #. (itstool) path: sect1/para
1827 #: C/index.docbook:1307
1829 "Adding a new library in a autotools project could be more or less easy depending on how the library is packaged. "
1830 "To take an example, imagine that we want to read an xml file using <application>libxml2</application> (see its "
1831 "<ulink type=\"http\" url=\"www.xmlsoft.org\">homepage at www.xmlsoft.org</ulink>)"
1834 #. (itstool) path: listitem/para
1835 #: C/index.docbook:1315
1836 msgid "Open the old tutorial project and replace <filename>main.c</filename> by the following."
1839 #. (itstool) path: example/title
1840 #: C/index.docbook:1318 C/index.docbook:1595
1841 msgid "main.c using <application>libxml2</application>:"
1844 #. (itstool) path: example/programlisting
1845 #: C/index.docbook:1319 C/index.docbook:1596
1849 "#include <libxml/parser.h>\t\t\t\n"
1850 "#include <stdio.h>\n"
1854 "\txmlDocPtr doc; \n"
1855 "\tdoc = xmlParseFile (\"testfile.xml\");\n"
1857 "\tif (doc == NULL) {\n"
1858 "\t\tprintf (\"Document not parsed successfully. \\n\");\n"
1862 "\t\tprintf (\"Document parsed successfully.\\n\");\n"
1863 "\t\txmlFreeDoc(doc);\n"
1869 #. (itstool) path: sect1/para
1870 #: C/index.docbook:1341
1872 "Our goal is now to compile it and make it work correctly. For that purpose, we must tell <application>GCC</"
1873 "application> two things: where to find libxml/parser.h (that is to say, give <application>GCC</application> the "
1874 "right include path) and what library (i.e. shared object) it should link our project against. There are several "
1875 "ways to do that, I will start with the easiest."
1878 #. (itstool) path: sect2/title
1879 #: C/index.docbook:1349 C/index.docbook:1589
1880 msgid "With pkg-config"
1883 #. (itstool) path: sect2/para
1884 #: C/index.docbook:1350
1886 "<application>pkg-config</application> is tools for developers providing a unified interface for querying installed "
1887 "libraries with their version and all options needed to compile and link it. It comes with an "
1888 "<application>Autoconf</application> macro named PKG_CHECK_MODULES allowing to check the existence of the library "
1889 "and set all necessary flags."
1892 #. (itstool) path: listitem/para
1893 #: C/index.docbook:1360 C/index.docbook:1495
1894 msgid "Add the following line in <filename>configure.ac</filename>."
1897 #. (itstool) path: listitem/programlisting
1898 #: C/index.docbook:1361
1900 msgid "PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.4)"
1903 #. (itstool) path: listitem/para
1904 #: C/index.docbook:1362
1906 "This macro will check the existence of <application>libxml2</application> with a version higher or equal to 2.4 "
1907 "and create 2 variable XML_CFLAGS and XML_LIBS containing respectively, the flags for the C compiler and the "
1908 "linker. <userinput>XML</userinput> is an user defined name. <userinput>libxml-2.0</userinput> is the name of the "
1909 "library. You can run <userinput>pkg-config --list-all</userinput> to get a list of all installed libraries."
1912 #. (itstool) path: listitem/para
1913 #: C/index.docbook:1372 C/index.docbook:1505 C/index.docbook:1532
1914 msgid "Add the following lines in <filename>Makefile.am</filename>."
1917 #. (itstool) path: listitem/programlisting
1918 #: C/index.docbook:1373
1921 "tut_prog_CPPFLAGS = $(XML_CFLAGS)\n"
1922 "tut_prog_LDFLAGS= $(XML_LIBS)"
1925 #. (itstool) path: listitem/para
1926 #: C/index.docbook:1375
1928 "This will use the options found by <application>configure</application> when the macro PKG_CHECK_MODULES is "
1929 "executed for compiling your program."
1932 #. (itstool) path: listitem/para
1933 #: C/index.docbook:1381
1934 msgid "That's all. You can run <userinput>make</userinput> again."
1937 #. (itstool) path: listitem/screen
1938 #: C/index.docbook:1382
1942 "cd . && /bin/sh /home/seb2008.1/Projects/tutprog/missing --run aclocal-1.10 \n"
1943 "cd . && /bin/sh /home/seb2008.1/Projects/tutprog/missing --run automake-1.10 --foreign \n"
1944 "cd . && /bin/sh /home/seb2008.1/Projects/tutprog/missing --run autoconf\n"
1945 "/bin/sh ./config.status --recheck\n"
1946 "running CONFIG_SHELL=/bin/sh /bin/sh ./configure --no-create --no-recursion\n"
1947 "checking for a BSD-compatible install... /usr/bin/install -c\n"
1948 "checking whether build environment is sane... yes\n"
1949 "checking for a thread-safe mkdir -p... /bin/mkdir -p\n"
1950 "checking for gawk... gawk\n"
1951 "checking whether make sets $(MAKE)... yes\n"
1952 "checking whether to enable maintainer-specific portions of Makefiles... yes\n"
1953 "checking for style of include used by make... GNU\n"
1954 "checking for gcc... gcc\n"
1955 "checking for C compiler default output file name... a.out\n"
1956 "checking whether the C compiler works... yes\n"
1957 "checking whether we are cross compiling... no\n"
1958 "checking for suffix of executables... \n"
1959 "checking for suffix of object files... o\n"
1960 "checking whether we are using the GNU C compiler... yes\n"
1961 "checking whether gcc accepts -g... yes\n"
1962 "checking for gcc option to accept ISO C89... none needed\n"
1963 "checking dependency style of gcc... gcc3\n"
1964 "checking for library containing strerror... none required\n"
1965 "checking for gcc... (cached) gcc\n"
1966 "checking whether we are using the GNU C compiler... (cached) yes\n"
1967 "checking whether gcc accepts -g... (cached) yes\n"
1968 "checking for gcc option to accept ISO C89... (cached) none needed\n"
1969 "checking dependency style of gcc... (cached) gcc3\n"
1970 "checking for gcc... (cached) gcc\n"
1971 "checking whether we are using the GNU C compiler... (cached) yes\n"
1972 "checking whether gcc accepts -g... (cached) yes\n"
1973 "checking for gcc option to accept ISO C89... (cached) none needed\n"
1974 "checking dependency style of gcc... (cached) gcc3\n"
1975 "checking how to run the C preprocessor... gcc -E\n"
1976 "checking for grep that handles long lines and -e... /bin/grep\n"
1977 "checking for egrep... /bin/grep -E\n"
1978 "checking for ANSI C header files... yes\n"
1979 "checking for pkg-config... /usr/bin/pkg-config\n"
1980 "checking pkg-config is at least version 0.9.0... yes\n"
1981 "checking for XML... yes\n"
1982 "configure: creating ./config.status\n"
1983 " /bin/sh ./config.status\n"
1984 "config.status: creating Makefile\n"
1985 "config.status: creating config.h\n"
1986 "config.status: config.h is unchanged\n"
1987 "config.status: executing depfiles commands\n"
1988 "cd . && /bin/sh /home/seb2008.1/Projects/tutprog/missing --run autoheader\n"
1990 "touch config.h.in\n"
1991 "cd . && /bin/sh ./config.status config.h\n"
1992 "config.status: creating config.h\n"
1993 "config.status: config.h is unchanged\n"
1995 "make[1]: Entering directory `/home/seb/Projects/tutprog'\n"
1996 "gcc -DHAVE_CONFIG_H -I. -DPACKAGE_DATA_DIR=\\\"\"/usr/local/share\"\\\" -I/usr/include/libxml2 \\\n"
1997 " -Wall -g -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c\n"
1998 "mv -f .deps/main.Tpo .deps/main.Po\n"
1999 "gcc -Wall -g -g -O2 -o tutprog main.o -lxml2 \n"
2000 "make[1]: Leaving directory `/home/seb/Projects/tutprog'"
2003 #. (itstool) path: listitem/para
2004 #: C/index.docbook:1442
2006 "There is no need to rerun <application>Autoconf</application> or <application>Automake</application> because the "
2007 "Makefile generated by it already contains some rules to do it."
2010 #. (itstool) path: tip/para
2011 #: C/index.docbook:1450
2013 "When installed, each library supporting pkg-config copy a small text file, with .pc extension, in a system "
2014 "directory; normally <filename>/usr/lib/pkgconfig</filename>. If you install a library from source it will be by "
2015 "default in <filename>/usr/local/lib/pkgconfig</filename>. You can ask <application>pkg-config</application> to "
2016 "search in this directory too, by defining the environment variable <userinput> PKG_CONFIG_PATH=/usr/local/lib/"
2017 "pkgconfig</userinput>."
2020 #. (itstool) path: sect2/title
2021 #: C/index.docbook:1460
2022 msgid "With an <application>Autoconf</application> macro"
2025 #. (itstool) path: listitem/para
2026 #: C/index.docbook:1467
2028 "Check if the library author shipped a <application>M4</application> macro, and use it if present. It is a text "
2029 "file named like the library with a .m4 extension often installed in <filename>/usr/share/aclocal</filename>."
2032 #. (itstool) path: listitem/para
2033 #: C/index.docbook:1472
2035 "If your library is a basic one, it might be checked by the standard <application>Autoconf</application> macros "
2036 "(see the list <ulink type=\"http\" url=\"http://sources.redhat.com/autobook/autobook/autobook_283.html#SEC283\"> "
2040 #. (itstool) path: listitem/para
2041 #: C/index.docbook:1478
2043 "Perhaps the <application>M4</application> macro you need has already be programmed by someone else. Look at the "
2044 "contributions <ulink type=\"http\" url=\"http://www.gnu.org/software/ac-archive/\">here</ulink>."
2047 #. (itstool) path: listitem/para
2048 #: C/index.docbook:1482
2050 "If all that fail, go deeper in <application>M4</application>, make your own macro, and donate it to the library's "
2054 #. (itstool) path: sect2/para
2055 #: C/index.docbook:1461
2057 "If the library does not support <application>pkg-config</application>: it does not appear in the list returned by "
2058 "<userinput>pkg-config --list-all</userinput>. You need a <application>Autoconf</application> macro: <_:"
2062 #. (itstool) path: sect2/para
2063 #: C/index.docbook:1487
2065 "When, you have this macro, you can copy it in <filename>/usr/share/aclocal</filename>, so <application>aclocal</"
2066 "application> will find it. Then, you just need to look in the macro file to see how to use it. "
2067 "<application>libxml2</application> installs a macro named AM_PATH_XML2 which is in <filename>/usr/share/aclocal/"
2068 "libxml.m4</filename>."
2071 #. (itstool) path: listitem/programlisting
2072 #: C/index.docbook:1496
2074 msgid "AM_PATH_XML2(2.4.0)"
2077 #. (itstool) path: listitem/para
2078 #: C/index.docbook:1497
2080 "This macro will check the existence of the library with a version higher or equal to 2.4 and create 2 variable "
2081 "XML_CPPFLAGS and XML_LIBS containing respectively, the flags for the C compiler and the linker. You get these "
2082 "information from the comments in the macro file."
2085 #. (itstool) path: listitem/programlisting
2086 #: C/index.docbook:1506
2089 "tut_prog_CPPFLAGS = $(XML_CPPFLAGS)\n"
2090 "tut_prog_LDFLAGS= $(XML_LIBS)"
2093 #. (itstool) path: listitem/para
2094 #: C/index.docbook:1508
2096 "This will use the options found by configure for compiling your program. Note that the macro defined XML_CPPFLAGS "
2097 "instead of XML_CFLAGS with <application>pkg-config</application>. Using CPPFLAGS makes more sense, because these "
2098 "flags are used by the C preprocessor, most of the time only to setup the path of the include files."
2101 #. (itstool) path: listitem/para
2102 #: C/index.docbook:1516
2104 "That's all. You can run <userinput>make</userinput> again. The generated <filename>Makefile</filename> is almost "
2108 #. (itstool) path: sect2/title
2109 #: C/index.docbook:1522
2110 msgid "With hardcoded library path"
2113 #. (itstool) path: sect2/para
2114 #: C/index.docbook:1523
2116 "It is the approach one could naturally have: let's give <application>GCC</application> the stuff it needs "
2117 "directly ! On my system, <filename>libxml/parser.h</filename> is in <filename class=\"directory\">/usr/include/"
2118 "libxml2</filename>, and the shared object is 'libxml.so', located in <filename>/usr/lib</filename>. (I will assume "
2119 "it's all the same for you)."
2122 #. (itstool) path: listitem/programlisting
2123 #: C/index.docbook:1533
2126 "tut_prog_CPPFLAGS = -I /usr/include/libxml2\n"
2127 "tut_prog_LDFLAGS= -lxml2"
2130 #. (itstool) path: listitem/para
2131 #: C/index.docbook:1535
2133 "There is no need to change <filename>configure.ac</filename> because you don't check anything and just assume that "
2134 "all host system will have the right library in the same place than you."
2137 #. (itstool) path: listitem/para
2138 #: C/index.docbook:1542
2139 msgid "You can run <userinput>make</userinput> and it should work if you have the same system than me."
2142 #. (itstool) path: listitem/screen
2143 #: C/index.docbook:1544
2147 " cd . && /bin/sh /home/seb2008.1/Projects/tutprog/missing --run automake-1.10 --foreign Makefile\n"
2148 " cd . && /bin/sh ./config.status Makefile depfiles\n"
2149 "config.status: creating Makefile\n"
2150 "config.status: executing depfiles commands\n"
2152 "make[1]: Entering directory `/home/seb/Projects/tutprog'\n"
2153 "gcc -DHAVE_CONFIG_H -I. -DPACKAGE_DATA_DIR=\\\"\"/usr/local/share\"\\\" -I /usr/include/libxml2 \\\n"
2154 " -Wall -g -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c\n"
2155 "mv -f .deps/main.Tpo .deps/main.Po\n"
2156 "gcc -Wall -g -g -O2 -o tutprog main.o -lxml2 \n"
2157 "make[1]: Leaving directory `/home/seb/Projects/tutprog'"
2160 #. (itstool) path: listitem/para
2161 #: C/index.docbook:1564
2162 msgid "It is not portable to various linuxes: perhaps on other distribution the include path is different."
2165 #. (itstool) path: listitem/para
2166 #: C/index.docbook:1568
2168 "If the next versions of libxml have different paths, or different needed libraries, we will need to update the "
2172 #. (itstool) path: listitem/para
2173 #: C/index.docbook:1572
2174 msgid "We don't test whether the system of the packager/user has the library."
2177 #. (itstool) path: listitem/para
2178 #: C/index.docbook:1576
2179 msgid "We cannot check the version of the <application>libxml2</application> we use."
2182 #. (itstool) path: sect2/para
2183 #: C/index.docbook:1558
2185 "I have described this here to show that it is possible to do simple thing using <application>Autotools</"
2186 "application>. But this approach has several drawbacks: <_:itemizedlist-1/>"
2189 #. (itstool) path: sect1/para
2190 #: C/index.docbook:1584
2192 "With <application>Anjuta</application> adding a library supporting <application>pkg-config</application> can be "
2193 "almost done without the keyboard."
2196 #. (itstool) path: listitem/para
2197 #: C/index.docbook:1592
2199 "Open the file <filename>main.c</filename> of the <application>Anjuta</application> project created in the previous "
2200 "chapter. Replace it with the following text:"
2203 #. (itstool) path: listitem/para
2204 #: C/index.docbook:1618
2206 "Select <menuchoice><guisubmenu>Project</guisubmenu> <guimenuitem>Properties</guimenuitem><guilabel>Packages</"
2207 "guilabel></menuchoice>, to get the package properties dialog."
2210 #. (itstool) path: listitem/para
2211 #: C/index.docbook:1623
2213 "Click on <guibutton>Add module</guibutton> button and Enter a name in the <guilabel>Module/Package</guilabel> "
2214 "column, \"XML\" by example."
2217 #. (itstool) path: listitem/para
2218 #: C/index.docbook:1627
2220 "Click on <guibutton>Add Package</guibutton> button that should be enabled now. You get the a dialog where you can "
2221 "select the library that you want to use. This dialog list all libraries supporting <application>pkg-config</"
2222 "application>. Select <userinput>libxml-2.0</userinput>. Then click on <guibutton>Add</guibutton> button."
2225 #. (itstool) path: listitem/para
2226 #: C/index.docbook:1633
2227 msgid "The package properties dialog should look like the following:"
2230 #. (itstool) path: figure/title
2231 #: C/index.docbook:1637
2232 msgid "Project package properties dialog"
2235 #. (itstool) path: imageobject/imagedata
2236 #. This is a reference to an external file such as an image or video. When
2237 #. the file changes, the md5 hash will change to let you know you need to
2238 #. update your localized copy. The msgstr is not used at all. Set it to
2239 #. whatever you like once you have updated your copy of the file.
2240 #: C/index.docbook:1641
2242 msgid "external ref='figures/library-add-pkgconfig.png' md5='3ccc834696358394b215e27994b0f25e'"
2245 #. (itstool) path: listitem/para
2246 #: C/index.docbook:1646
2248 "The module XML contains one library named libxml-2.0. You can define a minimum version required by clicking in the "
2249 "version column and writing <userinput>>= 2.4</userinput>. All this operation add the necessary lines in the "
2250 "file <filename>configure.ac</filename>."
2253 #. (itstool) path: listitem/para
2254 #: C/index.docbook:1653
2256 "Close the dialog and select <menuchoice><guisubmenu>Project</guisubmenu> <guimenuitem>Refresh</guimenuitem></"
2257 "menuchoice>. This should not be needed but is necessary with the current version of <application>Anjuta</"
2258 "application>. This bug has already been reported (#541694) and will be fixed soon"
2261 #. (itstool) path: listitem/para
2262 #: C/index.docbook:1659
2264 "In the project view, select the project target tutprog and click on right button to get a context menu and select "
2265 "Properties. You will get the target properties dialog."
2268 #. (itstool) path: listitem/para
2269 #: C/index.docbook:1663
2271 "This dialog will list all modules available in your project, just check the XML module. This will modify the file "
2272 "<filename>Makefile.am</filename> to use the right library."
2275 #. (itstool) path: figure/title
2276 #: C/index.docbook:1669
2277 msgid "Target properties dialog"
2280 #. (itstool) path: imageobject/imagedata
2281 #. This is a reference to an external file such as an image or video. When
2282 #. the file changes, the md5 hash will change to let you know you need to
2283 #. update your localized copy. The msgstr is not used at all. Set it to
2284 #. whatever you like once you have updated your copy of the file.
2285 #: C/index.docbook:1673
2287 msgid "external ref='figures/library-add-properties.png' md5='53095c1d9d784e3b71111b856ca3a97a'"
2290 #. (itstool) path: listitem/para
2291 #: C/index.docbook:1680
2293 "Click on <guibutton>Close</guibutton> and that's all. You can select <menuchoice><guisubmenu>Build</guisubmenu> "
2294 "<guimenuitem>Build</guimenuitem></menuchoice> to rebuild your project."
2297 #. (itstool) path: sect2/title
2298 #: C/index.docbook:1687
2299 msgid "Without pkg-config"
2302 #. (itstool) path: sect2/para
2303 #: C/index.docbook:1688
2305 "<application>Anjuta</application> has no real support for library not using <application>pkg-config</application>. "
2306 "You need to edit the <filename>configure.ac</filename> directly to add all necessary macros. For passing flags to "
2307 "each target you can select the <guibutton>Advanced</guibutton> button in the target properties dialog."
2310 #. (itstool) path: chapter/title
2311 #: C/index.docbook:1701
2315 #. (itstool) path: chapter/para
2316 #: C/index.docbook:1702
2318 "Here are some links to reference documents dealing with <application>Autotools</application> in general and "
2319 "<application>Autoconf</application> and <application>Automake</application> in particular."
2322 #. (itstool) path: varlistentry/term
2323 #: C/index.docbook:1708
2327 #. (itstool) path: listitem/para
2328 #: C/index.docbook:1713
2330 "First, you can take a look at the <ulink type=\"http\" url=\"http://www.gnu.org/software/autoconf/manual/autoconf."
2331 "html\"> Autoconf</ulink>, <ulink type=\"http\" url=\"http://www.gnu.org/software/automake/manual/automake.html\"> "
2332 "Automake</ulink>, <ulink type=\"http\" url=\"http://www.gnu.org/software/libtool/manual/libtool.html\"> Libtool</"
2333 "ulink>, <ulink type=\"http\" url=\"http://www.gnu.org/software/make/manual/make.html\"> make</ulink> and <ulink "
2334 "type=\"http\" url=\"http://www.gnu.org/software/m4/manual/m4.html\"> M4</ulink> manuals."
2337 #. (itstool) path: listitem/para
2338 #: C/index.docbook:1728
2340 "The <ulink type=\"http\" url=\"http://sources.redhat.com/autobook/autobook/autobook_toc.html\"> Autobook</ulink> "
2341 "explains in details how the <application>Autotools</application> work."
2344 #. (itstool) path: listitem/para
2345 #: C/index.docbook:1733
2347 "Amongst the various GNU development tools you are told about, <ulink type=\"http\" url=\"http://autotoolset."
2348 "sourceforge.net/tutorial.html\"> here</ulink> are <application>Autoconf</application> and <application>Automake</"
2352 #. (itstool) path: listitem/para
2353 #: C/index.docbook:1739
2355 "<ulink url=\"http://www.lrde.epita.fr/~adl/autotools.html\">Here</ulink> and <ulink url=\"http://seul.org/docs/"
2356 "autotut/\">here</ulink> are two other tutorials about <application>Autotools</application>."
2359 #. (itstool) path: varlistentry/term
2360 #: C/index.docbook:1747
2364 #. (itstool) path: listitem/para
2365 #: C/index.docbook:1748
2367 "<ulink type=\"http\" url=\"http://www.infres.enst.fr/~dax/polys/configure/slide1.html\"> Here</ulink> are some "
2368 "slides by a teacher from Ecole Nationale Supérieure des Télecoms about the <application>Autotools</application>."
2371 #. (itstool) path: varlistentry/term
2372 #: C/index.docbook:1754
2376 #. (itstool) path: listitem/para
2377 #: C/index.docbook:1756
2379 "<ulink type=\"http\" url=\"http://larse-gtk.hp.infoseek.co.jp/automake.html\"> A tutorial about "
2380 "<application>Autoconf</application> and <application>Automake</application> </ulink>."
2383 #. (itstool) path: tip/para
2384 #: C/index.docbook:1762
2386 "This tutorial uses <application>Autoconf 2.61 (November 2006)</application> and <application>Automake 1.10.1 "
2387 "(January 2008)</application>. Some of these documentations uses older versions. the syntaxes could have changed "
2388 "quite a bit. These old syntaxes usually still work and are used in old project. It is useful to know them but it "
2389 "is a bad idea to use them in a new project."