Skip to content

Commit a7a8c97

Browse files
airweenFelipe Zimmerle
authored and
Felipe Zimmerle
committed
Fix libmodsecurity search in autoconf file
1 parent a2e9307 commit a7a8c97

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

build/find_libmodsec.m4

+15-34
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,24 @@ AC_ARG_WITH(libmodsecurity,
77
[FILE is the path to libmodsecurity install dir; defaults to "/usr/local/modsecurity/".])],
88
[
99
if test "$withval" = "yes"; then
10-
V3PATH=/usr/local/modsecurity/
10+
AC_SUBST(CPPFLAGS, "$CPPFLAGS -I/usr/local/modsecurity/include/ -L/usr/local/modsecurity/lib/")
11+
V3INCLUDE="/usr/local/modsecurity/include/"
12+
V3LIB="/usr/local/modsecurity/lib/"
1113
else
12-
V3PATH="$withval"
13-
if test -f "${V3PATH}lib/libmodsecurity.so"; then
14-
V3LIB="${V3PATH}lib/"
15-
fi
16-
if test -f "${V3PATH}include/modsecurity/modsecurity.h"; then
17-
V3INCLUDE="${V3PATH}include/"
18-
fi
14+
AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval}/include/ -L${withval}/lib/")
15+
V3INCLUDE="${withval}/include/"
16+
V3LIB="${withval}/lib/"
1917
fi
2018
])
2119
22-
if test -z "$V3PATH"; then
23-
for i in /usr/local/modsecurity/ \
24-
/usr/local/sbin \
25-
/usr/local/bin \
26-
/usr/sbin \
27-
/usr/bin \
28-
/usr;
29-
do
30-
if test -f "$i/lib/libmodsecurity.so"; then
31-
V3LIB="$i/lib/"
32-
fi
33-
if test -f "$i/lib64/libmodsecurity.so"; then
34-
V3LIB="$i/lib64/"
35-
fi
36-
if test -f "$i/include/modsecurity/modsecurity.h"; then
37-
V3INCLUDE="$i/include/"
38-
# TODO: test if V3LIB is set
39-
break
40-
fi
41-
done
42-
fi
43-
if test -n "$V3LIB" -a "$V3LIB" != "no" -a -x "$V3LIB" ; then
44-
AC_MSG_NOTICE(found libmodsecurity at $V3LIB)
45-
else
46-
AC_MSG_ERROR(couldn't find libmodsecurity)
47-
fi
20+
dnl Check the ModSecurity libraries (modsecurity)
21+
22+
AC_CHECK_LIB([modsecurity], [msc_init], [
23+
AC_DEFINE([HAVE_MODSECURITYLIB], [1],
24+
[Define to 1 if you have the `libmodsecurity' library (-lmodsecurity).])], [
25+
AC_MSG_ERROR([ModSecurity libraries not found!])])
26+
27+
AC_CHECK_HEADERS([modsecurity/modsecurity.h], [], [
28+
AC_MSG_ERROR([ModSecurity headers not found...])])
4829
])
4930

0 commit comments

Comments
 (0)