-
Notifications
You must be signed in to change notification settings - Fork 107
/
configure.ac
232 lines (218 loc) · 6.03 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.71])
AC_INIT([carbon-c-relay],[3.8.1],[])
AC_SUBST([RELEASEDATE], [2024-04-28])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE([enable])
AC_CONFIG_MACRO_DIRS([m4])
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
# Checks for libraries.
AC_SEARCH_LIBS([sqrt], [m])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket])
saveLIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([pthread_create], [pthread])
if test "x$LIBS" != x ; then
# compiler knows best, really
LIBS="-pthread"
fi
LIBS="$saveLIBS $LIBS"
# Checks for header files.
AC_CHECK_HEADERS([\
arpa/inet.h \
assert.h \
errno.h \
fcntl.h \
glob.h \
math.h \
netdb.h \
netinet/in.h \
netinet/tcp.h \
poll.h \
pthread.h \
regex.h \
signal.h \
stdarg.h \
stdio.h \
stdlib.h \
string.h \
sys/resource.h \
sys/socket.h \
sys/stat.h \
sys/time.h \
sys/types.h \
sys/uio.h \
sys/un.h \
time.h \
unistd.h \
],
[],
[AC_MSG_ERROR([required header missing])])
# non-mandatory headers
AC_CHECK_HEADERS_ONCE([\
dispatch/dispatch.h \
semaphore.h \
])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([\
gethostname \
gettimeofday \
localtime_r \
memmove \
memset \
pow \
regcomp \
socket \
sqrt \
strchr \
strdup \
strerror \
strstr \
strtol \
],
[],
[AC_MSG_ERROR([required function missing])])
AC_ARG_WITH([gzip], [support gzip compression for sending/receiving],
[], [with_gzip=check])
LIBGZIP=
AS_IF([test "x$with_gzip" != xno],
[AC_CHECK_HEADERS([zlib.h], [], [LIBGZIP=_missing_header])
AC_CHECK_LIB([z${LIBGZIP}], [gzopen],
[AC_SUBST([LIBGZIP], [-lz])
AC_DEFINE([HAVE_GZIP], [1], [Define if you have gzip])
],
[if test "x$with_gzip" != xcheck; then
AC_MSG_FAILURE(
[--with-gzip was given, but test for gzip failed])
fi
LIBGZIP=
]
)])
AC_ARG_WITH([lz4], [support lz4 compression for sending/receiving],
[], [with_lz4=check])
LIBLZ4=
AS_IF([test "x$with_lz4" != xno],
[AC_CHECK_HEADERS([lz4.h lz4frame.h], [], [LIBLZ4=_missing_header])
AC_CHECK_LIB([lz4${LIBLZ4}], [LZ4_createStream],
[AC_SUBST([LIBLZ4], [-llz4])
AC_DEFINE([HAVE_LZ4], [1], [Define if you have lz4])
],
[if test "x$with_lz4" != xcheck; then
AC_MSG_FAILURE(
[--with-lz4 was given, but test for lz4 failed])
fi
LIBLZ4=
]
)])
AC_ARG_WITH([snappy], [support snappy compression for sending/receiving],
[], [with_snappy=check])
LIBSNAPPY=
AS_IF([test "x$with_snappy" != xno],
[AC_CHECK_HEADERS([snappy-c.h], [], [LIBSNAPPY=_missing_header])
AC_CHECK_LIB([snappy${LIBSNAPPY}], [snappy_compress],
[AC_SUBST([LIBSNAPPY], [-lsnappy])
AC_DEFINE([HAVE_SNAPPY], [1], [Define if you have snappy])
],
[if test "x$with_snappy" != xcheck; then
AC_MSG_FAILURE(
[--with-snappy was given, but test for snappy failed])
fi
LIBSNAPPY=
]
)])
AC_ARG_WITH([ssl], [support ssl encryption for sending/receiving],
[], [with_ssl=check])
LIBSSL=
AS_IF([test "x$with_ssl" != xno],
[AC_CHECK_HEADERS([openssl/err.h \
openssl/ssl.h], [], [LIBSSL=_missing_header])
AC_CHECK_LIB([ssl${LIBSSL}], [SSL_connect],
[LIBSSL="-lssl"
AC_DEFINE([HAVE_SSL], [1], [Define if you have ssl])
AC_CHECK_LIB([crypto],
[ERR_reason_error_string],
[LIBSSL="${LIBSSL} -lcrypto"],
[])
AC_SUBST([LIBSSL], ["${LIBSSL}"])
],
[if test "x$with_ssl" != xcheck; then
AC_MSG_FAILURE(
[--with-ssl was given, but test for ssl failed])
fi
LIBSSL=
]
)])
AM_CONDITIONAL([SSL_ENABLED], [test "x$LIBSSL" != x])
# SSL-related funcs
save_LIBS="${LIBS}"
test "x$LIBSSL" != x && LIBS="${LIBS} ${LIBSSL}"
AC_CHECK_FUNCS([TLS_server_method \
SSLv23_server_method \
SSL_CTX_set_cipher_list \
SSL_CTX_set_ciphersuites],
[], [])
LIBS="${save_LIBS}"
AC_ARG_WITH([oniguruma], [use oniguruma regex library],
[], [with_oniguruma=check])
LIBONIGURUMA=
AS_IF([test "x$with_oniguruma" != xno],
[AC_CHECK_HEADERS([onigposix.h], [], [LIBONIGURUMA=_missing_header])
AC_CHECK_LIB([onig${LIBONIGURUMA}], [regexec],
[LIBONIGURUMA="-lonig"
AC_DEFINE([HAVE_ONIGURAMA], [1],
[Define if you have oniguruma])
AC_SUBST([LIBONIGURUMA], ["${LIBONIGURUMA}"])
],
[if test "x$with_oniguruma" != xcheck; then
AC_MSG_FAILURE(
[--with-oniguruma was given, but test for oniguruma failed])
fi
LIBONIGURUMA=
]
)])
AC_ARG_WITH([pcre2], [use pcre2 regex library],
[], [with_pcre2=check])
LIBPCRE2=
AS_IF([test "x${LIBONIGURUMA}" = "x" && test "x$with_pcre2" != xno],
[AC_CHECK_HEADERS([pcre2posix.h], [], [LIBPCRE2=_missing_header])
AC_CHECK_LIB([pcre2-posix${LIBPCRE2}], [regexec],
[LIBPCRE2="-lpcre2-posix"
AC_DEFINE([HAVE_PCRE2], [1], [Define if you have pcre2])
AC_SUBST([LIBPCRE2], ["${LIBPCRE2}"])
],
[if test "x$with_pcre2" != xcheck; then
AC_MSG_FAILURE(
[--with-pcre2 was given, but test for pcre2 failed])
fi
LIBPCRE2=
]
)])
AC_ARG_WITH([pcre], [use pcre regex library],
[], [with_pcre=check])
LIBPCRE=
AS_IF([test "x${LIBONIGURUMA}${LIBPCRE2}" = "x" && test "x$with_pcre" != xno],
[AC_CHECK_HEADERS([pcreposix.h], [], [LIBPCRE=_missing_header])
AC_CHECK_LIB([pcreposix${LIBPCRE}], [regexec],
[LIBPCRE="-lpcreposix"
AC_DEFINE([HAVE_PCRE], [1], [Define if you have pcre])
AC_SUBST([LIBPCRE], ["${LIBPCRE}"])
],
[if test "x$with_pcre" != xcheck; then
AC_MSG_FAILURE(
[--with-pcre was given, but test for pcre failed])
fi
LIBPCRE=
]
)])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT