forked from CollaboraOnline/online
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1854 lines (1581 loc) · 72.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
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
# -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([coolwsd], [24.04.4.2], [https://github.com/CollaboraOnline/online/issues], [coolwsd], [https://collaboraonline.github.io/])
LT_INIT([shared, disable-static, dlopen])
AM_INIT_AUTOMAKE([1.10 foreign subdir-objects tar-pax -Wno-portability])
AC_CONFIG_MACRO_DIR([m4])
# We don't want to require pkg-config and PKG_CHECK_MODULES on macOS
m4_if(m4_esyscmd_s([uname -s]),Darwin,[m4_define([PKG_CHECK_MODULES],[])],[])
COOLWSD_VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
COOLWSD_VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
COOLWSD_VERSION_MICRO=`echo $VERSION | awk -F. '{print $3}'`
COOLWSD_VERSION_NANO=`echo $VERSION | awk -F. '{print $4}'`
ANDROID_PACKAGE_VERSIONCODE=
if test "$enable_androidapp" = "yes"; then
AC_MSG_CHECKING([for Android package versionCode])
if test -z "$with_android_package_versioncode" -o "$with_android_package_versioncode" = "no"; then
ANDROID_PACKAGE_VERSIONCODE="1"
AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_VERSIONCODE])
else
COOLWSD_VERSION_MAJOR=`echo $with_android_package_versioncode | awk -F. '{print $1}'`
COOLWSD_VERSION_MINOR=`echo $with_android_package_versioncode | awk -F. '{print $2}'`
COOLWSD_VERSION_MICRO=`echo $with_android_package_versioncode | awk -F. '{print $3}'`
COOLWSD_VERSION_NANO=`echo $with_android_package_versioncode | awk -F. '{print $4}' | awk -F- '{print $1}'`
ANDROID_PACKAGE_VERSIONCODE=`echo $with_android_package_versioncode | awk -F- '{print $2}'`
AC_MSG_RESULT([$ANDROID_PACKAGE_VERSIONCODE])
fi
fi
AC_SUBST(ANDROID_PACKAGE_VERSIONCODE)
COOLWSD_VERSION="$COOLWSD_VERSION_MAJOR.$COOLWSD_VERSION_MINOR.$COOLWSD_VERSION_MICRO.$COOLWSD_VERSION_NANO"
AC_SUBST([COOLWSD_VERSION_MAJOR])
AC_SUBST([COOLWSD_VERSION_MINOR])
AC_SUBST([COOLWSD_VERSION_MICRO])
AC_SUBST([COOLWSD_VERSION_NANO])
AC_SUBST([COOLWSD_VERSION])
AC_DEFINE_UNQUOTED([COOLWSD_VERSION],[["$COOLWSD_VERSION"]],[Collabora Online WebSocket server version])
# try to add a git hash for a version if we're developing
COOLWSD_VERSION_HASH="$COOLWSD_VERSION"
git_hash=`cd ${srcdir} && ( cat dist_git_hash 2> /dev/null || git log -1 --format=%h 2> /dev/null )`
if test "z$git_hash" != "z"; then
COOLWSD_VERSION_HASH=$git_hash
fi
AC_SUBST([COOLWSD_VERSION_HASH])
AC_DEFINE_UNQUOTED([COOLWSD_VERSION_HASH],[["$COOLWSD_VERSION_HASH"]],[Collabora Online git hash if present])
AC_CONFIG_SRCDIR([wsd/COOLWSD.cpp])
AC_DEFINE_UNQUOTED([COOLWSD_BUILDCONFIG],[["$ac_configure_args"]],[Options passed to configure script])
# this is a dummy header, autoheader adds all entries to it
# don't include config_unused.h anywhere!
AC_CONFIG_HEADERS([config_unused.h])
# maintain config.h.in and config_version.h.in manually
# config.h.in is for configurable variables that are stable if configure parameters are unchanged
AC_CONFIG_HEADERS([config.h])
# config_version.h.in is for version/hash related variables
AC_CONFIG_HEADERS([config_version.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_LN_S
# override AC_PROG_CXX:
# avoid libtool from adding -rpath when linking
if test "$host_os" = "emscripten"; then
hardcode_libdir_flag_spec=
hardcode_libdir_flag_spec_CXX=
fi
AC_LANG_PUSH([C++])
AS_IF([test `uname -s` = Linux -a "$host_os" != "emscripten"],
[AC_PATH_PROG([SETCAP], setcap,[],[/bin:/usr/bin:/sbin:/usr/sbin])]
AS_IF([test -z "$SETCAP"],
[AC_MSG_ERROR([The setcap command is needed. It might be in a package called libcap-progs.])]))
# check for python modules
for MODULE in lxml polib; do
AC_MSG_CHECKING([for ${MODULE} for python3])
if /usr/bin/env python3 -c "import ${MODULE}" 2> /dev/null ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AS_IF([test `uname -s` = Linux -o `uname -s` = FreeBSD -o `uname -s` = Darwin],
[AC_MSG_ERROR([${MODULE} for python3 is needed. It might be in a package called python3-${MODULE}.])],
[AC_MSG_WARN([${MODULE} for python3 is needed. It might be in a package called python3-${MODULE}. But
if you are building the JS bits on another (Linux) machine, that doesn't matter])])
fi
done
# On some platforms, std::atomic needs a helper library
AC_MSG_CHECKING([for the need of -latomic])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <atomic>
#include <cstdint>
std::atomic<std::int64_t> v;
int main() {
return v;
}
])],
[AC_MSG_RESULT([No])],
[AC_MSG_RESULT([Yes])
LIBS="$LIBS -latomic"])
# Declare options
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[Enable debugging, link with debugging version of Poco libraries]))
AC_ARG_ENABLE([hardening-flags],
AS_HELP_STRING([--disable-hardening-flags],
[Disable detection and use of compiler hardening flags]))
AC_ARG_ENABLE([bundle],
AS_HELP_STRING([--enable-bundle],
[Enable creating bundled JS and CSS even with --enable-debug]))
AC_ARG_ENABLE([debug-protocol],
AS_HELP_STRING([--disable-debug-protocol],
[Disables JS protocol logging by default, otherwise it is slaved to enable-debug.])
)
AC_ARG_ENABLE([browsersync],
AS_HELP_STRING([--enable-browsersync],
[Don't copy files to the target directory but create the symlink to allow browsersync usage]))
AC_ARG_ENABLE([anonymization],
AS_HELP_STRING([--enable-anonymization],
[Enable anonymization/obfuscation of user-data in logs]))
AC_ARG_ENABLE([iosapp],
AS_HELP_STRING([--enable-iosapp],
[Use on a Mac where you will build the iOS app.]))
AC_ARG_WITH([wasm-fallback],
AS_HELP_STRING([--with-wasm-fallback=<path>],
[Build a COOL where the client can fall back to a WASM implementation if the connection to the server fails.
The path is where the WASM build of Online was done.]))
AC_ARG_WITH([wasm-additional-files],
AS_HELP_STRING([--with-wasm-additional-files=<path>],
[Add more files to the in-memory WASM file system in online.wasm in addition to the ones from the WASM
build of Collabora Office. The files will be available in the WASM in-memory file system as pathnames
stripping the initial prefix <path> where they are on the build system. For instance, if you give
--with-wasm-additional-files=$HOME/our-sample-docs, and there is a file $HOME/our-sample-docs/temp/test.docx,
that will be available in the online.wasm as /temp/test.docx.
NOTE: Temporarily for now, this option is mandatory and the additional files should contain a document
in the root called "sample.docx"]))
AC_ARG_WITH([iosapp-appicon],
AS_HELP_STRING([--with-iosapp-appicon=<path>],
[Point to a directory containing an icon set to use instead of the default empty one.]))
AC_ARG_WITH([iosapp-fonts],
AS_HELP_STRING([--with-iosapp-fonts=<path>],
[Point to a directory containing .ttf or .otf files to be bundled in the iOS app (and
thus installed on the device for use of the LO core code).]))
AC_ARG_WITH([app-branding],
AS_HELP_STRING([--with-app-branding=<path>],
[Point to a directory containing a branding.css file and possibly other files it references,
to be bundled and used by the iOS app. The directory structure is copied to
"browser/dist/branding" and that directory ends upp in the app bundle as "branding".]))
AC_ARG_ENABLE([gtkapp],
AS_HELP_STRING([--enable-gtkapp],
[Use in a tree where the only purpose is to build the gtk+ "app" that is supposed
to work similarly to the iOS app, from the JavaScript and the pseudo WebSocket
message plumbing point of view. See gtk/README.]))
AC_ARG_ENABLE(fuzzers,
AS_HELP_STRING([--enable-fuzzers],
[Enables building libfuzzer targets for fuzz testing. It is useful to enable this switch
only in a separate build tree, since the switch disables the creation of a coolwsd
binary. For best results: --with-sanitizer=address,undefined])
)
AC_ARG_ENABLE([androidapp],
AS_HELP_STRING([--enable-androidapp],
[Use in a tree where the only purpose is to build the Android app that is supposed
to work similarly to the iOS app, from the JavaScript and the pseudo WebSocket
message plumbing point of view.]))
AC_ARG_ENABLE([android-google-play],
AS_HELP_STRING([--enable-android-google-play],
[When enabled, the app encourages the user periodically to rate the app on Google Play Store.]))
AC_ARG_WITH(android-package-name,
AS_HELP_STRING([--with-android-package-name="org.libreoffice.androidapp"],
[Set Android package name of the build.]),
,)
AC_ARG_WITH(android-package-versioncode,
AS_HELP_STRING([--with-android-package-versioncode=6.7.8-23],
[Set the versionCode for the Android package.]),
,)
AC_ARG_WITH(android-abi,
AS_HELP_STRING([--with-android-abi=x86_64],
[Allows specification of a concrete ABI that is to be built for, defaults to armeabi-v7a
(when only one build dir is provided in --with-lo-builddir) or to all 4 supported ABIs at
the same time (when there are more builddirs provided in --with-lo-builddir, separated
by colons). The supported ABIs are: armeabi-v7a, arm64-v8a, x86 and x86_64.
Please note that you need to specify the parameters for --with-lo-builddir,
--with-poco-includes and --with-poco-libs in the order of armeabi-v7a:arm64-v8a:x86:x86_64.
For example, when you use --with-android-abi=x86_64,
you have to specify --with-lo-builddir=:::/path/to/x86-64/builddir]),
,)
AC_ARG_WITH([app-name],
AS_HELP_STRING([--with-app-name=<name>],
[Set the user-visible name of the app you build.]))
AC_ARG_WITH([user-id],
AS_HELP_STRING([--with-user-id=cool],
[Set the account name of the user required to run the app (outside debug mode).]))
AC_ARG_WITH([icon-theme],
AS_HELP_STRING([--with-icon-theme=<path>],
[Path to custom icon theme (similar to browser/images).]))
AC_ARG_WITH(vendor,
AS_HELP_STRING([--with-vendor="John the Builder"],
[Set vendor of the build.]),
,)
AC_ARG_WITH(info-url,
AS_HELP_STRING([--with-info-url="https://john-the-builder.org"],
[Set the info url of the build.]),
,)
AC_ARG_WITH(welcome-url,
AS_HELP_STRING([--with-welcome-url=<url>],
[Set the welcome url of the build.]),
,)
AC_ARG_ENABLE([seccomp],
AS_HELP_STRING([--disable-seccomp],
[Disable use of linux/seccomp.h header when kernel on target system does not support it.
Beware of the security consequences!]))
AC_ARG_WITH([lokit-path],
AS_HELP_STRING([--with-lokit-path=<path>],
[Path to the "include" directory with the LibreOfficeKit headers]))
AC_ARG_WITH([lo-path],
AS_HELP_STRING([--with-lo-path=<path>],
[Path to a working installation directory or instdir of LibreOffice]))
AC_ARG_WITH([lo-builddir],
AS_HELP_STRING([--with-lo-builddir=<path>],
[Mandatory, and relevant, in a tree where building the iOS or Android app.
Path to a the build directory of the LibreOffice core source tree you want to use.
In case of macOS, you MUST manually edit the ios/Mobile.xcodeproj/project.pbxproj
file and change the references to "../ios-device" to refer to the corresponding
LibreOffice core source directory (which typically would be the same as the build
directory you specify with this option).
In case of Android, you can provide 2 builddirs
separated by a colon ':' - the first is for
armeabi-v7a, the second is for arm64-v8a]))
AC_ARG_WITH([logfile],
AS_HELP_STRING([--with-logfile=<path>],
[Path to the location of the logfile.]))
AC_ARG_WITH([trace-event-file],
AS_HELP_STRING([--with-trace-event-file=<path>],
[Path to the location of the Trace Event file.]))
AC_ARG_WITH([poco-includes],
AS_HELP_STRING([--with-poco-includes=<path>],
[Path to the "include" directory with the Poco
headers. If you are building for Android 64bit,
you need two, separated by a colon ':'.]))
AC_ARG_WITH([zstd-libs],
AS_HELP_STRING([--with-zstd-libs=<path>],
[Path to the directory containing libzstd.a
libraries. If you are building for Android 64bit,
you need two, separated by a colon ':'.]))
AC_ARG_WITH([zstd-includes],
AS_HELP_STRING([--with-zstd-includes=<path>],
[Path to the "include" directory with the zstd
headers. If you are building for Android 64bit,
you need two, separated by a colon ':'.]))
AC_ARG_WITH([poco-libs],
AS_HELP_STRING([--with-poco-libs=<path>],
[Path to the "lib" directory with the Poco
libraries. If you are building for Android 64bit,
you need two, separated by a colon ':'.]))
AC_ARG_WITH([libpng-includes],
AS_HELP_STRING([--with-libpng-includes=<path>],
[Path to the "include" directory with the libpng
headers. Not used on Android.]))
AC_ARG_WITH([libpng-libs],
AS_HELP_STRING([--with-libpng-libs=<path>],
[Path to the "lib" directory with the libpng
libraries. Not used on Android.]))
AC_ARG_WITH([cppunit-includes],
AS_HELP_STRING([--with-cppunit-includes=<path>],
[Path to the "include" directory with the Cppunit headers]))
AC_ARG_WITH([cppunit-libs],
AS_HELP_STRING([--with-cppunit-libs=<path>],
[Path to the "lib" directory with the Cppunit libraries]))
AC_ARG_ENABLE([ssl],
AS_HELP_STRING([--disable-ssl],
[Compile without SSL support]))
AC_ARG_WITH([support-public-key],
AS_HELP_STRING([--with-support-public-key=<public-key-name.pub>],
[Implements signed key with expiration required for support. Targeted at Collabora Online Service Providers.]))
AC_ARG_WITH([max-connections],
AS_HELP_STRING([--with-max-connections],
[Set the limit on the total number of client connections. Def: 20, Min: 3.]))
AC_ARG_WITH([max-documents],
AS_HELP_STRING([--with-max-documents],
[Set the limit on the total number of documents. Def: 10, Min: 2.]))
AC_ARG_WITH([feedback-url],
AS_HELP_STRING([--with-feedback-url=<url>],
[User feedback URL.]))
AC_ARG_WITH([infobar-url],
AS_HELP_STRING([--with-infobar-url=<url>],
[Infobar URL.]))
AC_ARG_WITH([coverage],
AS_HELP_STRING([--with-coverage=<gcov>],
[Enable a code-coverage method. Currently only gcov is supported (works with both gcc and clang).
Output HTML in gcov/ directory.
Generate report with 'make coverage-report'. Clean coverage files with 'make coverage-clean']))
AC_ARG_WITH([sanitizer],
AS_HELP_STRING([--with-sanitizer],
[Enable one or more compatible sanitizers. E.g. --with-sanitizer=address,undefined,leak]))
AC_ARG_ENABLE([logging-test-asserts],
AS_HELP_STRING([--enable-logging-test-asserts],
[Enable logging of passing test assertions.]))
AC_ARG_WITH([compiler-plugins],
AS_HELP_STRING([--with-compiler-plugins=<path>],
[Experimental! Unlikely to work for anyone except Noel! Enable compiler plugins that will perform additional checks during
building.]))
AC_ARG_ENABLE([setcap],
AS_HELP_STRING([--disable-setcap],
[Do not set capabilities on files. For packaging builds]))
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror],
[Do not turn warnings into errors.]))
AC_ARG_ENABLE([cypress],
AS_HELP_STRING([--enable-cypress],
[Enable cypress tests.]))
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--disable-tests],
[Do not build and run unit tests.]))
AC_ARG_WITH([help-url],
AS_HELP_STRING([--with-help-url=<url>],
[Set the base URL of the online help. Default is https://help.collaboraoffice.com/help.html?])
[--without-help-url Help buttons of dialogs will be disabled, external help website will not be used.],,)
AC_ARG_WITH([dictionaries],
AS_HELP_STRING([--with-dictionaries=<language list>],
[List of supported languages of Writing Aids (spell checker, grammar checker, thesaurus, hyphenation)
on this instance. Allowing too many has negative effect on startup performance. Default: de_DE en_GB
en_US es_ES fr_FR it nl pt_BR pt_PT ru.]))
AC_ARG_ENABLE([feature-lock],
AS_HELP_STRING([--enable-feature-lock],
[Enable control over which uno-commands/feature to lock.]))
AC_ARG_ENABLE([feature-restriction],
AS_HELP_STRING([--enable-feature-restriction],
[Enable control over which uno-commands/feature to disable completely.]))
AC_ARG_ENABLE([experimental],
AS_HELP_STRING([--enable-experimental],
[Enable experimental features and behavior]))
# Handle options
AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"],
[POCO_DEBUG_SUFFIX=d],
[POCO_DEBUG_SUFFIX=])
ENABLE_DEBUG=false
ENABLE_DEBUG_PROTOCOL=false
ENABLE_BUNDLE=true
COOLWSD_LOGLEVEL="warning"
COOLWSD_LOG_TO_FILE="false"
COOLWSD_LOGFILE="/var/log/coolwsd.log"
COOLWSD_TRACEEVENTFILE="/var/log/coolwsd.trace.json"
COOLWSD_ANONYMIZE_USER_DATA=false
BROWSER_LOGGING="false"
debug_msg="secure mode: product build"
anonym_msg=""
ENABLE_EXPERIMENTAL=false
experimental_msg="disabled by default"
bundle_msg="using uglified bundled JS and CSS"
LOK_LOG_ASSERTIONS=0
log_asserts_msg="disabled"
SSL_VERIFY="true"
# a reasonable default
NUM_PRESPAWN_CHILDREN=4
AC_MSG_CHECKING([whether to enable debug build])
if test "$enable_debug" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([ENABLE_DEBUG],1,[Whether to compile in some extra debugging support code and disable some security pieces])
ENABLE_DEBUG=true
ENABLE_DEBUG_PROTOCOL=true
COOLWSD_LOGLEVEL="trace"
COOLWSD_LOG_TO_FILE="true"
COOLWSD_LOGFILE="/tmp/coolwsd.log"
COOLWSD_TRACEEVENTFILE="/tmp/coolwsd.trace.json"
COOLWSD_ANONYMIZE_USER_DATA=false
BROWSER_LOGGING="true"
debug_msg="low security debugging mode"
SSL_VERIFY="false"
# helps attaching to the right process
NUM_PRESPAWN_CHILDREN=1
AC_MSG_CHECKING([whether to bundle JS and CSS files])
if test "$enable_bundle" != "yes"; then
ENABLE_BUNDLE=false
bundle_msg="using individual JS and CSS files"
AC_MSG_RESULT([no ($bundle_msg)])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING([whether to enable log passing test assertions in debug build (default)])
if test "$enable_logging_test_asserts" != "no"; then
LOK_LOG_ASSERTIONS=1
log_asserts_msg="enabled"
AC_MSG_RESULT([yes (override with --disable-logging-test-asserts)])
else
AC_MSG_RESULT([no (to enable --enable-logging-test-asserts)])
fi
else
AC_MSG_RESULT([no (Release build)])
AC_DEFINE([ENABLE_DEBUG],0,[Whether to compile in some extra debugging support code and disable some security pieces])
fi
AC_SUBST(ENABLE_DEBUG)
AC_SUBST(ENABLE_BUNDLE)
AC_SUBST(COOLWSD_LOGLEVEL)
AC_SUBST(COOLWSD_LOG_TO_FILE)
AC_SUBST(BROWSER_LOGGING)
AC_SUBST(NUM_PRESPAWN_CHILDREN)
if test "$enable_debug_protocol" = no; then
ENABLE_DEBUG_PROTOCOL=false
fi
AC_SUBST(ENABLE_DEBUG_PROTOCOL)
ENABLE_BROWSERSYNC=
browsersync_msg="disabled: copy files to the target directory"
if test "$enable_browsersync" = "yes"; then
ENABLE_BROWSERSYNC=true
browsersync_msg="enabled: create symlinks in the target directory"
fi
AC_SUBST(ENABLE_BROWSERSYNC)
if test -n "$with_logfile" ; then
COOLWSD_LOGFILE="$with_logfile"
fi
AC_SUBST(COOLWSD_LOGFILE)
if test -n "$with_trace_event_file" ; then
COOLWSD_TRACEEVENTFILE="$with_trace_event_file"
fi
AC_SUBST(COOLWSD_TRACEEVENTFILE)
AC_DEFINE_UNQUOTED([COOLWSD_TRACEEVENTFILE], [["]$COOLWSD_TRACEEVENTFILE["]], [Destination for Trace Event output])
if test "$enable_anonymization" = "yes" ; then
COOLWSD_ANONYMIZE_USER_DATA=true
anonym_msg="anonymization of user-data is enabled"
fi
AC_DEFINE_UNQUOTED([COOLWSD_ANONYMIZE_USER_DATA],[$COOLWSD_ANONYMIZE_USER_DATA],[Enable permanent anonymization in logs])
AC_SUBST(COOLWSD_ANONYMIZE_USER_DATA)
if test "$enable_logging_test_asserts" = "yes" ; then
LOK_LOG_ASSERTIONS=1
log_asserts_msg="enabled"
fi
AC_DEFINE_UNQUOTED([LOK_LOG_ASSERTIONS],[$LOK_LOG_ASSERTIONS],[Enable logging of test assertions])
AC_SUBST(LOK_LOG_ASSERTIONS)
if test -z "$anonym_msg"; then
anonym_msg="anonymization of user-data is disabled"
fi
if test "$enable_experimental" = "yes" ; then
ENABLE_EXPERIMENTAL=true
experimental_msg="enabled by default"
SSL_VERIFY="false"
fi
AC_SUBST(ENABLE_EXPERIMENTAL)
AC_MSG_CHECKING([if ssl verification is enabled by default])
AC_MSG_RESULT([$SSL_VERIFY])
AC_DEFINE_UNQUOTED([SSL_VERIFY],["$SSL_VERIFY"],[Default SSL Verification mode])
AC_SUBST(SSL_VERIFY)
dnl check for a file at a path with an env-var with a given suffix
AC_DEFUN([CHK_FILE_VAR], dnl env-var, suffix, file-to-match, msg
[
if test -n "$[$1][$4]" -o "z[$4]" = "z"; then
if test -f "$[$1][$4]/[$2]"; then
AC_MSG_RESULT([$[$1]])
else
AC_MSG_ERROR([This is not a [$3] [$4] directory no: $[$1][$4]/[$2]])
fi
fi
]) dnl CHK_FILE_VAR
# macOS: When configuring for building the app itself, on macOS, we need these.
# But not when just configuring for building the JS on Linux, for copying over
# to the Mac.
# Android: We need these to setup the CMakeLists.txt properly.
LOBUILDDIR=
ANDROID_ABI="armeabi-v7a"
ANDROID_ABI_SPLIT="'armeabi-v7a'"
LOBUILDDIR_ARM64_V8A=
LOBUILDDIR_X86=
LOBUILDDIR_X86_64=
POCOINCLUDE=
POCOINCLUDE_ARM64_V8A=
POCOINCLUDE_X86=
POCOINCLUDE_X86_64=
POCOLIB=
POCOLIB_ARM64_V8A=
POCOLIB_X86=
POCOLIB_X86_64=
POCODEBUG=
ZSTDINCLUDE=
ZSTDINCLUDE_ARM64_V8A=
ZSTDINCLUDE_X86=
ZSTDINCLUDE_X86_64=
ZSTDLIB=
ZSTDLIB_ARM64_V8A=
ZSTDLIB_X86=
ZSTDLIB_X86_64=
CORE_VERSION_HASH=""
if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_androidapp" = "yes" \) -o "$host_os" = "emscripten" ; then
if test "$enable_androidapp" = "yes" ; then
AC_MSG_CHECKING([for Android ABI to build for])
if test -n "$with_android_abi" ; then
ANDROID_ABI=`echo $with_android_abi | sed 's/:/ /g'`
else
if echo "$with_lo_builddir" | grep -qs ':' ; then
ANDROID_ABI="armeabi-v7a arm64-v8a x86 x86_64"
fi
fi
ANDROID_ABI_SPLIT=`echo $ANDROID_ABI | sed "s/^/'/g;s/ /','/g;s/$/'/g"`
AC_MSG_RESULT([$ANDROID_ABI])
fi
AC_MSG_CHECKING([for LibreOffice build tree to build against])
if test -z "$with_lo_builddir"; then
AC_MSG_ERROR([You MUST use the --with-lo-builddir option when configuring the mobile app build tree.])
fi
LOBUILDDIR="$with_lo_builddir"
if test "$enable_androidapp" = "yes" ; then
if echo "$LOBUILDDIR" | grep -qs ':' ; then
LOBUILDDIR=`echo $with_lo_builddir | cut -d: -f1`
LOBUILDDIR_ARM64_V8A=`echo $with_lo_builddir | cut -d: -f2`
LOBUILDDIR_X86=`echo $with_lo_builddir | cut -d: -f3`
LOBUILDDIR_X86_64=`echo $with_lo_builddir | cut -d: -f4`
fi
fi
# Get the git hash of the core build
CORE_VERSION_HASH=`cd $LOBUILDDIR && grep buildid instdir/program/setuprc | sed -e 's/buildid=//' -e 's/............................$//'`
# Sanity check, just a random object file in the LibreOffice build tree
if test \( "$enable_iosapp" = "yes" -a -f "$LOBUILDDIR/workdir/CxxObject/vcl/ios/iosinst.o" \) -o \( "$enable_androidapp" = "yes" -a -f "$LOBUILDDIR/workdir/LinkTarget/StaticLibrary/liblibpng.a" \) -o \( "$host_os" = "emscripten" -a -f "${LOBUILDDIR}/workdir/LinkTarget/StaticLibrary/liblibpng.a" \); then
AC_MSG_RESULT([$LOBUILDDIR])
else
AC_MSG_ERROR([This is not a LibreOffice core build directory: $LOBUILDDIR])
fi
if test -n "$LOBUILDDIR_ARM64_V8A" ; then
if test -f "$LOBUILDDIR_ARM64_V8A/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_ARM64_V8A])
else
AC_MSG_ERROR([This is not a LibreOffice ARM64 core build directory: $LOBUILDDIR_ARM64_V8A])
fi
fi
if test -n "$LOBUILDDIR_X86" ; then
if test -f "$LOBUILDDIR_X86/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_X86])
else
AC_MSG_ERROR([This is not a LibreOffice x86 core build directory: $LOBUILDDIR_X86])
fi
fi
if test -n "$LOBUILDDIR_X86_64" ; then
if test -f "$LOBUILDDIR_X86_64/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_X86_64])
else
AC_MSG_ERROR([This is not a LibreOffice x86-64 core build directory: $LOBUILDDIR_X86_64])
fi
fi
AC_MSG_CHECKING([for Poco include directory to build against])
if test -z "$with_poco_includes"; then
AC_MSG_ERROR([You MUST use the --with-poco-includes option when configuring the mobile app build tree.])
fi
POCOINCLUDE="$with_poco_includes"
if test "$enable_androidapp" = "yes" ; then
if echo "$POCOINCLUDE" | grep -qs ':' ; then
POCOINCLUDE=`echo $with_poco_includes | cut -d: -f1`
POCOINCLUDE_ARM64_V8A=`echo $with_poco_includes | cut -d: -f2`
POCOINCLUDE_X86=`echo $with_poco_includes | cut -d: -f3`
POCOINCLUDE_X86_64=`echo $with_poco_includes | cut -d: -f4`
fi
fi
# Sanity checks
CHK_FILE_VAR(POCOINCLUDE,Poco/Poco.h,Poco include)
CHK_FILE_VAR(POCOINCLUDE,Poco/Poco.h,Poco include,_ARM64_V8A)
CHK_FILE_VAR(POCOINCLUDE,Poco/Poco.h,Poco include,_X64)
CHK_FILE_VAR(POCOINCLUDE,Poco/Poco.h,Poco include,_X86_64)
AC_MSG_CHECKING([for Poco lib directory to build against])
if test -z "$with_poco_libs"; then
AC_MSG_ERROR([You MUST use the --with-poco-libs option when configuring the mobile app build tree.])
fi
POCOLIB="$with_poco_libs"
if test "$enable_androidapp" = "yes" ; then
if echo "$POCOLIB" | grep -qs ':' ; then
POCOLIB=`echo $with_poco_libs | cut -d: -f1`
POCOLIB_ARM64_V8A=`echo $with_poco_libs | cut -d: -f2`
POCOLIB_X86=`echo $with_poco_libs | cut -d: -f3`
POCOLIB_X86_64=`echo $with_poco_libs | cut -d: -f4`
fi
fi
# Sanity checks
CHK_FILE_VAR(POCOLIB,libPocoFoundation.a,Poco lib)
CHK_FILE_VAR(POCOLIB,libPocoFoundation.a,Poco lib,_ARM64_V8A)
CHK_FILE_VAR(POCOLIB,libPocoFoundation.a,Poco lib,_X64)
CHK_FILE_VAR(POCOLIB,libPocoFoundation.a,Poco lib,_X86_X64)
if test "$ENABLE_DEBUG" = "true" ; then
POCODEBUG=d
fi
AC_MSG_CHECKING([for zstd lib directory to build against])
if test -z "$with_zstd_libs"; then
AC_MSG_ERROR([You MUST use the --with-zstd-libs option when configuring the mobile app build tree.])
fi
ZSTDINCLUDE="$with_zstd_includes"
if test "$enable_androidapp" = "yes" ; then
if echo "$ZSTDINCLUDE" | grep -qs ':' ; then
ZSTDINCLUDE=`echo $with_zstd_includes | cut -d: -f1`
ZSTDINCLUDE_ARM64_V8A=`echo $with_zstd_includes | cut -d: -f2`
ZSTDINCLUDE_X86=`echo $with_zstd_includes | cut -d: -f3`
ZSTDINCLUDE_X86_64=`echo $with_zstd_includes | cut -d: -f4`
fi
fi
# Sanity checks
CHK_FILE_VAR(ZSTDINCLUDE,zstd.h,Zstd include)
CHK_FILE_VAR(ZSTDINCLUDE,zstd.h,Zstd include,_ARM64_V8A)
CHK_FILE_VAR(ZSTDINCLUDE,zstd.h,Zstd include,_X64)
CHK_FILE_VAR(ZSTDINCLUDE,zstd.h,Zstd include,_X86_64)
ZSTDLIB="$with_zstd_libs"
if test "$enable_androidapp" = "yes" ; then
if echo "$ZSTDLIB" | grep -qs ':' ; then
ZSTDLIB=`echo $with_zstd_libs | cut -d: -f1`
ZSTDLIB_ARM64_V8A=`echo $with_zstd_libs | cut -d: -f2`
ZSTDLIB_X86=`echo $with_zstd_libs | cut -d: -f3`
ZSTDLIB_X86_64=`echo $with_zstd_libs | cut -d: -f4`
fi
fi
CHK_FILE_VAR(ZSTDLIB,libzstd.a,Zstd lib)
CHK_FILE_VAR(ZSTDLIB,libzstd.a,Zstd lib,_ARM64_V8A)
CHK_FILE_VAR(ZSTDLIB,libzstd.a,Zstd lib,_X64)
CHK_FILE_VAR(ZSTDLIB,libzstd.a,Zstd lib,_X86_64)
fi
AC_SUBST(LOBUILDDIR)
AC_SUBST(ANDROID_ABI)
AC_SUBST(ANDROID_ABI_SPLIT)
AC_SUBST(LOBUILDDIR_ARM64_V8A)
AC_SUBST(LOBUILDDIR_X86)
AC_SUBST(LOBUILDDIR_X86_64)
AC_SUBST(POCOINCLUDE)
AC_SUBST(POCOINCLUDE_ARM64_V8A)
AC_SUBST(POCOINCLUDE_X86)
AC_SUBST(POCOINCLUDE_X86_64)
AC_SUBST(POCOLIB)
AC_SUBST(POCOLIB_ARM64_V8A)
AC_SUBST(POCOLIB_X86)
AC_SUBST(POCOLIB_X86_64)
AC_SUBST(POCODEBUG)
AC_SUBST(ZSTDINCLUDE)
AC_SUBST(ZSTDINCLUDE_ARM64_V8A)
AC_SUBST(ZSTDINCLUDE_X86)
AC_SUBST(ZSTDINCLUDE_X86_64)
AC_SUBST(ZSTDLIB)
AC_SUBST(ZSTDLIB_ARM64_V8A)
AC_SUBST(ZSTDLIB_X86)
AC_SUBST(ZSTDLIB_X86_64)
AC_SUBST([CORE_VERSION_HASH])
AC_DEFINE_UNQUOTED([CORE_VERSION_HASH],[["$CORE_VERSION_HASH"]],[LibreOffice core git hash if present])
LIBPNG_INCLUDES="$with_libpng_includes"
LIBPNG_LIBS="$with_libpng_libs"
if test "$enable_iosapp" != yes -a "$enable_androidapp" != yes; then
LOKIT_PATH=`readlink -f $with_lokit_path`
fi
if test "$enable_iosapp" = "yes" -o "$enable_androidapp" = "yes"; then
if test -n "$LIBPNG_INCLUDES" ; then
AC_MSG_ERROR([--with-libpng-includes is ignored on Android, please remove the parameter.])
fi
if test -n "$LIBPNG_LIBS" ; then
AC_MSG_ERROR([--with-libpng-libs is ignored on Android, please remove the parameter.])
fi
if test -n "$LOKIT_PATH" ; then
AC_MSG_ERROR([--with-lokit-path is ignored on Android, please remove the parameter.])
LOKIT_PATH=`readlink -f $LOBUILDDIR/include`
fi
fi
AC_SUBST(LIBPNG_INCLUDES)
AC_SUBST(LIBPNG_LIBS)
AC_SUBST(LOKIT_PATH)
ENABLE_ANDROIDAPP=
ANDROID_PACKAGE_NAME=
if test "$enable_androidapp" = "yes"; then
ENABLE_ANDROIDAPP=true
AC_MSG_CHECKING([for Android package name])
if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
ANDROID_PACKAGE_NAME="org.libreoffice.androidapp"
AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
else
ANDROID_PACKAGE_NAME="$with_android_package_name"
AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
fi
fi
AC_SUBST(ENABLE_ANDROIDAPP)
AM_CONDITIONAL([ENABLE_ANDROIDAPP], [test "$ENABLE_ANDROIDAPP" = "true"])
AC_SUBST(ANDROID_PACKAGE_NAME)
APP_NAME="Collabora Online Development Edition"
if test -n "$with_app_name"; then
APP_NAME="$with_app_name"
fi
AC_DEFINE_UNQUOTED([APP_NAME],["$APP_NAME"],[The user-visible name of the app you build.])
AC_SUBST(APP_NAME)
VENDOR=
AC_MSG_CHECKING([for vendor])
if test "$enable_iosapp" = yes -a -z "$with_vendor"; then
AC_MSG_ERROR([You must use --with-vendor when configuring for the iOS app])
fi
if test -z "$with_vendor" -o "$with_vendor" = "no"; then
VENDOR="$USERNAME"
if test -z "$VENDOR"; then
VENDOR="$USER"
fi
if test -z "$VENDOR"; then
VENDOR="`id -u -n`"
fi
AC_MSG_RESULT([not set, using $VENDOR])
else
VENDOR="$with_vendor"
AC_MSG_RESULT([$VENDOR])
fi
AC_SUBST(VENDOR)
INFO_URL='https://collaboraonline.github.io/'
if test -n "$with_info_url" -a "$with_info_url" != "no"; then
INFO_URL="$with_info_url"
fi
AC_SUBST(INFO_URL)
ENABLE_IOSAPP=
IOSAPP_BUNDLE_VERSION=
if test "$enable_iosapp" = "yes"; then
ENABLE_IOSAPP=true
if test -f BUNDLE-VERSION; then
IOSAPP_BUNDLE_VERSION=$(cat BUNDLE-VERSION)
else
IOSAPP_BUNDLE_VERSION=1
fi
echo $IOSAPP_BUNDLE_VERSION >BUNDLE-VERSION
fi
AC_SUBST(ENABLE_IOSAPP)
AM_CONDITIONAL([ENABLE_IOSAPP], [test "$ENABLE_IOSAPP" = "true"])
AC_SUBST(IOSAPP_BUNDLE_VERSION)
AC_MSG_CHECKING([for custom icon theme])
CUSTOM_ICONS_DIRECTORY=
if test -d "$with_icon_theme"; then
CUSTOM_ICONS_DIRECTORY=`readlink -f $with_icon_theme`
AC_MSG_RESULT([$CUSTOM_ICONS_DIRECTORY])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(CUSTOM_ICONS_DIRECTORY)
ENABLE_GTKAPP=
if test "$enable_gtkapp" = "yes"; then
ENABLE_GTKAPP=true
fi
AC_SUBST(ENABLE_GTKAPP)
AM_CONDITIONAL([ENABLE_GTKAPP], [test "$ENABLE_GTKAPP" = "true"])
dnl ENABLE_WASM_FALLBACK means we are building an otherwise normal COOL but with the "WASM fallback"
dnl capability. Compare to ENABLE_WASM.
AM_CONDITIONAL([ENABLE_WASM_FALLBACK], [test -n "$with_wasm_fallback"])
WASM_BUILDDIR="$with_wasm_fallback"
AC_SUBST(WASM_BUILDDIR)
dnl Temporary hack: We hardcode /sample.docx in a few places, so make sure that file is there
AS_IF(["$host_os" = "emscripten"],
[AC_MSG_CHECKING([that temporarily there is a sample document with a fixed name])
AS_IF([test -z "$with_wasm_additional_files"],
[AC_MSG_ERROR([You must use the --with-wasm-additional-files option for now])])
AS_IF([test ! -f "$with_wasm_additional_files/sample.docx"],
[AC_MSG_ERROR([There must be a file called sample.docx in $with_wasm_additional_files for now])])
AC_MSG_RESULT([yes])])
AM_CONDITIONAL([ENABLE_WASM_ADDITIONAL_FILES], [test -n "$with_wasm_additional_files"])
WASM_ADDITIONAL_FILES="$with_wasm_additional_files"
AC_SUBST(WASM_ADDITIONAL_FILES)
AS_IF([test -n "$WASM_ADDITIONAL_FILES" && test ! -d "$WASM_ADDITIONAL_FILES"],
[AC_MSG_ERROR([No such directory "'"$WASM_ADDITIONAL_FILES"'"])])
dnl ENABLE_WASM means that we are building the WASM "app" that will run locally in the
dnl client when necessary. ENABLE_WASM_FALLBACK and ENABLE_WASM can't both be on simultaneously.
AM_CONDITIONAL([ENABLE_WASM], [test "$host_os" = "emscripten"])
AS_IF([test "$host_os" = "emscripten"],
[AC_DEFINE([WASMAPP],1,[Define to 1 if this is the WASM app build.])],
[AC_DEFINE([WASMAPP],0,[Define to 1 if this is the WASM app build.])])
MAX_CONNECTIONS=9999
AS_IF([test -n "$with_max_connections" && test "$with_max_connections" -gt "0"],
[MAX_CONNECTIONS="$with_max_connections"])
AS_IF([test "$MAX_CONNECTIONS" -lt "3"],
[MAX_CONNECTIONS="3"])
AC_DEFINE_UNQUOTED([MAX_CONNECTIONS],[$MAX_CONNECTIONS],[Limit the maximum number of open connections])
AC_SUBST(MAX_CONNECTIONS)
MAX_DOCUMENTS=9999
AS_IF([test -n "$with_max_documents" && test "$with_max_documents" -gt "0"],
[MAX_DOCUMENTS="$with_max_documents"])
AS_IF([test "$MAX_DOCUMENTS" -gt "$MAX_CONNECTIONS"],
[MAX_DOCUMENTS="$MAX_CONNECTIONS"])
AS_IF([test "$MAX_DOCUMENTS" -lt "2"],
[MAX_DOCUMENTS="2"])
AC_DEFINE_UNQUOTED([MAX_DOCUMENTS],[$MAX_DOCUMENTS],[Limit the maximum number of open documents])
AC_SUBST(MAX_DOCUMENTS)
FEEDBACK_URL=
if test -n "$with_feedback_url"; then
FEEDBACK_URL=$with_feedback_url
fi
AC_DEFINE_UNQUOTED([FEEDBACK_URL],["$FEEDBACK_URL"],[User feedback URL.])
INFOBAR_URL=
if test -n "$with_infobar_url"; then
INFOBAR_URL=$with_infobar_url
fi
AC_DEFINE_UNQUOTED([INFOBAR_URL],["$INFOBAR_URL"],[Infobar URL.])
WELCOME_CONFIG_FRAGMENT=/dev/null
ENABLE_WELCOME_MESSAGE=0
WELCOME_URL=
if test -n "$with_welcome_url"; then
WELCOME_URL=$with_welcome_url
ENABLE_WELCOME_MESSAGE=1
else
WELCOME_CONFIG_FRAGMENT=$srcdir/coolwsd-welcome.xml
fi
AC_SUBST_FILE([WELCOME_CONFIG_FRAGMENT])
AC_DEFINE_UNQUOTED([ENABLE_WELCOME_MESSAGE],$ENABLE_WELCOME_MESSAGE,[Should the Release notes message be shown on upgrade])
AM_CONDITIONAL([ENABLE_WELCOME_MESSAGE], [test "$ENABLE_WELCOME_MESSAGE" = "1"])
AC_DEFINE_UNQUOTED([WELCOME_URL],["$WELCOME_URL"],[The welcome url of the build.])
# Test for build environment
AS_IF([test "$ENABLE_GTKAPP" != true],
[CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -Wundef"])
CFLAGS="$CFLAGS -Wall -Wextra"
AC_MSG_CHECKING([whether to turn warnings to errors])
if test -z "$enable_werror" -o "$enable_werror" = "yes"; then
AC_MSG_RESULT([yes])
CXXFLAGS="$CXXFLAGS -Werror"
CFLAGS="$CFLAGS -Werror"
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether to use extra compiler hardening flags])
if test "$enable_hardening_flags" = no -o "$host_os" = "emscripten" -o "x$with_sanitizer" != "x"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_LANG_PUSH([C])
AC_MSG_CHECKING([whether $CC supports -grecord-gcc-switches])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC supports -D_FORTIFY_SOURCE=2])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC supports -D_GLIBCXX_ASSERTIONS])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-protector-strong"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC supports -fstack-clash-protection])
save_CFLAGS=$CFLAGS