diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-04 17:11:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-04 17:11:58 -0300 |
commit | 366c85564874d560b3608349f752e9e490f9002d (patch) | |
tree | 77426f1c700cf4c7aa15b0742cf6669c9166af7a /luaconf.h | |
parent | 781219dbe16fc327f5b828e1ff6fa45ec3265cba (diff) | |
download | lua-366c85564874d560b3608349f752e9e490f9002d.tar.gz lua-366c85564874d560b3608349f752e9e490f9002d.tar.bz2 lua-366c85564874d560b3608349f752e9e490f9002d.zip |
lua.c loads 'readline' dynamically
(See comments in luaconf.h.) This change allows easier compilation,
as Lua compiles and works even if the package 'readline' is absent
from the system. Moreover, non-interactive uses don't load the library,
making the stand-alone slightly faster for small loads.
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -58,15 +58,26 @@ | |||
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | 60 | ||
61 | /* | ||
62 | ** When Posix DLL ('LUA_USE_DLOPEN') is enabled, the Lua stand-alone | ||
63 | ** application will try to dynamically link a 'readline' facility | ||
64 | ** for its REPL. In that case, LUA_READLINELIB is the name of the | ||
65 | ** library it will look for those facilities. If lua.c cannot open | ||
66 | ** the specified library, it will generate a warning and then run | ||
67 | ** without 'readline'. If that macro is not defined, lua.c will not | ||
68 | ** use 'readline'. | ||
69 | */ | ||
61 | #if defined(LUA_USE_LINUX) | 70 | #if defined(LUA_USE_LINUX) |
62 | #define LUA_USE_POSIX | 71 | #define LUA_USE_POSIX |
63 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ | 72 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
73 | #define LUA_READLINELIB "libreadline.so" | ||
64 | #endif | 74 | #endif |
65 | 75 | ||
66 | 76 | ||
67 | #if defined(LUA_USE_MACOSX) | 77 | #if defined(LUA_USE_MACOSX) |
68 | #define LUA_USE_POSIX | 78 | #define LUA_USE_POSIX |
69 | #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ | 79 | #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ |
80 | #define LUA_READLINELIB "libedit.dylib" | ||
70 | #endif | 81 | #endif |
71 | 82 | ||
72 | 83 | ||