diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-07-02 16:24:26 +0200 |
---|---|---|
committer | Nathan Angelacos <nangel@alpinelinux.org> | 2013-07-03 06:48:47 -0700 |
commit | 6fd9dd351e0e616d200f12126d57e20582f90633 (patch) | |
tree | 92e7d9284bf68c2ffa8dc9353be37d8712da3032 /configure.ac | |
parent | 338a9dc21cfdd1a6514fb2b485b1b0f91c3b61b8 (diff) | |
download | haserl-6fd9dd351e0e616d200f12126d57e20582f90633.tar.bz2 haserl-6fd9dd351e0e616d200f12126d57e20582f90633.tar.xz |
use pkg-config to find Lua CFLAGS and LIBS
By default, use pkg-config lua --cflags/--libs but let user override
the pkg-config name. For example, to build with lua5.2.pc use
--with-lua=lua5.2
This fixes situations when both lua5.1 and lua5.2 is available but not
'lua'.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac index 74560c5..a854642 100644 --- a/configure.ac +++ b/configure.ac @@ -40,13 +40,6 @@ AC_DEFINE([_GNU_SOURCE], [], [Enable GNU Extensions]) dnl ************************************************************** -AC_ARG_WITH(lua-headers, - [ --with-lua-headers=DIR lua include files location], - [LUA_HDR_DIR="$withval"] - [CFLAGS="$CFLAGS -I$withval"] -) - - dnl Checks for lua luashell=false @@ -54,36 +47,17 @@ luacshell=false ac_report_have_lua=disabled ac_report_bash_extensions=disabled +AC_ARG_WITH([lua], + AS_HELP_STRING([--with-lua], [Specify lua pkg-config name (default is 'lua')])) -AC_ARG_WITH(lua, - AS_HELP_STRING([--with-lua[[=DIR]]],[use lua in DIR]), -[ case "$withval" in - no) ac_report_have_lua=disabled - ;; - *) AC_SEARCH_LIBS(dlopen, dl) - # ubuntu has lua5.1 rather than just lua - if pkg-config --exists lua5.1; then - LUALIB=lua5.1 - else - LUALIB=lua - fi - if test -z "$LUA_HDR_DIR"; then - CFLAGS="$CFLAGS `pkg-config $LUALIB --cflags`" - fi - LIBS="$LIBS -lm" - LDFLAGS="$LDFLAGS -Wl,-E -L$withval" - AC_DEFINE(USE_LUA, , [Enable Lua]) - - AC_CHECK_LIB($LUALIB, luaL_newstate, , [ - AC_MSG_ERROR([The Lua runtime library cannot be found!]) - ], $LIBS) - luashell=true - luacshell=true - ac_report_have_lua=enabled - ;; - esac ], [ - ac_report_have_lua=disabled +AS_IF([test "x$with_lua" = "xyes"], [with_lua=lua]) +AS_IF([test "x$with_lua" != "xno"], [ + luashell=true + luacshell=true + ac_report_have_lua=enabled + PKG_CHECK_MODULES([LUA], [$with_lua]) ]) + AM_CONDITIONAL(USE_LUA, test x$ac_report_have_lua = xenabled) # If Lua is enabled, the user can choose between two different shells |