E-Mail:
Get our new Windows 7 eBook (PDF) for $7 with 70+ Tips. Download Now!

Compiling Software from Source, Part II

  • No Related Post

Compiling Software from Source, Part II: Compiling with GNU
Autoconf

Many programmers today are using GNU Autoconf instead of the make build manager. You can tell if this is the case
by looking in the main source directory for the package. If
there’s no Makefile and there is a “configure” file… be careful.
If make’s being used, there
might be files with names like configure.in, so things can get confusing.

Often, you can just type ./configure from within the source code directory to
start up, but it’s a good idea to go through the README and
INSTALL files before doing so. Sometimes you’ll find that you need
to use options to tell Autoconf what features to enable or
disable, especially when building something as complex as, say,
Apache. In that case, type ./configure --help to see a list of your options. For
most packages, you’d better pipe it through more (./configure --help | more) or it
will all scroll right past!

Most of the time, the items that will get you are when the
installer’s expecting libraries to be in one place, but you have
them in another. I rarely run into things like this, since I
typically allow installers to put things in their default
locations. However, not every Linux distribution puts things in
the same place, and not every program you want to autoconfigure
was built specifically for Linux. Some were built more broadly for
multiple flavors of Unix. You also might have multiple versions of
a library and want it to use a specific one.

With the notorious Apache, the thing you’re most likely to need
flags for is to tell Apache to include support for MySQL, APXS,
PHP, and other such programs that Apache might need to build
modules for so it can integrate properly.

Typically, when it’s time to autoconfigure something, I run ./configure --help to see if there
are any specialty flags I need to be aware of (or even better,
read the README and INSTALL files, which will tell me that without
me having to wade through the code), and then just run ./configure and see what happens.
It’s mostly because I’m lazy. If nothing goes wrong, I guess I
didn’t need to specifically tell it where such-and-such library
was. If it complains, I guess I do.

The great thing is you don’t have to learn anything else new for
this one. Autoconf is just used to build custom Makefiles for your
setup. After that, you just usually type make and make
install
!

Next week: We’ll troubleshoot a compile. Maybe I’ll
do a make one this time, and
an Apache one with autoconf
next time.

What Do You Think?

 
35 queries / 0.369 seconds.