lua-users home
lua-l archive

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


KHMan wrote:
> William Pursell wrote:
>> Miles Bader wrote:
>>> William Pursell <...> writes:
>>>> The problem is that the lua makefiles are built with
>>>> the assumption that the readline library is always
>>>> available under linux.  This is a packaging error,
>>>> and should be reported as a bug.
>>> Given that it's a simple makefile, what do you expect?
>>>
>>> They target a "typical" system (of each type), and if yours is
>>> different, you edit the makefile..
>>
>> [snip]
>> Life would be much easier if one could build
>> the system by passing arguments to a configure
>> script rather than editing Makefiles and luaconf.h
> 
> Well then, can you, or someone contribute a configure setup and put it
> on the Lua wiki?
> 
> I don't believe I've seen a configure setup for Lua yet, perhaps there
> is a real dearth of automake/autoconf talent around these parts... We
> need a automake/autoconf guru to save us unwashed barbarians! :-)
> 


Here's a quick configure.ac and src/Makefile.am that produced
reasonable results for me.  Note that this does not address
things like LUA_USE_MKSTEMP for the following reason:
it would be possible to have the configure script define
LUA_USE_MKSTEMP on the commad line, but the norm would
be to define HAVE_MKSTEMP in config.h  (which ought to
either replace luaconf.h or be included by it) and
check for HAVE_MKSTEMP in the source.

If anyone feels like this would actually be worthwhile,
I'd be willing to spend some time working on it, but
I'm of the mind that it's really not...I suspect most
people copy the source files and compile them into
their projects rather than linking against an installed
liblua.  (At least, that's what I'm doing...but I've only
just started looking at Lua)


$ cat configure.ac:
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63.251-064cee])
AC_INIT([LUA], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/lua.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([m], [log])
AC_CHECK_LIB([readline], [readline])
AC_CHECK_LIB([history], [add_history])
AC_CHECK_LIB([curses], [curs_addstr])

# Checks for header files.
AC_CHECK_HEADERS([limits.h locale.h stddef.h stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STRCOLL
AC_CHECK_FUNCS([floor localeconv memchr modf pow setlocale sqrt strchr strcspn strerror strpbrk strrchr strstr strtoul])

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT


$ cat Makefile.am

SUBDIRS = src

$ cat src/Makefile.am
# Process this with automake to produce Makefile.in

lib_LTLIBRARIES = liblua.la
CORE_FILES = \
	lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c \
	lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c  \
	lundump.c lvm.c lzio.c
LIB_FILES = \
	lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c \
	lstrlib.c loadlib.c linit.c

bin_PROGRAMS = lua luac
luac_SOURCES = luac.c print.c
lua_LDADD = liblua.la
luac_LDADD = liblua.la

liblua_la_SOURCES = $(CORE_FILES) $(LIB_FILES)


-- 
William Pursell