summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-03-28 12:47:34 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-03-28 12:54:42 +0300
commitf825911b73db44d1b2455a0495d2450dd0865402 (patch)
tree2fb4687af93e59230ad83ddce3c3ce441ca4d78d
parentb098c173481e739b83b18900e241b6b467ed26cd (diff)
downloadlibrpm-tizen-f825911b73db44d1b2455a0495d2450dd0865402.tar.gz
librpm-tizen-f825911b73db44d1b2455a0495d2450dd0865402.tar.bz2
librpm-tizen-f825911b73db44d1b2455a0495d2450dd0865402.zip
Use pkg-config to find Lua + determine flags (ticket #88)
- Additionally clean up the logic a bit and dont bother building any lua-related bits if disabled
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac35
-rw-r--r--lib/Makefile.am8
-rw-r--r--luaext/Makefile.am4
-rw-r--r--rpmio/Makefile.am11
5 files changed, 30 insertions, 30 deletions
diff --git a/Makefile.am b/Makefile.am
index 0ea651762..35b185476 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,7 +16,7 @@ SUBDIRS = po misc
if WITH_INTERNAL_DB
SUBDIRS += db3
endif
-if WITH_LUAEXT
+if WITH_LUA
SUBDIRS += luaext
endif
SUBDIRS += rpmio lib sign build scripts fileattrs doc . tests
diff --git a/configure.ac b/configure.ac
index ee891af8f..e3fe5112e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,8 @@ AC_USE_SYSTEM_EXTENSIONS
AC_DISABLE_STATIC
+PKG_PROG_PKG_CONFIG
+
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
@@ -692,28 +694,19 @@ AS_IF([test "$with_acl" = yes],[
AC_SUBST(WITH_ACL_LIB)
AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
-WITH_LUA_LIB=
-WITH_LUA_INCLUDE=
-AC_ARG_WITH(lua, [AS_HELP_STRING([--with-lua],[build with lua support])],,[with_lua=yes])
-AS_IF([test "$with_lua" = yes],[
- AC_CHECK_HEADER([lua.h],[
- AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
- AC_MSG_ERROR([--with-lua given, but liblua not found])
- ],
- [-lm])
- ],[
- AC_MSG_ERROR([--with-lua given, but lua.h not found])
- ])
-])
-
-AS_IF([test "$with_lua" = yes],[
- AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
- WITH_LUA_INCLUDE=
- WITH_LUA_LIB="-llua -lm"
+AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [build with lua support])],
+ [],
+ [with_lua=yes])
+
+AS_IF([test "$with_lua" != no],[
+ PKG_CHECK_MODULES([LUA],
+ [lua >= 5.1],
+ [AC_DEFINE(WITH_LUA, 1, [Build with lua support?])],
+ [AC_MSG_ERROR([lua not present (--without-lua to disable)])])
+ AC_SUBST(LUA_CFLAGS)
+ AC_SUBST(LUA_LIBS)
])
-AC_SUBST(WITH_LUA_LIB)
-AC_SUBST(WITH_LUA_INCLUDE)
-AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
+AM_CONDITIONAL(WITH_LUA,[test "$with_lua" = yes])
AC_ARG_ENABLE(plugins, [AS_HELP_STRING([--disable-plugins],[build without plugin support])],,[enable_plugins=yes])
AS_IF([test "$enable_plugins" = yes],[
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5ae5e955a..c4e4cea50 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -35,7 +35,7 @@ librpm_la_SOURCES = \
rpmvercmp.c signature.c signature.h transaction.c \
verify.c rpmlock.c rpmlock.h misc.h \
rpmscript.h rpmscript.c legacy.c merge.c \
- rpmliblua.c rpmliblua.h rpmchroot.c rpmchroot.h \
+ rpmchroot.c rpmchroot.h \
rpmplugins.c rpmplugins.h rpmug.c rpmug.h
librpm_la_LDFLAGS = -version-info 2:0:0
@@ -48,6 +48,12 @@ librpm_la_LIBADD = \
@WITH_ACL_LIB@ \
@LIBINTL@
+if WITH_LUA
+AM_CPPFLAGS += @LUA_CFLAGS@
+librpm_la_LIBADD += @LUA_LIBS@
+librpm_la_SOURCES += rpmliblua.c rpmliblua.h
+endif
+
if WITH_INTERNAL_DB
librpm_la_LIBADD += $(libdb_la)
else
diff --git a/luaext/Makefile.am b/luaext/Makefile.am
index 41ec9ede9..65e15551f 100644
--- a/luaext/Makefile.am
+++ b/luaext/Makefile.am
@@ -7,8 +7,8 @@ EXTRA_DIST = \
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/include -I.
-libluaext_la_CPPFLAGS = $(AM_CPPFLAGS) -DWITH_POSIX
-libluaext_la_LIBADD = @WITH_LUA_LIB@
+libluaext_la_CPPFLAGS = $(AM_CPPFLAGS) -DWITH_POSIX @LUA_CFLAGS@
+libluaext_la_LIBADD = @LUA_LIBS@
libluaext_la_SOURCES = \
lposix.h \
lposix.c \
diff --git a/rpmio/Makefile.am b/rpmio/Makefile.am
index b94a77204..fee340836 100644
--- a/rpmio/Makefile.am
+++ b/rpmio/Makefile.am
@@ -2,7 +2,6 @@
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/
AM_CPPFLAGS += @WITH_NSS_INCLUDE@
-AM_CPPFLAGS += @WITH_LUA_INCLUDE@
AM_CPPFLAGS += @WITH_POPT_INCLUDE@
AM_CPPFLAGS += -I$(top_srcdir)/misc
AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\""
@@ -12,9 +11,9 @@ usrlibdir = $(libdir)
usrlib_LTLIBRARIES = librpmio.la
librpmio_la_SOURCES = \
argv.c base64.h base64.c digest.h digest.c macro.c \
- rpmhook.c rpmio.c rpmlog.c rpmlua.c rpmmalloc.c \
+ rpmhook.c rpmio.c rpmlog.c rpmmalloc.c \
rpmpgp.c rpmsq.c rpmsw.c url.c \
- rpmio_internal.h rpmlua.h rpmhook.h \
+ rpmio_internal.h rpmhook.h \
rpmstring.c rpmfileutil.c \
rpmkeyring.c
@@ -22,7 +21,6 @@ librpmio_la_LDFLAGS = -version-info 2:0:0
librpmio_la_LIBADD = \
../misc/libmisc.la \
@WITH_NSS_LIB@ \
- @WITH_LUA_LIB@ \
@WITH_BZ2_LIB@ \
@WITH_ZLIB_LIB@ \
@WITH_LIBELF_LIB@ \
@@ -30,8 +28,11 @@ librpmio_la_LIBADD = \
@WITH_LZMA_LIB@ \
-lpthread
-if WITH_LUAEXT
+if WITH_LUA
AM_CPPFLAGS += -I$(top_srcdir)/luaext/
+AM_CPPFLAGS += @LUA_CFLAGS@
+librpmio_la_SOURCES += rpmlua.c rpmlua.h
+librpmio_la_LIBADD += @LUA_LIBS@
librpmio_la_LIBADD += $(top_builddir)/luaext/libluaext.la
endif