94Chapter3 • Compilers and Assemblers
downloaded from the same location from which you downloaded the main
glibc-
2.2.5.tar.gz
file. The following commands are used to extract files from these two
archives:
cd glibc-2.2.5
tar zxvf ../ glibc-linuxthreads-2.2.5.tar.gz
In old versions of
glibc
, you had to install add-ons like locale data and crypt library.
These are included in the latest version of
glibc
.
Now you have to configure the library after creating a build directory. Basically this is the
same process that you have done while installing GCC and binutils. This is done using the fol-
lowing set of commands:
[root@conformix glibc-2.2.5]# mkdir build
[root@conformix glibc-2.2.5]# cd build
[root@conformix build]# ../configure --enable-add-
ons=linuxthreads --prefix=/opt/gcc-3.0.4
The actual compilation and testing is done using the following two commands:
make
make check
The final install command is the following:
make install
This command will install components of GNU C library under
/opt/gcc-3.0.4/
lib
because we had chosen
/opt/gcc/3.0.4
as our prefix when we ran the
configure
script. Now you can set the appropriate paths in your Makefiles to use the new library.
3.10Compiling Pascal Programs
Pascal programs can be converted to C language programs and then compiled in the usual way.
The
p2c
command on Linux does this for you. Consider the following Pascal program
hello.pas.
(* Program to demonstrate Pascal compilation *)
program Hello ;
begin
writeln ('Hello world')
end.
The following command will create a file
hello.c
which is the equivalent C version of
the
hello.pas
program.
[rr@conformix 4]$ p2c hello.pas
Hello
Translation completed.
[rr@conformix 4]$