Datasheet

Alternatively, you can specify some other location for the installation. For example, if you want to install
in /tmp/lua-5.1.1, execute the following command:
make INSTALL_TOP=/tmp/lua-5.1.1 install
In these last cases, you’ll need to specify a full or relative path to lua, luac, and the man pages because
the default search path won’t include them. For example, to read the man page installed with the last
example, execute the following:
man /tmp/lua-5.1.1/man/man1/lua.1
Then, to test lua, execute the following command:
/tmp/lua-5.1.1/bin/lua -v
This section led you through a basic build of Lua on Unix-like systems. Many options exist for configur-
ing Lua in different ways. For example, you can configure Lua to use a primitive data type other than
double for numbers. The curious can examine src/luaconf.h to see the configurable options. Your
best approach at this point is to leave them at their default settings. This book assumes that you are
using Lua with its default options.
Compiling Lua on Windows
Although Lua compiles cleanly on Windows, the makefile that comes with the Lua source package is
oriented toward Unix-style systems. Unless you are using a Unix emulation layer such as Cygwin, you’ll
need to craft your own approach to the task of creating the Lua interpreter and byte-code compiler.
A lot of C/C++ compilers exist for Windows, and many of them are available for free. The tools in these
SDKs generally have their own particular set of command line switches, configuration conventions, and
system dependencies, making it impractical to cover more than one Windows SDK in this book. The
instructions in this book assume you are using the Microsoft Visual C++ 6.0 SDK. Later versions of this
kit have been released, but Visual C++ 6.0 is still widely used in the industry because of its support for a
broad range of Windows versions. You can configure it to generate programs that use
MSVCRT.DLL, a
system library that is available on all 32-bit desktop versions of Windows. An effort has been made in
this book to provide instructions that will generate applications and libraries that are compatible with
the Lua binaries for Windows available on LuaForge. These binaries are easy to deploy, because they
depend only on libraries that come with Windows.
If you have a later version of Visual C++ or are using another SDK (such as a product from Pelles C or
Borland) you will need to consult the appropriate documentation to find how to build and deploy appli-
cations and libraries. Recent versions of the Microsoft C++ SDK require manifest files to be deployed
along with applications and libraries.
The directions that follow create the Lua interpreter and compiler. Three approaches are shown. The first
works well with Visual C++ 6.0. If you are some other large-scale C development system, follow these
directions with the understanding that you may need to make toolkit-specific changes. The second
approach is suitable for users of TCC, and the third applies to the MinGW SDK.
12
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 12