form requires the use of GNU’s autoconf utility. This program builds an
executable shell script named configure that, when executed,
automatically examines and tailors a client’s build from source according to
software resources, or dependencies (such as programming tools, libraries,
and associated utilities) that are installed on the target host (your Linux
system).
Many Linux commands and graphical clients for X downloaded in source
code form include configure scripts. To configure the source package,
build the software, and then install the new program, the root user might use
the script like this (after uncompressing the source and navigating into the
resulting build directory):
Click here to view code image
matthew@seymour:~$ ./configure ; make ; sudo make install
The autoconf program uses a file named configure.in that contains a
basic ruleset, or set of macros. The configure.in file is created with the
autoscan command. Building a properly executing configure script
also requires a template for the makefile, named Makefile.in. Although
creating the dependency-checking configure script can be done manually,
you can easily overcome any complex dependencies by using a graphical
project development tool such as KDE’s KDevelop or GNOME’s Glade. (See
the “Graphical Development Tools” section, later in this chapter, for more
information.)
Debugging Tools
Debugging is both a science and an art. Sometimes, the simplest tool—the
code listing—is the best debugging tool. At other times, however, you need to
use other debugging tools, such as splint, gprof, and gdb.
Using splint to Check Source Code
The splint command is similar to the traditional UNIX lint command: It
statically examines source code for possible problems, and it also has many
additional features. Even if your C code meets the standards for C and
compiles cleanly, it might still contain errors. splint performs many types
of checks and can provide extensive error information. For example, this
simple program might compile cleanly and may even run:
Click here to view code image