lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> > Then in luaconf.h at the top there is a check for LUA_USE_POSIX
> Shouldn't we change LUA_USE_ULONGJMP to use sigsetjmp instead
> of _setjmp? Then we could add LUA_USE_ULONGJMP to the above list.

Err, please no. This will cause more trouble than it's worth.
Part of the problem is that support for this call is not good
because it's not widely used. The jump buffer is also of a
different type and size and may be rather large.

Strictly speaking LUA_USE_ULONGJMP is only _needed_ for systems
with a BSD heritage (FreeBSD, NetBSD, OpenBSD, Mac OS X). But
AFAIK all POSIX systems I know of _do_ have the legacy underscore
variants (and it's usually just an alias for the non-underscore
variant). POSIX 1003.1-2003 mentions that they _may_ be removed
in a future version (but there is none yet). And even then many
vendors won't do this due to compatibility requirements.

IMHO it's safe to add LUA_USE_ULONGJMP (as is) to the above
feature set when LUA_USE_POSIX is selected. After all any of the
above features may be missing in certain POSIX environments. But
if anyone has such a non-mainstream system then well ... they can
easily add their own target with their own set of flags (they had
to modify the source in prior versions, anyway).

Also dlopen() is more or less universally supported in POSIX
systems. So adding this one, too (but allowing an override) makes
things even simpler. Consider LUA_USE_POSIX a catch-all for a
'full-featured mainstream POSIX system'.

Keeping the individual flags still allows easy customization for
embedders or non-mainstream systems.

The top-level Makefile then only needs the following targets:

linux     MYCFLAGS="-DLUA_USE_POSIX" MYLIBS="-Wl,-E -ldl"
mingw     (many flags, see beta-rc)
generic   (no flags set)

The *BSD variants are included in the 'posix' target, just like
the other mainstream systems (Solaris, AIX, HP-UX, ...). Anyone
not using a pure GNU toolchain needs to remove/replace "-Wl,-E"
and/or override CC=gcc.

This leaves us with the following at the start of luaconf.h:

#if defined(LUA_USE_POSIX)
#if !defined(LUA_DL_NONE) && !defined(LUA_DL_DYLD)

(plus the _WIN32 dependent defines spread throughout the file.)

Here's a suggested replacement for the first section in INSTALL:

* Building Lua
  This will build Lua in the src directory.

  Provided you have the GNU toolchain (gcc, GNU linker) installed,
  building Lua on most POSIX (Unix) systems should be very easy.

  Use "make linux" for Linux, "make osx" for Mac OS X and
  "make posix" for most other POSIX systems.

  "make generic" or "make ansi" should work on almost any system,
  but without support for any system specific features (like dynamic

  If you want to use a different compiler or linker or want to
  do other customizations then see below.

  "make mingw" builds Lua for Windows using the MinGW toolchain.
  See below for instructions on how to build with other Windows

* Installing Lua
  [... move all the paragraphs about 'installation' here ...]

Ah, and before I forget:

The install paths for Lua modules and C modules are still not
created by "make install":

INSTALL_LMOD= $(INSTALL_TOP)/share/lua/5.1

install: all
	... mkdir -p ... $(INSTALL_LMOD) $(INSTALL_CMOD)