lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Monday, February 18, 2002, at 09:26 AM, Luiz Henrique de Figueiredo wrote:

[moved to top]
> Lua is 100% ANSI C. You only need an ANSI C compiler to build it.
> There's no need for Autoconf because it does not depend on the OS.

Lua is not 100% ANSI C. It's configurable to build that way, but the use of popen and the support for readline allow minor extensions at the cost of being 99.44% ANSI C. :-) But the 100% ANSI option is the default, and I agree with it.

Also, autoconf is not just about discovering the runtime environment (which is 99.44% ANSI in Lua's case.) autoconf is also about discovering the build-time environment---what compiler should I use, what arguments do I need to use to link in the libraries for this function, and so on.

That being said, I think the "read, understand, edit-by-hand" config file should not go away. There are enough non-POSIX build systems out there that "autoconf or die" is a silly idea. Yes, I use cygwin, but sometimes I use Visual C++ too, and autoconf won't help me at all there.

fltk is an example of a package that supports both configuration styles; autoconf for systems that support it, hand-edit for those that don't.

This is false.  Lua is not easy to install.  For autoconfig'ed
systems, one simply types:

$ ./configure
$ make
$ make install

In Lua, in a Unix system that has gcc, you simply type "make install"!

The current Lua install method requires that one edit it's makefile.

Only if you want to do something other than the default. And it's a config file,
not the Makefile. As far as I can tell, the Makefile is pretty standard.
If not, I welcome suggestion on making the Makefiles more standard and portable.

The Makefile looks good; it moves its configuration options to config, which is a good practice, but it's still part of the configuration.

Lemme enumerate what config does. I'll flag those that autoconf would assist with.

Chooses number format.  Not something people do lightly.

Chooses whether to build popen into liblualib. (Incidentally, popen is defined in -D_POSIX_C_SOURCE=2, so if you want full warningless compiles, you should set that instead of _POSIX_SOURCE if you have popen on. But it's only one function prototype.) [autoconf would detect popen, and could try flags to get the prototype.]

Sets compiler explicitly. Is there a good reason not to use make's builtin CC definition? [autoconf picks up the CC definition from either the environment or the site config.]

...oh, and sets warning options, which are compiler dependent. So if you didn't need compiler-dependent warnings you could avoid setting CC. [autoconf would allow supplying the proper options to CC if CC is known, otherwise falling back on the empty string.]

Sets optimization options. In theory, compiler-dependent, but most every compiler supports -O2. [Again, autoconf can probe for the availability of particular optimization options.]

Sets LDFLAGS.

Sets _POSIX_SOURCE. Note that this has two functions. First, it tells the system to provide function prototypes defined by POSIX (above what you get with ANSI); second, it turns on an internal prototype in lua.c. [Slam dunk for autoconf.]

Lists libraries needed to link lua.c and luac.c. [autoconf can determine what libraries are needed to get a successful link given a list of functions.]

Allows configuration of readline support in lua.c. Defines what libraries need to be linked in that case. [Obvious use of autoconf; if the user asks for this with --enable-readline, autoconf can detect whether readline is actually available and what libraries need to be linked.

Defines AR, RANLIB, and STRIP.  [autoconf does this for you as well.]

Defines multiple variables to control installation destination. (Note that for man pages, /share/man is more correct on many systems than /man.) [autoconf has excellent support for configuring installation.]

Sets the tool used to install data and binaries. [Most people use autoconf's "look for BSD install, fall back to cp" rules.]

autoconf makes the life of people doing cross compiles much easier, as well as those who have standard configuration options site-wide.

Jay