forked from LibreOffice/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
13269 lines (11947 loc) · 457 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: 102 -*-
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 argumemnt 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],[5.1.0.0.alpha1+],[],[],[http://documentfoundation.org/])
AC_PREREQ([2.59])
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
BUILD_TYPE="LibO"
SCPDEFS=""
GIT_NEEDED_SUBMODULES=""
LO_PATH= # used by path_munge to construct a PATH variable
PathFormat()
{
formatted_path="$1"
if test "$build_os" = "cygwin"; then
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 "$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 "$1", not necessarily a problem.])
else
formatted_path="$new_formatted_path"
fi
fi
formatted_path=`cygpath -m "$formatted_path"`
if test $? -ne 0; then
AC_MSG_ERROR([path conversion failed for "$1".])
fi
fi
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.
rel="$1"
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
}
rm -f warn
have_WARNINGS="no"
add_warning()
{
if test "$have_WARNINGS" = "no"; then
echo "*************************************" > warn
have_WARNINGS="yes"
if which tput >/dev/null 2>/dev/null && test `tput colors` -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 $@" >> warn
}
dnl Some Mac User have the bad habbit of letting a lot fo 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=`which git 2>/dev/null`
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
PATH="$mac_path"
unset mac_path
unset git_mac_path
}
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 ===================================================================
AC_CANONICAL_HOST
AC_MSG_CHECKING([for product name])
if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
PRODUCTNAME=AC_PACKAGE_NAME"Dev"
else
PRODUCTNAME=AC_PACKAGE_NAME
fi
AC_MSG_RESULT([$PRODUCTNAME])
AC_SUBST(PRODUCTNAME)
dnl ===================================================================
dnl Our version is defined by the AC_INIT() at the top of this script.
dnl ===================================================================
set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
LIBO_VERSION_MAJOR=$1
LIBO_VERSION_MINOR=$2
LIBO_VERSION_MICRO=$3
LIBO_VERSION_PATCH=$4
# The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
# as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
# no way to encode that into an integer in general.
MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
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"
AC_SUBST(LIBO_VERSION_MAJOR)
AC_SUBST(LIBO_VERSION_MINOR)
AC_SUBST(LIBO_VERSION_MICRO)
AC_SUBST(LIBO_VERSION_PATCH)
AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
AC_SUBST(LIBO_VERSION_SUFFIX)
AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
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)
LIBO_THIS_YEAR=`date +%Y`
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 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 "$(which "$(cygpath -u $a)")")"
GNUMAKE_WIN_NATIVE="TRUE"
else
GNUMAKE=`which $a`
fi
else
GNUMAKE=`which $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 "$local_short_path"
else
cygpath -u "$(cygpath -d "$local_short_path")"
fi
}
if test "$build_os" = "cygwin"; then
PathFormat "$SRC_ROOT"
SRC_ROOT="$formatted_path"
PathFormat "$BUILDDIR"
BUILDDIR="$formatted_path"
x_Cygwin=
fi
AC_SUBST(SRC_ROOT)
AC_SUBST(BUILDDIR)
AC_SUBST(x_Cygwin)
AC_DEFINE_UNQUOTED(SRCDIR,"$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])
AC_DEFINE(STATIC_LINKING)
else
ENABLE_LTO=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_LTO)
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 is 4.9 currently.]), ,)
AC_ARG_WITH(android-sdk,
AS_HELP_STRING([--with-android-sdk],
[Specify location of the Android SDK. Mandatory when building for Android,
or when building the Impress Remote Android app.]),
,)
ANDROID_NDK_HOME=
if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk"; then
with_android_ndk="$SRC_ROOT/external/android-ndk"
fi
if test -n "$with_android_ndk"; then
ANDROID_NDK_HOME=$with_android_ndk
# Set up a lot of pre-canned defaults
if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
fi
ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
case $ANDROID_NDK_VERSION in
r9*|r10*)
;;
*)
AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
;;
esac
if test $host_cpu = arm; then
android_cpu=arm
android_platform_prefix=$android_cpu-linux-androideabi
elif test $host_cpu = aarch64; then
android_cpu=aarch64
android_platform_prefix=$android_cpu-linux-android
elif test $host_cpu = mips; then
android_cpu=mips
android_platform_prefix=$android_cpu-linux-androideabi
else
# host_cpu is something like "i386" or "i686" I guess, NDK uses
# "x86" in some contexts
android_cpu=x86
android_platform_prefix=$android_cpu
fi
if test -z "$with_android_ndk_toolchain_version"; then
# Default to gcc 4.9
with_android_ndk_toolchain_version=4.9
fi
case "$with_android_ndk_toolchain_version" in
4.6|4.7|4.8|4.9)
ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
;;
clang3.3|clang3.4)
AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
ANDROID_USING_CLANG=true
;;
*)
AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
esac
if test ! -d $ANDROID_BINUTILS_DIR; then
AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
fi
# Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
# NDK r8e and later, and for earlier NDKs it was possible to build one yourself. 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 to much over 10 gigabytes of virtual space when linking such a .so if
# all objects have been built with debug information.)
toolchain_system='*'
case $build_os in
linux-gnu*)
ndk_build_os=linux
;;
darwin*)
ndk_build_os=darwin
;;
*)
AC_MSG_ERROR([We only support building for Android from Linux or OS X])
;;
esac
ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
if test $build_cpu = x86_64; then
if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
fi
if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
fi
fi
ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
# This stays empty if there is just one version of the toolchain in the NDK
ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
*/bin\ */bin*)
# Trailing slash intentional and necessary, compare to how this is used
if test -n "$ANDROID_USING_CLANG"; then
ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
else
ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
fi
;;
esac
ANDROID_API_LEVEL=15
if test $host_cpu = arm; then
android_gnu_prefix=arm-linux-androideabi
elif test $host_cpu = aarch64; then
android_gnu_prefix=aarch64-linux-android
ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
ANDROID_API_LEVEL=L
elif test $host_cpu = mips; then
android_gnu_prefix=mipsel-linux-android
elif test $ANDROID_NDK_VERSION = r8; then
# The prefix used for the x86 tool-chain changed between NDK r8 and r8b
android_gnu_prefix=i686-android-linux
else
android_gnu_prefix=i686-linux-android
fi
ANDROID_ARCH=$android_cpu
if test $host_cpu = arm; then
ANDROID_APP_ABI=armeabi-v7a
if test -n "$ANDROID_USING_CLANG"; then
ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
else
:
fi
ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
elif test $host_cpu = aarch64; then
ANDROID_APP_ABI=arm64-v8a
ANDROID_ARCH=arm64
elif test $host_cpu = mips; then
ANDROID_APP_ABI=mips
ANDROIDCFLAGS=""
else # x86
ANDROID_APP_ABI=x86
ANDROIDCFLAGS="-march=atom"
fi
ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
if test -n "$ANDROID_USING_CLANG"; then
ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
else
ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
fi
test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
# When using the 4.6 or newer toolchain, use the gold linker
case "$with_android_ndk_toolchain_version" in
4.[[6789]]*|[[56789]].*|clang*)
if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
fi
;;
esac
if test "$ENABLE_LTO" = TRUE; then
# -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
# $CC and $CXX when building external libraries
ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
fi
# gdbserver can be in different locations
if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
elif test $android_cpu = aarch64; then
ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
else
AC_MSG_ERROR([Can't find gdbserver for your Android target])
fi
if test $host_cpu = arm; then
ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/armeabi-v7a/include"
elif test $host_cpu = mips; then
ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
else # x86
ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
fi
if test -z "$CC"; then
case "$with_android_ndk_toolchain_version" in
4.*)
CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
;;
clang*)
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
esac
fi
if test -z "$CXX"; then
case "$with_android_ndk_toolchain_version" in
4.*)
CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
;;
clang*)
CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
;;
esac
fi
# remember to download the ownCloud Android library later
BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
fi
AC_SUBST(ANDROID_NDK_GDBSERVER)
AC_SUBST(ANDROID_APP_ABI)
dnl ===================================================================
dnl --with-android-sdk
dnl ===================================================================
ANDROID_SDK_HOME=
if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux"; then
with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
fi
if test -n "$with_android_sdk"; then
ANDROID_SDK_HOME=$with_android_sdk
PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
fi
AC_SUBST(ANDROID_SDK_HOME)
dnl ===================================================================
dnl The following is a list of supported systems.
dnl Sequential to keep the logic very simple
dnl These values may be checked and reset later.
dnl ===================================================================
#defaults unless the os test overrides this:
test_randr=yes
test_xrender=yes
test_cups=yes
test_dbus=yes
test_fontconfig=yes
test_cairo=no
# 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"
INSTROOTSUFFIX=
SDKDIRNAME=sdk
case "$host_os" in
solaris*)
test_gtk=yes
build_gstreamer_1_0=yes
build_gstreamer_0_10=yes
test_tde=yes
test_kde=yes
test_freetype=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*)
test_gtk=yes
build_gstreamer_1_0=yes
build_gstreamer_0_10=yes
test_tde=yes
test_kde=yes
test_kde4=yes
test_freetype=yes
_os=Linux
;;
gnu)
test_randr=no
test_xrender=no
_os=GNU
;;
cygwin*|interix*|mingw32*)
# 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
# tool-chain, not an operating system.)
# Somewhat confusing, yes. But this configure script doesn't
# look at $host etc that much, it mostly uses its own $_os
# variable, set here in this case statement.
# When cross-compiling to Windows from Unix, the host platform
# is "mingw32" (because in that case it is the MinGW
# tool-chain that is used).
test_cups=no
test_dbus=no
test_randr=no
test_xrender=no
test_freetype=no
test_fontconfig=no
_os=WINNT
DLLPOST=".dll"
LINKFLAGSNOUNDEFS=
# If the host OS matches "mingw32*", that means we are using the
# MinGW cross-compiler, because we don't see the point in building
# LibreOffice using MinGW on Windows. If you want to build on
# Windows, use MSVC. If you want to use MinGW, surely you want to
# cross-compile (from Linux or some other Unix).
case "$host_os" in
mingw32*)
WITH_MINGW=yes
if test -z "$CC"; then
CC="$host_cpu-$host_vendor-$host_os-gcc"
fi
if test -z "$CXX"; then
CXX="$host_cpu-$host_vendor-$host_os-g++"
fi
;;
esac
;;
darwin*) # Mac OS X or iOS
test_gtk=yes
test_randr=no
test_xrender=no
test_freetype=no
test_fontconfig=no
test_dbus=no
if test "$host_cpu" = "arm"; then
_os=iOS
test_gtk=no
test_cups=no
else
_os=Darwin
if test -n "$LODE_HOME" ; then
mac_sanitize_path
AC_MSG_NOTICE([sanitized the PATH to $PATH])
fi
INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
fi
enable_systray=no
# See comment above the case "$host_os"
LINKFLAGSSHL="-dynamiclib -single_module"
# -fPIC is default
PICSWITCH=""
DLLPOST=".dylib"
# -undefined error is the default
LINKFLAGSNOUNDEFS=""
;;
freebsd*)
test_gtk=yes
build_gstreamer_1_0=yes
build_gstreamer_0_10=yes
test_tde=yes
test_kde=yes
test_kde4=yes
test_freetype=yes
AC_MSG_CHECKING([the FreeBSD operating system release])
if test -n "$with_os_version"; then
OSVERSION="$with_os_version"
else
OSVERSION=`/sbin/sysctl -n kern.osreldate`
fi
AC_MSG_RESULT([found OSVERSION=$OSVERSION])
AC_MSG_CHECKING([which thread library to use])
if test "$OSVERSION" -lt "500016"; then
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-pthread"
elif test "$OSVERSION" -lt "502102"; then
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-lc_r"
else
PTHREAD_CFLAGS=""
PTHREAD_LIBS="-pthread"
fi
AC_MSG_RESULT([$PTHREAD_LIBS])
_os=FreeBSD
;;
*netbsd*)
test_gtk=yes
build_gstreamer_1_0=yes
build_gstreamer_0_10=yes
test_tde=no
test_kde=no
test_kde4=yes
test_freetype=yes
PTHREAD_LIBS="-pthread -lpthread"
_os=NetBSD
;;
aix*)
test_randr=no
test_freetype=yes
PTHREAD_LIBS=-pthread
_os=AIX
;;
openbsd*)
test_gtk=yes
test_tde=yes
test_kde=yes
test_freetype=yes
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-pthread"
_os=OpenBSD
;;
dragonfly*)
test_gtk=yes
build_gstreamer_1_0=yes
build_gstreamer_0_10=yes
test_tde=yes
test_kde=yes
test_kde4=yes
test_freetype=yes
PTHREAD_LIBS="-pthread"
_os=DragonFly
;;
linux-android*)
build_gstreamer_1_0=no
build_gstreamer_0_10=no
enable_lotuswordpro=no
enable_mpl_subset=yes
enable_coinmp=yes
enable_lpsolve=no
enable_report_builder=no
with_theme="tango"
test_cups=no
test_dbus=no
test_fontconfig=no
test_freetype=no
test_gtk=no
test_tde=no
test_kde=no
test_kde4=no
test_randr=no
test_xrender=no
_os=Android
if test -z "$with_android_ndk"; then
AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
fi
if test -z "$with_android_ndk_toolchain_version"; then
AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
fi
# Verify that the NDK and SDK options are proper
if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
fi
AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
;;
*)
AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
;;
esac
if echo "$host_os" | grep -q linux-android ; then
if test -z "$with_android_sdk"; then
AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
fi
if test ! -d "$ANDROID_SDK_HOME/platforms"; then
AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
fi
fi
if test "$_os" = "AIX"; then
AC_PATH_PROG(GAWK, gawk)
if test -z "$GAWK"; then
AC_MSG_ERROR([gawk not found in \$PATH])
fi
fi
AC_SUBST(SDKDIRNAME)
AC_SUBST(WITH_MINGW)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
###############################################################################
# Extensions switches --enable/--disable
###############################################################################
# By default these should be enabled unless having extra dependencies.
# If there is extra dependency over configure options then the enable should
# be automagic based on whether the requiring feature is enabled or not.
# All this options change anything only with --enable-extension-integration.
# The name of this option and its help string makes it sound as if
# extensions are built anyway, just not integrated in the installer,
# if you use --disable-extension-integration. Is that really the
# case?
AC_ARG_ENABLE(extension-integration,
AS_HELP_STRING([--disable-extension-integration],
[Disable integration of the built extensions in the installer of the
product. Use this switch to disable the integration.])
)
AC_ARG_ENABLE(export,
AS_HELP_STRING([--disable-export],
[Disable (some) code for document export. Useful when building viewer-only apps that lack
save/export functionality, to avoid having an excessive amount of code and data used
only for exporrt linked in. Work in progress, use only if you are hacking on it.])
)
AC_ARG_ENABLE(avmedia,
AS_HELP_STRING([--disable-avmedia],
[Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
)
AC_ARG_ENABLE(database-connectivity,
AS_HELP_STRING([--disable-database-connectivity],
[Disable various database connectivity. Work in progress, use only if you are hacking on it.])
)
# This doesn't mean not building (or "integrating") extensions
# (although it probably should; i.e. it should imply
# --disable-extension-integration I guess), it means not supporting
# any extension mechanism at all
AC_ARG_ENABLE(extensions,
AS_HELP_STRING([--disable-extensions],
[Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
)
AC_ARG_ENABLE(scripting,
AS_HELP_STRING([--disable-scripting],
[Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
)
# This is mainly for Android and iOS, but could potentially be used in some
# special case otherwise, too, so factored out as a separate setting
AC_ARG_ENABLE(dynamic-loading,
AS_HELP_STRING([--disable-dynamic-loading],
[Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
)
AC_ARG_ENABLE(ext-mariadb-connector,
AS_HELP_STRING([--enable-ext-mariadb-connector],
[Enable the build of the MariaDB/MySQL Connector extension.])
)
AC_ARG_ENABLE(report-builder,
AS_HELP_STRING([--disable-report-builder],
[Disable the Report Builder.])
)
AC_ARG_ENABLE(ext-wiki-publisher,
AS_HELP_STRING([--enable-ext-wiki-publisher],
[Enable the Wiki Publisher extension.])
)
AC_ARG_ENABLE(lpsolve,
AS_HELP_STRING([--disable-lpsolve],
[Disable compilation of the lp solve solver ])
)
AC_ARG_ENABLE(coinmp,
AS_HELP_STRING([--disable-coinmp],
[Disable compilation of the CoinMP solver ])
)
AC_ARG_ENABLE(pdfimport,
AS_HELP_STRING([--disable-pdfimport],
[Disable building the PDF import feature.])
)
###############################################################################
dnl ---------- *** ----------
AC_ARG_ENABLE([hardlink-deliver],
AS_HELP_STRING([--enable-hardlink-deliver],
[Put files into deliver folder as hardlinks instead of copying them
over. Saves space and speeds up build.])
)
AC_ARG_ENABLE(mergelibs,
AS_HELP_STRING([--enable-mergelibs],
[Enables linking of big, merged, library. Experimental feature, tested
only for Linux at some stage in history, but possibly does not work even
for Linux any more. This will link a core set of libraries into libmerged.])
)
AC_ARG_ENABLE(graphite,
AS_HELP_STRING([--enable-graphite],
[Enables the compilation of Graphite smart font rendering.])
)
AC_ARG_ENABLE(orcus,
AS_HELP_STRING([--enable-orcus],
[Enables orcus for extra file import filters for Calc.])
)
AC_ARG_ENABLE(fetch-external,
AS_HELP_STRING([--disable-fetch-external],
[Disables fetching external tarballs from web sources.])
)
AC_ARG_ENABLE(lockdown,
AS_HELP_STRING([--disable-lockdown],
[Disables the gconf integration work in LibreOffice.]),
)
AC_ARG_ENABLE(pch,
AS_HELP_STRING([--enable-pch],
[Enables precompiled header support for C++. Forced default on Windows/VC build])
)
AC_ARG_ENABLE(win-mozab-driver,
AS_HELP_STRING([--enable-win-mozab-driver],
[LibreOffice includes a driver to connect to Mozilla
address books under Windows, to build with this version, use this option.])
)
AC_ARG_ENABLE(epm,
AS_HELP_STRING([--enable-epm],
[LibreOffice includes self-packaging code, that requires epm, however epm is
useless for large scale package building.])
)
AC_ARG_ENABLE(odk,
AS_HELP_STRING([--disable-odk],
[LibreOffice includes an ODK, office development kit which some packagers may
wish to build without.])
)
AC_ARG_ENABLE(mpl-subset,
AS_HELP_STRING([--enable-mpl-subset],
[Don't compile any pieces which are not MPL or more liberally licensed])
)
AC_ARG_ENABLE(evolution2,
AS_HELP_STRING([--enable-evolution2],