forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
executable file
·236 lines (208 loc) · 5.15 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT(dnsforwarder, 0.0, https://github.com/holmium/dnsforwarder/issues)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([dnscache.h])
AC_CONFIG_HEADERS(config.h)
AC_ARG_WITH([ccflags],
[AS_HELP_STRING([--with-ccflags],
[clear $CFLAGS (default=yes)]
)],
[ case "${withval}" in
yes) [CFLAGS=""] ;;
no) [] ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-ccflags) ;;
esac
],
[CFLAGS=""]
)
LDFLAGS=" ${LDFLAGS} -pthread "
CFLAGS=" ${CFLAGS} -pthread "
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for math libraries.
AC_CHECK_LIB(m, log, ,
AC_MSG_ERROR(No libmath found.)
)
AC_CHECK_LIB(m, sqrt, ,
AC_MSG_ERROR(No libmath found.)
)
AC_ARG_ENABLE([win],
[AS_HELP_STRING([--enable-win],
[compile for win32 (default=no)]
)],
[ case "${enableval}" in
yes) [WIN32=yes];;
no) [WIN32=no];;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-win) ;;
esac
],
[WIN32=no]
)
if test "$WIN32" == "yes"
then
CFLAGS="${CFLAGS} -DWIN32 "
fi
if test "$WIN32" != "yes"
then
AC_ARG_ENABLE([android],
[AS_HELP_STRING([--enable-android],
[compile for android (default=no)]
)],
[ case "${enableval}" in
yes) [ANDROID=yes];;
no) [ANDROID=no];;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-android) ;;
esac
],
[ANDROID=no]
)
if test "$ANDROID" == "yes"
then
CFLAGS="${CFLAGS} -DANDROID "
fi
AC_ARG_ENABLE([downloader],
[AS_HELP_STRING([--enable-downloader],
[downloader, libcurl, wget, or no (default=libcurl)]
)],
[ case "${enableval}" in
libcurl) DOWNLOADER=libcurl;;
wget) DOWNLOADER=wget;;
no) DOWNLOADER=no;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-downloader) ;;
esac
],
[DOWNLOADER=libcurl]
)
if test "$DOWNLOADER" == "libcurl"
then
# Checks for curl.
AC_CHECK_LIB(curl, curl_global_init, ,
AC_MSG_ERROR(No libcurl found.)
)
CFLAGS="${CFLAGS} -DDOWNLOAD_LIBCURL "
fi
if test "$DOWNLOADER" == "wget"
then
CFLAGS="${CFLAGS} -DDOWNLOAD_WGET "
fi
if test "$DOWNLOADER" == "no"
then
CFLAGS="${CFLAGS} -DNODOWNLOAD "
fi
# AC_ARG_ENABLE([base64decoder],
# [AS_HELP_STRING([--enable-base64decoder],
# [base64decoder, openssl or coreutils or uudecode (default=openssl)]
# )],
# [ case "${enableval}" in
# openssl) BASE64DECODER=openssl;;
# uudecode) BASE64DECODER=uudecode;;
# coreutils) BASE64DECODER=coreutils;;
# *) AC_MSG_ERROR(bad value ${enableval} for --enable-base64decoder) ;;
# esac
# ],
# [BASE64DECODER=openssl]
# )
#
# if test "$BASE64DECODER" == "openssl"
# then
# CFLAGS="${CFLAGS} -DBASE64_DECODER_OPENSSL "
# # Checks for openssl.
# AC_CHECK_LIB(crypto, BIO_new, ,
# AC_MSG_ERROR(No openssl found.)
# )
# fi
#
# if test "$BASE64DECODER" == "uudecode"
# then
# CFLAGS="${CFLAGS} -DBASE64_DECODER_UUDECODE "
# fi
#
# if test "$BASE64DECODER" == "coreutils"
# then
# CFLAGS="${CFLAGS} -DBASE64_DECODER_COREUTILS "
# fi
# Checks for header files.
AC_CHECK_HEADERS([sys/syscall.h wordexp.h])
if test "$DOWNLOADER" == "libcurl"
then
AC_CHECK_HEADERS([curl/curl.h],
[],
AC_MSG_ERROR(No libcurl headers found.),
[]
)
fi
if test "$BASE64DECODER" == "openssl"
then
AC_CHECK_HEADERS([openssl/evp.h openssl/bio.h],
[],
AC_MSG_ERROR(No openssl headers found.),
[]
)
fi
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV, [], [setenv]), AC_MSG_WARN(Relative path is not supported.))
AC_CHECK_FUNC(wordexp, AC_DEFINE(HAVE_WORDEXP, [], [wordexp]), AC_MSG_WARN(Relative path is not supported.))
AC_ARG_ENABLE([spinlock],
[AS_HELP_STRING([--enable-spinlock],
[spinlock will be used (default=yes)]
)],
[ case "${enableval}" in
yes) AC_CHECK_FUNCS([pthread_spin_init]) ;;
no) [];;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-spinlock) ;;
esac
],
[]
)
AC_ARG_ENABLE([rwlock],
[AS_HELP_STRING([--enable-rwlock],
[rwlock will be used (default=yes)]
)],
[ case "${enableval}" in
yes) AC_CHECK_FUNCS([pthread_rwlock_init]) ;;
no) [];;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-rwlock) ;;
esac
],
[]
)
AC_TYPE_PID_T
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable DEBUG mode (default=no)]
)],
[ case "${enableval}" in
yes) [CFLAGS="${CFLAGS} -DDEBUG -g -Wall "] ;;
no) [CFLAGS="${CFLAGS} -O2 "] ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac
],
[CFLAGS="${CFLAGS} -O2 "]
)
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static],
[static link (default=no)]
)],
[ case "${enableval}" in
yes) [CFLAGS="${CFLAGS} -static "];;
no) [];;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
esac
],
[]
)
AC_CONFIG_FILES([makefile])
AC_OUTPUT