aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/acinclude.m4
blob: b262f1c6937a5fc550a750994c9dfaf15078e7a9 (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
#
#   Tiny TACACS+ Client Library
#   Copyright (C) 2022 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_TINYTAC_DOCUMENTATION()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYTAC_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_TINYTAC_EXAMPLES()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYTAC_EXAMPLES],[dnl
   enableval=""
   AC_ARG_ENABLE(
      examples,
      [AS_HELP_STRING([--enable-examples], [build TinyTac 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_TINYTAC_IPV4
# ______________________________________________________________________________
AC_DEFUN([AC_TINYTAC_IPV4],[dnl
   WITH_IPV4=yes
   AM_CONDITIONAL([WITH_IPV4],    [test "${WITH_IPV4}" == "yes"])
   AM_CONDITIONAL([WITHOUT_IPV4], [test "${WITH_IPV4}" != "yes"])
])dnl


# AC_TINYTAC_IPV6
# ______________________________________________________________________________
AC_DEFUN([AC_TINYTAC_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_TINYTAC_LIBTINYTAC()
# ______________________________________________________________________________
AC_DEFUN([AC_TINYTAC_LIBTINYTAC],[dnl
   enableval=""
   AC_ARG_ENABLE(
      libtinytac,
      [AS_HELP_STRING([--disable-libtinytac], [disable TinyTac library])],
      [ ELIBTINYTAC=$enableval ],
      [ ELIBTINYTAC=$enableval ]
   )
   if test "x${ELIBTINYTAC}" != "xno";then
      ENABLE_LIBTINYTAC="yes"
   else
      ENABLE_LIBTINYTAC="no"
   fi
   AM_CONDITIONAL([ENABLE_LIBTINYTAC],  [test "$ENABLE_LIBTINYTAC" = "yes"])
   AM_CONDITIONAL([DISABLE_LIBTINYTAC], [test "$ENABLE_LIBTINYTAC" = "no"])
])dnl


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

   HAVE_OPENSSL=yes
   AC_CHECK_HEADERS( [openssl/evp.h],                     [], [HAVE_OPENSSL=no] )
   AC_SEARCH_LIBS(   [EVP_md5],                 [crypto], [], [HAVE_OPENSSL=no], [] )
   AC_SEARCH_LIBS(   [EVP_Digest],              [crypto], [], [HAVE_OPENSSL=no], [] )
   AC_SEARCH_LIBS(   [EVP_DigestInit_ex],       [crypto], [], [HAVE_OPENSSL=no], [] )
   AC_SEARCH_LIBS(   [EVP_DigestUpdate],        [crypto], [], [HAVE_OPENSSL=no], [] )
   AC_SEARCH_LIBS(   [EVP_DigestFinal_ex],      [crypto], [], [HAVE_OPENSSL=no], [] )
   AC_SEARCH_LIBS(
      [EVP_MD_CTX_new],
      [crypto],
      [],
      [AC_SEARCH_LIBS(
         [EVP_MD_CTX_create],
         [crypto],
         [AC_DEFINE_UNQUOTED([EVP_MD_CTX_new], [EVP_MD_CTX_create], [map new function name to legacy name])],
         [HAVE_OPENSSL=no],
         []
      )],
      []
   )
   AC_SEARCH_LIBS(
      [EVP_MD_CTX_free],
      [crypto],
      [],
      [AC_SEARCH_LIBS(
         [EVP_MD_CTX_destroy],
         [crypto],
         [AC_DEFINE_UNQUOTED([EVP_MD_CTX_free], [EVP_MD_CTX_destroy], [map new function name to legacy name])],
         [HAVE_OPENSSL=no],
         []
      )],
      []
   )

   if test "x${HAVE_OPENSSL}" != "xyes";then
      AC_MSG_ERROR([unable to find OpenSSL])
   fi
])dnl



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

   enableval=""
   AC_ARG_ENABLE(
      tinytac,
      [AS_HELP_STRING([--disable-tinytac], [disable TinyTac client])],
      [ ETINYTAC=$enableval ],
      [ ETINYTAC=$enableval ]
   )

   if test "x${ETINYTAC}" == "xyes";then
      ENABLE_TINYTAC="yes"
   elif test "x${ETINYTAC}" == "xno";then
      ENABLE_TINYTAC="no"
   else
      ENABLE_TINYTAC="yes"
   fi

   AM_CONDITIONAL([ENABLE_TINYTAC],  [test "$ENABLE_TINYTAC" = "yes"])
   AM_CONDITIONAL([DISABLE_TINYTAC], [test "$ENABLE_TINYTAC" = "no"])
])dnl

# end of m4 file