-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
471 lines (392 loc) · 13.4 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
# | |
# | -*- configure.ac -*- |
# | |
# | Process this file with autoconf to produce a configure script |
# |_____________________________________________________________________|
# // \\
# [| GENETIC © 2014-2019 Antonio Cao (@burzumishi) |]
# \\_____________________________________________________________________//
AC_PREREQ([2.69])
AC_INIT([genetic],[20.03.08],[<@burzumishi>],[genetic])
AC_COPYRIGHT(["2014-2020 (c) Antonio Cao (@burzumishi)"])
AC_REVISION([$Revision: 1.20 $])
AC_SUBST([DESCRIPTION], ["Genetic Package Manager"])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([src/genetic.h])
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 dist-xz tar-ustar -Wno-portability])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE([disable])
AH_TOP([
#ifndef GENETIC_CONFIG_H__
#define GENETIC_CONFIG_H__
])
AH_BOTTOM([
#endif /* GENETIC_CONFIG_H__ */
])
AM_SANITY_CHECK
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_DEFINE_UNQUOTED([PREFIX], ["/usr/"], [Define to the root directory.])
AC_DEFINE_UNQUOTED([SBINDIR], ["${prefix}/sbin/"], [Define Executable Directory.])
AC_LANG([C])
AC_LANG_PUSH([C])
AC_PROG_CC([cc])
AC_PROG_CXX([g++])
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_PROG_LEX
AC_PROG_AWK
AC_PROG_GREP
AC_PROG_SED
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AM_PROG_AS
AC_FUNC_MALLOC
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")
LT_PREREQ([2.4]) # require libtool
LT_INIT()
LT_LANG([C])
AC_SUBST(LIBTOOL_DEPS)
# Checks for libraries.
AM_WITH_DMALLOC
AC_PATH_PROG([GNUMAKE], [make])
AM_CONDITIONAL([HAVE_GNUMAKE], [test -n "${GNUMAKE}"])
AC_PATH_PROG([FILE], [file])
AM_CONDITIONAL([FILE], [test -n "${FILE}"])
AC_PATH_PROG([BASH], [bash])
AM_CONDITIONAL([HAVE_BASH], [test -n "${BASH}"])
AC_PATH_PROG([ENV], [env])
AM_CONDITIONAL([HAVE_ENV], [test -n "${ENV}"])
AC_PATH_PROG([TAIL], [tail])
AM_CONDITIONAL([HAVE_TAIL], [test -n "${TAIL}"])
AC_PATH_PROG([HEAD], [head])
AM_CONDITIONAL([HAVE_HEAD], [test -n "${HEAD}"])
AC_PATH_PROG([LESS], [less])
AM_CONDITIONAL([HAVE_LESS], [test -n "${LESS}"])
AC_PATH_PROG([MORE], [more])
AM_CONDITIONAL([HAVE_MORE], [test -n "${MORE}"])
AC_PATH_PROG([FIND], [find])
AM_CONDITIONAL([HAVE_FIND], [test -n "${FIND}"])
AC_PATH_PROG([SED], [sed])
AM_CONDITIONAL([HAVE_SED], [test -n "${SED}"])
AC_PATH_PROG([TAR], [tar])
AM_CONDITIONAL([HAVE_TAR], [test -n "${TAR}"])
AC_PATH_PROG([GZIP], [gzip])
AM_CONDITIONAL([HAVE_GZIP], [test -n "${GZIP}"])
AC_PATH_PROG([BZIP2], [bzip2])
AM_CONDITIONAL([HAVE_BZIP2], [test -n "${BZIP2}"])
AC_PATH_PROG([XZ], [xz])
AM_CONDITIONAL([HAVE_XZ], [test -n "${XZ}"])
AC_PATH_PROG([PERL], [perl])
AM_CONDITIONAL([HAVE_PERL], [test -n "${PERL}"])
AC_PATH_PROG([PATCH], [patch])
AM_CONDITIONAL([HAVE_PATCH], [test -n "${PATCH}"])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_INT64_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_STRUCT_TIMEZONE
AC_C_CONST
AC_C_INLINE
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_CHECK_FUNCS([bzero gethostname re_comp setlocale textdomain bindtextdomain alarm dup2 gethostbyaddr gethostbyname gettimeofday inet_ntoa isascii memmove memset pow putenv select socket sqrt strcasecmp strchr strerror strpbrk strrchr strstr tzset strtol getcwd memchr mkdir rmdir strcspn strdup strspn])
dnl Language Support
IT_PROG_INTLTOOL([0.50.1])
dnl Check for gettext
GETTEXT_PACKAGE=genetic2
AM_GNU_GETTEXT([external])
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext translation domain])
AC_SUBST(GETTEXT_PACKAGE)
dnl Dependency Checks
PKG_PROG_PKG_CONFIG()
# Check for doxygen (optional) #
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "${DOXYGEN}"])
# Check for bash (required) #
AC_PATH_PROG([BASH], [bash])
AM_CONDITIONAL([HAVE_BASH], [test -n "${BASH}"])
AC_CHECK_PROG(BASH, [bash], [yes], [no])
if test "$BASH" = "no"; then
AC_MSG_ERROR([Unable to find the bash command.])
fi
# Check for env (required) #
AC_PATH_PROG([ENV], [env])
AM_CONDITIONAL([HAVE_ENV], [test -n "${ENV}"])
AC_CHECK_PROG(ENV, [env], [yes], [no])
if test "$ENV" = "no"; then
AC_MSG_ERROR([Unable to find the env command.])
fi
# Check for make (required) #
AC_PATH_PROG([GNUMAKE], [make])
AM_CONDITIONAL([HAVE_GNUMAKE], [test -n "${GNUMAKE}"])
AC_CHECK_PROG(GNUMAKE, [make], [yes], [no])
if test "$GNUMAKE" = "no"; then
AC_MSG_ERROR([Unable to find the make command.])
fi
# Check for perl (required) #
AC_PATH_PROG([PERL], [perl])
AM_CONDITIONAL([HAVE_PERL], [test -n "${PERL}"])
AC_CHECK_PROG(PERL, [perl], [yes], [no])
if test "$PERL" = "no"; then
AC_MSG_ERROR([Unable to find the perl command.])
fi
## CPU architecture specific assembly
build_cpu_mmx="no"
build_cpu_sse3="no"
build_cpu_altivec="no"
build_cpu_neon="no"
want_neon="yes"
AC_ARG_ENABLE([neon],
[AS_HELP_STRING([--disable-neon],[disable neon support @<:@default=enable@:>@])],
[
if test "x${enableval}" = "xyes"; then
want_neon="yes"
else
want_neon="no"
fi
])
SSE3_CFLAGS=""
ALTIVEC_CFLAGS=""
NEON_CFLAGS=""
case $host_cpu in
i*86|x86_64|amd64)
AC_DEFINE([BUILD_MMX], [1], [Build MMX Code])
build_cpu_mmx="yes"
AC_CHECK_HEADER([immintrin.h],
[
AC_DEFINE(BUILD_SSE3, 1, [Build SSE3 Code])
build_cpu_sse3="yes"
],
[build_cpu_sse3="no"])
AC_MSG_CHECKING([whether to build SSE3 code])
AC_MSG_RESULT([${build_cpu_sse3}])
if test "x$build_cpu_sse3" = "xyes" ; then
SSE3_CFLAGS="-msse3"
fi
;;
*power* | *ppc*)
build_cpu_altivec="yes"
AC_CHECK_HEADER([altivec.h],
[
AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
AC_DEFINE([HAVE_ALTIVEC_H], [1], [Have altivec.h header file])
build_cpu_altivec="yes"
],
[
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
CFLAGS=$CFLAGS" -maltivec"
CPPFLAGS=$CPPFLAGS" -maltivec"
unset ac_cv_header_altivec_h
AC_CHECK_HEADER([altivec.h],
[
AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
AC_DEFINE([HAVE_ALTIVEC_H], [1], [Have altivec.h header file])
build_cpu_altivec="yes"
],
[build_cpu_altivec="no"]
)
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
]
)
if test "x${build_cpu_altivec}" = "xyes"; then
AC_MSG_CHECKING([whether to use altivec compiler flag])
if test "x$GCC" = "xyes"; then
if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
altivec_cflags="-faltivec"
AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
altivec_cflags="-maltivec"
AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
fi
fi
AC_MSG_RESULT([${altivec_cflags}])
CFLAGS="$CFLAGS ${altivec_cflags}"
ALTIVEC_CFLAGS="-maltivec"
fi
;;
arm*)
if test "x${want_neon}" = "xyes"; then
build_cpu_neon="yes"
AC_MSG_CHECKING([whether to use NEON instructions])
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} -mfpu=neon -ftree-vectorize"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <arm_neon.h>]], [[asm volatile ("vqadd.u8 d0, d1, d0\n")]])],[
AC_MSG_RESULT([yes])
AC_DEFINE([BUILD_NEON], [1], [Build NEON Code])
build_cpu_neon="yes"
NEON_CFLAGS="-mfpu=neon"
],[
AC_MSG_RESULT([no])
build_cpu_neon="no"
])
CFLAGS="${CFLAGS_save}"
fi
;;
esac
AC_SUBST([ALTIVEC_CFLAGS])
AC_SUBST([SSE3_CFLAGS])
AC_SUBST([NEON_CFLAGS])
# sockets
case "$host_os" in
*mingw*)
AC_MSG_NOTICE([OS MinGW detected])
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
AC_DEFINE_UNQUOTED(WIN32,1,[This is a Windows system])
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
LIBS="$LIBS -lws2_32"
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],, AC_MSG_ERROR([[Winsock2 headers are required for W32]]))
AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool],
[[mslibcheck=`lib 2>&1`
if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then
ac_cv_use_ms_lib_tool="yes"
else
ac_cv_use_ms_lib_tool="no"
fi
]])
if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then
AC_SUBST([MS_LIB_TOOL], [[lib]])
fi
AC_SUBST([lt_cv_objdir])
os_is_windows="yes"
os_is_native_w32="yes"
have_socket="no"
enable_crypt="no"
;;
freebsd*)
AC_MSG_NOTICE([OS FreeBSD detected])
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
;;
openbsd*)
AC_MSG_NOTICE([OS OpenBSD detected])
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
;;
netbsd*)
AC_MSG_NOTICE([OS NetBSD detected])
AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
;;
*solaris*)
AC_MSG_NOTICE([OS Solaris detected])
AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
AC_CHECK_LIB([socket], [connect],
[
have_socket="yes"
requirement_elm_libs="-lsocket ${requirement_elm_libs}"
],
[have_socket="no"])
CFLAGS="-Dsun -DSYSV $CFLAGS"
LDFLAGS="-lnsl -lsocket $LDFLAGS"
;;
*darwin* | *rhapsody* | *macosx*)
AC_MSG_NOTICE([OS MacOSX detected])
AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
CFLAGS="-no-cpp-precomp -fno-common $CFLAGS"
have_socket="yes"
;;
*arm-linux*)
AC_MSG_NOTICE([OS ARM GNU/Linux detected])
AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets])
CFLAGS="-fPIC -pipe $CFLAGS"
;;
*linux*)
AC_MSG_NOTICE([OS GNU/Linux detected])
AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets])
;;
*cygwin*)
AC_MSG_NOTICE([OS Cygwin detected])
AC_DEFINE_UNQUOTED(__CYGWIN__,1,[This is a Cygwin system])
os_is_windows="yes"
have_socket="yes"
enable_crypt="no"
enable_regex="no"
;;
*openedition*)
AC_MSG_NOTICE([OS Open Edition detected])
AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system])
;;
*)
AC_MSG_WARN([Unrecognised OS $host_os])
AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
have_socket="yes"
;;
esac
AM_CONDITIONAL([BUILD_RUN], [test "x$have_socket" = "xyes"])
### GENETIC BASIC FEATURES ###
# Profiling Support #
AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling],[enable profiling support @<:@default=no@:>@]),
[], [enable_profiling=no])
if test "$enable_profiling" = "yes"; then
CFLAGS="$CFLAGS -pg -g3"
else
CFLAGS="$CFLAGS -fomit-frame-pointer"
fi
### GENETIC BUILD FLAGS ###
# Performance CFLAGS #
AC_ARG_ENABLE(performance,
AS_HELP_STRING([--enable-performance],[enable Performance Flags @<:@default=yes@:>@]),
[], [enable_performance=yes])
if test "$enable_performance" = "yes"; then
LDFLAGS="$LDFLAGS -finline-functions -funroll-loops -fdefer-pop -fstrength-reduce"
fi
# Developer CFLAGS #
AC_ARG_ENABLE(devel,
AS_HELP_STRING([--enable-devel],[enable Developer Build Flags @<:@default=no@:>@]),
[], [enable_devel=no])
if test "$enable_devel" = "yes"; then
CFLAGS="$CFLAGS -Wall -Wshadow -Wformat-security -Wpointer-arith -Wcast-align -Wredundant-decls -Wuninitialized"
else
CFLAGS="$CFLAGS -Wno-all -Wno-cast-align -Wno-unused-result -Wno-write-strings -Wno-unused-but-set-variable -Wno-pointer-to-int-cast -Wno-address -Wno-int-to-pointer-cast -Wno-uninitialized"
fi
### GENETIC 2.0 EXTRA FEATURES ###
# GENETIC 2.0 Suport (-DGENETIC -DGENETIC2) #
AC_ARG_ENABLE(genetic2,
AS_HELP_STRING([--enable-genetic2],[enable GENETIC 2.0 support @<:@default=yes@:>@]),
[], [enable_genetic2=yes])
if test "$enable_genetic2" = "yes"; then
AC_DEFINE([GENETIC2], [], [GENETIC Support])
fi
AM_CONDITIONAL([GENETIC2], [test "$enable_genetic2" = "yes"])
# Create build files #
AC_CONFIG_FILES([Makefile
po/Makefile.in
src/Makefile
etc/Makefile
etc/conf.d/Makefile])
LT_OUTPUT()
AC_OUTPUT
# Show configure build flags & options #
AC_MSG_RESULT
AC_MSG_RESULT([Configured --{ GENETIC }-- build flags:
* Profiling flags: <$enable_profiling>
* Developer flags: <$enable_devel>
* Performance flags: <$enable_performance>
* Genetic ${PACKAGE_VERSION}: <$enable_genetic2>
])
AC_MSG_RESULT([Well done! \"configure\" complete, now type \"make\"!])
AC_MSG_RESULT