-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
2080 lines (1800 loc) · 64.1 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
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
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AC_PREREQ([2.68])
AC_INIT
AC_CONFIG_SRCDIR([include/kno/lisp.h])
AC_PREFIX_PROGRAM(autoconf)
AC_USE_SYSTEM_EXTENSIONS
xprefix=${prefix}
if test $exec_prefix = "NONE"; then
xprefix=$prefix
else
xprefix=$exec_prefix
fi
AC_DEFUN([AC_CHECK_USER],[
AC_MSG_CHECKING([for user $1])
found_user="none";
for user in $2;
do
if grep ^$user: /etc/passwd > /dev/null;
then
found_user=$user;
break;
fi;
done;
$1=$found_user;
AC_MSG_RESULT($found_user)])
AC_DEFUN([AC_CHECK_GROUP],[
AC_MSG_CHECKING([for group $1])
found_group="none";
for group in $2;
do if grep ^$group: /etc/group > /dev/null;
then
found_group=$group;
break;
fi; done;
$1=$found_group;
AC_MSG_RESULT($found_group)])
mkpath(){
local dir=$1
local path=$2
if test "${dir%/}" = ${dir}; then
echo ${dir}/${path};
else
echo ${dir}${path};
fi;
}
# Basic path information
AC_DEFINE_UNQUOTED(KNO_INSTALL_ROOT,"$prefix/")
SYSROOT=
AC_ARG_WITH(sysroot,--with-sysroot where to place all KNO support files,with_sysroot=$withval,with_sysroot=no)
if test "${with_sysroot}" != "no"; then
SYSROOT=$(mkpath ${with_sysroot} "")
fi
default_statedir=/var
if test ! -z "${SYSROOT}" ; then
AC_DEFINE_UNQUOTED(KNO_SYSROOT,"${SYSROOT}")
default_statedir="${SYSROOT}"
AC_SUBST(SYSROOT)
fi
AC_ARG_ENABLE(relocation,--en/disable-relocation makes kno handle relocation of executables,enable_relocation=$enableval,enable_relocation="no")
echo "enable_relocation=${enable_relocation}";
if test "${enable_relocation}" != "no"; then
RELOCATABLE=true;
else
RELOCATABLE=false;
fi
if ${RELOCATABLE}; then
AC_DEFINE(KNO_RELOCATION_ENABLED,1)
fi
# These are all contribs we might build
ALLCONTRIBS="sundown tidy ziptools mongodb leveldb rocksdb postgres mariadb odbc archivetools imagetools hyphenate hunspell nng zeromq readstat mod_knocgi"
# Override the default value for statedir
AC_ARG_WITH(statedir,--with-statedir where to keep local state e.g. /var,statedir=$withval,statedir="${default_statedir}")
CC=${CC}
DEFAULTMAKETARGET=update
threads_default="yes"
shared_default="yes"
shared_suffix="so"
rpath_default=$exec_prefix
tls_default="no"
global_ipeval_default="no"
enable_ipeval_default="no"
install_dir_opts="-m ug+rwx,o+rx -d"
install_file_opts="-m ug+rw,o+r"
install_exe_opts="-m ug+rwx,o+rx"
setup_target=
ifmacos="#"
webuser=""
webgroup=""
install_user=
install_group=
libc_pthreads="no"
libc_dlopen="no"
calltracko=""
curlo=""
ldnso=""
ipevalo=""
ipevalopso=""
curlconfig=""
curl_default="no"
dns_default="no"
exifo=""
with_gettext="no"
rpmflags=""
rmpdir="dist"
exif_default="no"
dynamic_cflag=""
xstatic_exe_libs=""
xstatic_scheme_libs=""
xdynamic_scheme_libs=""
scheme_builtins_init="kno_init_scheme()"
versionsh="include/kno/versions.h"
suffix=""
rpath=""
daemon_identity_default="daemon"
setup_target="setup-unix"
extra_gdb_sources=
DREENTRANT="-D_REENTRANT"
MKSTATIC="ld -r "
TESTLIBS=
TESTLDFLAGS=
STATICLDFLAGS=
EXEFLAGS=
EXELIBS=
BINPATH=${PATH}
U8BIN=$(dirname $(which u8_gitversion) || echo ${PREFIX})
U8BIN="${U8BIN}"
U8RUN=${U8BIN}/u8run
RPATHFLAGS=-Wl,-rpath,"\\\$\$ORIGIN/\${RPATH}"
SHARED_LIB_TARGET=shared-libs
KNO_PATCHVERSION=$(if test -d .git; then ${U8BIN}/u8_gitversion etc/base_version; elif test -f VERSION; then cat VERSION; else echo "$(cat etc/base_version).0"; fi)
KNO_BRANCH=$(${U8BIN}/u8_gitbranch)
KNO_VERSION=$(echo ${KNO_PATCHVERSION} | cut -d'-' -f1)
KNO_MAJOR=$(echo ${KNO_VERSION} | cut -d'.' -f1)
KNO_MINOR=$(echo ${KNO_VERSION} | cut -d'.' -f2)
KNO_PATCHLEVEL=$(echo ${KNO_VERSION} | cut -d'.' -f3)
KNO_CHANNEL=${KNO_BRANCH}
VERSION=$KNO_VERSION
LIBSOURCE=lib
SHAREDEXE=exe
STATICEXE=static
mshared_suffix=so.${KNO_MAJOR}
mmshared_suffix=so.${KNO_MAJOR}.${KNO_MINOR}
vshared_suffix=so.${KNO_VERSION}
CLEAN="rm -f "
I18N=""
INSTALLI18N=""
WWWUSER="apache"
apache_modules_dir="/usr/lib/apache2/modules"
apache_conf_dir="/etc/apache2"
apache_log_dir=""
apache_modinfo="/etc/apache2"
A2EN="none"
stdlib_install_dir=""
installed_module_dir=""
source_module_dir=""
local_module_dir=""
conf_module_dir=""
default_module_path=""
module_path=""
source_dir=""
CONTRIBS=""
CMODULES=""
TEST_CMODULES=""
INSTALL_CMODULES=""
DATAFILES="etc/base_version"
ZIPCMD=""
SUDO=""
SUINSTALL=
RPMDIR=${RPMDIR:-dist}
RPMFLAGS=${RPMFLAGS:-}
APTLY=
APTLY_FLAGS=
PKGCONFIG_DIR=
GPG=`which gpg2 || which gpg || gpg`
GPGID=${GPGID:-FE1BC737F9F323D732AA26330620266BE5AFF294}
TAGS_TARGET="alltags"
LIBSCM=""
install_libscm="install-libscm"
STDLIB=""
rundir=$(mkpath "${statedir}" "run")
logdir=$(mkpath "${statedir}" "log")
if test -z "${SYSROOT}"; then
kno_rundir=$(mkpath "$rundir" "kno")
kno_logdir=$(mkpath "$logdir" "kno")
else
kno_rundir=$(mkpath "${SYSROOT}" "run")
kno_logdir=$(mkpath "${SYSROOT}" "log")
fi;
default_source_dir="\$prefix/src"
default_config_dir="\$prefix/etc/kno"
default_buildopts_dir="\$prefix/etc/beingmeta/opts"
local_config="\$prefix/etc/kno"
shared_config="\$prefix/etc/kno"
daemon_logdir="$kno_logdir/daemons"
servlet_logdir="$kno_logdir/servlets"
daemon_rundir="$kno_rundir/daemons"
servlet_rundir="$kno_rundir/servlets"
default_bugjar="$kno_logdir/bugjar"
share_dir=""
data_dir=""
archflags=""
with_crypto_default="yes"
use_dtblock_default="yes"
default_bootsystem="none"
BOOTSETUP=
CFLAGS="${CFLAGS} -DLIBU8_SOURCE -DKNO_SOURCE -fPIC"
LDFLAGS="${LDFLAGS}"
PKG_CFLAGS="-fPIC"
OPTFLAGS=
XOPTFLAGS=
CLANG=no
MALLOC_FLAGS="-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
LIBZIP_CFLAGS=
LIBZIP_LDFLAGS=
PYTHON2_CFLAGS=
PYTHON2_LDFLAGS=
PYTHON3_CFLAGS=
PYTHON3_LDFLAGS=
DEFAULTISASYNC=0
USEDTBLOCK=0
MSG=echo
debugcflags=" -Og -g3 -ggdb3 -fno-inline -fno-omit-frame-pointer "
debugldflags=""
debuglibs=""
profilecflags=" -O0 -g3 -ggdb3 -fno-inline -fno-omit-frame-pointer "
profileldflags=""
profiledefines=""
manually_disabled=""
auto_disabled=""
force_enabled=""
missing=""
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*|*x32*|*armhf*|mips|mipsel)
TRY_LIBNAME=lib32;
;;
*64*|*alpha*)
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 4; 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
test_env=
memtest_env="MALLOC_CHECK_=3 "
leaktester_env=""
TESTER=./runtest
MEMTESTER=./memtest
LEAKTESTER=./leaktest
MEMTEST_CMD=
LEAKTEST_CMD=
test_config="TESTSIZE=64"
memtest_config=
leaktester_config=
test_size=512
small_test_size=64
use_duma_lib="no"
custom_malloc=""
using_malloc=""
default_malloc=${KNO_DEFAULT_MALLOC:-libc}
gperftools=""
asan=""
static_libgcc="no"
CODENAME="beingmeta"
RELSTATUS="stable"
AC_CHECK_LIB(jemalloc,malloc,default_malloc=jemalloc)
gperftools_default="yes"
if which lsb_release 2>&1 > /dev/null; then
CODENAME=`lsb_release -cs || echo beingmeta`
fi
if test -f .reponame; then
REPONAME=$(cat .reponame);
elif test -z "${KNO_BRANCH}" || test "${KNO_BRANCH}" = "main"; then
REPONAME="kno";
else
REPONAME="kno_${KNO_BRANCH}";
fi;
if (test "$rpath_default" = "NONE") || (test "$rpath_default" = ""); then
rpath_default=$prefix;
fi
AC_CONFIG_AUX_DIR(etc)
AC_CONFIG_HEADERS([include/kno/knosource.h include/kno/config.h])
AC_SUBST(DEFAULTMAKETARGET)
AC_SUBST(install_dir_opts)
AC_SUBST(install_file_opts)
AC_SUBST(install_exe_opts)
AC_SUBST(setup_target)
AC_SUBST(ifmacos)
AC_SUBST(shared_suffix)
AC_SUBST(vshared_suffix)
AC_SUBST(mshared_suffix)
AC_SUBST(mmshared_suffix)
AC_SUBST(dynamic_cflag)
AC_SUBST(OPTFLAGS)
AC_SUBST(XOPTFLAGS)
AC_SUBST(rpath)
AC_SUBST(curlconfig)
AC_SUBST(calltracko)
AC_SUBST(curlo)
AC_SUBST(ldnso)
AC_SUBST(exifo)
AC_SUBST(ipevalo)
AC_SUBST(ipevalopso)
AC_SUBST(suffix)
AC_SUBST(xstatic_exe_libs)
AC_SUBST(xstatic_scheme_libs)
AC_SUBST(xdynamic_scheme_libs)
AC_SUBST(scheme_builtins_init)
AC_SUBST(systemd_loc)
AC_SUBST(share_dir)
AC_SUBST(unpackage_dir)
AC_SUBST(installed_module_dir)
AC_SUBST(source_module_dir)
AC_SUBST(local_module_dir)
AC_SUBST(conf_module_dir)
AC_SUBST(default_module_path)
AC_SUBST(config_dir)
AC_SUBST(buildopts_dir)
AC_SUBST(local_config)
AC_SUBST(shared_config)
AC_SUBST(data_dir)
AC_SUBST(source_dir)
AC_SUBST(apache_log_dir)
AC_SUBST(apache_modules_dir)
AC_SUBST(apache_conf_dir)
AC_SUBST(apache_modinfo)
AC_SUBST(webuser)
AC_SUBST(webgroup)
AC_SUBST(install_user)
AC_SUBST(install_group)
AC_SUBST(rundir)
AC_SUBST(logdir)
AC_SUBST(bugjar)
AC_SUBST(kno_rundir)
AC_SUBST(kno_logdir)
AC_SUBST(daemon_rundir)
AC_SUBST(daemon_logdir)
AC_SUBST(daemon_bugjar)
AC_SUBST(servlet_rundir)
AC_SUBST(servlet_logdir)
AC_SUBST(servlet_bugjar)
AC_SUBST(archflags)
AC_SUBST(versionsh)
AC_SUBST(extra_gdb_sources)
AC_SUBST(debugcflags)
AC_SUBST(debugldflags)
AC_SUBST(debuglibs)
AC_SUBST(profilecflags)
AC_SUBST(profileldflags)
AC_SUBST(profileldefines)
AC_SUBST(profilellibs)
AC_SUBST(test_env)
AC_SUBST(memtest_env)
AC_SUBST(leaktest_env)
AC_SUBST(TESTER)
AC_SUBST(MEMTESTER)
AC_SUBST(LEAKTESTER)
AC_SUBST(LEAKTEST_CMD)
AC_SUBST(MEMTEST_CMD)
AC_SUBST(test_config)
AC_SUBST(memtest_config)
AC_SUBST(leaktest_config)
AC_SUBST(test_size)
AC_SUBST(small_test_size)
AC_SUBST(TAGS_TARGET)
AC_SUBST(DREENTRANT)
AC_SUBST(SHARED_LIB_TARGET)
AC_SUBST(SHARED_LIB)
AC_SUBST(SHARED_LIBV)
AC_SUBST(test_env)
AC_SUBST(STATICLDFLAGS)
AC_SUBST(TESTLDFLAGS)
AC_SUBST(TESTLIBS)
AC_SUBST(EXEFLAGS)
AC_SUBST(EXELIBS)
AC_SUBST(RPATHFLAGS)
AC_SUBST(KNO_VERSION)
AC_SUBST(KNO_MAJOR)
AC_SUBST(KNO_MINOR)
AC_SUBST(KNO_BRANCH)
AC_SUBST(KNO_PATCHLEVEL)
AC_SUBST(KNO_PATCHVERSION)
AC_SUBST(LIBSOURCE)
AC_SUBST(SHAREDEXE)
AC_SUBST(STATICEXE)
AC_SUBST(VERSION)
AC_SUBST(PROFILING)
AC_SUBST(MKSTATIC)
AC_SUBST(CLEAN)
AC_SUBST(I18N)
AC_SUBST(INSTALLI18N)
AC_SUBST(SUDO)
AC_SUBST(SUINSTALL)
AC_SUBST(ZIPCMD)
AC_SUBST(WWWUSER)
AC_SUBST(CONTRIBS)
AC_SUBST(ALLCONTRIBS)
AC_SUBST(CMODULES)
AC_SUBST(TEST_CMODULES)
AC_SUBST(INSTALL_CMODULES)
AC_SUBST(DATAFILES)
AC_SUBST(BOOTSETUP)
AC_SUBST(PKG_CFLAGS)
AC_SUBST(MALLOC_FLAGS)
AC_SUBST(LIBZIP_CFLAGS)
AC_SUBST(LIBZIP_LDFLAGS)
AC_SUBST(DEFAULTISASYNC)
AC_SUBST(DEFAULT_DLOAD_PATH)
AC_SUBST(USEDTBLOCK)
AC_SUBST(MSG)
AC_SUBST(BINDIR)
AC_SUBST(CHOWN)
AC_SUBST(CHMOD)
AC_SUBST(GZIP)
AC_SUBST(DELETEFILE)
AC_SUBST(COPYFILE)
AC_SUBST(TOUCHFILE)
AC_SUBST(MKDIR)
AC_SUBST(CHGRP)
AC_SUBST(APTLY)
AC_SUBST(CODENAME)
AC_SUBST(REPONAME)
AC_SUBST(RELSTATUS)
AC_SUBST(BINPATH)
AC_SUBST(LIBSCM)
AC_SUBST(install_libscm)
AC_SUBST(ODBC_LIBS)
AC_SUBST(SQLITE3_LIBS)
AC_SUBST(ZEROMQ_LIBS)
AC_SUBST(PYTHON2_CFLAGS)
AC_SUBST(PYTHON2_LDFLAGS)
AC_SUBST(PYTHON3_CFLAGS)
AC_SUBST(PYTHON3_LDFLAGS)
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_SUBST(RPMDIR)
AC_SUBST(RPMFLAGS)
AC_SUBST(GPGID)
AC_SUBST(PKGCONFIG_DIR)
AC_SUBST(GPG)
AC_SUBST(U8BIN)
AC_SUBST(u8run)
AC_PATH_PROG(binenv,env)
AC_PATH_PROG(SCRIPT_SHELL,sh)
AC_CHECK_PROG(ECHO,echo,,/bin/echo)
AC_CHECK_PROG(MKDIR_DEFAULT,mkdir,,/bin/mkdir)
AC_CHECK_PROG(CHMOD_DEFAULT,chmod,,/bin/chmod)
AC_CHECK_PROG(CHOWN_DEFAULT,chown,,/bin/chown)
AC_CHECK_PROG(CHGRP_DEFAULT,chgrp,,/bin/chgrp)
AC_CHECK_PROG(COPYFILE_DEFAULT,cp,,/bin/cp)
AC_CHECK_PROG(DELETEFILE_DEFAULT,rm,,/bin/rm)
AC_CHECK_PROG(TOUCHFILE_DEFAULT,touch,,/bin/touch)
AC_CHECK_PROG(APTLY,aptly,,/usr/bin/aptly)
AC_PATH_PROG(VALGRIND,valgrind,none)
AC_PATH_PROG(DUMA,duma,none)
AC_PATH_PROG(CLANG,clang,none)
AC_CHECK_PROG(CREATEREPO,createrepo)
AC_CHECK_PROGS(LLVM_SYMBOLIZER,llvm-symbolizer-3.5,llvm-symbolizer-3.4)
AC_PATH_PROG(LLVM_SYMBOLIZER_PATH,$LLVM_SYMBOLIZER)
AC_PATH_PROG(GOOGLE_PPROF,google-pprof)
AC_PATH_PROG(XGETTEXT,xgettext)
AC_PATH_PROG(MSGMERGE,msgmerge)
AC_PATH_PROG(MSGFMT,msgfmt)
AC_CHECK_PROGS(GZIP,"gzip","na")
AC_CHECK_PROGS(ZIP,"zip","na")
if test ! -z "${ZIP}"; then
if ${ZIP} -y temp.zip configure.ac 2>&1 > /dev/null; then
ZIPCMD="${ZIP} -y";
else ZIPCMD="${ZIP}";
fi;
else
ZIPCMD="nozipcommand";
fi;
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_PROG_CC([${CC} cc gcc clang])
AC_ARG_WITH(execwrapper,--with-execwrapper program to use when calling exec(),,with_execwrapper=$binenv)
if test "$with_execwrapper" != ""; then
AC_DEFINE_UNQUOTED(KNO_EXEC_WRAPPER,"$with_execwrapper")
fi
AC_ARG_WITH(u8bin,--with-u8bin path for libu8 programs/scripts,,with_u8bin=${U8BIN})
if test "$with_u8bin" != ""; then
AC_DEFINE_UNQUOTED(KNO_U8BIN,"$with_u8bin")
U8BIN="${with_u8bin}/"
DEFAULT_U8RUN="$with_u8bin/u8run"
else
DEFAULT_U8RUN=u8run
fi
AC_ARG_WITH(u8run,--with-u8run location of the u8run launcher,,with_u8run=${DEFAULT_U8RUN})
if test "$with_u8run" != ""; then
AC_DEFINE_UNQUOTED(KNO_U8RUN,"$with_u8run")
u8run=$with_u8run;
else
u8run=${u8bin}u8run
fi
AC_CHECK_PROGS(etags,etags,"na")
if test $etags = "na"; then
TAGS_TARGET="NOTAGS"
fi
AC_CHECK_PROGS(git,"git","na")
AC_CHECK_PROGS(pkg_config,pkg-config /opt/local/bin/pkg-config /opt/bin/pkg-config /usr/local/bin/pkg-config ,"na")
AC_ARG_WITH(mkdir,--with-mkdir command,with_mkdir=$withval,with_mkdir=$MKDIR_DEFAULT)
MKDIR=$with_mkdir
AC_ARG_WITH(chmod,--with-chmod command,with_chmod=$withval,with_chmod=$CHMOD_DEFAULT)
CHMOD=$with_chmod
AC_ARG_WITH(chown,--with-chown command,with_chown=$withval,with_chown=$CHOWN_DEFAULT)
CHOWN=$with_chown
AC_ARG_WITH(chgrp,--with-chgrp command,with_chgrp=$withval,with_chgrp=$CHGRP_DEFAULT)
CHGRP=$with_chgrp
AC_ARG_WITH(deletefile,--with-deletefile command,with_deletefile=$withval,with_deletefile=$DELETEFILE_DEFAULT)
DELETEFILE=$with_deletefile
AC_ARG_WITH(copyfile,--with-copyfile command,with_copyfile=$withval,with_copyfile=$COPYFILE_DEFAULT)
COPYFILE=$with_copyfile
AC_ARG_WITH(touchfile,--with-touchfile command,with_touchfile=$withval,with_touchfile=$TOUCHFILE_DEFAULT)
TOUCHFILE=$with_touchfile
AC_ARG_WITH(aptly,--with-aptly command,with_aptly=$withval)
if test ! -z "${with_aptly}"; then
case $with_aptly in
/*) APTLY=$with_aptly;;
-*) APTLY="${APTLY} $with_aptly";;
esac;
fi;
AC_ARG_WITH(default-target,--with-default-target default-make-target,with_default_target=$withval,with_default_target=update)
DEFAULTMAKETARGET=$with_default_target
AC_PROG_INSTALL
AC_PROG_RANLIB
CFLAGS="-I$prefix/include/$host/ $CFLAGS"
PKG_CFLAGS="-I$prefix/include/$host/ $PKG_CFLAGS"
AC_ARG_WITH(suffix,--with-suffix string,,with_suffix="")
suffix=$with_suffix
AC_MSG_CHECKING(PATCHLEVEL)
if test ! -z "${KNO_PATCHLEVEL}"; then
AC_MSG_RESULT(${KNO_PATCHLEVEL});
elif test -d .git; then
KNO_PATCHLEVEL=$(${U8BIN}/u8_gitpatchcount ./etc/base_version);
AC_MSG_RESULT(${KNO_PATCHLEVEL} from ${U8BIN}/u8_gitpatchcount);
else
if test -f VERSION; then
KNO_PATCHLEVEL=$(cat VERSION | cut -d'-' -f2); fi;
if test -z "${KNO_PATCHLEVEL}"; then KNO_PATCHLEVEL=unknown; fi
AC_MSG_RESULT(${KNO_PATCHLEVEL} noinfo);
fi;
if test -f .ipeval; then
enable_ipeval_default="yes;
else enable_ipeval_default="no;
fi
AC_ARG_WITH(optinclude,--with-optinclude Use optional include directory,,with_optinclude="none")
if test "$with_optinclude" != "none"; then
CPPFLAGS="$CPPFLAGS -I$with_optinclude"
CFLAGS="$CFLAGS -I$with_optinclude"
fi
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(sourcedir,--with-sourcedir source directory,source_dir=$withval,source_dir=$prefix/src)
AC_ARG_WITH(extra_sources,--with-extra_sources Configure extra source directories for gdb,,with_extra_sources="none")
if test "$with_extra_sources" != "none"; then
extra_gdb_sources=:${with_extra_sources};
fi
AC_ARG_ENABLE(stripping,--enable-stripping strip libraries and executables before installing,,enable_stripping="no")
if test "$enable_stripping" != "no"; then
LIBSOURCE=lib/stripped
SHAREDEXE=exe/stripped
STATICEXE=static/stripped
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"
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
dnl Specify an additional library
AC_ARG_WITH(extlib,
[ --with-extlib[[=DIR]] use additional lib dir],[
if test "$withval" != "no" -a "$withval" != "yes"; then
LDFLAGS="${LDFLAGS} -l$withval"
fi
])
AC_ARG_WITH(rpath,--with-rpath dir,rpath=$withval,rpath=$rpath_default)
# If we have an rpath, we add RPATHFLAGS (resolved during the make) to EXEFLAGS
if test "$rpath" != "none" && test "$rpath" != "NONE" && test ! -z "$rpath" &&
test "$rpath" != "/usr" && test "$rpath" != "/usr/local"; then
EXEFLAGS=" \$(RPATHFLAGS) ${EXEFLAGS} "
fi
AC_ARG_WITH(pkgconfig_dir,--with-pkgconfig-dir pathname,,with_pkgconfig_dir=$prefix/share/pkgconfig)
PKGCONFIG_DIR=${with_pkgconfig_dir}
AC_DEFINE_UNQUOTED(KNO_PKGCONFIG_DIR,"$with_pkgconfig_dir")
### Checking the compiler
AC_CHECK_DECL(__clang__,CLANG=yes)
if test "${CLANG}" = "yes"; then
CFLAGS="${CFLAGS} -fno-strict-aliasing -g3 -ggdb"
OPTFLAGS="-O2"
XOPTFLAGS="-O3 -funroll-loops"
elif test "${GCC}" = "yes"; then
CFLAGS="${CFLAGS} -fno-strict-aliasing -g3 -ggdb"
OPTFLAGS="-O2"
XOPTFLAGS="-O3 -funroll-loops"
gcc_version=`gcc -dumpversion`;
dynamic_cflag="-rdynamic";
fi;
m4_include([etc/ax_pthread.m4])
m4_include([etc/ax_atomics.m4])
m4_include([etc/ax_check_link_flag.m4])
m4_include([etc/ax_python.m4])
m4_include([etc/ax_gcov.m4])
AC_DEFINE(KNO_WORDS_ARE_ALIGNED,1)
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_C_INLINE
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(long long,8)
AC_CHECK_SIZEOF(void *,8)
AC_CHECK_SIZEOF(time_t,8)
AC_CHECK_TYPES(uchar)
case $host_os in
darwin*)
# MKSTATIC="libtool -static "
dynamic_cflag="-dynamic"
shared_suffix="dylib"
vshared_suffix=${KNO_VERSION}.dylib
mshared_suffix=${KNO_MAJOR}.dylib
mmshared_suffix=${KNO_MAJOR}.${KNO_MINOR}.dylib
CFLAGS="-D_DARWIN_C_SOURCE $CFLAGS"
PKG_CFLAGS="-D_DARWIN_C_SOURCE $PKG_CFLAGS"
RPATHFLAGS=" -rpath \$(RPATH) "
STATICLDFLAGS=" -lc++"
ifmacos=""
setup_target="setup-osx"
gperftools_default="no"
;;
*)
MKSTATIC="ld -r --build-id "
;;
esac
# Now that we have shared_suffix defined, set some things up
CMODULES="lib/kno/testcapi.${shared_suffix} ${CMODULES}"
INSTALL_CMODULES="install-testcapi ${INSTALL_CMODULES}"
AX_CHECK_LINK_FLAG("-static-libgcc",static_libgcc="yes")
if test "${static_libgcc}" == "yes"; then
LDFLAGS="-static-libgcc -Wl,--as-needed ${LDFLAGS}"
fi
min_stacksize=4194304;
AC_ARG_WITH(minstack,--with-minstack Build with minimium stack size,min_stacksize=$withval)
AC_DEFINE_UNQUOTED(KNO_MIN_STACKSIZE,${min_stacksize})
default_stacksize=16777216;
AC_ARG_WITH(stacksize,--with-stacksize Build with default stack size,default_stacksize=$withval)
AC_DEFINE_UNQUOTED(KNO_DEFAULT_STACKSIZE,${default_stacksize})
default_cstacksize=
AC_ARG_WITH(cstacksize,--with-cstacksize Link specifying a default stacksize,default_cstacksize=$withval)
if test ! -z "${default_cstacksize}"; then
LDFLAGS="${LDFLAGS} -Wl,-z,stack-size=${default_cstacksize}";
fi;
AC_ARG_WITH(stackcheck,--with-stackcheck Build with native stack checking,with_stackcheck=$withval,with_stackcheck="yes")
if ! test "${with_stackcheck}" = "no"; then
AC_DEFINE_UNQUOTED(KNO_STACKCHECK,1)
fi
# profiling
dnl This compiles a version to be used with the GNU profiling tools
AC_ARG_ENABLE(cprofiling,--en/disable-cprofiling compile to support profiling and coverage tools,,enable_cprofiling="no")
if test -z "$enable_cprofiling" || test "$enable_cprofiling" = "no"; then
AC_DEFINE(KNO_PROFILING,0)
PROFILING=""
elif test $enable_cprofiling = "yes"; then
AC_DEFINE(KNO_PROFILING,1)
PROFILING="-O0 -fno-inline"
elif test $enable_cprofiling = "deep" || test $enable_cprofiling = "2" ; then
AC_DEFINE(KNO_PROFILING,2)
PROFILING="-O0 -fno-inline"
elif test $enable_cprofiling = "extreme" || test $enable_cprofiling = "3" ; then
AC_DEFINE(KNO_PROFILING,3)
PROFILING="-O0 -fno-inline"
else
AC_DEFINE(KNO_PROFILING,0)
PROFILING=""
fi
dnl This compiles a version to be used with the GNU profiling tools
AC_ARG_WITH(gnuprof,--with/out-gnuprof compile to generate GNU profiling information,,with_gnuprof="no")
if test "$with_gnuprof" = "yes"; then
if test -z "$PROFILING" ; then
AC_DEFINE(KNO_PROFILING,2)
PROFILING="-O0 -pg -fno-inline -fprofile-arcs -ftest-coverage"
else
PROFILING="${PROFILING} -pg"
fi;
fi;
### GNU Coverage checking
AC_TDD_GCOV
AC_SUBST(GCOV_CFLAGS)
AC_SUBST(GCOV_LDFLAGS)
if test "${use_gcov}" == "yes"; then
# AC_DEFINE(KNO_PROFILING,2)
PROFILING="${PROFILING} -fprofile-arcs -ftest-coverage"
OPTFLAGS=
XOPTFLAGS=
fi;
### Check some compiler fancies
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)])
dnl ***********************************
dnl *** Checks for working __builtin_prefetch ***
dnl ***********************************
AC_MSG_CHECKING(for working __builtin_prefetch)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
static int data[]={0,1,2,3};
int main (int argc,char *argv[]) {
__builtin_prefetch(&data[2],0,3);
return 0;
}
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BUILTIN_PREFETCH)],[AC_MSG_RESULT(no)])
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)])
### What flavor of malloc() to use
AC_ARG_WITH(duma,--with-duma Build with Detect Unintended Memory Access,with_duma=$withval,with_duma="no")
if test "$with_duma" != "no"; then
default_malloc="libc";
fi
WITHMALLOC_OPTS="libc builtin jemalloc asan tcmalloc dmalloc list"
AC_ARG_WITH(malloc,--with-malloc Use custom malloc: e.g. $WITHMALLOC_OPTS,with_malloc=$withval,with_malloc=$default_malloc)
if test "$with_malloc" = "jemalloc"; then
AC_CHECK_LIB(jemalloc,malloc,EXELIBS="-ljemalloc $EXELIBS")
elif test "$with_malloc" = "dmalloc"; then
AC_CHECK_LIB(dmalloc,malloc,EXELIBS="-ldmalloc $EXELIBS")
fi
AC_MSG_CHECKING(malloc library)
if test -z "$with_malloc" ||
test "$with_malloc" = "libc" ||
test "$with_malloc" = "builtin" ; then
AC_MSG_RESULT(libc default)
custom_malloc="";
using_malloc="libc"
elif test "$with_duma" != "no"; then
AC_MSG_ERROR(DUMA can only be used with libc malloc)
exit;
elif test "$with_malloc" = "tcmalloc"; then
gperftools="yes";
custom_malloc="tcmalloc"
using_malloc="tcmalloc"
AC_MSG_RESULT(tcmalloc)
elif test "$with_malloc" = "gperftools"; then
gperftools="profile";
custom_malloc="tcmalloc"
using_malloc="gperftools"
AC_MSG_RESULT(tcmalloc profiling)
elif test "$with_malloc" = "tcmalloc_debug"; then
gperftools="debug";
custom_malloc="tcmalloc_debug"
using_malloc="tcmalloc_debug"
AC_MSG_RESULT(tcmalloc debug)
elif test "$with_malloc" = "tcmalloc_minimal"; then
gperftools="minimal";
custom_malloc="tcmalloc_minimal"
using_malloc="tcmalloc_minimal"
AC_MSG_RESULT(tcmalloc minimal)
elif test "$with_malloc" = "jemalloc"; then
if test "${ac_cv_lib_jemalloc_malloc}" = "yes"; then
custom_malloc="jemalloc"
using_malloc="jemalloc"
AC_MSG_RESULT(jemalloc)
memtest_env="junk:true,tcache:false"
leaktest_env="prof_leak:true,lg_prof_sample:0,prof_final:true"
else
AC_MSG_ERROR(jemalloc can't be found)
exit;
fi;
elif test "$with_malloc" = "dmalloc"; then
if test "${ac_cv_lib_dmalloc_malloc}" = "yes"; then
custom_malloc="dmalloc"
using_malloc="dmalloc"
AC_MSG_RESULT(dmalloc)
else
AC_MSG_ERROR(dmalloc can't be found)
exit;
fi;
elif test "$with_malloc" = "asan"; 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"
using_malloc="asan"
test_env="MEMCHECKING=yes ASAN_SYMBOLIZER_PATH=$LLVM_SYMBOLIZER_PATH ASAN_OPTIONS=malloc_context_size=20 LSAN_OPTIONS=report_objects=1 $test_env";
leaktester_env="ASAN_OPTIONS=malloc_context_size=20 LSAN_OPTIONS=report_objects=1 ${leaktester_env}";
asan="yes"
test_size=64
AC_MSG_RESULT(ASAN)
elif test "$with_malloc" = "asan_noleak"; 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"
using_malloc="asan"
test_env="MEMCHECKING=yes ASAN_SYMBOLIZER_PATH=$LLVM_SYMBOLIZER_PATH ASAN_OPTIONS=detect_leaks=0:malloc_context_size=20 $test_env";
leaktester_env="ASAN_OPTIONS=malloc_context_size=20:detect_leaks=1 LSAN_OPTIONS=report_objects=1 ${leaktester_env}";
asan="yes"
test_size=64
AC_MSG_RESULT(ASAN)
elif test "$with_malloc" = "asan_thread"; then
CFLAGS="-fsanitize=thread -g -fno-omit-frame-pointer $CFLAGS"
LDFLAGS="-g -fsanitize=thread -fno-omit-frame-pointer $LDFLAGS"
build_static=""
test_static=""
install_static=""
custom_malloc="asan_thread"
using_malloc="asan_thread"
test_env="MEMCHECKING=yes MSAN_SYMBOLIZER_PATH=$LLVM_SYMBOLIZER_PATH $test_env";
asan="thread"
AC_MSG_RESULT(ASAN thread)
else
AC_MSG_ERROR(Valid values for malloc are libc tcmalloc jemalloc gperftools dmalloc tcmalloc_debug asan asan_thread)
exit 1;
fi
if test ! -z "$using_malloc"; then
AC_DEFINE_UNQUOTED(KNO_DEFAULT_MALLOC,"$using_malloc")
fi;
#if test ! -z "$asan" && test "$CLANG" = "none"; then
# AC_MSG_ERROR(No clang program to use with ASAN)
#fi;
if test -z "$gperftools" || test "$gperftools" = "no"; then
${ECHO} -n;
else
AC_CHECK_HEADERS(gperftools/profiler.h)
AC_CHECK_HEADERS(gperftools/heap-profiler.h)
AC_CHECK_HEADERS(gperftools/heap-checker.h)
AC_CHECK_HEADERS(gperftools/malloc_extension_c.h)
if test "$gperftools" = "debug"; then
AC_CHECK_LIB(tcmalloc_debug,malloc,EXELIBS="-ltcmalloc_debug $EXELIBS")
AC_CHECK_LIB(profiler,ProfilerStart,EXELIBS="-lprofiler $EXELIBS")
elif test "$gperftools" = "profile"; then
AC_CHECK_LIB(tcmalloc,malloc,EXELIBS="-ltcmalloc $EXELIBS")
AC_CHECK_LIB(profiler,ProfilerStart,EXELIBS="-lprofiler $EXELIBS")
CMODULES="lib/kno/gperftools.${shared_suffix} ${CMODULES}"
TEST_CMODULES="test-gperftools ${CMODULES}"
INSTALL_CMODULES="install-gperftools ${INSTALL_CMODULES}"
elif test "$gperftools" = "minimal"; then
AC_CHECK_LIB(tcmalloc_minimal,malloc,EXELIBS="-ltcmalloc_minimal $EXELIBS")
else
AC_CHECK_LIB(tcmalloc,malloc)
fi;
if test "${ac_cv_lib_tcmalloc_malloc}" == "yes" || \
test "${ac_cv_lib_tcmalloc_debug_malloc}" == "yes" || \
test "${ac_cv_lib_tcmalloc_and_profiler_malloc}" == "yes"; then
custom_malloc="tcmalloc";
CFLAGS="${CFLAGS} ";
leaktest_env="HEAPCHECK=normal PPROF_PATH=${GOOGLE_PPROF}";