forked from LibreOffice/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
15942 lines (14483 loc) · 562 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
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
dnl configure.ac serves as input for the GNU autoconf package
dnl in order to create a configure script.
# The version number in the second argument to AC_INIT should be four numbers separated by
# periods. Some parts of the code requires the first one to be less than 128 and the others to be less
# than 256. The four numbers can optionally be followed by a period and a free-form string containing
# no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
# several non-alphanumeric characters, those are split off and used only for the
# ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
AC_INIT([LibreOffice],[25.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
dnl so check for the version of autoconf that is actually used to create the configure script
AC_PREREQ([2.59])
m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
[AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
if test -n "$BUILD_TYPE"; then
AC_MSG_ERROR([You have sourced config_host.mk in this shell. This may lead to trouble, please run in a fresh (login) shell.])
fi
save_CC=$CC
save_CXX=$CXX
first_arg_basename()
{
for i in $1; do
basename "$i"
break
done
}
CC_BASE=`first_arg_basename "$CC"`
CXX_BASE=`first_arg_basename "$CXX"`
BUILD_TYPE="LibO"
SCPDEFS=""
GIT_NEEDED_SUBMODULES=""
LO_PATH= # used by path_munge to construct a PATH variable
FilterLibs()
{
# Return value: $filteredlibs
filteredlibs=
if test "$COM" = "MSC"; then
for f in $1; do
if test "x$f" != "x${f#-L}"; then
filteredlibs="$filteredlibs -LIBPATH:${f:2}"
elif test "x$f" != "x${f#-l}"; then
filteredlibs="$filteredlibs ${f:2}.lib"
else
filteredlibs="$filteredlibs $f"
fi
done
else
for f in $1; do
case "$f" in
# let's start with Fedora's paths for now
-L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
# ignore it: on UNIXoids it is searched by default anyway
# but if it's given explicitly then it may override other paths
# (on macOS it would be an error to use it instead of SDK)
;;
*)
filteredlibs="$filteredlibs $f"
;;
esac
done
fi
}
PathFormat()
{
# Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
# function is called also on Unix.
#
# Return value: $formatted_path and $formatted_path_unix.
#
# $formatted_path is the argument in Windows format, but using forward slashes instead of
# backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
# or shell metacharacters).
#
# $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
# necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
# Unix pathname.
#
# Errors out if 8.3 names are needed but aren't present for some of the path components.
# Examples:
#
# /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
#
# C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
#
# C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
#
# C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
#
# /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
#
# C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
#
# /usr/bin/find.exe => C:/cygwin64/bin/find.exe
if test -n "$UNITTEST_WSL_PATHFORMAT"; then
printf "PathFormat $1 ==> "
fi
formatted_path="$1"
if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
if test "$build_os" = "wsl"; then
formatted_path=$(echo "$formatted_path" | tr -d '\r')
fi
pf_conv_to_dos=
# spaces,parentheses,brackets,braces are problematic in pathname
# so are backslashes
case "$formatted_path" in
*\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
pf_conv_to_dos="yes"
;;
esac
if test "$pf_conv_to_dos" = "yes"; then
if test "$build_os" = "wsl"; then
case "$formatted_path" in
/*)
formatted_path=$(wslpath -w "$formatted_path")
;;
esac
formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
formatted_path=`cygpath -sm "$formatted_path"`
else
formatted_path=`cygpath -d "$formatted_path"`
fi
if test $? -ne 0; then
AC_MSG_ERROR([path conversion failed for "$1".])
fi
fi
fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
if test "$fp_count_slash$fp_count_colon" != "00"; then
if test "$fp_count_colon" = "0"; then
new_formatted_path=`realpath "$formatted_path"`
if test $? -ne 0; then
AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
else
formatted_path="$new_formatted_path"
fi
fi
if test "$build_os" = "wsl"; then
if test "$fp_count_colon" != "0"; then
formatted_path=$(wslpath "$formatted_path")
local final_slash=
case "$formatted_path" in
*/)
final_slash=/
;;
esac
formatted_path=$(wslpath -m $formatted_path)
case "$formatted_path" in
*/)
;;
*)
formatted_path="$formatted_path"$final_slash
;;
esac
else
formatted_path=$(wslpath -m "$formatted_path")
fi
else
formatted_path=`cygpath -m "$formatted_path"`
fi
if test $? -ne 0; then
AC_MSG_ERROR([path conversion failed for "$1".])
fi
fi
fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
if test "$fp_count_space" != "0"; then
AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
fi
fi
if test "$build_os" = "wsl"; then
# WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
formatted_path_unix=$(wslpath "$formatted_path")
else
# But Cygwin can
formatted_path_unix="$formatted_path"
fi
if test -n "$WSL_ONLY_AS_HELPER"; then
# if already in unix format, switch to windows format to create shortened path
case "$formatted_path" in
/*)
formatted_path=$(wslpath -m "$formatted_path")
;;
esac
# cd to /mnt/c to avoid wsl/cmd complaining about not supporting UNC paths/the current working directory
formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
# WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
formatted_path=$(wslpath -m "$formatted_path_unix")
fi
}
AbsolutePath()
{
# There appears to be no simple and portable method to get an absolute and
# canonical path, so we try creating the directory if does not exist and
# utilizing the shell and pwd.
# Args: $1: A possibly relative pathname
# Return value: $absolute_path
# Convert to unix path, mkdir would treat c:/path as a relative path.
PathFormat "$1"
local rel="$formatted_path_unix"
absolute_path=""
test ! -e "$rel" && mkdir -p "$rel"
if test -d "$rel" ; then
cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
absolute_path="$(pwd)"
cd - > /dev/null
else
AC_MSG_ERROR([Failed to resolve absolute path. "$rel" does not exist or is not a directory.])
fi
}
WARNINGS_FILE=config.warn
WARNINGS_FILE_FOR_BUILD=config.Build.warn
rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
have_WARNINGS="no"
add_warning()
{
if test "$have_WARNINGS" = "no"; then
echo "*************************************" > "$WARNINGS_FILE"
have_WARNINGS="yes"
if command -v tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
COLORWARN='*@<:@1;33;40m WARNING @<:@0m:'
else
COLORWARN="* WARNING :"
fi
fi
echo "$COLORWARN $@" >> "$WARNINGS_FILE"
}
dnl Some Mac User have the bad habit of letting a lot of crap
dnl accumulate in their PATH and even adding stuff in /usr/local/bin
dnl that confuse the build.
dnl For the ones that use LODE, let's be nice and protect them
dnl from themselves
mac_sanitize_path()
{
mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
dnl a common but nevertheless necessary thing that may be in a fancy
dnl path location is git, so make sure we have it
mac_git_path=`command -v git`
if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
mac_path="$mac_path:`dirname $mac_git_path`"
fi
dnl a not so common but nevertheless quite helpful thing that may be in a fancy
dnl path location is gpg, so make sure we find it
mac_gpg_path=`command -v gpg`
if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
mac_path="$mac_path:`dirname $mac_gpg_path`"
fi
PATH="$mac_path"
unset mac_path
unset mac_git_path
unset mac_gpg_path
}
dnl semantically test a three digits version
dnl $1 - $3 = minimal version
dnl $4 - $6 = current version
check_semantic_version_three()
{
test "$4" -gt "$1" \
-o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
-o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
return $?
}
dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
check_semantic_version_three_prefixed()
{
eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
eval local MIN_MINOR="\$${1}_${2}_MINOR"
eval local MIN_TINY="\$${1}_${2}_TINY"
eval local CUR_MAJOR="\$${1}_MAJOR"
eval local CUR_MINOR="\$${1}_MINOR"
eval local CUR_TINY="\$${1}_TINY"
check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
return $?
}
echo "********************************************************************"
echo "*"
echo "* Running ${PACKAGE_NAME} build configuration."
echo "*"
echo "********************************************************************"
echo ""
dnl ===================================================================
dnl checks build and host OSes
dnl do this before argument processing to allow for platform dependent defaults
dnl ===================================================================
# are we running in wsl but are called from git-bash/env with mingw64 in path?
# if so, we aim to run nearly everything in the Windows realm, and only run autogen/configure
# in wsl and run a few tools via wsl
WSL_ONLY_AS_HELPER=
if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then
WSL_ONLY_AS_HELPER=TRUE
AC_ARG_WITH([strawberry-perl-portable],
[AS_HELP_STRING([--with-strawberry-perl-portable],
[Specify the base path to strawberry perl portable])],
[],
[AC_MSG_ERROR(
[for the moment strawberry-perl-portable is a requirement, feel free to replace it])])
shortpath_cmd=$(wslpath -m $srcdir/solenv/bin/shortpath.cmd)
PathFormat "$with_strawberry_perl_portable"
if test ! -f "$formatted_path_unix/perl/bin/perl.exe" -o ! -d "$formatted_path_unix/c/bin"; then
AC_MSG_ERROR([$formatted_path doesn't contain perl or the utilities - sure you provided the base path?])
fi
STRAWBERRY_TOOLS="$formatted_path/c/bin"
STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
AC_ARG_WITH([wsl-command],
[AS_HELP_STRING([--with-wsl-command],
[Specify your wsl distro command if it isn't the default/the one used with just wsl.exe –
for example: wsl.exe -d MyDistro -u NonDefaultUser])],
[],
[with_wsl_command="wsl.exe"])
WSL="$with_wsl_command"
fi
AC_SUBST([STRAWBERRY_PERL])
AC_SUBST([WSL])
# Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
# Linux on WSL) trust that.
if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
ac_cv_host="x86_64-pc-wsl"
ac_cv_host_cpu="x86_64"
ac_cv_host_os="wsl"
ac_cv_build="$ac_cv_host"
ac_cv_build_cpu="$ac_cv_host_cpu"
ac_cv_build_os="$ac_cv_host_os"
# Emulation of Cygwin's cygpath command for WSL.
cygpath()
{
if test -n "$UNITTEST_WSL_CYGPATH"; then
echo -n cygpath "$@" "==> "
fi
# Cygwin's real cygpath has a plethora of options but we use only a few here.
local args="$@"
local opt
local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
OPTIND=1
while getopts dmuwlsp opt; do
case "$opt" in
\?)
AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
;;
?)
eval opt_$opt=yes
;;
esac
done
shift $((OPTIND-1))
if test $# -ne 1; then
AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
fi
local input="$1"
local result
if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
# Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
if test -n "$opt_u"; then
AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
fi
case "$input" in
/mnt/*)
# A Windows file in WSL format
input=$(wslpath -w "$input")
;;
[[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
# Already in Windows format
;;
/*)
input=$(wslpath -w "$input")
;;
*)
AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
;;
esac
if test -n "$opt_d" -o -n "$opt_s"; then
input=$($WSL_LO_HELPER --8.3 "$input")
fi
if test -n "$opt_m"; then
input="${input//\\//}"
fi
echo "$input"
else
# Print Unix path
case "$input" in
[[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
wslpath -u "$input"
;;
/)
echo "$input"
;;
*)
AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
;;
esac
fi
}
if test -n "$UNITTEST_WSL_CYGPATH"; then
BUILDDIR=.
# Nothing special with these file names, just arbitrary ones picked to test with
cygpath -d /usr/lib64/ld-linux-x86-64.so.2
cygpath -w /usr/lib64/ld-linux-x86-64.so.2
cygpath -m /usr/lib64/ld-linux-x86-64.so.2
cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
# At least on my machine for instance this file does have an 8.3 name
cygpath -d /mnt/c/windows/WindowsUpdate.log
# But for instance this one doesn't
cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
cygpath -ws /mnt/c/windows/WindowsUpdate.log
cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
cygpath -ms /mnt/c/windows/WindowsUpdate.log
cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
exit 0
fi
if test -z "$WSL_LO_HELPER"; then
if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
elif test -x "/opt/lo/bin/wsl-lo-helper"; then
WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
fi
fi
if test -z "$WSL_LO_HELPER"; then
AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
fi
fi
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
if test -n "$UNITTEST_WSL_PATHFORMAT"; then
BUILDDIR=.
GREP=grep
# Use of PathFormat must be after AC_CANONICAL_BUILD above
PathFormat /
printf "$formatted_path , $formatted_path_unix\n"
PathFormat $PWD
printf "$formatted_path , $formatted_path_unix\n"
PathFormat "$PROGRAMFILESX86"
printf "$formatted_path , $formatted_path_unix\n"
exit 0
fi
AC_MSG_CHECKING([for product name])
PRODUCTNAME="AC_PACKAGE_NAME"
if test -n "$with_product_name" -a "$with_product_name" != no; then
PRODUCTNAME="$with_product_name"
fi
if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
PRODUCTNAME="${PRODUCTNAME}Dev"
fi
AC_MSG_RESULT([$PRODUCTNAME])
AC_SUBST(PRODUCTNAME)
PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
dnl ===================================================================
dnl Our version is defined by the AC_INIT() at the top of this script.
dnl ===================================================================
AC_MSG_CHECKING([for package version])
if test -n "$with_package_version" -a "$with_package_version" != no; then
PACKAGE_VERSION="$with_package_version"
fi
AC_MSG_RESULT([$PACKAGE_VERSION])
set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
LIBO_VERSION_MAJOR=$1
LIBO_VERSION_MINOR=$2
LIBO_VERSION_MICRO=$3
LIBO_VERSION_PATCH=$4
LIBO_VERSION_SUFFIX=$5
# Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
# openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
# they get undoubled before actually passed to sed.
LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
# LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
# The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
# three non-negative integers. Please find more information about CFBundleVersion at
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
# The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
# of at most three non-negative integers. Please find more information about
# CFBundleShortVersionString at
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
# But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
if test "$enable_macosx_sandbox" = yes; then
MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
else
MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
fi
AC_SUBST(LIBO_VERSION_MAJOR)
AC_SUBST(LIBO_VERSION_MINOR)
AC_SUBST(LIBO_VERSION_MICRO)
AC_SUBST(LIBO_VERSION_PATCH)
AC_SUBST(LIBO_VERSION_SUFFIX)
AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
AC_SUBST(MACOSX_BUNDLE_VERSION)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>/dev/null`
LIBO_THIS_YEAR=${git_date:-2024}
AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
dnl ===================================================================
dnl Product version
dnl ===================================================================
AC_MSG_CHECKING([for product version])
PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
AC_MSG_RESULT([$PRODUCTVERSION])
AC_SUBST(PRODUCTVERSION)
AC_PROG_EGREP
# AC_PROG_EGREP doesn't set GREP on all systems as well
AC_PATH_PROG(GREP, grep)
BUILDDIR=`pwd`
cd $srcdir
SRC_ROOT=`pwd`
cd $BUILDDIR
x_Cygwin=[\#]
dnl ======================================
dnl Required GObject introspection version
dnl ======================================
INTROSPECTION_REQUIRED_VERSION=1.32.0
dnl ===================================================================
dnl Search all the common names for GNU Make
dnl ===================================================================
AC_MSG_CHECKING([for GNU Make])
# try to use our own make if it is available and GNUMAKE was not already defined
if test -z "$GNUMAKE"; then
if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
GNUMAKE="$LODE_HOME/opt/bin/make"
elif test -x "/opt/lo/bin/make"; then
GNUMAKE="/opt/lo/bin/make"
fi
fi
GNUMAKE_WIN_NATIVE=
for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
if test -n "$a"; then
$a --version 2> /dev/null | grep GNU 2>&1 > /dev/null
if test $? -eq 0; then
if test "$build_os" = "cygwin"; then
if test -n "$($a -v | grep 'Built for Windows')" ; then
GNUMAKE="$(cygpath -m "$(command -v "$(cygpath -u $a)")")"
GNUMAKE_WIN_NATIVE="TRUE"
else
GNUMAKE=`command -v $a`
fi
else
GNUMAKE=`command -v $a`
fi
break
fi
fi
done
AC_MSG_RESULT($GNUMAKE)
if test -z "$GNUMAKE"; then
AC_MSG_ERROR([not found. install GNU Make.])
else
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
fi
fi
win_short_path_for_make()
{
local short_path="$1"
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
cygpath -sm "$short_path"
elif test -n "$WSL_ONLY_AS_HELPER"; then
# when already unix-style path, wslpath doesn't return anything
case "$short_path" in
/*)
echo $short_path
exit
;;
esac
wslpath -m "$(wslpath -u "$short_path")"
else
cygpath -u "$(cygpath -d "$short_path")"
fi
}
if test "$build_os" = "cygwin"; then
PathFormat "$SRC_ROOT"
SRC_ROOT="$formatted_path"
PathFormat "$BUILDDIR"
BUILDDIR="$formatted_path"
x_Cygwin=
AC_MSG_CHECKING(for explicit COMSPEC)
if test -z "$COMSPEC"; then
AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
else
AC_MSG_RESULT([found: $COMSPEC])
fi
fi
AC_SUBST(SRC_ROOT)
AC_SUBST(BUILDDIR)
AC_SUBST(x_Cygwin)
AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
fi
# need sed in os checks...
AC_PATH_PROGS(SED, sed)
if test -z "$SED"; then
AC_MSG_ERROR([install sed to run this script])
fi
# Set the ENABLE_LTO variable
# ===================================================================
AC_MSG_CHECKING([whether to use link-time optimization])
if test -n "$enable_lto" -a "$enable_lto" != "no"; then
ENABLE_LTO="TRUE"
AC_MSG_RESULT([yes])
else
ENABLE_LTO=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_LTO)
AC_ARG_ENABLE(fuzz-options,
AS_HELP_STRING([--enable-fuzz-options],
[Randomly enable or disable each of those configurable options
that are supposed to be freely selectable without interdependencies,
or where bad interaction from interdependencies is automatically avoided.])
)
dnl ===================================================================
dnl When building for Android, --with-android-ndk,
dnl --with-android-ndk-toolchain-version and --with-android-sdk are
dnl mandatory
dnl ===================================================================
AC_ARG_WITH(android-ndk,
AS_HELP_STRING([--with-android-ndk],
[Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
,)
AC_ARG_WITH(android-ndk-toolchain-version,
AS_HELP_STRING([--with-android-ndk-toolchain-version],
[Specify which toolchain version to use, of those present in the
Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
with_android_ndk_toolchain_version=clang5.0)
AC_ARG_WITH(android-sdk,
AS_HELP_STRING([--with-android-sdk],
[Specify location of the Android SDK. Mandatory when building for Android.]),
,)
AC_ARG_WITH(android-api-level,
AS_HELP_STRING([--with-android-api-level],
[Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
,)
ANDROID_NDK_DIR=
if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
with_android_ndk="$SRC_ROOT/external/android-ndk"
fi
if test -n "$with_android_ndk"; then
eval ANDROID_NDK_DIR=$with_android_ndk
ANDROID_API_LEVEL=21
if test -n "$with_android_api_level" ; then
ANDROID_API_LEVEL="$with_android_api_level"
fi
if test $host_cpu = arm; then
LLVM_TRIPLE=armv7a-linux-androideabi
ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
ANDROID_APP_ABI=armeabi-v7a
ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
elif test $host_cpu = aarch64; then
LLVM_TRIPLE=aarch64-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=arm64-v8a
elif test $host_cpu = x86_64; then
LLVM_TRIPLE=x86_64-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=x86_64
else
# host_cpu is something like "i386" or "i686" I guess, NDK uses
# "x86" in some contexts
LLVM_TRIPLE=i686-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=x86
fi
# Set up a lot of pre-canned defaults
if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
if test ! -f $ANDROID_NDK_DIR/source.properties; then
AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
fi
ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
else
ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
fi
if test -z "$ANDROID_NDK_VERSION"; then
AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
fi
case $ANDROID_NDK_VERSION in
r9*|r10*)
AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
;;
11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*)
AC_MSG_ERROR([Building for Android requires NDK version >= 23.*])
;;
23.*|24.*|25.*)
;;
*)
AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk.])
add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 23.* to 25.* have been used successfully. Proceed at your own risk."
;;
esac
case "$with_android_ndk_toolchain_version" in
clang5.0)
ANDROID_GCC_TOOLCHAIN_VERSION=4.9
;;
*)
AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
esac
AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
# NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
# linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
# manage to link the (app-specific) single huge .so that is built for the app in
# android/source/ if there is debug information in a significant part of the object files.
# (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
# all objects have been built with debug information.)
case $build_os in
linux-gnu*)
android_HOST_TAG=linux-x86_64
;;
darwin*)
android_HOST_TAG=darwin-x86_64
;;
*)
AC_MSG_ERROR([We only support building for Android from Linux or macOS])
# ndk would also support windows and windows-x86_64
;;
esac
ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
if test "$ENABLE_LTO" = TRUE; then
# -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
# $CC and $CXX when building external libraries
ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
fi
ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
if test -z "$CC"; then
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
CC_BASE="clang"
fi
if test -z "$CXX"; then
CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
CXX_BASE="clang++"
fi
fi
AC_SUBST(ANDROID_NDK_DIR)
AC_SUBST(ANDROID_NDK_VERSION)
AC_SUBST(ANDROID_API_LEVEL)
AC_SUBST(ANDROID_APP_ABI)
AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
AC_SUBST(ANDROID_SYSROOT_PLATFORM)
AC_SUBST(ANDROID_TOOLCHAIN)
dnl ===================================================================
dnl --with-android-sdk
dnl ===================================================================
ANDROID_SDK_DIR=
if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
fi
if test -n "$with_android_sdk"; then
eval ANDROID_SDK_DIR=$with_android_sdk
PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
fi
AC_SUBST(ANDROID_SDK_DIR)
AC_ARG_ENABLE([android-lok],
AS_HELP_STRING([--enable-android-lok],
[The Android app from the android/ subdir needs several tweaks all
over the place that break the LOK when used in the Online-based
Android app. This switch indicates that the intent of this build is
actually the Online-based, non-modified LOK.])
)
ENABLE_ANDROID_LOK=
if test -n "$ANDROID_NDK_DIR" ; then
if test "$enable_android_lok" = yes; then
ENABLE_ANDROID_LOK=TRUE
AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
else
AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
fi
fi
AC_SUBST([ENABLE_ANDROID_LOK])
libo_FUZZ_ARG_ENABLE([android-editing],
AS_HELP_STRING([--enable-android-editing],
[Enable the experimental editing feature on Android.])
)
ENABLE_ANDROID_EDITING=
if test "$enable_android_editing" = yes; then
ENABLE_ANDROID_EDITING=TRUE
fi
AC_SUBST([ENABLE_ANDROID_EDITING])
disable_database_connectivity_dependencies()
{
enable_evolution2=no
enable_firebird_sdbc=no
enable_mariadb_sdbc=no
enable_postgresql_sdbc=no
enable_report_builder=no
}
# ===================================================================
#
# Start initial platform setup
#
# The using_* variables reflect platform support and should not be
# changed after the "End initial platform setup" block.
# This is also true for most test_* variables.
# ===================================================================
build_crypto=yes
test_clucene=no
test_gdb_index=no
test_openldap=yes
test_split_debug=no
test_webdav=yes
usable_dlapi=yes
# There is currently just iOS not using salplug, so this explicitly enables it.
# must: using_freetype_fontconfig
# may: using_headless_plugin defaults to $using_freetype_fontconfig
# must: using_x11
# Default values, as such probably valid just for Linux, set
# differently below just for Mac OSX, but at least better than
# hardcoding these as we used to do. Much of this is duplicated also
# in solenv for old build system and for gbuild, ideally we should
# perhaps define stuff like this only here in configure.ac?
LINKFLAGSSHL="-shared"
PICSWITCH="-fpic"
DLLPOST=".so"
LINKFLAGSNOUNDEFS="-Wl,-z,defs"
INSTROOTBASESUFFIX=
INSTROOTCONTENTSUFFIX=
SDKDIRNAME=sdk
HOST_PLATFORM="$host"
host_cpu_for_clang="$host_cpu"
case "$host_os" in
solaris*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
_os=SunOS
dnl ===========================================================
dnl Check whether we're using Solaris 10 - SPARC or Intel.
dnl ===========================================================
AC_MSG_CHECKING([the Solaris operating system release])
_os_release=`echo $host_os | $SED -e s/solaris2\.//`
if test "$_os_release" -lt "10"; then
AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
else
AC_MSG_RESULT([ok ($_os_release)])
fi
dnl Check whether we're using a SPARC or i386 processor
AC_MSG_CHECKING([the processor type])
if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
AC_MSG_RESULT([ok ($host_cpu)])
else
AC_MSG_ERROR([only SPARC and i386 processors are supported])
fi
;;
linux-gnu*|k*bsd*-gnu*|linux-musl*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
test_gdb_index=yes
test_split_debug=yes
if test "$enable_fuzzers" = yes; then
test_system_freetype=no
fi
_os=Linux
;;
gnu)
using_freetype_fontconfig=yes
using_x11=no
_os=GNU
;;
cygwin*|wsl*)
# When building on Windows normally with MSVC under Cygwin,
# configure thinks that the host platform (the platform the
# built code will run on) is Cygwin, even if it obviously is
# Windows, which in Autoconf terminology is called
# "mingw32". (Which is misleading as MinGW is the name of the