1AC_INIT([mod_auth_openidc],[2.4.7],[hans.zandbelt@zmartzone.eu])
2
3AC_SUBST(NAMEVER, AC_PACKAGE_TARNAME()-AC_PACKAGE_VERSION())
4
5# This section defines the --with-apxs2 option.
6AC_ARG_WITH(
7	[apxs2],
8	[  --with-apxs2=PATH       Full path to the apxs2 executable.],
9	[
10		APXS2=${withval}
11	],)
12
13
14if test "x$APXS2" = "x"; then
15   # The user didn't specify the --with-apxs2-option.
16
17   # Search for apxs2 in the specified directories
18   AC_PATH_PROG(APXS2, apxs2,,
19		/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
20
21   if test "x$APXS2" = "x"; then
22      # Didn't find apxs2 in any of the specified directories.
23      # Search for apxs instead.
24      AC_PATH_PROG(APXS2, apxs,,
25		   /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
26   fi
27
28fi
29
30# Test if $APXS2 exists and is an executable.
31if test ! -x "$APXS2"; then
32   # $APXS2 isn't a executable file.
33   AC_MSG_ERROR([
34Could not find apxs2. Please specify the path to apxs2
35using the --with-apxs2=/full/path/to/apxs2 option.
36The executable may also be named 'apxs'.
37])
38fi
39
40# Replace any occurrences of @APXS2@ with the value of $APXS2 in the Makefile.
41AC_SUBST(APXS2)
42
43# Use environment variable APXS2_OPTS to pass params to APXS2 command
44AC_ARG_VAR(APXS2_OPTS, [Additional command line options to pass to apxs2.])
45
46# We need the curl library for HTTP callouts.
47PKG_CHECK_MODULES(CURL, libcurl)
48AC_SUBST(CURL_CFLAGS)
49AC_SUBST(CURL_LIBS)
50
51# We need OpenSSL for crypto and HTTPS callouts.
52PKG_CHECK_MODULES(OPENSSL, openssl)
53AC_SUBST(OPENSSL_CFLAGS)
54AC_SUBST(OPENSSL_LIBS)
55
56PKG_CHECK_MODULES(APR, [apr-1, apr-util-1])
57AC_SUBST(APR_CFLAGS)
58AC_SUBST(APR_LIBS)
59
60# older versions of libapr may not have memcache support
61old_CPPFLAGS=$CPPFLAGS
62CPPFLAGS="${APR_CFLAGS} $CPPFLAGS"
63AC_CHECK_HEADERS([apr_memcache.h], [HAVE_MEMCACHE=1], [HAVE_MEMCACHE=0])
64AC_SUBST(HAVE_MEMCACHE)
65CPPFLAGS=$old_CPPFLAGS
66
67# We need Jansson for JSON parsing.
68PKG_CHECK_MODULES(JANSSON, jansson)
69AC_SUBST(JANSSON_CFLAGS)
70AC_SUBST(JANSSON_LIBS)
71
72# cjose
73PKG_CHECK_MODULES(CJOSE, cjose)
74AC_SUBST(CJOSE_CFLAGS)
75AC_SUBST(CJOSE_LIBS)
76
77# PCRE
78PKG_CHECK_MODULES(PCRE, libpcre)
79AC_SUBST(PCRE_CFLAGS)
80AC_SUBST(PCRE_LIBS)
81
82# Redis
83AC_ARG_WITH([hiredis],
84  [AS_HELP_STRING([--with-hiredis],
85    [support Redis @<:@default=check@:>@])],
86  [],
87  [with_hiredis=yes])
88AS_CASE(["$with_hiredis"],
89  [yes], [if test "$HIREDIS_LIBS" == ""; then PKG_CHECK_MODULES([HIREDIS], [hiredis], [HAVE_LIBHIREDIS=1], [HAVE_LIBHIREDIS=0]) ; else [HAVE_LIBHIREDIS=1] ; fi],
90  [no], [HAVE_LIBHIREDIS=0],
91  [PKG_CHECK_MODULES([HIREDIS], [hiredis], [HAVE_LIBHIREDIS=1], [HAVE_LIBHIREDIS=0])])
92AC_SUBST(HAVE_LIBHIREDIS)
93AC_SUBST(HIREDIS_CFLAGS)
94AC_SUBST(HIREDIS_LIBS)
95
96# JQ
97HAVE_LIBJQ=0
98
99AC_ARG_WITH(jq,
100        [  --with-jq=PATH          location of your libjq installation])
101
102if test -n "$with_jq"
103then
104    JQ_CFLAGS="-I$with_jq/include"
105    JQ_LIBS="-L$with_jq/lib -ljq"
106
107	CPPFLAGS="$JQ_CFLAGS $CPPFLAGS"
108	AC_CHECK_HEADERS([jq.h], , [HAVE_LIBJQ=0])
109
110	LDFLAGS="$JQ_LIBS $LDFLAGS"
111	AC_CHECK_LIB([jq], [jq_init], [HAVE_LIBJQ=1], [HAVE_LIBJQ=0])
112	if test "x$have_jq" = "x0" ; then
113  		AC_MSG_WARN("cannot find library for -ljq.")
114	fi
115fi
116
117AC_SUBST(HAVE_LIBJQ)
118AC_SUBST(JQ_CFLAGS)
119AC_SUBST(JQ_LIBS)
120
121# Create Makefile from Makefile.in
122AC_CONFIG_FILES([Makefile])
123AC_OUTPUT
124