-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
519 lines (432 loc) · 12.8 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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.69)
AC_INIT([udppingpong], [1.0.0], [[email protected]], [udppingpong-1.0.0.tar.bz2])
AC_CONFIG_AUX_DIR([autoconf])
#DNSPerfTest
AC_CONFIG_SRCDIR([src/bouncer.cpp])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([include/config.h])
# PPL7
AC_CONFIG_SRCDIR([ppl7/include/ppl7.h])
AC_CONFIG_SRCDIR([ppl7/include/ppl7-config.h.in])
AC_CONFIG_FILES([ppl7/Makefile])
AC_CONFIG_HEADERS([ppl7/include/config_ppl7.h])
AC_CONFIG_HEADERS([ppl7/include/ppl7-config.h])
###############################################################################
# Includes
###############################################################################
## PPL7
sinclude(autoconf/ax_cxx_compile_stdcxx.m4)
sinclude(autoconf/ax_path_lib_pcre.m4)
sinclude(autoconf/ax_pthread.m4)
sinclude(autoconf/lib-link.m4)
sinclude(autoconf/checkfuncs.m4)
sinclude(autoconf/ax_gcc_x86_cpuid.m4)
sinclude(autoconf/ax_check_compiler_flags.m4)
sinclude(autoconf/ax_gcc_archflag.m4)
sinclude(autoconf/libbind.m4)
report_have_pthreads="no"
report_have_pcre="no"
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
OLD_CFLAGS=$CFLAGS
# Checks for programs.
AC_PROG_CC
CFLAGS=$OLD_CFLAGS
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX(11)
AX_CHECK_COMPILE_FLAG([-no-pie],
LDFLAGS="-no-pie $LDFLAGS"
NOPIE="-no-pie",
NOPIE=""
)
AC_SUBST(NOPIE)
case "$host_os" in
freebsd* )
CFLAGS="-I/usr/local/include $CFLAGS"
LDFLAGS="-L/usr/local/lib $LDFLAGS -lkvm"
;;
esac
case "$host_os" in
*mingw32*|msys )
report_have_pthreads="yes, Windows Threads"
;;
*mingw64* )
report_have_pthreads="yes, Windows Threads"
;;
*)
AX_PTHREAD([report_have_pthreads="yes, pthreads"]
AC_DEFINE(HAVE_PTHREADS,1, [Define to 1 if we have pthreads])
)
;;
esac
AC_C_BIGENDIAN(
report_byteorder="BIG ENDIAN"
AC_DEFINE(__BIG_ENDIAN__),
report_byteorder="LITTLE ENDIAN"
AC_DEFINE(__LITTLE_ENDIAN__))
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(void*)
# ppl7
if test $ac_cv_sizeof_char -eq 1; then
AC_DEFINE(ppluint8,unsigned char)
AC_DEFINE(pplint8,signed char)
fi
if test $ac_cv_sizeof_short -eq 2; then
AC_DEFINE(ppluint16,unsigned short)
AC_DEFINE(pplint16,signed short)
fi
if test $ac_cv_sizeof_int -eq 4; then
AC_DEFINE(ppluint32,unsigned int)
AC_DEFINE(pplint32,signed int)
fi
if test $ac_cv_sizeof_long_long -eq 8; then
AC_DEFINE(ppluint64,unsigned long long)
AC_DEFINE(pplint64,signed long long)
else
if test $ac_cv_sizeof_long -eq 8; then
AC_DEFINE(ppluint64,unsigned long)
AC_DEFINE(pplint64,signed long)
fi
fi
if test $ac_cv_sizeof_voidp -eq 4; then
AC_DEFINE(ppliptr,ppluint32)
elif test $ac_cv_sizeof_voidp -eq 8; then
AC_DEFINE(ppliptr,ppluint64)
else
AC_MSG_ERROR(size of void* is not supported)
fi
AC_CHECK_SIZEOF(fpos_t)
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
PKG_PROG_PKG_CONFIG()
PPLIBTESTVERSION=release
AC_SUBST(PPLIBTESTVERSION)
#--------------------------------------------------------------------
# Check for various typedefs and provide substitutes if
# they don't exist.
#--------------------------------------------------------------------
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_OFF_T
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM
# FPOS_T ist ein Struct?
AX_FPOS_ISSTRUCT()
AX_TM_HAS_GMTOFF()
AC_PATH_XTRA
AX_CHECK_GNU_MAKE(,
[AC_MSG_ERROR([No gmake found])]
)
if test x$_cv_gnu_make_command = x ; then
AC_MSG_ERROR(No gmake found)
else
MAKECMD=$_cv_gnu_make_command
fi
AC_SUBST(MAKECMD)
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([math.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([sys/file.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/poll.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/sysinfo.h])
AC_CHECK_HEADERS([sys/sysctl.h])
AC_CHECK_HEADERS([sys/resource.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_HEADERS([arpa/nameser.h])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([strings.h])
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([signal.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([fnmatch.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS([wctype.h])
AC_CHECK_HEADERS([locale.h])
AC_CHECK_HEADERS([wchar.h])
AC_CHECK_HEADERS([widec.h])
AC_CHECK_HEADERS([syslog.h])
AC_CHECK_HEADERS([pthread.h pthread_np.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([resolv.h],[],[],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
])
AC_CHECK_TYPE(size_t, unsigned)
AC_CHECK_TYPE(wchar_t, unsigned)
# Checks for library functions.
AC_FUNC_MKTIME
AC_FUNC_FSEEKO
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([strtolower strtoupper])
AC_CHECK_FUNCS([bzero bcopy gethostbyname gettimeofday inet_ntoa memmove memset mkdir socket __mingw_vasprintf vasprintf asprintf])
AC_CHECK_FUNCS([gethostname sethostname getdomainname setdomainname uname])
AC_CHECK_FUNCS([strcasecmp strlen strnlen strdup strerror strncasecmp strndup strstr strcasestr strcmp strncmp])
AC_CHECK_FUNCS([strncpy strlcpy strncat strlcat])
AC_CHECK_FUNCS([strtok strtok_r])
AC_CHECK_FUNCS([htol atoll atoi atol atof strtoll strtoull])
AC_CHECK_FUNCS([flock fcntl truncate ftruncate sync fsync unlink remove])
AC_CHECK_FUNCS([fgets fputs fgetws fputws fputc fgetc fputwc fgetwc mmap munmap sysconf pagesize])
AC_CHECK_FUNCS([usleep nanosleep localtime localtime_r gmtime gmtime_r])
AC_CHECK_FUNCS([signal syslog openlog closelog])
AC_CHECK_FUNCS([strtok_r])
AC_CHECK_FUNCS([getpid getppid getuid geteuid])
AC_CHECK_FUNCS([mkstemp])
AC_CHECK_FUNCS([wcscmp wcsncmp wcscasecmp wcsncasecmp wcstol wcstoll wcslen wcsstr wcstoul wcstoull wcstod wcstof])
AC_CHECK_FUNCS([wcstombs mbstowcs wcsrtombs wcsnrtombs mbsrtowcs mbsnrtowcs])
AC_CHECK_FUNCS([wprintf fwprintf swprintf vwprintf vfwprintf vswprintf])
AC_CHECK_FUNCS([vsnprintf])
AC_CHECK_FUNCS([wstol wstoll watoi watoll wstod watof])
AC_CHECK_FUNCS([poll select pselect])
AC_CHECK_FUNCS([opendir closedir readdir readdir_r stat])
AC_CHECK_FUNCS([clock_gettime])
AC_CHECK_FUNCS([inet_ntop inet_pton inet_aton inet_ntoa inet_ntoa_r inet_addr inet_network inet_makeaddr])
AC_CHECK_FUNCS([ioctl])
AC_CHECK_FUNCS([signal syslog openlog closelog])
AC_CHECK_LIB(pthread, pthread_set_name_np,
AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP,1),,)
AC_CHECK_LIB(pthread, pthread_setname_np,
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP,1),,)
AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_struct_sa_len,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
ac_cv_struct_sa_len=yes, ac_cv_struct_sa_len=no)])
if test $ac_cv_struct_sa_len = yes; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi
dnl do we need to specify -lm explicitly?
AC_CHECK_FUNC(sin,,[AC_CHECK_LIB(m,sin)])
# Resolver
AM_CHECK_LIBBIND()
report_have_libbind="no"
if test "$have_res_mkquery" = "yes"
then
AC_DEFINE(HAVE_LIBBIND,1,[ Define if you have libbind resolver functions ])
report_have_libbind="yes"
fi
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CFLAGS="$CFLAGS -I/usr/local/include"
# PCRE vorhanden?
AX_PATH_LIB_PCRE(
AC_DEFINE(HAVE_PCRE, 1, [ Define if you have pcre. ])
report_have_pcre="yes"
,
)
case $target in
x86_64*|amd64*)
AC_DEFINE(HAVE_AMD64,1,)
;;
esac
SRCDIR=`pwd`
AC_SUBST(SRCDIR)
# If we support __thread, that can speed up tcmalloc a bit.
# Note, however, that our code tickles a bug in gcc < 4.1.2
# involving TLS and -fPIC (which our libraries will use) on x86:
# http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
AC_MSG_CHECKING([for __thread])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ < 2))
#error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
#endif], [static __thread int p = 0])],
[AC_DEFINE(HAVE_TLS, 1,
Define to 1 if compiler supports __thread)
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# We also need to check if the kernel supports __thread, which requires uname()
AC_CHECK_DECLS(uname,,, [#include <sys/utsname.h>])
WINDOWS_WINSOCK_LIBS=""
case "$host_os" in
*mingw32* )
MINGW32=yes
AC_DEFINE(MINGW32, 1, [Define if you compile on Windows MINGW32])
#LIBS="$LIBS -lws2_32"
WINDOWS_WINSOCK_LIBS="-lws2_32"
;;
*mingw64*|msys )
MINGW32=yes
MINGW64=yes
AC_DEFINE(MINGW32, 1, [Define if you compile on Windows MINGW32])
AC_DEFINE(MINGW64, 1, [Define if you compile on Windows MINGW64])
WINDOWS_WINSOCK_LIBS="-lws2_32"
;;
* )
MINGW32=no
;;
esac
AC_SUBST(WINDOWS_WINSOCK_LIBS)
# unused ppl7 stuff
MYSQL_CFLAGS=
POSTGRESQL_CFLAGS=
SQLITE3_CFLAGS=
LAME_CFLAGS=
MPG123_CFLAGS=
LIBMICROHTTPD_CFLAGS=
LIBCDIO_CFLAGS=
SDL2_CFLAGS=
LIBIDN_CFLAGS=
LIBCURL_CPPFLAGS=
LIBMCRYPT_CFLAGS=
FT2_CFLAGS=
LIBLDNS_CFLAGS=
IMLIB_CF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(LIBCDIO_LDFLAGS)
AC_SUBST(LIBMICROHTTPD_LIBS)
AC_SUBST(LIBIDN_LIBS)
AC_SUBST(OPENSSL_LDFLAGS)
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(BZ2_LIBS)
AC_SUBST(ICONV_LIBS)
AC_SUBST(ASM)
AC_SUBST(ASMFLAGS)
AC_SUBST(ASMDEBUGFLAGS)
HAVE_X86_ASSEMBLER=
AC_SUBST(HAVE_X86_ASSEMBLER)
############################
AC_SUBST(report_have_pcre)
AC_SUBST(report_have_pthreads)
AC_SUBST(report_have_libbind)
###############################################################################
# Output
###############################################################################
AC_OUTPUT
###############################################################################
# Report
###############################################################################
dnl report configuration
AC_MSG_RESULT([
******************************************************************************
** Configuration summary for $PACKAGE_NAME Version $PACKAGE_VERSION
** Target: $target_os CPU: $target_cpu
**
** Byteorder: $report_byteorder
** Size of char $ac_cv_sizeof_char Size of float $ac_cv_sizeof_float
** Size of short $ac_cv_sizeof_short Size of double $ac_cv_sizeof_double
** Size of int $ac_cv_sizeof_int Size of void* $ac_cv_sizeof_voidp
** Size of long $ac_cv_sizeof_long Size of wchar_t $ac_cv_sizeof_wchar_t
** Size of long long $ac_cv_sizeof_long_long
** Size of size_t $ac_cv_sizeof_size_t
******************************************************************************
** Features:
** Threads: $report_have_pthreads
** Resolver lib: $report_have_libbind
** PCRE: $report_have_pcre
******************************************************************************
])
dnl check if we have all required libraries
missing=""
if test "$report_have_pthreads" = "no"
then
missing="$missing - no threading available
"
fi
if test "$report_have_pcre" != "yes"
then
missing="$missing - libpcre is required but not found
"
fi
if test "$report_have_libbind" != "yes"
then
missing="$missing - libbind or libresolv is required but not found
"
fi
if test -n "$missing"
then
AC_MSG_ERROR(Cannot build because of missing dependencies:
$missing)
fi