Skip to content

Finding libmodsecurity #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions build/find_libmodsec.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AC_MSG_NOTICE(looking for libmodsecurity)
# Check if the user provided --with-libmodsecurity
AC_ARG_WITH(libmodsecurity,
[AS_HELP_STRING([[--with-libmodsecurity=FILE]],
[FILE is the path to libmodsecurity install dir; defaults to "/usr/local/modsecurity/".])],
[FILE is the path to libmodsecurity install dir; defaults to "/usr/local/modsecurity".])],
[
if test "$withval" = "yes"; then
V3PATH=/usr/local/modsecurity/
Expand All @@ -13,27 +13,39 @@ AC_ARG_WITH(libmodsecurity,
fi
])

# --with-libmodsecurity=/my/absolute/path is provided,
# do some checks
if test -n "$V3PATH"; then
if test -f "$V3PATH/lib/libmodsecurity.so"; then
V3LIB="$V3PATH/lib/"
fi
if test -f "$V3PATH/include/modsecurity/modsecurity.h"; then
V3INCLUDE="$V3PATH/include/"
fi
fi

# --with-libmodsecurity= is set to empty,
# do some blind guessing
if test -z "$V3PATH"; then
for i in /usr/local/modsecurity/ \
for i in /usr/local/modsecurity \
/usr/local/sbin \
/usr/local/bin \
/usr/sbin \
/usr/bin;
/usr/bin \
/usr
do
if test -f "$i/lib/libmodsecurity.so"; then
V3LIB="$i/lib/"
fi
if test -f "$i/include/modsecurity/modsecurity.h"; then
V3INCLUDE="$i/include/"
# TODO: test if V3LIB is set
break
fi
done
fi

if test -n "$V3LIB" -a "$V3LIB" != "no" -a -x "$V3LIB" ; then
AC_MSG_NOTICE(found libmodsecurity at $V3LIB)
else
AC_MSG_ERROR(couldn't find libmodsecurity)
fi
])