-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.ac
More file actions
676 lines (592 loc) · 19.2 KB
/
configure.ac
File metadata and controls
676 lines (592 loc) · 19.2 KB
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
AC_INIT
AC_CONFIG_SRCDIR([include/libu8/libu8.h])
AC_PREFIX_PROGRAM(autoconf)
#m4_include([etc/ax_check_link_flags.m4])
m4_include([etc/ax_pthread.m4])
m4_include([etc/ax_sign.m4])
threads_default="yes"
ifmacosx="#"
shared_default="yes"
shared_suffix="so"
SHARED_LIB="libu8.so libu8stdio.so libu8fns.so libu8io.so libu8data.so"
rpath_default=$exec_prefix
CLEAN="rm -f"
U8VERSION=$(scripts/u8_gitversion etc/base_version)
U8MAJOR=$(echo ${U8VERSION} | cut -d'.' -f1)
U8MINOR=$(echo ${U8VERSION} | cut -d'.' -f2)
U8PATCHLEVEL=$(echo ${U8VERSION} | cut -d'.' -f3)
mshared_suffix=so.${U8MAJOR}
mmshared_suffix=so.${U8MAJOR}.${U8MINOR}
vshared_suffix=so.${U8VERSION}
RPMVERSION=${U8PATCHLEVEL}
DEBVERSION=${U8PATCHLEVEL}
LD="ld"
MKSTATIC="\$(LD) -r "
EXEFLAGS=
EXELIBS=
RPATHFLAGS="-Wl,'-rpath \$(RPATH)'"
LIBSOURCE=lib
EXESOURCE=exe
I18N=""
INSTALLI18N=""
SUDO=""
GITDESCRIBE=""
GITBRANCH=""
TAGS_TARGET="TAGS"
DOCTARGETS=""
DOCINSTALL=""
BUILDRPM="lsbrpmbuild"
RPMDIR=${RPMDIR:-dist}
RPMFLAGS=${RPMFLAGS:-}
GPG=`which gpg2 || which gpg || gpg`
GPGID=${GPGID:-FE1BC737F9F323D732AA26330620266BE5AFF294}
PKGCONFIG_DIR=
doi18n="no"
debugcflags=" -O0 -g3 -ggdb3 -fno-inline -fno-omit-frame-pointer "
build_shared="shared-libs"
build_static="static-libs"
shared_exe="shared-exe"
static_exe=""
test_shared="test-shared"
test_static="test-static"
install_shared="install-so"
install_static="install-static"
install_exe="install-exe"
libc_pthreads="no"
libc_dlopen="no"
suffix=""
rpath=""
have_constructor_attributes="yes"
archflags=""
definefileinfo=""
versionsh=""
doxygen=$(which doxygen)
ronn=$(which ronn || which ronn-2.7)
default_buildopts_dir="\$prefix/etc/beingmeta/opts"
if test -z "${U8PATCHLEVEL}"; then
U8PATCHLEVEL=$(./scripts/u8_gitpatchcount ./etc/base_version)
fi;
if which lsb_release 2>&1 > /dev/null; then
CODENAME=`lsb_release -cs || echo beingmeta`
fi
if (test "$rpath_default" = "NONE") || (test "$rpath_default" = ""); then
rpath_default=$prefix;
fi
CFLAGS="-Wimplicit -fno-strict-aliasing -g $CFLAGS"
AC_CONFIG_AUX_DIR(etc)
AC_CONFIG_HEADERS([include/libu8/u8source.h include/libu8/config.h])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
DOCINSTALL="${DOCINSTALL} install-core-manpages install-dev-manpages";
case $target_os in
linux*)
MKSTATIC="${MKSTATIC} --build-id";
AC_DEFINE(U8_RUSAGE_PROCFS_PATCH,1)
AC_DEFINE(U8_LINUX_TARGET,1)
AC_DEFINE(U8_UNIX_TARGET,1)
;;
darwin*)
# MKSTATIC="/usr/bin/libtool -static ";
# if test "x$CC" = "xgcc"; then LIBS="$LIBS -lgcc"; fi
shared_suffix="dylib";
install_shared="install-dylib";
ifmacosx="";
RPATHFLAGS=" -rpath \$(RPATH) "
CFLAGS="-D_DARWIN_C_SOURCE $CFLAGS"
AC_DEFINE(DESTRUCTIVE_POLL,1)
AC_DEFINE(CHECK_DANGLING_ERRNOS,1)
AC_DEFINE(U8_DARWIN_TARGET,1)
AC_DEFINE(U8_BSD_TARGET,1)
AC_DEFINE(U8_UNIX_TARGET,1)
;;
esac
AC_DEFINE_UNQUOTED(U8_HOST_CPU,"$host_cpu")
AC_DEFINE_UNQUOTED(U8_HOST_VENDOR,"$host_vendor")
AC_DEFINE_UNQUOTED(U8_HOST_OS,"$host_os")
AC_DEFINE_UNQUOTED(U8_TARGET_CPU,"$target_cpu")
AC_DEFINE_UNQUOTED(U8_TARGET_VENDOR,"$target_vendor")
AC_DEFINE_UNQUOTED(U8_TARGET_OS,"$target_os")
if test $prefix == "/usr"; then
default_config_dir=/etc/kno;
default_buildopts_dir=/etc/beingmeta/opts;
else
default_config_dir=$prefix/etc/kno;
default_buildopts_dir=$prefix/etc/beingmeta/opts;
fi
AC_SUBST(LD)
AC_SUBST(CLEAN)
AC_SUBST(TAGS_TARGET)
AC_SUBST(SHARED_LIB)
AC_SUBST(SHARED_LIBV)
AC_SUBST(U8MAJOR)
AC_SUBST(U8MINOR)
AC_SUBST(U8PATCHLEVEL)
AC_SUBST(U8VERSION)
AC_SUBST(RPMVERSION)
AC_SUBST(DEBVERSION)
AC_SUBST(PKGCONFIG_DIR)
AC_SUBST(MKSTATIC)
AC_SUBST(SUDO)
AC_SUBST(GZIP)
AC_SUBST(EXEFLAGS)
AC_SUBST(EXELIBS)
AC_SUBST(debugcflags)
AC_SUBST(shared_suffix)
AC_SUBST(vshared_suffix)
AC_SUBST(mshared_suffix)
AC_SUBST(mmshared_suffix)
AC_SUBST(suffix)
AC_SUBST(test_shared)
AC_SUBST(test_static)
AC_SUBST(build_shared)
AC_SUBST(build_static)
AC_SUBST(shared_exe)
AC_SUBST(static_exe)
AC_SUBST(install_shared)
AC_SUBST(install_static)
AC_SUBST(buildopts_dir)
AC_SUBST(archflags)
AC_SUBST(definefileinfo)
AC_SUBST(versionsh)
AC_SUBST(I18N)
AC_SUBST(INSTALLI18N)
AC_SUBST(GITDESCRIBE)
AC_SUBST(GITBRANCH)
AC_SUBST(doxygen)
AC_SUBST(ronn)
AC_SUBST(DOCTARGETS)
AC_SUBST(DOCINSTALL)
AC_SUBST(rpath)
AC_SUBST(RPATHFLAGS)
AC_SUBST(LIBSOURCE)
AC_SUBST(EXESOURCE)
AC_ARG_VAR(GITBRANCH,"Git branch for build")
AC_ARG_VAR(RPMDIR,"Location for writing built RPMs")
AC_ARG_VAR(RPMFLAGS,"Default flags for building RPMs")
AC_ARG_VAR(GPG,"GPG executable")
AC_ARG_VAR(GPGID,"Default GnuPG id for signing packages")
AC_SUBST(RPMDIR)
AC_SUBST(RPMFLAGS)
AC_SUBST(GPG)
AC_SUBST(GPGID)
AC_SUBST(GITBRANCH)
AC_SUBST(REPONAME)
AC_SUBST(CODENAME)
if test -z "${GITBRANCH}"; then
GITBRANCH=`scripts/u8_gitbranch`;
fi;
if test -z "${GITBRANCH}" || test "${GITBRANCH}" = "main"; then
REPONAME="kno";
else
REPONAME="kno_${GITBRANCH}";
fi;
AC_PATH_PROG(CLANG,clang,none)
AC_ARG_WITH(sanitize,--with-sanitize[=address*|memory|thread],with_sanitize=$withval,with_sanitize="none")
if test "x$with_sanitize" = "xnone"; then
echo "Configuring normal (no sanitization) build";
elif test "x$with_sanitize" = "xaddress" ||
test "x$with_sanitize" = "x" ||
test "x$with_sanitize" = "xyes"; then
CFLAGS="-fsanitize=address -fno-omit-frame-pointer -O0 -g $CFLAGS"
LDFLAGS="-g -fsanitize=address $LDFLAGS"
build_static=""
test_static=""
install_static=""
custom_malloc="asan"
memtest_prefix=builtin_
heaptest_prefix=builtin_
elif test "x$with_sanitize" = "xleak"; then
CFLAGS="-fsanitize=address -fno-omit-frame-pointer -O0 -g $CFLAGS"
LDFLAGS="-g -fsanitize=address $LDFLAGS"
build_static=""
test_static=""
install_static=""
custom_malloc="asan"
memtest_prefix=builtin_
heaptest_prefix=builtin_
elif test "x$CLANG" = "xnone"; then
echo "No clang for sanitizing $with_sanitize";
exit;
elif test "x$with_sanitize" = "xmemory"; then
CC=$CLANG
CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -fPIE -g -fno-omit-frame-pointer $CFLAGS"
LD=$CLANG
LDFLAGS="-g -fsanitize=memory -fsanitize-memory-track-origins -pie -fno-omit-frame-pointer $LDFLAGS"
build_static=""
test_static=""
install_static=""
custom_malloc="msan-full"
elif test "x$with_sanitize" = "xthread"; then
CC=$CLANG
CFLAGS="-fsanitize=thread -g -fno-omit-frame-pointer $CFLAGS"
LD=$CLANG
LDFLAGS="-g -fsanitize=thread -fno-omit-frame-pointer $LDFLAGS"
build_static=""
test_static=""
install_static=""
custom_malloc="msan"
fi
AC_DEFINE_UNQUOTED(U8_SANITIZE,"$with_sanitize")
AC_PROG_CC([${CC} cc gcc])
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_USE_SYSTEM_EXTENSIONS
AC_DEFINE_UNQUOTED(U8_VERSION,"$U8VERSION")
AC_DEFINE_UNQUOTED(U8_MAJOR_VERSION,$U8MAJOR)
AC_DEFINE_UNQUOTED(U8_MINOR_VERSION,$U8MINOR)
if test "x$prefix" != "x/usr"; then
CFLAGS="$CFLAGS -I$prefix/include"
CPPFLAGS="$CPPFLAGS -I$prefix/include"
LDFLAGS="$LDFLAGS -L$prefix/lib"
fi
AC_ARG_WITH(reponame,--with-reponame for distribution,with_reponame=$withval,with_reponame=$REPONAME)
REPONAME=$with_reponame;
AC_ARG_WITH(codename,--with-codename for distribution,with_codename=$withval,with_codename=$CODENAME)
CODENAME=$with_codename
AC_ARG_WITH(buildopts,--with-buildopts-dir location used by getbuildopt,,with_buildopts_dir=$default_buildopts_dir)
buildopts_dir=$with_buildopts_dir
AC_ARG_WITH(optlib,--with-optlib Use optional library directory,,with_optlib="none")
if test $with_optlib != "none"; then
LDFLAGS="$LDFLAGS -L$with_optlib"
fi
AC_ARG_WITH(optdir,--with-optdir Use optional header/lib,,with_optdir="/opt/local")
if test -d $with_optdir/include; then
CPPFLAGS="$CPPFLAGS -I$with_optdir/include"
CFLAGS="$CFLAGS -I$with_optdir/include"
APXSFLAGS="$APXSFLAGS -I$with_optdir/include"
fi
if test -d $with_optdir/lib; then
LDFLAGS="$LDFLAGS -L$with_optdir/lib"
fi
if test -d $with_optdir/bin; then
PATH="$PATH:$with_optdir/bin"
fi
AC_ARG_WITH(rpath,--with-rpath dir,rpath=$withval,rpath=$rpath_default)
if test "$rpath" != "none" && test "$rpath" != "NONE" && test ! -z "$rpath" &&
test "$rpath" != "/usr" && test "$rpath" != "/usr/local"; then
EXEFLAGS=" $EXEFLAGS \$(RPATHFLAGS) "
fi
AC_ARG_WITH(pkgconfig_dir,--with-pkgconfig-dir pathname,,with_pkgconfig_dir=$prefix/share/pkgconfig)
AC_DEFINE_UNQUOTED(U8_PKGCONFIG_DIR,"$with_pkgconfig_dir")
PKGCONFIG_DIR=${with_pkgconfig_dir}
AC_ARG_WITH(encodings_dir,--with-encodings-dir pathname,,with_encodings_dir=$prefix/share/libu8/encodings)
AC_DEFINE_UNQUOTED(U8_ENCODINGS_DIR,"$with_encodings_dir")
dnl For specifying default -arch flags for OSX
AC_ARG_WITH(arch,--with[out]-arch build with particular --arch flags,,with_arch="")
if test -z $with_arch; then
archflags=""
elif test $with_arch = "all"; then
archflags="-arch i386 -arch x86_64 -arch ppc -arch ppc64";
elif test $with_arch = "all86"; then
archflags="-arch i386 -arch x86_64";
elif test $with_arch = "allppc"; then
archflags="-arch ppc -arch ppc64";
else archflags=$with_arch
fi
AC_ARG_ENABLE(maintainer-mode,--en[dis]able-maintainer-mode doesn't do anything)
AC_ARG_ENABLE(dependency-tracking,--en[dis]able-dependency-tracking doesn't do anything)
AC_ARG_ENABLE(stripping,--enable-stripping strip libraries and executables before installing,,enable_stripping="no")
if test "$enable_stripping" != "no"; then
LIBSOURCE=lib/stripped
EXESOURCE=exe/stripped
fi
AC_ARG_ENABLE(shared,--en[dis]able-shared Build with/without shared libraries,,enable_shared=$shared_default)
if test $target = "i686-pc-mingw32"; then
CFLAGS="-DU8_DLL=1 $CFLAGS"
elif test $enable_shared = "yes"; then
CFLAGS="-fPIC $CFLAGS"
else
SHARED_LIB=
fi
AC_CHECK_PROGS(git,"git","na")
AC_CHECK_PROGS(etags,"etags","na")
AC_CHECK_PROGS(buildrpm,"lsb-rpmbuild","rpmbuild","lsb-rpm","rpm","na")
AC_CHECK_PROGS(rpm,"lsb-rpm","rpm","na")
AC_CHECK_PROG(CREATEREPO,createrepo,,echo No createrepo for )
AC_CHECK_PROGS(GZIP,"gzip","na")
AC_CHECK_PROGS(ZIP,"zip","zip")
if test $etags = "na"; then
TAGS_TARGET="NOTAGS"
fi
if test ! -z "$doxygen"; then
DOCTARGETS="${DOCTARGETS} docs/doxygen.done"
fi
if test ! -z "$ronn"; then
DOCTARGETS="${DOCTARGETS} docs/ronn.done"
fi
if test $target = "i686-pc-mingw32"; then
shared_suffix="dll"
install_shared="install-dll"
LIBS="$LIBS -lwsock32"
fi
AC_DEFINE_UNQUOTED(U8_SHARED_SUFFIX,"${shared_suffix}")
AC_PATH_PROG(XGETTEXT,xgettext)
AC_PATH_PROG(MSGMERGE,msgmerge)
AC_PATH_PROG(MSGFMT,msgfmt)
ALPINE_CRYPTO_LIB=libressl2.7-libcrypto
AC_SUBST(ALPINE_CRYPTO_LIB)
AC_CHECK_PROGS(APK,"apk","")
if test ! -z "${APK}"; then
ALPINE_CRYPTO_LIB=$(${APK} search libressl | grep crypto | cut -d- -f1,2);
fi;
AC_DEFINE(FD_WORDS_ARE_ALIGNED,1)
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_PID_T
AC_TYPE_MODE_T
AC_C_INLINE
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(void *)
TRY_LIBNAME=
# Check whether to use an architecture specific libdir
if test "x${libdir}" != "x\${exec_prefix}/lib"; then
echo using explicit libdir ${libdir};
else case ${target_cpu} in
*i386*)
TRY_LIBNAME=lib32;
;;
*64*)
TRY_LIBNAME=lib64;
;;
esac;
if test -n "${TRY_LIBNAME}"; then
:;
elif test ${ac_cv_sizeof_void_p} -eq 8; then
TRY_LIBNAME=lib64;
elif test ${ac_cv_sizeof_void_p} -eq 8; then
TRY_LIBNAME=lib32;
else
TRY_LIBNAME=lib;
fi;
if test -z "${TRY_LIBNAME}"; then
echo using default libdir ${libdir};
elif test -d /usr/${TRY_LIBNAME} && test -f /usr/${TRY_LIBNAME}/libc.so; then
libdir=\${exec_prefix}/${TRY_LIBNAME};
echo using libdir ${libdir};
else
echo using default libdir ${libdir};
fi;
fi
AC_HEADER_STAT
AC_CHECK_HEADERS(strings.h netdb.h sys/types.h sys/mman.h)
AC_CHECK_HEADERS(sys/stat.h unistd.h pwd.h grp.h fcntl.h poll.h sys/poll.h)
AC_CHECK_HEADERS(sys/socket.h sys/select.h sys/un.h netdb.h)
AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h)
AC_CHECK_HEADERS(sys/timeb.h utime.h dlfcn.h malloc.h sys/malloc.h malloc/malloc.h)
AC_CHECK_HEADERS(sys/resource.h resource.h sys/syscall.h)
AC_CHECK_FUNCS(getenv setenv unsetenv execvpe)
AC_CHECK_FUNCS(getrusage mallinfo syscall mstats sysconf getpagesize)
AC_CHECK_FUNCS(strchr strrchr strstr strrrstr)
AC_CHECK_FUNCS(posix_fadvise posix_madvise posix_fallocate)
AC_CHECK_HEADERS(stdatomic.h)
AC_HEADER_STAT
if test "x$with_asan" = "xyes"; then
AC_CHECK_LIB(asan,asan_init)
fi
# Time support
AC_CHECK_HEADERS(time.h sys/time.h sys/types.h)
AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_EGREP_HEADER(tm_gmtoff,time.h,AC_DEFINE(HAVE_TM_GMTOFF,1),AC_DEFINE(HAVE_TM_GMTOFF,0))
AC_EGREP_HEADER(tm_isdst,time.h,AC_DEFINE(HAVE_TM_ISDST,1),AC_DEFINE(HAVE_TM_ISDST,0))
# pwd/grp types
signed_uid_t=1
signed_gid_t=1
AX_CHECK_SIGN([uid_t],
[ signed_uid_t=1 ],
[ signed_uid_t=0 ], [
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
])
AX_CHECK_SIGN([gid_t],
[ signed_gid_t=1 ],
[ signed_gid_t=0 ], [
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
])
if test ${signed_uid_t} = 0; then
AC_DEFINE(UID_T_UNSIGNED,1)
fi
if test ${signed_gid_t} = 0; then
AC_DEFINE(GID_T_UNSIGNED,1)
fi
# Particular functions
AC_CHECK_FUNCS(isatty fstat)
AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(strdup strerror_r)
AC_CHECK_FUNCS(access flock fcntl fseeko)
AC_CHECK_FUNCS(chown chmod setuid getuid geteuid utime)
AC_CHECK_FUNCS(getpwnam getpwnam_r getpwgid getpwgid_r)
AC_CHECK_FUNCS(setgid getgid getegid getgroups)
AC_CHECK_FUNCS(getgrnam getgrnam_r getgrgid getgrgid_r)
AC_CHECK_FUNCS(symlink realpath mkdtemp mkstemp)
AC_CHECK_FUNCS(ftime gettimeofday localtime_r gmtime_r getpid)
AC_CHECK_FUNCS(gethostbyname2_r)
AC_CHECK_FUNCS(getservbyname)
AC_CHECK_FUNCS(nanosleep)
AC_CHECK_FUNCS(mmap)
AC_FUNC_STRERROR_R
# Syslog
AC_CHECK_FUNCS(syslog,syslog_target="syslog_libs",syslog_target="")
# Internationalization
AC_CHECK_HEADERS(libintl.h)
AC_CHECK_LIB(intl,gettext)
AC_CHECK_FUNCS(gettext,[libc_gettext="yes"])
if test "x$libc_gettext" != "xyes"; then
AC_CHECK_LIB(intl,gettext)
fi
AC_CHECK_FUNCS(gettext,[do_i18n="yes"])
if test "x$do_i18n" = "xyes"; then
AC_CHECK_FUNCS(textdomain bindtextdomain bindtextdomain_codeset)
fi
AC_ARG_WITH(i18n,--with[out]-i18n built and install message catalogs,,with_i18n="yes")
if test "x$doi18n" = "xyes" && test "x$with_i18n" = "xyes"; then
I18N="i18n"
INSTALLI18N="install-i18n"
fi
AC_ARG_WITH(fileinfo,--with[out]-fileinfo record fileinfo,,with_fileinfo="yes")
if test "x$with_fileinfo" = "xyes" ; then
definefileinfo="-D_FILEINFO=\"\\\"\`exe/u8_fileinfo ./$< .\`\\\"\""
versionsh="include/framerd/versions.h"
fi
dnl Use sudo for installations in makefile
AC_ARG_WITH(sudo,--with[out]-sudo use sudo with install,,with_sudo="yes")
if test "x$with_sudo" == "xyes"; then
AC_CHECK_PROGS(sudo_program,sudo,"na")
if test "x$sudoprogram" == "xna"; then
SUDO=""
else
SUDO="unset LD_LIBRARY_PATH; unset DYLD_LIBRARY_PATH; $sudo_program "
fi
elif test "x$with_sudo" != "xno"; then
SUDO="$with_sudo "
fi
AC_ARG_WITH(tcmalloc,--with[out]-tcmalloc Use the Google malloc library,,with_tcmalloc="no")
if test $with_tcmalloc = "yes"; then
AC_CHECK_LIB(tcmalloc,malloc)
fi
AC_CHECK_LIB(dl,dlopen)
AC_ARG_ENABLE(threads,--en/disable-threads Enable multi-threading,,enable_threads=$threads_default)
if test $enable_threads = "yes"; then
AX_PTHREAD()
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_DEFINE(U8_THREADS_ENABLED,1)
else
AC_DEFINE(U8_THREADS_ENABLED,0)
fi
dnl ***********************************
dnl *** Checks for working __thread ***
dnl ***********************************
AC_MSG_CHECKING(for working __thread)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
__thread int i;
static int res1, res2;
]], [[
void thread_main (void *arg)
{
i = arg;
sleep (1);
if (arg == 1) res1 = (i == arg);
else res2 = (i == arg);
}
int main () {
pthread_t t1, t2;
i = 5;
pthread_create (&t1, NULL, thread_main, 1);
pthread_create (&t2, NULL, thread_main, 2);
pthread_join (t1, NULL);
pthread_join (t2, NULL);
return !(res1 + res2 == 2);
}
]])],[
tls_default=no
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_THREAD_STORAGE_CLASS)],[tls_default=yes
AC_MSG_RESULT(no)])
dnl This forces the use of the threadlocal storage functions from the pthreads
dnl library. Otherwise, the executable will use __thread storage declarations
dnl when available
AC_ARG_WITH(tls,--with[out]-tls Force use of threadlocal storage,,with_tls=$tls_default)
if test $with_tls = "yes"; then
AC_DEFINE(U8_FORCE_TLS,1)
else
AC_DEFINE(U8_FORCE_TLS,0)
fi
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_rwlock_init pthread_self pthread_create)
AC_CHECK_FUNCS(pthread_mutexattr_init pthread_mutexattr_settype)
AC_CHECK_FUNCS(pthread_threadid_np)
AC_CHECK_FUNCS(pthread_get_stacksize_np pthread_get_stackaddr_np)
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
AC_CHECK_FUNCS(pthread_attr_getstack pthread_attr_getstackaddr)
AC_CHECK_FUNCS(pthread_attr_getstacksize pthread_attr_setstacksize)
AC_ARG_ENABLE(malloc-debugging,--en[dis]able-malloc-debugging en[dis]ables libu8 malloc debugging support)
if test "malloc_debugging_enabled" = "yes"; then
AC_DEFINE(U8_DEBUG_MALLOC,1)
fi
AC_ARG_ENABLE(largefiles,--en/disable-largefiles Enable use of large (> 2GB) file support,,largefiles_enabled=yes)
if test $largefiles_enabled = "yes"; then
AC_DEFINE(U8_LARGEFILES_ENABLED,1)
else
AC_DEFINE(U8_LARGEFILES_ENABLED,0)
fi
dnl ***********************************
dnl *** Checks for working constructor attributes ***
dnl ***********************************
AC_MSG_CHECKING(for working __constructor_attributes)
dnl ***********************************
dnl *** Checks for working constructor attributes ***
dnl ***********************************
AC_MSG_CHECKING(for working __constructor_attributes)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
int tmpinit(void) __attribute__ ((constructor));
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONSTRUCTOR_ATTRIBUTES)],[AC_MSG_RESULT(no)])
dnl ***********************************
dnl *** Checks for working __builtin_expect ***
dnl ***********************************
AC_MSG_CHECKING(for working __builtin_expect)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
int main (int argc,char *argv[]) {
if (__builtin_expect((argc>2),1)) return 0;
else return 1;
}
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BUILTIN_EXPECT)],[AC_MSG_RESULT(no)])
# OS X crypto
AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h CommonCrypto/CommonHMAC.h)
AC_CHECK_HEADERS(CommonCrypto/CommonCryptor.h)
AC_CHECK_FUNCS(CCHmacInit CCCryptorCreate)
# OpenSSL crypto
AC_CHECK_HEADERS(openssl/hmac.h)
AC_CHECK_HEADERS(openssl/md5.h)
AC_CHECK_HEADERS(openssl/sha.h)
AC_CHECK_HEADERS(openssl/err.h)
AC_CHECK_HEADERS(openssl/evp.h)
AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_new)
AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init)
AC_CHECK_FUNCS(EVP_get_cipherbyname EVP_CIPHER_CTX_new EVP_CIPHER_CTX_init SHA1_Init)
# UUID functions
AC_CHECK_HEADERS(uuid/uuid.h)
AC_CHECK_LIB(uuid,uuid_generate_time)
AC_CHECK_FUNCS(uuid_generate_time)
AC_CONFIG_FILES([makefile docs/makefile etc/libu8.pc etc/getbuildopt
dist/libu8-2.7.spec dist/libu8.spec dist/alpine/APKBUILD
scripts/u8_install_shared scripts/u8_gzinstall])
AC_CONFIG_COMMANDS([default],[chmod a+x etc/getbuildopt scripts/u8_install_shared scripts/u8_gzinstall],[])
AC_OUTPUT