aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/acinclude.m4
blob: cc01489ade5b69847b671e8388eb3f225f26502a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#
#   Tiny RADIUS Client Library
#   Copyright (C) 2021 David M. Syzdek <david@syzdek.net>.
#   All rights reserved.
#
#   Redistribution and use in source and binary forms, with or without
#   modification, are permitted provided that the following conditions are
#   met:
#
#      * Redistributions of source code must retain the above copyright
#        notice, this list of conditions and the following disclaimer.
#      * Redistributions in binary form must reproduce the above copyright
#        notice, this list of conditions and the following disclaimer in the
#        documentation and/or other materials provided with the distribution.
#      * Neither the name of David M. Syzdek nor the
#        names of its contributors may be used to endorse or promote products
#        derived from this software without specific prior written permission.
#
#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
#   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR
#   ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
#   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
#   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
#   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
#
#   acinclude.m4 - custom m4 macros used by configure.ac
#

# AC_TINYRAD_COMMON()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_COMMON],[dnl

   # prerequists
   AC_REQUIRE([AC_TINYRAD_DOCUMENTATION])
   AC_REQUIRE([AC_TINYRAD_LIBTINYRAD])
   AC_REQUIRE([AC_TINYRAD_TINYRAD])
   AC_REQUIRE([AC_TINYRAD_TINYRAD_URL])
   AC_REQUIRE([AC_TINYRAD_TINYRADPROXY])

   ENABLE_TINYRAD_COMMON="no"
   if   test "x${ENABLE_DOCUMENATION}" = "xyes";then ENABLE_TINYRAD_COMMON="yes"
   elif test "x${ENABLE_LIBTINYRAD}"   = "xyes";then ENABLE_TINYRAD_COMMON="yes"
   elif test "x${ENABLE_TINYRAD}"      = "xyes";then ENABLE_TINYRAD_COMMON="yes"
   elif test "x${ENABLE_TINYRAD_URL}"  = "xyes";then ENABLE_TINYRAD_COMMON="yes"
   elif test "x${ENABLE_TINYRADPROXY}" = "xyes";then ENABLE_TINYRAD_COMMON="yes"
   fi;

   AM_CONDITIONAL([ENABLE_TINYRAD_COMMON],  [test "$ENABLE_TINYRAD_COMMON" = "yes"])
   AM_CONDITIONAL([DISABLE_TINYRAD_COMMON], [test "$ENABLE_TINYRAD_COMMON" = "no"])
])dnl


# AC_TINYRAD_DOCUMENTATION()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_DOCUMENTATION],[dnl
   enableval=""
   AC_ARG_ENABLE(
      documentation,
      [AS_HELP_STRING([--enable-documentation], [install extra documentation])],
      [ EDOCUMENATION=$enableval ],
      [ EDOCUMENATION=$enableval ]
   )

   if test "x${EDOCUMENATION}" == "xyes";then
      ENABLE_DOCUMENATION="yes"
   else
      ENABLE_DOCUMENATION="no"
   fi

   AM_CONDITIONAL([ENABLE_DOCUMENATION],  [test "$ENABLE_DOCUMENATION" = "yes"])
   AM_CONDITIONAL([DISABLE_DOCUMENATION], [test "$ENABLE_DOCUMENATION" = "no"])
])dnl


# AC_TINYRAD_EXAMPLES()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_EXAMPLES],[dnl
   enableval=""
   AC_ARG_ENABLE(
      examples,
      [AS_HELP_STRING([--enable-examples], [build tinyrad examples])],
      [ EEXAMPLES=$enableval ],
      [ EEXAMPLES=$enableval ]
   )

   if test "x${EEXAMPLES}" == "xyes";then
      ENABLE_EXAMPLES="yes"
   else
      ENABLE_EXAMPLES="no"
   fi

   AM_CONDITIONAL([ENABLE_EXAMPLES],  [test "$ENABLE_EXAMPLES" = "yes"])
   AM_CONDITIONAL([DISABLE_EXAMPLES], [test "$ENABLE_EXAMPLES" = "no"])
])dnl


# AC_TINYRAD_IPV4
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_IPV4],[dnl
   WITH_IPV4=yes
   AM_CONDITIONAL([WITH_IPV4],    [test "${WITH_IPV4}" == "yes"])
   AM_CONDITIONAL([WITHOUT_IPV4], [test "${WITH_IPV4}" != "yes"])
])dnl


# AC_TINYRAD_IPV6
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_IPV6],[dnl

   # prerequists
   AC_REQUIRE([AC_PROG_CC])

   enableval=""
   AC_ARG_WITH(
      ipv6,
      [AS_HELP_STRING([--without-ipv6], [disable IPv6 support])],
      [ WIPV6=$enableval ],
      [ WIPV6=$enableval ]
   )

   HAVE_IPV6=yes
   AC_MSG_CHECKING(for working IPv6 support)
   AC_COMPILE_IFELSE(
      [
         AC_LANG_PROGRAM(
            [[ #include <sys/types.h>
               #include <netinet/in.h>
               #include <sys/socket.h>
               #include <netdb.h>
            ]],
            [[ struct sockaddr_in6  a;
               struct addrinfo      hints;
               a.sin6_family  = AF_INET6;
               a.sin6_family  = PF_INET6;
               hints.ai_flags = AI_V4MAPPED|AI_ALL;
            ]]
         )
      ],
      [],
      [HAVE_IPV6="no"]
   )
   AC_MSG_RESULT($HAVE_IPV6)

   WITH_IPV6=yes
   if test "x${WIPV6}" = "xno";then
      WITH_IPV6=no
   elif test "x${WIPV6}" = "x";then
      WITH_IPV6=${HAVE_IPV6}
   else
      if test "x${HAVE_IPV6}" = "xno";then
         AC_MSG_ERROR([unable to determine IPv6 support])
      fi
   fi

   if test "x${WITH_IPV6}" == "xno";then
      AC_DEFINE_UNQUOTED(WITHOUT_IPV6, 1, [Disable IPv6])
   fi
   AM_CONDITIONAL([WITH_IPV6],    [test "${WITH_IPV6}" == "yes"])
   AM_CONDITIONAL([WITHOUT_IPV6], [test "${WITH_IPV6}" != "yes"])
])dnl


# AC_TINYRAD_LIBTINYRAD()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_LIBTINYRAD],[dnl
   enableval=""
   AC_ARG_ENABLE(
      libtinyrad,
      [AS_HELP_STRING([--disable-libtinyrad], [disable tinyrad library])],
      [ ELIBTINYRAD=$enableval ],
      [ ELIBTINYRAD=$enableval ]
   )
   if test "x${ELIBTINYRAD}" != "xno";then
      ENABLE_LIBTINYRAD="yes"
   else
      ENABLE_LIBTINYRAD="no"
   fi
   AM_CONDITIONAL([ENABLE_LIBTINYRAD],  [test "$ENABLE_LIBTINYRAD" = "yes"])
   AM_CONDITIONAL([DISABLE_LIBTINYRAD], [test "$ENABLE_LIBTINYRAD" = "no"])
])dnl


# AC_TINYRAD_TINYRAD()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_TINYRAD],[dnl

   AC_REQUIRE([AC_TINYRAD_UTILITIES])

   enableval=""
   AC_ARG_ENABLE(
      tinyrad,
      [AS_HELP_STRING([--disable-tinyrad], [disable tinyrad client])],
      [ ETINYRAD=$enableval ],
      [ ETINYRAD=$enableval ]
   )

   if test "x${ETINYRAD}" == "xyes";then
      ENABLE_TINYRAD="yes"
   elif test "x${ETINYRAD}" == "xno";then
      ENABLE_TINYRAD="no"
   elif test "x${ENABLE_UTILITIES}" == "xyes";then
      ENABLE_TINYRAD="yes"
   elif test "x${ENABLE_UTILITIES}" == "xno";then
      ENABLE_TINYRAD="no"
   else
      ENABLE_TINYRAD="yes"
   fi

   AM_CONDITIONAL([ENABLE_TINYRAD],  [test "$ENABLE_TINYRAD" = "yes"])
   AM_CONDITIONAL([DISABLE_TINYRAD], [test "$ENABLE_TINYRAD" = "no"])
])dnl


# AC_TINYRAD_TINYRAD_URL()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_TINYRAD_URL],[dnl

   AC_REQUIRE([AC_TINYRAD_UTILITIES])

   enableval=""
   AC_ARG_ENABLE(
      tinyrad-url,
      [AS_HELP_STRING([--enable-tinyrad-url], [enable tinyrad-url utility])],
      [ ETINYRADURL=$enableval ],
      [ ETINYRADURL=$enableval ]
   )

   if test "x${ETINYRADURL}" == "xyes";then
      ENABLE_TINYRAD_URL="yes"
   elif test "x${ETINYRADURL}" == "xno";then
      ENABLE_TINYRAD_URL="no"
   elif test "x${ENABLE_UTILITIES}" == "xyes";then
      ENABLE_TINYRAD_URL="yes"
   elif test "x${ENABLE_UTILITIES}" == "xno";then
      ENABLE_TINYRAD_URL="no"
   else
      ENABLE_TINYRAD_URL="no"
   fi

   AM_CONDITIONAL([ENABLE_TINYRAD_URL],  [test "$ENABLE_TINYRAD_URL" = "yes"])
   AM_CONDITIONAL([DISABLE_TINYRAD_URL], [test "$ENABLE_TINYRAD_URL" = "no"])
])dnl


# AC_TINYRAD_TINYRADPROXY()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_TINYRADPROXY],[dnl

   AC_REQUIRE([AC_TINYRAD_UTILITIES])

   enableval=""
   AC_ARG_ENABLE(
      tinyradproxy,
      [AS_HELP_STRING([--enable-tinyradproxy], [enable tinyrad proxy])],
      [ ETINYRADPROXY=$enableval ],
      [ ETINYRADPROXY=$enableval ]
   )

   if test "x${ETINYRADPROXY}" == "xyes";then
      ENABLE_TINYRADPROXY="yes"
   elif test "x${ETINYRADPROXY}" == "xno";then
      ENABLE_TINYRADPROXY="no"
   elif test "x${ENABLE_UTILITIES}" == "xyes";then
      ENABLE_TINYRADPROXY="yes"
   elif test "x${ENABLE_UTILITIES}" == "xno";then
      ENABLE_TINYRADPROXY="no"
   else
      ENABLE_TINYRADPROXY="no"
   fi

   AM_CONDITIONAL([ENABLE_TINYRADPROXY],  [test "$ENABLE_TINYRADPROXY" = "yes"])
   AM_CONDITIONAL([DISABLE_TINYRADPROXY], [test "$ENABLE_TINYRADPROXY" = "no"])
])dnl


# AC_TINYRAD_UTILITIES()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYRAD_UTILITIES],[dnl
   enableval=""
   AC_ARG_ENABLE(
      utilities,
      [AS_HELP_STRING([--enable-utilities], [enable all RADIUS utility])],
      [ EUTILITIES=$enableval ],
      [ EUTILITIES=$enableval ]
   )
   if test "x${EUTILITIES}" == "xyes";then
      ENABLE_UTILITIES="yes"
   elif test "x${EUTILITIES}" == "xno";then
      ENABLE_UTILITIES="no"
   else
      ENABLE_UTILITIES="auto"
   fi
])dnl

# end of m4 file