[Rpm-maint] [PATCH 1/2] Fix --without-lua build.

Mark Wielaard mark at klomp.org
Mon Jun 3 21:28:50 UTC 2019

commit 62bd62 "Add a rpmlua wrapper function for registering libraries"
moved the rpmluaRegister function definition into rpmio/rpmlua.h and
added an #include <lauxlib.h>. This made that file not compile anymore
when lua-devel isn't installed and configuring --without-lua. Even though
that function isn't compiled or used when not using lua with rpm.

Fix this by wrapping both the include and the function definition
in #ifdef WITH_LUA.
 rpmio/rpmlua.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rpmio/rpmlua.h b/rpmio/rpmlua.h
index 9179b37..87418c6 100644
--- a/rpmio/rpmlua.h
+++ b/rpmio/rpmlua.h
@@ -1,7 +1,9 @@
 #ifndef RPMLUA_H
 #define RPMLUA_H
+#ifdef WITH_LUA
 #include <lauxlib.h>
 typedef enum rpmluavType_e {
     RPMLUAV_NIL		= 0,
@@ -20,7 +22,10 @@ extern "C" {
 rpmlua rpmluaNew(void);
 rpmlua rpmluaFree(rpmlua lua);
 rpmlua rpmluaGetGlobalState(void);
+#ifdef WITH_LUA
 void rpmluaRegister(rpmlua lua, const luaL_Reg *funcs, const char *lib);
 int rpmluaCheckScript(rpmlua lua, const char *script,
 		      const char *name);

More information about the Rpm-maint mailing list