Next: , Up: Unix Installation   [Contents][Index]


B.2.1 Compiling gawk for Unix-Like Systems

The normal installation steps should work on all modern commercial Unix-derived systems, GNU/Linux, BSD-based systems, and the Cygwin environment for MS-Windows.

After you have extracted the gawk distribution, cd to gawk-4.1.4. As with most GNU software, you configure gawk for your system by running the configure program. This program is a Bourne shell script that is generated automatically using GNU Autoconf. (The Autoconf software is described fully in Autoconf—Generating Automatic Configuration Scripts, which can be found online at the Free Software Foundation’s website.)

To configure gawk, simply run configure:

sh ./configure

This produces a Makefile and config.h tailored to your system. The config.h file describes various facts about your system. You might want to edit the Makefile to change the CFLAGS variable, which controls the command-line options that are passed to the C compiler (such as optimization levels or compiling for debugging).

Alternatively, you can add your own values for most make variables on the command line, such as CC and CFLAGS, when running configure:

CC=cc CFLAGS=-g sh ./configure

See the file INSTALL in the gawk distribution for all the details.

After you have run configure and possibly edited the Makefile, type:

make

Shortly thereafter, you should have an executable version of gawk. That’s all there is to it! To verify that gawk is working properly, run ‘make check’. All of the tests should succeed. If these steps do not work, or if any of the tests fail, check the files in the README_d directory to see if you’ve found a known problem. If the failure is not described there, send in a bug report (see Bugs).

Of course, once you’ve built gawk, it is likely that you will wish to install it. To do so, you need to run the command ‘make install’, as a user with the appropriate permissions. How to do this varies by system, but on many systems you can use the sudo command to do so. The command then becomes ‘sudo make install’. It is likely that you will be asked for your password, and you will have to have been set up previously as a user who is allowed to run the sudo command.


Next: , Up: Unix Installation   [Contents][Index]