Your Daily Source for Apache News and Information  
Breaking News Preferences Contribute Triggers Link Us Search About
Apache Guide: Configuring Your Apache Compile with ./Configure
(Nov 6th, 13:16:56 )

By Rich Bowen

During my "Introduction to Apache Server" talk at ApacheCon, I talked about configuring your Apache compilation using the configure script. During the break, someone asked why I was talking about using configure, but did not mention using Configure.

That's configure with a lower case c, and Configure with an upper case C, in case you missed the distinction.

Well, I suppose there's really no particular reason that I talk about one over the other. Except that configure seems to be a little easier to explain to beginners.

In my earlier column about configuring your Apache compilation, I talked mainly about configure, and mentioned Configure only briefly.

So, in this article, I'll talk about using Configure -- why you might want to, some of its advantages, and how to use it to make your life easier.

Just to be Clear Here ...

configure is a script that is located in the top directory when you unpack the Apache source code. It's used something like:

     tar -zvxf apache_1.3.14.tar.gz
     cd apache_1.3.14
     ./configure --prefix=/usr/local/apache
     make
     make install

Configure is a script located in the src subdirectory. Rather than passing it arguments on the command line, you give it its parameters in a configuration file, called Configuration. Apache comes with a configuration template file, called Configuration.tmpl, which contains common default values.

If you want to do a default install, using Configure, you'd do something like this:

     tar -zvxf apache_1.3.14.tar.gz
     cd apache_1.3.14/src
     cp -f Configuration.tmpl Configuration
     vi Configuration
     ... make changes to Configuration if desired ...
     ./Configure
     make
     make install

Disadvantages

There are some distinct disadvantages to using Configure, at least for the beginner.

First, it's not obvious that it's even an option. If you unpack the source tarball, and go into the directory, if you have any familiarity with Open Source software packages, you're probably going to be familiar with running a configure script, and it won't even occur to you to go into the src directory to look for anything else.

If you are aware of this way of doing things, the Configuration file itself might be a little intimidating, since, although it is exceedingly well documented internally -- each line has extensive comments telling you what it is for -- it is very long, and contains a lot of stuff that most folks will never want to customize.

Finally, the documentation is somewhat lacking on the differences between the two ways of doing things, but seems to indicate that configure is what the beginner should probably be using, and Configure is for the more advanced folks. While this is not a real disadvantage, it's a good way to scare people off from experimenting, which is a shame.

Advantages

The biggest advantage, in my mind, of using Configure is the ability to save a particular configuration for later use and not have to remember a lengthy configure command line.

For example, when I built Apache the last time, I used something like:

     ./configure --prefix=/usr/local/apache --enable-module=most
          --enable-shared=max --enable-module=auth_dbm 
          --enable-module=auth_mysql

And that was a rather simple compile. The problem is, even to type that line, I had to look up the syntax of the various arguments and try to remember what the module names were. This may not be a big deal for most people, but I rebuild Apache a lot, and it gets very irritating.

The nice thing about configure is that it actually generates a configuration file in the src directory, which you can save for later reference. It's called src/Configuration.apaci.

This is also very handy if you are building Apache on a test system, and when you get it right, you want to build Apache on your production system in the same way. Simply grap that Configuration.apaci file, copy it up to your production server, and build Apache using that file.

Note that although the file Configuration is used to supply the configuration parameters by default, you can specify another file using the -file flag:

     ./Configure -file Configuration.saved_prefs

Editing the Configuration file by hand

In the old days, the only way to specify compliation parameters was to edit the Configuration file by hand. Of course, we had to walk to school in bare feet, too. Uphill. In the snow. The good old days weren't all that good.

Anyways, if you're going to be working with these Configuration files, you should look into one and see what it's made of.

Most of the things in there will not need to be customized, but it's good to get an idea what they are all about.

At the top of the file is a brief explanation of what you are looking at. This section is reproduced here, rather than trying to explain what it talks about:

     # There are 5 types of lines here:
     # '#' comments, distinguished by having a '#' as the first non-blank character
     #
     # Makefile options, such as CC=gcc, etc...
     #
     # Rules, distinguished by having "Rule" at the front. These are used to
     # control Configure's behavior as far as how to create Makefile.
     #
     # Module selection lines, distinguished by having 'AddModule' at the front.
     # These list the configured modules, in priority order (highest priority
     # last).  They're down at the bottom.
     #
     # Optional module selection lines, distinguished by having `%Module'
     # at the front.  These specify a module that is to be compiled in (but
     # not enabled).  The AddModule directive can be used to enable such a
     # module.  By default no such modules are defined.

For most of us, the main thing that you're going to be modifying is the module selection lines. The other things should, for the most part, be left for the folks that really understand what they are doing.

Towards the bottom of the file, you'll see a lot of lines that look like:

     AddModule modules/standard/mod_cgi.o

This indicates that a particular module (in this case, mod_cgi) will be enabled in this compile of Apache. You can remove a module by commenting out the line referring to it. Alternately, you can enable a module by uncommentind a commented-out line referring to it.

You can cause a module to be compiled as a DSO (shared object) by using the SharedModule directive rather than the AddModule directive:

     SharedModule modules/standard/mod_vhost_alias.so

Make sure that if you do this, mod_so is enabled.

It is very instructive to generate Configuration.apaci files using configure, and see what the differences are.

Once you have made all of the changes that you want in your Configuration file, simply run ./Configure to start the compilation process.

So, Which Should I Use?

Apparently, there are folks that feel strongly about using either configure or Configure. This seems a little strange to me. I'm sure there are political and/or historical reasons for each view.

I would recommend that you use both. Use configure to generate Configuration files. Read those files to understand what it is doing. Save various ones of these files for later reuse with Configure.

If you're only ever going to do a default installation of Apache, and you're never planning to change anything, it really does not matter which method you use.

That's All, Folks

That's about it for this week.

If you have questions and/or suggestions for future articles, please feel free to contact me via email. Thanks for reading.

Related Stories:
Apache Guide: ApacheCon Europe(Oct 30, 2000)
Apache Guide: Generating Fancy Directory Listings with mod_autoindex(Oct 09, 2000)
Apache Guide: Logging, Part 4 -- Log-File Analysis(Sep 18, 2000)
Apache Guide: Logging, Part 3 -- Custom Logs(Sep 05, 2000)
Apache Guide: Logging, Part II -- Error Logs(Aug 28, 2000)
Apache Guide: Logging with Apache--Understanding Your access_log(Aug 21, 2000)
Apache Guide: Apache Authentication, Part 4(Aug 14, 2000)
Apache Guide: Apache Authentication, Part 3(Aug 07, 2000)
Apache Guide: Apache Authentication, Part II(Jul 31, 2000)
Apache Guide: Apache Authentication, Part 1(Jul 24, 2000)
Apache Guide: Setting Up Virtual Hosts(Jul 17, 2000)
Apache Guide: Configuring Your Apache Server Installation(Jul 10, 2000)
Apache Guide: The Newbie's Guide to Installing Apache(Jul 03, 2000)
Apache Guide: Advanced SSI Techniques(Jun 26, 2000)
Apache Guide: Introduction to Server Side Includes, Part 2 (Jun 19, 2000)
Apache Guide: Introduction to Server Side Includes(Jun 12, 2000)
Apache Guide: Dynamic Content with CGI(Jun 05, 2000)


Printed from Apache Today (https://apachetoday.com).
https://apachetoday.com//news_story.php3?ltsn=2000-11-06-001-01-OS-CY-LF

About Triggers Media Kit Security Triggers Login


All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux 2.4, Apache 1.3, and PHP 4
Copyright 2002 INT Media Group, Incorporated All Rights Reserved.
Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/