Fix build when building on OSX, using non standard libssl, and a non standard version...
[freeradius.git] / src / modules / rlm_yubikey / configure.ac
1 AC_PREREQ([2.53])
2 AC_INIT(rlm_yubikey.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_yubikey])
5
6 if test x$with_[]modname != xno; then
7     dnl ############################################################
8     dnl # Check for command line options
9     dnl ############################################################
10
11     dnl ############################################################
12     dnl # Yubikey options
13     dnl ############################################################
14
15     dnl extra argument: --with-yubikey-include-dir=DIR
16     yubikey_include_dir=
17     AC_ARG_WITH(yubikey-include-dir,
18         [AS_HELP_STRING([--with-yubikey-include-dir=DIR],
19                 [Directory where the yubikey includes may be found])],
20         [case "$withval" in
21             no)
22                 AC_MSG_ERROR(Need yubikey-include-dir)
23                 ;;
24             yes)
25                 ;;
26             *)
27                 yubikey_include_dir="$withval"
28                 ;;
29         esac])
30
31     dnl extra argument: --with-yubikey-lib-dir=DIR
32     yubikey_lib_dir=
33     AC_ARG_WITH(yubikey-lib-dir,
34         [AS_HELP_STRING([--with-yubikey-lib-dir=DIR],
35                 [Directory where the yubikey libraries may be found])],
36         [case "$withval" in
37             no)
38                 AC_MSG_ERROR(Need yubikey-lib-dir)
39                 ;;
40             yes)
41                 ;;
42             *)
43                 yubikey_lib_dir="$withval"
44                 ;;
45         esac])
46
47     dnl extra argument: --with-yubikey-dir=DIR
48     AC_ARG_WITH(yubikey-dir,
49         [AS_HELP_STRING([--with-yubikey-dir=DIR],
50                 [Base directory where yubikey is installed])],
51         [case "$withval" in
52             no)
53                 AC_MSG_ERROR(Need yubikey-dir)
54                 ;;
55             yes)
56                 ;;
57             *)
58                 yubikey_lib_dir="$withval/lib"
59                 yubikey_include_dir="$withval/include"
60                 ;;
61         esac])
62
63     dnl ############################################################
64     dnl # Ykclient options
65     dnl ############################################################
66
67     dnl extra argument: --with-ykclient-include-dir=DIR
68     ykclient_include_dir=
69     AC_ARG_WITH(ykclient-include-dir,
70         [AS_HELP_STRING([--with-ykclient-include-dir=DIR],
71                 [Directory where the ykclient includes may be found])],
72         [case "$withval" in
73             no)
74                 AC_MSG_ERROR(Need ykclient-include-dir)
75                 ;;
76             yes)
77                 ;;
78             *)
79                 ykclient_include_dir="$withval"
80                 ;;
81         esac])
82
83     dnl extra argument: --with-ykclient-lib-dir=DIR
84     ykclient_lib_dir=
85     AC_ARG_WITH(ykclient-lib-dir,
86         [AS_HELP_STRING([--with-ykclient-lib-dir=DIR],
87                 [Directory where the ykclient libraries may be found])],
88         [case "$withval" in
89             no)
90                 AC_MSG_ERROR(Need ykclient-lib-dir)
91                 ;;
92             yes)
93                 ;;
94             *)
95                 ykclient_lib_dir="$withval"
96                 ;;
97         esac])
98
99     dnl extra argument: --with-ykclient-dir=DIR
100     AC_ARG_WITH(ykclient-dir,
101         [AS_HELP_STRING([--with-ykclient-dir=DIR],
102                 [Base directory where ykclient is installed])],
103         [case "$withval" in
104             no)
105                 AC_MSG_ERROR(Need ykclient-dir)
106                 ;;
107             yes)
108                 ;;
109             *)
110                 ykclient_lib_dir="$withval/lib"
111                 ykclient_include_dir="$withval/include"
112                 ;;
113         esac])
114
115     dnl ############################################################
116     dnl # Check for yubikey header files (optional)
117     dnl ############################################################
118
119     have_yubikey="yes"
120     smart_try_dir="$yubikey_include_dir"
121     FR_SMART_CHECK_INCLUDE(yubikey.h)
122     if test "x$ac_cv_header_yubikey_h" != "xyes"; then
123         have_ykclient="no"
124         AC_MSG_WARN([yubikey headers not found. Use --with-yubikey-include-dir=<path>.])
125     fi
126
127     dnl ############################################################
128     dnl # Check for yubikey libraries (optional)
129     dnl ############################################################
130
131     dnl try to link to yubikey
132     smart_try_dir="$yubikey_lib_dir"
133     FR_SMART_CHECK_LIB(yubikey, yubikey_aes_decrypt)
134     if test "x$ac_cv_lib_yubikey_yubikey_aes_decrypt" != "xyes"; then
135         have_yubikey="no"
136         AC_MSG_WARN([yubikey libraries not found. Use --with-yubikey-lib-dir=<path>.])
137     fi
138
139     if test "x$have_yubikey" = "xyes"; then
140         AC_DEFINE([HAVE_YUBIKEY],[1],[Build with yubikey token decryption support support from yubikey])
141     else
142         AC_MSG_WARN([silently building without yubikey token decryption support. requires: yubikey])
143     fi
144
145     dnl ############################################################
146     dnl # Check for ykclient header files (optional)
147     dnl ############################################################
148
149     have_ykclient="yes"
150     smart_try_dir="$ykclient_include_dir"
151     FR_SMART_CHECK_INCLUDE([ykclient.h])
152     if test "x$ac_cv_header_ykclient_h" != "xyes"; then
153         have_ykclient="no"
154         AC_MSG_WARN([ykclient headers not found. Use --with-ykclient-include-dir=<path>.])
155     fi
156
157     dnl ############################################################
158     dnl # Check for ykclient libraries (optional)
159     dnl ############################################################
160
161     smart_try_dir="$ykclient_lib_dir"
162     FR_SMART_CHECK_LIB([ykclient], [ykclient_request_process])
163     if test "x$ac_cv_lib_ykclient_ykclient_request_process" != "xyes"; then
164         have_ykclient="no"
165         FR_SMART_CHECK_LIB([ykclient], [ykclient_request])
166         if test "x$ac_cv_lib_ykclient_ykclient_request" == "xyes"; then
167             AC_MSG_WARN([libykclient missing ykclient_request_process. A later version of libykclient is required.])
168         else
169             AC_MSG_WARN([ykclient libraries not found. Use --with-ykclient-lib-dir=<path>.])
170         fi
171     fi
172
173     if test "x$have_ykclient" = "xyes"; then
174         AC_DEFINE([HAVE_YKCLIENT],[1],[Build with yubicloud support from ykclient])
175     else
176         AC_MSG_WARN([silently building without yubicloud support. requires: ykclient])
177     fi
178
179     targetname=modname
180 else
181     targetname=
182     echo \*\*\* module modname is disabled.
183 fi
184
185 dnl  Don't change this section.
186 if test x"$fail" != x""; then
187     if test x"${enable_strict_dependencies}" = x"yes"; then
188         AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
189     else
190         AC_MSG_WARN([silently not building ]modname[.])
191         AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
192         targetname=""
193     fi
194 fi
195
196 mod_ldflags="$SMART_LIBS"
197 mod_cflags="$SMART_CPPFLAGS"
198
199 AC_SUBST(mod_cflags)
200 AC_SUBST(mod_ldflags)
201 AC_SUBST(targetname)
202 AC_CONFIG_HEADER(config.h)
203 AC_OUTPUT(all.mk)