-
Notifications
You must be signed in to change notification settings - Fork 51
/
Compilation.html
129 lines (84 loc) · 6.96 KB
/
Compilation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Compilation</title>
<link rel="stylesheet" type="text/css" href="DoX.css"/>
</head>
<body>
<div class="DoX">
<h1>Configuration and compilation</h1>
<p>You will have received the FoX source code as a tar.gz file.</p>
<p>Unpack it as normal, and change directory into the top-level directory, FoX-$VERSION.</p>
<h3>Requirements for use</h3>
<p>FoX requires a Fortran 95 compiler - not just Fortran 90. All currently available versions of Fortran compilers claim to support F95. If your favoured compiler is not listed as working, I recommend the use of <a href="www.g95.org">g95</a>, which is free to download and use. And in such a case, please send a bug report to your compiler vendor.</p>
<p>In the event that you need to write a code targetted at multiple compilers, including some which have bugs preventing FoX compilation, please note the possibility of producing a <a href="#dummy_library">dummy library</a>.</p>
<h2>Configuration</h2>
<ul>
<li><p>In order to generate the Makefile, make sure that you have a Fortran compiler in your <code>PATH</code>, and do:</p>
<p><code>./configure</code></p></li>
</ul>
<p>This should suffice for most installations. However:</p>
<ol>
<li><p>You may not be interested in all of the modules that FoX supplies. For example, you may only be interested in output, not input. If so, you can select which modules you want using <code>--enable-MODULENAME</code> where MODULENAME is one of <code>wxml</code>, <code>wcml</code>, <code>wkml</code>, <code>sax</code>, <code>dom</code>. If none are explicitly enabled, then all will be built. (Alternatively, you can exclude modules one at a time with <code>--disable-MODULENAME</code>) Thus, for example, if you only care about CML output, and not anything else: <code>./configure --enable-wcml</code></p></li>
<li><p>If you have more than one Fortran compiler available, or it is not on your <code>PATH</code>, you can force the choice by doing:</p>
<p><code>./configure FC=/path/to/compiler/of/choice</code></p></li>
<li><p>It is possible that the configuration fails. In this case</p>
<ul>
<li>please tell me about it so I can fix it</li>
<li>all relevant compiler details are placed in the file arch.make; you may be able to edit that file to allow compilation. Again, if so, please let me know what you need to do.</li>
</ul></li>
<li><p>By default the resultant files are installed under the objs directory. If you wish them to be installed elsewhere, you may do</p>
<p><code>./configure --prefix=/path/to/installation</code></p></li>
</ol>
<p>Note that the configure process encodes the current directory location in several
places. If you move the FoX directory later on, you will need to re-run configure.</p>
<ul>
<li><p>You may be interested in <a href="#dummy_library">dummy compilation</a>. This is activated with the <code>--enable-dummy</code> switch (but only works for wxml/wcml currently).</p>
<p><code>./configure --enable-wcml --enable-dummy</code></p></li>
</ul>
<h2>Compilation</h2>
<p>In order to compile the full library, now simply do:</p>
<pre><code>make
</code></pre>
<p>This will build all the requested FoX modules, and the relevant examples</p>
<h2>Testing</h2>
<p>In the full version of the FoX library, there are several testsuites included.</p>
<p>To run them all, simply run <code>make check</code> from the top-level directory. This will run the individual testsuites, and collate their results.</p>
<p>If any failures occur (unrelated to known compiler issues, see the <a href="http://github.com/andreww/fox/issues">up-to-date list</a>), please send a message to the mailing list (<a href="mailto:fox-discuss@googlegroups.com">fox-discuss@googlegroups.com</a>) with details of compiler, hardware platform, and the nature of the failure.</p>
<p>The testsuites for the SAX and DOM libraries are very extensive, and are somewhat fragile, so are not distributed with FoX. Please contact the author for details.</p>
<h2>Linking to an existing program</h2>
<ul>
<li>The files all having been compiled and installed, you need to link them into your program.</li>
</ul>
<p>A script is provided which will provide the appropriate compiler and linker flags for you; this will be created after configuration, in the top-level directory, and is called <code>FoX-config</code>. It may be taken from there and placed anywhere.</p>
<p>FoX-config takes the following arguments:</p>
<ul>
<li><code>--fcflags</code>: return flags for compilation</li>
<li><code>--libs</code>: return flags for linking</li>
<li><code>--wxml</code>: return flags for compiling/linking against wxml</li>
<li><code>--wcml</code>: return flags for compiling/linking against wcml</li>
<li><code>--sax</code>: return flags for compiling/linking against sax</li>
</ul>
<p>If it is called with no arguments, it will expand to compile & link flags, thusly:</p>
<pre><code> f95 -o program program.f90 `FoX-config`
</code></pre>
<p>For compiling only against FoX, do the following:</p>
<pre><code>f95 -c `FoX-config --fcflags` sourcefile.f90
</code></pre>
<p>For linking only to the FoX library, do:</p>
<pre><code>f95 -o program `FoX-config --libs` *.o
</code></pre>
<p>or similar, according to your compilation scheme. </p>
<p>Note that by default, <code>FoX-config</code> assumes you are using all modules of the library. If you are only using part, then this can be specified by also passing the name of each module required, like so:</p>
<pre><code>FoX-config --fcflags --wcml
</code></pre>
<h2>Compiling a dummy library</h2>
<p><a name="dummy_library"/></p>
<p>Because of the shortcomings in some compilers, it is not possible to compile FoX everywhere. Equally, sometimes it is useful to be able to compile a code both with and without support for FoX (perhaps to reduce executable size). Especially where FoX is being used only for additional output, it is useful to be able to run the code and perform computations even without the possibility of XML output.</p>
<p>For this reason, it is possible to compile a dummy version of FoX. This includes all public interfaces, so that your code will compile and link correctly - however none of the subroutines do anything, so you can retain the same version of your code without having to comment out all FoX calls.</p>
<p>Because this dummy version of FoX contains nothing except empty subroutines, it compiles and links with all known Fortran 95 compilers, regardless of compiler bugs.</p>
<p>To compile the dummy code, use the <code>--enable-dummy</code> switch. Note that currently the dummy mode is not yet available for the DOM module.</p>
</div>
</body>
</html>