Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support to LUA in configure scripts
- Loading branch information
Felipe Zimmerle
committed
Oct 31, 2017
1 parent
9369efc
commit 1189e9b
Showing
13 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
dnl Check for LUA Libraries | ||
dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) | ||
|
||
|
||
AC_DEFUN([CHECK_LUA], | ||
[dnl | ||
# Possible names for the lua library/package (pkg-config) | ||
LUA_POSSIBLE_LIB_NAMES="lua" | ||
# Possible extensions for the library | ||
LUA_POSSIBLE_EXTENSIONS="so so0 la sl dll dylib so.0.0.0" | ||
# Possible paths (if pkg-config was not found, proceed with the file lookup) | ||
LUA_POSSIBLE_PATHS="/usr/lib /usr/local/lib /usr/local/lua /usr/local/liblua /usr/local /opt /usr /usr/lib64 /opt/local" | ||
# Variables to be set by this very own script. | ||
LUA_CFLAGS="" | ||
LUA_LDFLAGS="" | ||
LUA_LDADD="" | ||
LUA_DISPLAY="" | ||
AC_ARG_WITH( | ||
lua, | ||
AC_HELP_STRING( | ||
[--with-lua=PATH], | ||
[Path to lua prefix] | ||
) | ||
) | ||
if test "x${with_lua}" == "xno"; then | ||
AC_DEFINE(HAVE_LUA, 0, [Support for LUA was disabled by the utilization of --without-lua or --with-lua=no]) | ||
AC_MSG_NOTICE([Support for LUA was disabled by the utilization of --without-lua or --with-lua=no]) | ||
LUA_DISABLED=yes | ||
else | ||
if test "x${with_lua}" == "xyes"; then | ||
LUA_MANDATORY=yes | ||
AC_MSG_NOTICE([LUA support was marked as mandatory by the utilization of --with-lua=yes]) | ||
else | ||
LUA_MANDATORY=no | ||
fi | ||
for x in ${LUA_POSSIBLE_PATHS}; do | ||
CHECK_FOR_LUA_AT(${x}) | ||
if test -n "${LUA_CFLAGS}"; then | ||
break | ||
fi | ||
done | ||
fi | ||
if test -z "${LUA_CFLAGS}"; then | ||
if test -z "${LUA_MANDATORY}" || test "x${LUA_MANDATORY}" == "xno"; then | ||
if test -z "${LUA_DISABLED}"; then | ||
AC_MSG_NOTICE([LUA library was not found]) | ||
LUA_FOUND=0 | ||
else | ||
LUA_FOUND=2 | ||
fi | ||
else | ||
AC_MSG_ERROR([LUA was explicitly referenced but it was not found]) | ||
LUA_FOUND=-1 | ||
fi | ||
else | ||
if test -z "${LUA_MANDATORY}" || test "x${LUA_MANDATORY}" == "xno"; then | ||
LUA_FOUND=2 | ||
AC_MSG_NOTICE([LUA is disabled by default.]) | ||
else | ||
LUA_FOUND=1 | ||
AC_MSG_NOTICE([using LUA v${LUA_VERSION}]) | ||
LUA_CFLAGS="-DWITH_LUA ${LUA_CFLAGS}" | ||
LUA_DISPLAY="${LUA_LDADD} ${LUA_LDFLAGS}, ${LUA_CFLAGS}" | ||
AC_SUBST(LUA_LDFLAGS) | ||
AC_SUBST(LUA_LDADD) | ||
AC_SUBST(LUA_CFLAGS) | ||
AC_SUBST(LUA_DISPLAY) | ||
fi | ||
fi | ||
AC_SUBST(LUA_FOUND) | ||
]) # AC_DEFUN [CHECK_LUA] | ||
|
||
|
||
AC_DEFUN([CHECK_FOR_LUA_AT], [ | ||
path=$1 | ||
echo "*** LOOKING AT PATH: " ${path} | ||
for y in ${LUA_POSSIBLE_EXTENSIONS}; do | ||
for z in ${LUA_POSSIBLE_LIB_NAMES}; do | ||
if test -e "${path}/${z}.${y}"; then | ||
lua_lib_path="${path}/" | ||
lua_lib_name="${z}" | ||
lua_lib_file="${lua_lib_path}/${z}.${y}" | ||
break | ||
fi | ||
if test -e "${path}/lib${z}.${y}"; then | ||
lua_lib_path="${path}/" | ||
lua_lib_name="${z}" | ||
lua_lib_file="${lua_lib_path}/lib${z}.${y}" | ||
break | ||
fi | ||
if test -e "${path}/lib/lib${z}.${y}"; then | ||
lua_lib_path="${path}/lib/" | ||
lua_lib_name="${z}" | ||
lua_lib_file="${lua_lib_path}/lib${z}.${y}" | ||
break | ||
fi | ||
if test -e "${path}/lib/x86_64-linux-gnu/lib${z}.${y}"; then | ||
lua_lib_path="${path}/lib/x86_64-linux-gnu/" | ||
lua_lib_name="${z}" | ||
lua_lib_file="${lua_lib_path}/lib${z}.${y}" | ||
break | ||
fi | ||
if test -e "${path}/lib/i386-linux-gnu/lib${z}.${y}"; then | ||
lua_lib_path="${path}/lib/i386-linux-gnu/" | ||
lua_lib_name="${z}" | ||
lua_lib_file="${lua_lib_path}/lib${z}.${y}" | ||
break | ||
fi | ||
done | ||
if test -n "$lua_lib_path"; then | ||
break | ||
fi | ||
done | ||
if test -e "${path}/include/fuzzy.h"; then | ||
lua_inc_path="${path}/include" | ||
elif test -e "${path}/fuzzy.h"; then | ||
lua_inc_path="${path}" | ||
elif test -e "${path}/include/fuzzy/fuzzy.h"; then | ||
lua_inc_path="${path}/include" | ||
fi | ||
if test -n "${lua_lib_path}"; then | ||
AC_MSG_NOTICE([LUA library found at: ${lua_lib_file}]) | ||
fi | ||
if test -n "${lua_inc_path}"; then | ||
AC_MSG_NOTICE([LUA headers found at: ${lua_inc_path}]) | ||
fi | ||
if test -n "${lua_lib_path}" -a -n "${lua_inc_path}"; then | ||
# TODO: Compile a piece of code to check the version. | ||
LUA_CFLAGS="-I${lua_inc_path}" | ||
LUA_LDADD="-l${lua_lib_name}" | ||
LUA_LDFLAGS="-L${lua_lib_path}" | ||
LUA_DISPLAY="${lua_lib_file}, ${lua_inc_path}" | ||
fi | ||
]) # AC_DEFUN [CHECK_FOR_LUA_AT] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* ModSecurity, http://www.modsecurity.org/ | ||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/) | ||
* | ||
* You may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* If any of the files related to licensing are missing or if you have any | ||
* other questions related to licensing please contact Trustwave Holdings, Inc. | ||
* directly using the email address security@modsecurity.org. | ||
* | ||
*/ | ||
|
||
|
||
#include "modsecurity/modsecurity.h" | ||
#include "src/engines/lua.h" | ||
|
||
|
||
#ifdef WITH_LUA | ||
#include <lua.hpp> | ||
|
||
|
||
#endif | ||
|
||
#ifndef SRC_ENGINES_LUA_H_ | ||
#define SRC_ENGINES_LUA_H_ | ||
|
||
|
||
|
||
#endif // SRC_ENGINES_LUA_H_ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters