Merge pull request #700 from mcnewton/rlm_files
[freeradius.git] / src / modules / rlm_rediswho / configure.ac
1 AC_PREREQ([2.61])
2 AC_INIT(rlm_rediswho.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_rediswho])
5
6 fail=
7 SMART_LIBS=
8 SMART_CLFAGS=
9 if test x$with_[]modname != xno; then
10
11     dnl ############################################################
12     dnl # Check for command line options
13     dnl ############################################################
14
15     dnl extra argument: --with-redis-include-dir=DIR
16     redis_include_dir=
17     AC_ARG_WITH(redis-include-dir,
18         [AS_HELP_STRING([--with-redis-include-dir=DIR],
19                 [Directory where the redis includes may be found])],
20         [case "$withval" in
21             no)
22                 AC_MSG_ERROR(Need redis-include-dir)
23                 ;;
24             yes)
25                 ;;
26             *)
27                 redis_include_dir="$withval"
28                 ;;
29         esac])
30
31     dnl extra argument: --with-redis-lib-dir=DIR
32     redis_lib_dir=
33     AC_ARG_WITH(redis-lib-dir,
34         [AS_HELP_STRING([--with-redis-lib-dir=DIR],
35                 [Directory where the redis libraries may be found])],
36         [case "$withval" in
37             no)
38                 AC_MSG_ERROR(Need redis-lib-dir)
39                 ;;
40             yes)
41                 ;;
42             *)
43                 redis_lib_dir="$withval"
44                 ;;
45         esac])
46
47     dnl extra argument: --with-redis-dir=DIR
48     AC_ARG_WITH(redis-dir,
49         [AS_HELP_STRING([--with-redis-dir=DIR],
50                 [Base directory where redis is installed])],
51         [case "$withval" in
52             no)
53                 AC_MSG_ERROR(Need redis-dir)
54                 ;;
55             yes)
56                 ;;
57             *)
58                 redis_lib_dir="$withval/lib"
59                 redis_include_dir="$withval/include"
60                 ;;
61         esac])
62
63     dnl ############################################################
64     dnl # Check for programs
65     dnl ############################################################
66
67     AC_PROG_CC
68
69     dnl ############################################################
70     dnl # Check for header files
71     dnl ############################################################
72
73     smart_try_dir="${redis_include_dir}"
74     FR_SMART_CHECK_INCLUDE([hiredis/hiredis.h])
75     if test "x$ac_cv_header_hiredis_hiredis_h" != "xyes"; then
76       AC_MSG_WARN([hiredis headers not found. Use --with-redis-include-dir=<path>.])
77       fail="$fail hiredis.h"
78     fi
79
80     dnl ############################################################
81     dnl # Check for libraries
82     dnl ############################################################
83
84     smart_try_dir="$redis_lib_dir"
85     FR_SMART_CHECK_LIB(hiredis, redisConnect)
86     if test "x$ac_cv_lib_hiredis_redisConnect" != "xyes"
87     then
88       AC_MSG_WARN([hiredis libraries not found. Use --with-redis-lib-dir=<path>.])
89       fail="$fail libhiredis"
90     fi
91
92     targetname=modname
93 else
94     targetname=
95     echo \*\*\* module modname is disabled.
96 fi
97
98 dnl Don't change this section.
99 if test "x$fail" != x; then
100         if test "x${enable_strict_dependencies}" = xyes; then
101                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
102         else
103                 AC_MSG_WARN([silently not building ]modname[.])
104                 AC_MSG_WARN([FAILURE: ]modname[ requires:$fail.]);
105                 targetname=
106         fi
107 fi
108
109 mod_ldflags="$SMART_LIBS"
110 mod_cflags="$SMART_CPPFLAGS"
111 AC_SUBST(mod_ldflags)
112 AC_SUBST(mod_cflags)
113 AC_SUBST(targetname)
114 AC_OUTPUT(all.mk)