1build(3)                            ANTLR3C                           build(3)
2
3
4

NAME

6       build - Building From Source The C runtime is provided in source code
7       form only as there are too many binary versions to sensibly maintain
8       binaries on www.antlr.org.
9
10       The runtime code is provided with .sln and .vcproj files for Visual
11       Studio 2005 and 2008, and configure files for building and installation
12       on UNIX or other systems that support this tool. If your system is
13       neither Windows nor configure compatible, then you should find it
14       reasonable to build the code manually (see section 'Building
15       Manually'.)
16

Source Code Organization

18       The source code expands from a tar/zip file to give you the following
19       directories:
20
21./ The location of the configure script and the antlr3config.h file
22         generated by the running the configure script.This directory also
23         contains the solution and project files for visual studio 2005 and
24         2008.
25
26./src The location of all the C files in the project.
27
28./include The location of all the header files for the project
29
30./doxygen The location of documentation files such as the one that
31         generates this page
32
33       • Other ancillary directories used by the build or documentation
34         process.
35

Building for Windows

37       If you are building for Cygwin, or a similar UNIX on Windows System,
38       follow the 'Building With Configure' instructions below.
39
40       Note that the runtime is no longer compatible with the VC6 Microsoft
41       compiler. If you absolutely need to build with this compiler, you can
42       probably hack the source code to deall with the pieces that VC6 cannot
43       handle such as the ULL suffix for constants.
44
45       If you wish to build the binaries for Windows using Visual Studio 2005,
46       or 2008 you may build using the IDE:
47
48       1.  Open the C.sln file
49
50       2.  Select batch Build from the Build menu
51
52       3.  Select all configurations and press the build button.
53
54       If you wish or need to build the libraries from the command line, then
55       you must use a Windows command shell configured for access to
56       VS2005/VS2008 compilers, such as the one that is started from:
57
58       Start->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio
59       2005 Command Prompt
60
61       There appears to be no way to build all targets at once in a batch mode
62       from the command line, so you may build one or all of the following:
63
64          C:ntlrsrc   C:ntlrsrc   C:ntlrsrc   C:ntlrsrc
65
66       After the build is complete you will find the in a subdirectory named after the /Build target. In the Release and Debug targets, you will find that there is only a which you can link directly into your own projects if you wish to avoid the DLL. In
67       batim
68
69
70       • ReleaseDLL : ANTLR3C.DLL and ANTLR3C_DLL.LIB
71
72       • DebugDLL : ANTLR3CD.DLL and ANTLR3CD_DLL.LIB
73
74       • Release : ANTLR3C.LIB
75
76       • Debug : ANTLR3CD.LIB
77
78       There currently no .msi modules or other installs built for Windows, so you must place the DLLs in a directory referenced
79       by the PATH environment variable and make the include directory available to your project configurations.
80
81
82       tion configure Building with configure
83
84       Before starting, make sure that you are using a source code distribution and not the source code directly from the
85       Perforce repository. If you use the source from the perforce tree directly, you will find that there is no configure
86       script as this is generated as part of the distribution build by the maintainers. If you feel the need to build from
87       the distribution tree then you must have all the autobuild packages available on your system and can generate the
88       configure script using autoreconf. If you are not familiar with these tools, then please use the tgz files in the
89       dist subdirectory (or downloaded from the ANTLR web site).
90
91       The source code file should be expanded in a directory of your choice (probably your working directory) using the command:
92
93       batim
94                                                                                                                    c
95                                                                                                                    o
96        gzip -dc antlrtgzname.tar.gz | tar xvf -                                                                    n
97                                                                                                                    f
98       Where: <b>antlrtgzname.tar.gz</b> is of course the name of the tar when you downloaded it. You should find a iscript in the sub directory thus created.
99                                                                                                                    g
100       The configure script accepts the usual options, such as --prefix= but the default is to build in the source duirectory and to place libraries in
101       <b>/usr/local/lib</b> and include files (for building your recognizers) in <b>/usr/local/include</b>. There arre also a number of antlr specific options, which you may wish to utilize. The command:
102       batim                                                                                                        e
103
104
105        ./configure --help
106
107       Will document the latest incarnations of these options in case this documentation is ever out of date. At this time the options are:
108
109       batim
110
111
112        --enable-debuginfo Compiles debug info into the library (default no)
113       --enable-64bit Turns on flags that produce 64 bit object code if any
114       are required (default no)
115
116       Unless you need 64 bit builds, or a change in library types, you will generally use the configure command without options:
117
118       Here is a sample configure output:
119
120       batim
121
122
123        [jimi@localhost dist]$ tar zvxf libantlr3c-3.0.0-rc8.tar.gz
124
125       libantlr3c-3.0.0-rc8/ libantlr3c-3.0.0-rc8/antlr3config.h
126       libantlr3c-3.0.0-rc8/src/ libantlr3c-3.0.0-rc8/src/antlr3stringstream.c
127       ... libantlr3c-3.0.0-rc8/antlr3config.h.in
128
129       [jimi@localhost dist]$ cd libantlr3c-3.0.0-rc
130
131
132       [jimi@localhost libantlr3c-3.0.0-rc8]$ ./configure
133
134       checking for a BSD-compatible install... /usr/bin/install -c
135       checking whether build environment is sane... yes
136       checking for a thread-safe mkdir -p... /bin/mkdir -p
137       checking for gawk... gawk
138       checking whether make sets $(MAKE)... yes
139       checking for xlc... no
140       checking for aCC... no
141       checking for gcc... gcc
142       checking for strdup... yes
143       configure: creating ./config.status
144       config.status: creating Makefile
145       config.status: creating antlr3config.h
146       config.status: antlr3config.h is unchanged
147       config.status: executing depfiles commands
148
149
150       Having configured the library successfully, you need only make it, and install it:
151
152       batim
153
154
155        [jimi@localhost libantlr3c-3.0.0-rc8]$ make
156
157       make  all-am
158       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
159       /bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -Iinclude -Iinclude    -O2  -MT antlr3baserecognizer.lo -MD -MP -MF .deps/antlr3baserecognizer.Tpo -c -o antlr3baserecognizer.lo `test -f 'src/antlr3baserecognizer.c' || echo './'`src/antlr3baserecognizer.c
160       gcc  -shared  .libs/antlr3baserecognizer.o .libs/antlr3basetree.o .libs/antlr3basetreeadaptor.o .libs/antlr3bitset.o .libs/antlr3collections.o .libs/antlr3commontoken.o .libs/antlr3commontree.o .libs/antlr3commontreeadaptor.o .libs/antlr3commontreenodestream.o .libs/antlr3cyclicdfa.o .libs/antlr3encodings.o .libs/antlr3exception.o .libs/antlr3filestream.o .libs/antlr3inputstream.o .libs/antlr3intstream.o .libs/antlr3lexer.o .libs/antlr3parser.o .libs/antlr3string.o .libs/antlr3stringstream.o .libs/antlr3tokenstream.o .libs/antlr3treeparser.o .libs/antlr3rewritestreams.o .libs/antlr3ucs2inputstream.o   -Wl,-soname -Wl,libantlr3c.so -o .libs/libantlr3c.so
161       ar cru .libs/libantlr3c.a  antlr3baserecognizer.o antlr3basetree.o antlr3basetreeadaptor.o antlr3bitset.o antlr3collections.o antlr3commontoken.o antlr3commontree.o antlr3commontreeadaptor.o antlr3commontreenodestream.o antlr3cyclicdfa.o antlr3encodings.o antlr3exception.o antlr3filestream.o antlr3inputstream.o antlr3intstream.o antlr3lexer.o antlr3parser.o antlr3string.o antlr3stringstream.o antlr3tokenstream.o antlr3treeparser.o antlr3rewritestreams.o antlr3ucs2inputstream.o
162       ranlib .libs/libantlr3c.a
163       creating libantlr3c.la
164
165       (cd .libs && rm -f libantlr3c.la && ln -s ../libantlr3c.la libantlr3c.la)
166       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
167
168
169       [jimi@localhost libantlr3c-3.0.0-rc8]$ sudo make install
170
171
172       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
173       test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
174        /bin/sh ./libtool --mode=install /usr/bin/install -c  'libantlr3c.la' '/usr/local/lib/libantlr3c.la'
175       /usr/bin/install -c .libs/libantlr3c.so /usr/local/lib/libantlr3c.so
176       /usr/bin/install -c .libs/libantlr3c.lai /usr/local/lib/libantlr3c.la
177       /usr/bin/install -c .libs/libantlr3c.a /usr/local/lib/libantlr3c.a
178        /usr/bin/install -c -m 644 'include/antlr3stringstream.h' '/usr/local/include/antlr3stringstream.h'
179        /usr/bin/install -c -m 644 'antlr3config.h' '/usr/local/include/antlr3config.h'
180       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
181
182       [jimi@localhost libantlr3c-3.0.0-rc8]$
183
184
185       You are now ready to generate C recognizers and compile and link them with the ANTLR 3 C Runtime.
186
187
188       tion buildman Building Manually
189                                                     a    c
190       The only step that configure performs that cannuot beo done
191       manually (without effort) is to produce the heatder fnile
192       that your local C compiler supports. The easiesot wayf to produce
193       this file for your system, if you cannot port mand i
194       to the system is:                             a    g
195                                                     k    u
196       -# Run configure on a system that does supporteconfrigure
197       -# Copy the generated -# Edit the file locally and echange any types that differ on this
198         system to the target systems. There are only a few types and you should
199         find this relatively easy.
200
201       Having produced a compatible antlr3config.h file, then you should be able to
202       compile the source files in the to the location of to:
203       batim
204
205
206        ~/C/src: cc -c -O -I.. -I../include *.c
207
208       Having produced the .o (or equivalent) files for the local system you can then
209       build an archive or shared library for the C runtime.
210
211       When you wish to build and link with the C runtime, specify the path to the
212       supplied header files, and the path to the library that you built.
213
214Version 3.3.1                   Tue Jan 26 2021                       build(3)
Impressum