forked from wolfSSL/wolfssh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
327 lines (279 loc) · 11.5 KB
/
configure.ac
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# wolfssh
# Copyright (C) 2014-2024 wolfSSL Inc.
# All right reserved.
AC_COPYRIGHT([Copyright (C) 2014-2024 wolfSSL Inc.])
AC_INIT([wolfssh],[1.4.19],[[email protected]],[wolfssh],[https://www.wolfssl.com])
AC_PREREQ([2.63])
AC_CONFIG_AUX_DIR([build-aux])
: ${CFLAGS=""}
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
AC_ARG_PROGRAM
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
WOLFSSH_LIBRARY_VERSION=17:1:10
# | | |
# +-----+ | +----+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | +- set to zero if interfaces have been
# | | removed or changed
# | +- increment if source code has changed
# | +- set to zero if current is incremented
# +- increment if interfaces have been added, removed
# or changed
AC_SUBST([WOLFSSH_LIBRARY_VERSION])
LT_PREREQ([2.2])
LT_INIT([disable-static win32-dll])
gl_VISIBILITY
AS_IF([test -n "$CFLAG_VISIBILITY"],[AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"])
# silent
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
# Checks for type sizes.
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([off_t])
AC_TYPE_SIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINTPTR_T
# Check headers/libs
AC_CHECK_HEADERS([limits.h sys/select.h sys/time.h sys/ioctl.h pty.h util.h termios.h])
AC_CHECK_LIB([network],[socket])
AC_CHECK_LIB([util],[forkpty])
#wolfssl
AC_MSG_CHECKING([for wolfSSL])
if test "x$prefix" = "xNONE"
then
wcpath=$ac_default_prefix
else
wcpath=$prefix
fi
AC_MSG_NOTICE([prefix ${prefix}])
WOLFSSL_URL="http://www.wolfssl.com/download.html"
AC_ARG_WITH(wolfssl,
[AS_HELP_STRING([--with-wolfssl=PATH], [PATH to wolfssl install (default /usr/local)])],
[
if test "x$withval" != "xno" ; then
if test -d "${withval}/lib" && test -d "${withval}/include"; then
wcpath=${withval}
LDFLAGS="-L${wcpath}/lib $LDFLAGS"
CPPFLAGS="-I${wcpath}/include $CPPFLAGS"
else
AC_MSG_ERROR([wolfSSL path error (${withval}): missing lib and include])
fi
fi
]
)
AC_CHECK_LIB([wolfssl],[wolfCrypt_Init],,[AC_MSG_ERROR([libwolfssl is required for ${PACKAGE}. It can be obtained from https://www.wolfssl.com/download.html/ .])])
AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday inet_ntoa memset socket wc_ecc_set_rng])
AC_CHECK_DECLS([[pread],[pwrite]],,[unistd.h])
# DEBUG
DEBUG_CFLAGS="-g -O0"
DEBUG_CPPFLAGS="-DDEBUG -DDEBUG_WOLFSSH"
AX_DEBUG
AS_IF([test "x$ax_enable_debug" = "xyes"],
[AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"
AM_CPPFLAGS="$DEBUG_CPPFLAGS $AM_CPPFLAGS"],
[AM_CFLAGS="$AM_CFLAGS -O2"
AM_CPPFLAGS="-DNDEBUG $AM_CPPFLAGS"])
AX_PTHREAD([
AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
# If AX_PTHREAD is adding -Qunused-arguments, need to prepend with
# -Xcompiler libtool will use it. Newer versions of clang don't need
# the -Q flag when using pthreads.
AS_CASE([$PTHREAD_CFLAGS],[-Qunused-arguments*],[PTHREAD_CFLAGS="-Xcompiler $PTHREAD_CFLAGS"])
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"])
AX_AM_JOBSERVER([yes])
# Inline Build
AC_ARG_ENABLE([inline],
[AS_HELP_STRING([--disable-inline],[Disable inline functions (default: enabled)])],
[ENABLED_INLINE=$enableval],[ENABLED_INLINE=yes])
# Examples Build
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--disable-examples],[Disable examples (default: enabled)])],
[ENABLED_EXAMPLES=$enableval],[ENABLED_EXAMPLES=yes])
# Key Generation
AC_ARG_ENABLE([keygen],
[AS_HELP_STRING([--enable-keygen],[Enable key generation (default: disabled)])],
[ENABLED_KEYGEN=$enableval],[ENABLED_KEYGEN=no])
# SCP
AC_ARG_ENABLE([scp],
[AS_HELP_STRING([--enable-scp],[Enable scp support (default: disabled)])],
[ENABLED_SCP=$enableval],[ENABLED_SCP=no])
# SFTP
AC_ARG_ENABLE([sftp],
[AS_HELP_STRING([--enable-sftp],[Enable SFTP support (default: disabled)])],
[ENABLED_SFTP=$enableval],[ENABLED_SFTP=no])
# SSHD
AC_ARG_ENABLE([sshd],
[AS_HELP_STRING([--enable-sshd],[Enable SSHD support (default: disabled)])],
[ENABLED_SSHD=$enableval],[ENABLED_SSHD=no])
# SSH Client
AC_ARG_ENABLE([sshclient],
[AS_HELP_STRING([--enable-sshclient],[Enable SSH client app (default: disabled)])],
[ENABLED_SSHCLIENT=$enableval],[ENABLED_SSHCLIENT=no])
# TCP/IP Forwarding
AC_ARG_ENABLE([fwd],
[AS_HELP_STRING([--enable-fwd],[Enable TCP/IP Forwarding support (default: disabled)])],
[ENABLED_FWD=$enableval],[ENABLED_FWD=no])
# pseudo-terminal
AC_ARG_ENABLE([term],
[AS_HELP_STRING([--disable-term],[Disable pseudo-terminal support (default: enabled)])],
[ENABLED_TERM=$enableval],[ENABLED_TERM=yes])
# shell support
AC_ARG_ENABLE([shell],
[AS_HELP_STRING([--enable-shell],[Enable echoserver shell support (default: disabled)])],
[ENABLED_SHELL=$enableval],[ENABLED_SHELL=no])
# ssh-agent
AC_ARG_ENABLE([agent],
[AS_HELP_STRING([--enable-agent],[Enable ssh-agent support (default: disabled)])],
[ENABLED_AGENT=$enableval],[ENABLED_AGENT=no])
# X.509 certs
AC_ARG_ENABLE([certs],
[AS_HELP_STRING([--enable-certs],[Enable X.509 cert support (default: disabled)])],
[ENABLED_CERTS=$enableval],[ENABLED_CERTS=no])
# smallstack
AC_ARG_ENABLE([smallstack],
[AS_HELP_STRING([--enable-smallstack],[Enable small stack (default: disabled)])],
[ENABLED_SMALLSTACK=$enableval],[ENABLED_SMALLSTACK=no])
# use PAM lib
AC_ARG_WITH([pam],
[AS_HELP_STRING([--with-pam=PATH],[PATH to directory with the PAM library])],
[PAM_LIB=$withval],
[PAM_LIB=""])
# Enable All
AC_ARG_ENABLE([all],
[AS_HELP_STRING([--enable-all],[Enable all wolfSSH features (default: disabled)])],
[ENABLED_ALL=$enableval],[ENABLED_ALL=no])
# Distro build
AC_ARG_ENABLE([distro],
[AS_HELP_STRING([--enable-distro],[Enable wolfSSH distro build (default: disabled)])],
[ENABLED_DISTRO=$enableval],[ENABLED_DISTRO=no])
# Update the ENABLED flags for options that affect other options.
AS_IF([test "x$ENABLED_DISTRO" = "xyes"],
[ENABLED_ALL=yes; enable_shared=yes; enable_static=yes])
AS_IF([test "x$ENABLED_ALL" = "xyes"],
[ENABLED_KEYGEN=yes; ENABLED_SCP=yes; ENABLED_SFTP=yes; ENABLED_FWD=yes; ENABLED_SHELL=yes; ENABLED_AGENT=yes; ENABLED_SSHD=yes; ENABLED_SSHCLIENT=yes; ENABLED_CERTS=yes])
AS_IF([test "x$ENABLED_SSHD" = "xyes"],
[ENABLED_SHELL=yes])
# Set the defined flags for the code.
AS_IF([test "x$ENABLED_INLINE" = "xno"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DNO_INLINE"])
AS_IF([test "x$ENABLED_KEYGEN" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_KEYGEN"])
AS_IF([test "x$ENABLED_SCP" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SCP"])
AS_IF([test "x$ENABLED_SFTP" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SFTP"])
AS_IF([test "x$ENABLED_FWD" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_FWD"])
AS_IF([test "x$ENABLED_TERM" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_TERM"])
AS_IF([test "x$ENABLED_SHELL" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SHELL"])
AS_IF([test "x$ENABLED_AGENT" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_AGENT"])
AS_IF([test "x$ENABLED_CERTS" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_CERTS"])
AS_IF([test "x$ENABLED_SMALLSTACK" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SMALL_STACK"])
AS_IF([test "x$ENABLED_SSHD" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SSHD"])
AS_IF([test "x$ENABLED_SSHCLIENT" = "xyes"],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_SSHCLIENT"])
if test "$ENABLED_SSHD" = "yes"; then
if test -n "$PAM_LIB"
then
AC_MSG_CHECKING([for directory $PAM_LIB])
if ! test -d "$PAM_LIB"
then
AC_MSG_ERROR([PAM lib dir $PAM_LIB not found.])
fi
AC_MSG_RESULT([yes])
AM_LDFLAGS="-L$PAM_LIB $AM_LDFLAGS"
LIBS="$LIBS -lpam"
AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_USE_PAM"
#TODO check on link to lib
#AC_CHECK_LIB([pam], [pam],
# [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_USE_PAM"; LIBS="$LIBS -lpam"],
# [AC_MSG_ERROR(libpam not found)])
else
case $host in
*qnx*)
# QNX uses liblogin for crypt operation
AC_CHECK_LIB([login], [login],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_HAVE_LIBLOGIN";
LIBS="$LIBS -llogin"],
[AC_MSG_ERROR(liblogin not found)])
;;
*darwin*)
AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_HAVE_LIBCRYPT"
;;
*)
AC_CHECK_LIB([crypt], [crypt],
[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSH_HAVE_LIBCRYPT";
LIBS="$LIBS -lcrypt"],
[AC_MSG_ERROR(libcrypt not found)])
esac
fi
fi
# Set the automake conditionals.
AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes"])
AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
AM_CONDITIONAL([BUILD_INLINE],[test "x$ENABLED_INLINE" = "xyes"])
AM_CONDITIONAL([BUILD_KEYGEN],[test "x$ENABLED_KEYGEN" = "xyes"])
AM_CONDITIONAL([BUILD_SCP],[test "x$ENABLED_SCP" = "xyes"])
AM_CONDITIONAL([BUILD_SFTP],[test "x$ENABLED_SFTP" = "xyes"])
AM_CONDITIONAL([BUILD_FWD],[test "x$ENABLED_FWD" = "xyes"])
AM_CONDITIONAL([BUILD_TERM],[test "x$ENABLED_TERM" = "xyes"])
AM_CONDITIONAL([BUILD_SHELL],[test "x$ENABLED_SHELL" = "xyes"])
AM_CONDITIONAL([BUILD_AGENT],[test "x$ENABLED_AGENT" = "xyes"])
AM_CONDITIONAL([BUILD_SSHD],[test "x$ENABLED_SSHD" = "xyes"])
AM_CONDITIONAL([BUILD_SSHCLIENT],[test "x$ENABLED_SSHCLIENT" = "xyes"])
AM_CONDITIONAL([BUILD_CERTS],[test "x$ENABLED_CERTS" = "xyes"])
AX_HARDEN_CC_COMPILER_FLAGS
CREATE_HEX_VERSION
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])
# FINAL
AC_CONFIG_FILES([Makefile wolfssh/version.h])
AX_CREATE_GENERIC_CONFIG
AC_OUTPUT
# force make clean
AS_ECHO(["---"])
AS_ECHO(["Running make clean..."])
make clean >/dev/null 2>&1
# output config summary
AS_ECHO(["---"])
AS_ECHO(["Configuration summary for $PACKAGE_NAME version $VERSION"])
AS_ECHO
AS_ECHO([" * Installation prefix: $prefix"])
AS_ECHO([" * System type: $host_vendor-$host_os"])
AS_ECHO([" * Host CPU: $host_cpu"])
AS_ECHO([" * C Compiler: $CC"])
AS_ECHO([" * C Flags: $CFLAGS"])
AS_ECHO([" * CPP Flags: $CPPFLAGS"])
AS_ECHO([" * Linker Flags: $LDFLAGS"])
AS_ECHO
AS_ECHO([" Features"])
AS_ECHO([" * Inline Code: $ENABLED_INLINE"])
AS_ECHO([" * Small stack: $ENABLED_SMALLSTACK"])
AS_ECHO([" * keygen: $ENABLED_KEYGEN"])
AS_ECHO([" * psuedo-terminal: $ENABLED_TERM"])
AS_ECHO([" * echoserver shell support: $ENABLED_SHELL"])
AS_ECHO([" * scp: $ENABLED_SCP"])
AS_ECHO([" * sftp: $ENABLED_SFTP"])
AS_ECHO([" * sshd: $ENABLED_SSHD"])
AS_ECHO([" * ssh client: $ENABLED_SSHCLIENT"])
AS_ECHO([" * agent: $ENABLED_AGENT"])
AS_ECHO([" * TCP/IP Forwarding: $ENABLED_FWD"])
AS_ECHO([" * X.509 Certs: $ENABLED_CERTS"])
AS_ECHO([" * Examples: $ENABLED_EXAMPLES"])