Editing Documentation/Maemo 5 Developer Guide/GNU Build System

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.

Warning: This page is 69 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 780: Line 780:
This is best illustrated with a small example. The input file contents are listed after the autoconf configuration file. In this example, the substitution is only made for one file, but it is also possible to process multiple files using the substitution mechanism. [https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/autoconf-automake/example2/configure.ac autoconf-automake/example2/configure.ac]
This is best illustrated with a small example. The input file contents are listed after the autoconf configuration file. In this example, the substitution is only made for one file, but it is also possible to process multiple files using the substitution mechanism. [https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/autoconf-automake/example2/configure.ac autoconf-automake/example2/configure.ac]
-
<source lang="autoconf">
+
<tt><span>''<span><font color="#9A1900"><nowiki># An example showing how to use a variable-based substitution.</nowiki></font></span>''</span>
-
# An example showing how to use a variable-based substitution.
+
-
 
+
AC_INIT<span><font color="#990000">(</font></span>hello<span><font color="#990000">,</font></span> version-<span><font color="#993399">0.1</font></span><span><font color="#990000">)</font></span>
-
AC_INIT(hello, version-0.1)
+
-
 
+
AC_PROG_CC
-
AC_PROG_CC
+
AC_PROG_AWK
-
AC_PROG_AWK
+
AC_CHECK_HEADER<span><font color="#990000">(</font></span>unistd<span><font color="#990000">.</font></span>h<span><font color="#990000">)</font></span>
-
AC_CHECK_HEADER(unistd.h)
+
AC_CHECK_HEADERS<span><font color="#990000">([</font></span>math<span><font color="#990000">.</font></span>h stdio<span><font color="#990000">.</font></span>h<span><font color="#990000">])</font></span>
-
AC_CHECK_HEADERS([math.h stdio.h])
+
AC_CHECK_HEADER<span><font color="#990000">(</font></span>b0rk<span><font color="#990000">.</font></span>h<span><font color="#990000">,</font></span> <span><font color="#990000">[</font></span>echo <span><font color="#FF0000">"b0rk.h present in system"</font></span><span><font color="#990000">],</font></span> <span><font color="#990000">\</font></span>
-
AC_CHECK_HEADER(b0rk.h, [echo "b0rk.h present in system"], \
+
                        <span><font color="#990000">[</font></span>echo <span><font color="#FF0000">"b0rk.h not present in system"</font></span><span><font color="#990000">])</font></span>
-
                        [echo "b0rk.h not present in system"])
+
-
 
+
echo <span><font color="#FF0000">"But that doesn't stop us from continuing!"</font></span>
-
echo "But that doesn't stop us from continuing!"
+
-
 
+
<span>''<span><font color="#9A1900"><nowiki># Run the test-output.txt(.in) through autoconf substitution logic.</nowiki></font></span>''</span>
-
# Run the test-output.txt(.in) through autoconf substitution logic.
+
AC_OUTPUT<span><font color="#990000">(</font></span>test-output<span><font color="#990000">.</font></span>txt<span><font color="#990000">)</font></span>
-
AC_OUTPUT(test-output.txt)
+
</tt>
-
</source>
+
[https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/autoconf-automake/example2/test-output.txt.in autoconf-automake/example2/test-output.txt.in]
[https://vcs.maemo.org/svn/maemoexamples/tags/maemo_5.0/autoconf-automake/example2/test-output.txt.in autoconf-automake/example2/test-output.txt.in]
-
<pre>
+
<code>This file will go through autoconf variable substitution.
-
This file will go through autoconf variable substitution.
+
The output file will be named as 'test-output.txt' (the '.in'-suffix
-
The output file will be named as 'test-output.txt' (the '.in'-suffix
+
is stripped).
-
is stripped).
+
All the names surrounded by '@'-characters will be replaced by the values
-
All the names surrounded by '@'-characters will be replaced by the values
+
of the variables (if present) by the configure script, when it is run
-
of the variables (if present) by the configure script, when it is run
+
by the end user.
-
by the end user.
+
Prefix: @prefix@
-
Prefix: @prefix@
+
C compiler: @CC@
-
C compiler: @CC@
+
This is a name for which there is no variable.
-
This is a name for which there is no variable.
+
Stuff: @stuff@</code>
-
Stuff: @stuff@
+
-
</pre>
+
We then run autoconf and configure:
We then run autoconf and configure:
-
<pre>
+
[sbox-FREMANTLE_X86: ~/example2] &gt; autoconf
-
[sbox-FREMANTLE_X86: ~/example2] > autoconf
+
[sbox-FREMANTLE_X86: ~/example2] &gt; ./configure
-
[sbox-FREMANTLE_X86: ~/example2] > ./configure
+
checking for gcc... gcc
-
checking for gcc... gcc
+
checking for C compiler default output file name... a.out
-
checking for C compiler default output file name... a.out
+
checking whether the C compiler works... yes
-
checking whether the C compiler works... yes
+
checking whether we are cross compiling... no
-
checking whether we are cross compiling... no
+
checking for suffix of executables...
-
checking for suffix of executables...
+
checking for suffix of object files... o
-
checking for suffix of object files... o
+
checking whether we are using the GNU C compiler... yes
-
checking whether we are using the GNU C compiler... yes
+
checking whether gcc accepts -g... yes
-
checking whether gcc accepts -g... yes
+
checking for gcc option to accept ANSI C... none needed
-
checking for gcc option to accept ANSI C... none needed
+
checking for gawk... gawk
-
checking for gawk... gawk
+
checking how to run the C preprocessor... gcc -E
-
checking how to run the C preprocessor... gcc -E
+
checking for egrep... grep -E
-
checking for egrep... grep -E
+
checking for ANSI C header files... yes
-
checking for ANSI C header files... yes
+
checking for sys/types.h... yes
-
checking for sys/types.h... yes
+
checking for sys/stat.h... yes
-
checking for sys/stat.h... yes
+
checking for stdlib.h... yes
-
checking for stdlib.h... yes  
+
checking for string.h... yes
-
checking for string.h... yes
+
checking for memory.h... yes
-
checking for memory.h... yes
+
checking for strings.h... yes
-
checking for strings.h... yes
+
checking for inttypes.h... yes
-
checking for inttypes.h... yes
+
checking for stdint.h... yes
-
checking for stdint.h... yes
+
checking for unistd.h... yes
-
checking for unistd.h... yes
+
checking for unistd.h... (cached) yes
-
checking for unistd.h... (cached) yes
+
checking math.h usability... yes
-
checking math.h usability... yes
+
checking math.h presence... yes
-
checking math.h presence... yes
+
checking for math.h... yes
-
checking for math.h... yes
+
checking stdio.h usability... yes
-
checking stdio.h usability... yes
+
checking stdio.h presence... yes
-
checking stdio.h presence... yes
+
checking for stdio.h... yes
-
checking for stdio.h... yes
+
checking b0rk.h usability... no
-
checking b0rk.h usability... no
+
checking b0rk.h presence... no
-
checking b0rk.h presence... no
+
checking for b0rk.h... no
-
checking for b0rk.h... no
+
b0rk.h not present in system
-
b0rk.h not present in system
+
But that doesn't stop us from continuing!
-
But that doesn't stop us from continuing!
+
configure: creating ./config.status
-
configure: creating ./config.status
+
config.status: creating test-output.txt
-
config.status: creating test-output.txt
+
[sbox-FREMANTLE_X86: ~/example2] &gt; cat test-output.txt
-
[sbox-FREMANTLE_X86: ~/example2] > cat test-output.txt
+
This file will go through autoconf variable substitution.
-
This file will go through autoconf variable substitution.
+
-
 
+
The output file will be named as 'test-output.txt' (the '.in'-suffix
-
The output file will be named as 'test-output.txt' (the '.in'-suffix
+
is stripped).
-
is stripped).
+
-
 
+
All names surrounded by '@'-characters will be replaced by the values
-
All names surrounded by '@'-characters will be replaced by the values
+
of the variables (if present) by the configure script when it is run
-
of the variables (if present) by the configure script when it is run
+
by end user.
-
by end user.
+
-
 
+
Prefix: /usr/local
-
Prefix: /usr/local
+
C compiler: gcc
-
C compiler: gcc
+
 +
This is a name for which there is no variable.
 +
Stuff: @stuff@
-
This is a name for which there is no variable.
 
-
Stuff: @stuff@
 
-
</pre>
 
-
This feature is used later on. When you run your own version of the file, notice the creation of file called <code>config.status</code>. It is the file that actually does the substitution for external files, so if the configuration is otherwise complex, and you only want to re-run the substitution of the output files, you can run the config.status script.
+
This feature is used later on. When you run your own version of the file, notice the creation of file called '''config.status'''. It is the file that actually does the substitution for external files, so if the configuration is otherwise complex, and you only want to re-run the substitution of the output files, you can run the config.status script.
=== Introducing Automake ===
=== Introducing Automake ===

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: