This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathconfigure.ac
1996 lines (1759 loc) · 63.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
##################
# /!\ ATTENTION
# Before editting this file, please read the following:
#
# The platform is stored in IS_WIN, IS_OSX, IS_LINUX, IS_POSIX variables.
# Those are detected automatically from the host.
# Currently you can't cross-compile.
# IS_LINUX and IS_OSX implies IS_POSIX
#
# Each dependency have a set of variables set at the beginning of this file:
# X_CFLAGS, X_LDFLAGS: expected flags for shared linking.
# COMPILE_X: whether or not a download+compile will be performed.
# COMPILED_X_CFLAGS, COMPILED_X_LDFLAGS: expected flags once compiled locally.
# X_CFLAGS and X_LDFLAGS will be replace with COMPILED ones if appropriate.
#
# Each dependency has it own space for dependency resolution (although most
# look very similar)
# Process is the same for all:
# 1. get path from --with-x= and add it to LIBRARY_PATH
# 2. get path from --with-static-x (usually a .a file) and store it.
# 3. if no static requested, try to find the library automaticaly
# using pkg-config, AC_CHECK_LIB, etc. If not found, fail.
# 4. mark package for compile if static is SELF. If static is a path, try to
# find the archive and fail if not found.
##################
# Autotools initializations
AC_INIT([kiwix], [0.10])
IS_WIN=0
IS_OSX=0
IS_POSIX=0
IS_LINUX=0
IS_OLD_GCC=0
AC_CONFIG_AUX_DIR([.]) # where are autotools scripts located
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
# I have commented out this. Default prefix should be /usr/local
#AC_PREFIX_PROGRAM("whoami")
# find C compiler
AC_PROG_CC
# Macro for "ln -s" and "cp" in fallback
AC_PROG_LN_S
# find C++ compiler
AC_PROG_CXX
AC_CHECK_TOOL(HAVE_CXX, "$CXX")
if test [ ! "$HAVE_CXX" ]
then
AC_MSG_ERROR([[cannot find any C++ compiler]])
fi
# AC_CHECK_TOOL(HAVE_ZIP, zip)
# Check binary compressor
AC_CHECK_PROG(HAVE_UPX, upx, 1, 0)
AM_CONDITIONAL([HAVE_UPX], [test "$HAVE_UPX" = 1])
# Check if running on Windows
AC_CHECK_PROG(HAVE_CL, cl.exe, yes, no)
AM_CONDITIONAL([IS_WIN], [test "$HAVE_CL" = yes])
AM_CONDITIONAL([IS_POSIX], [test ! "$HAVE_CL" = yes])
if test [ "$HAVE_CL" = yes ]
then
IS_WIN=1
else
IS_POSIX=1
fi
# Check if running on OSX
AC_CHECK_PROG(HAVE_XCODE, Xcode, yes, no, [$PATH$PATH_SEPARATOR/Developer/Applications/Xcode.app/Contents/MacOS/$PATH_SEPARATOR,$PATH$PATH_SEPARATOR/Applications/Xcode.app/Contents/MacOS/$PATH_SEPARATOR])
AM_CONDITIONAL([IS_OSX], [test "$HAVE_XCODE" = yes])
if test [ "$HAVE_XCODE" = yes ]
then
IS_OSX=1
else
if test [ $IS_POSIX -eq 1 ]
then
IS_LINUX=1
else
IS_LINUX=3
fi
fi
# check if running on Linux
AM_CONDITIONAL([IS_LINUX], [test $IS_POSIX -eq 1 -a $IS_OSX -eq 0 ])
# POSIX only checks
# Only for POSIX systems
if test [ $IS_POSIX -eq 1 ]
then
# Chek zip
AC_CHECK_TOOL([ZIP],[zip],[])
if [[ "$ZIP" = "" ]]; then
AC_MSG_ERROR([zip is required.])
fi
# Check the compiler version
if test [ "$CXX" ]
then
CXX_VERSION=`$CXX --version | head -n 1 | cut -d " " -f 3`
if [[ "$CXX_VERSION" \< "3.3" ]]
then
AC_MSG_ERROR([g++ 3.3.x or higher required])
fi
fi
# Determine libtool
AC_PROG_LIBTOOL
AC_PROG_RANLIB
AC_PROG_MAKE_SET
# Check if the 'pkg-config' binary exists
AC_CHECK_TOOL(HAVE_PKG_CONFIG, pkg-config)
if test [ ! "$HAVE_PKG_CONFIG" ]
then
AC_MSG_ERROR([[cannot find pkg-config]])
fi
fi
# Windows only checks
if test [ $IS_WIN -eq 1 ] ; then
CL_VERSION=`cl.exe 2>&1 | grep Version | sed 's/.*Version //' | sed 's/\..*//'`
AC_MSG_RESULT(checking for cl version... ${CL_VERSION})
fi
# Set current language to C++
AC_LANG(C++)
# Current path
CURRENT_PATH=`pwd`
# Check if their is a Perl binary
AC_CHECK_TOOL(HAVE_PERL, perl)
# check if java tools for Android are present
AC_CHECK_TOOL(HAVE_JAVA_BIN, java)
AC_CHECK_TOOL(HAVE_JAVAH_BIN, javah)
AC_CHECK_TOOL(HAVE_JARSIGNER_BIN, jarsigner)
# check if imagemagick's convert is present
AC_CHECK_TOOL(HAVE_CONVERT_BIN, convert)
# check if python-requests is installed
HAVE_PYTHON_REQUESTS=`python -c 'import requests; print("python-requests")' 2> /dev/null`
AC_MSG_RESULT(checking for python-requests... ${HAVE_PYTHON_REQUESTS})
HAVE_PYTHON_BEAUTIFULSOUP=`python -c 'import bs4; print("python-beautifulsoup")' 2> /dev/null`
AC_MSG_RESULT(checking for python-beautifulsoup... ${HAVE_PYTHON_BEAUTIFULSOUP})
# Check the existence of stat64 (to handle file >2GB) in the libc
AC_CHECK_FUNCS([stat64])
# used to display a warning message at end of configure
# if there are unmet dependencies which will be compiled.
MISSING_SELF_DEPS=0
function ErrorOrWarning {
# parameters:
# $1: condition on COMPILE_XX variable (check if it will be compiled)
# $2: error message
# if $1 is 1, we assume it will be compiled and just display warning
if [[ $1 -eq 1 ]]
then
AC_MSG_WARN([[$2]])
MISSING_SELF_DEPS=1
# if not, it is supposed to be present so we send error
else
AC_MSG_ERROR([[$2]])
fi
}
function yesno {
if [[ $1 -eq 1 ]]
then
echo yes
else
echo no
fi
}
function findLibrary {
found=0
for f in $(echo $LIBS_ROOT|tr ":" "\n") ; do
sf=`find $f -name $1 | grep $ARCH | head -1 2> /dev/null`
if [[ -f "$sf" -a $found -eq 0 ]]
then
found=1
echo $sf
fi
done
if [[ $found -eq 0 ]]
then
for f in $(echo $LIBS_ROOT|tr ":" "\n") ; do
sf=`find $f -name $1 | head -1 2> /dev/null`
if [[ -f "$sf" -a $found -eq 0 ]]
then
found=1
echo $sf
fi
done
fi
if [[ $found -eq 0 ]]
then
echo "no"
fi
}
####################################################
############ TARGET_ARCH
####################################################
# ARCH flags
#ARCH=`echo $MACHTYPE | cut -d- -f1`
ARCH=`uname -m`
AC_ARG_WITH(target-arch,
AC_HELP_STRING([--with-target-arch=ARCH], [(OSX Only) Define the target architecture of the built (i386 or x86_64)]),
XTARGET=${withval})
# only overwrite arch on OSX
if test [ $IS_OSX -eq 1 ] ; then
AS_IF([test ! "${XTARGET}" = "i386" -a ! "${XTARGET}" = "x86_64"], [], [ARCH=${XTARGET}])
CC="$CC -arch ${ARCH}"
CXX="$CXX -arch ${ARCH}"
fi
if test [ "`uname -m | grep 64 | wc -l | awk '{ print $1}'`" = "0" ];
then
IS_64B=0
else
IS_64B=1
fi
if test [ "`uname -m | grep arm | wc -l | awk '{ print $1}'`" = "0" ];
then
IS_ARM=0
else
IS_ARM=1
fi
DEFAULT_CERTIFICATE="Developer ID Application: Renaud Gaudin (S3QKTMRU8F)"
####################################################
############ DEPENDENCIES DEFAULT VALUES
####################################################
SELF="SELF"
DEP_PATH="${CURRENT_PATH}/src/dependencies"
LIBS_ROOT="${LD_LIBRARY_PATH}:${LIBRARY_PATH}:/usr/lib:/lib"
SERVER_BIN="${CURRENT_PATH}/src/server/kiwix-serve"
DEP_MIRROR="http://download.kiwix.org/dev"
if test [ $IS_OSX -eq 1 ] ; then
CHECK_LDFLAGS=""
else
CHECK_LDFLAGS="-Wl,-z,defs"
fi
JAR_CONTENT=0
DEBIAN_RULES=0
COMPIL_DEPS=0
STATIC_BINS=0
STATIC_TMP="static_tmp"
DISTDEBIAN_TMP="debian_tmp"
SUGAR_TMP="sugar_tmp"
SUGAR_VERSION=`if test [ -f src/sugar/activity/activity.info ]; then grep activity_version src/sugar/activity/activity.info | cut -d " " -f3; fi`
# list of .so to copy to xulrunner/ path
EMBED_LIBS=""
SHARED_EXT="so"
if test [ $IS_OSX -eq 1 ] ; then
SHARED_EXT="dylib"
elif test [ $IS_WIN -eq 1 ] ; then
SHARED_EXT="dll"
fi
GECKO_SDK_PATH=""
COMPILE_GECKO_SDK=0
if test [ $IS_OSX -eq 1 ] ; then
COMPILED_GECKO_SDK_PATH="${DEP_PATH}/universal-sdk"
else
COMPILED_GECKO_SDK_PATH="${DEP_PATH}/xulrunner-sdk"
fi
if test [ $IS_OSX -eq 1 ]
then
XULRUNNER_RUNTIME_PATH="${DEP_PATH}/xr_target/xulrunner-29.0.en-US.mac/XUL.framework"
else
XULRUNNER_RUNTIME_PATH="${DEP_PATH}/xulrunner"
fi
ANDROID_NDK_PATH="${DEP_PATH}/android-ndk-r8e/"
ANDROID_SDK_PATH="${DEP_PATH}/android-sdk/sdk"
ANDROID_DEPS="android-deps"
ZLIB_CFLAGS=""
ZLIB_LDFLAGS=" -lz"
ZLIB_STATIC_LDFLAGS=""
COMPILE_ZLIB=0
COMPILED_ZLIB_CFLAGS="-I${DEP_PATH}/zlib-1.2.8"
COMPILED_ZLIB_LDFLAGS="-L${DEP_PATH}/zlib-1.2.8/shared/lib -lz"
if test [ $IS_WIN -eq 1 ]
then
COMPILED_ZLIB_FILES="${DEP_PATH}/zlib-1.2.8/zlib.lib"
else
COMPILED_ZLIB_FILES="${DEP_PATH}/zlib-1.2.8/shared/lib/libz.${SHARED_EXT}"
fi
COMPILED_ZLIB_STATIC_LDFLAGS="${DEP_PATH}/zlib-1.2.8/static/lib/libz.a"
if test [ $IS_OSX -eq 1 ]
then
COMPILED_ZLIB_LDFLAGS="-L${DEP_PATH}/zlib-1.2.8/build/shared/lib -lz"
COMPILED_ZLIB_FILES="${DEP_PATH}/zlib-1.2.8/build/shared/lib/libz.${SHARED_EXT}"
COMPILED_ZLIB_STATIC_LDFLAGS="${DEP_PATH}/zlib-1.2.8/build/static/lib/libz.a"
fi
XAPIAN_CFLAGS=""
XAPIAN_LDFLAGS="-lxapian -lrt"
XAPIAN_STATIC_LDFLAGS=""
COMPILE_XAPIAN=0
COMPILED_XAPIAN_CFLAGS="-I${DEP_PATH}/xapian-core-1.4.2/include/"
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_XAPIAN_FILES="${DEP_PATH}/xapian-core-1.4.2/win32/Release/libs/libunicode.lib"
else
COMPILED_XAPIAN_LDFLAGS="-L${DEP_PATH}/xapian-core-1.4.2/.libs -lxapian -lrt"
COMPILED_XAPIAN_FILES="${DEP_PATH}/xapian-core-1.4.2/.libs/libxapian.${SHARED_EXT}"
COMPILED_XAPIAN_STATIC_LDFLAGS="${DEP_PATH}/xapian-core-1.4.2/.libs/libxapian.a"
fi
XAPIAN_COMPACT=""
COMPILED_XAPIAN_COMPACT="${DEP_PATH}/xapian-core-1.4.2/bin/xapian-compact"
ICU_CFLAGS=""
ICU_LDFLAGS="-licui18n -licuuc -licudata" # replaced by icu-config
ICU_STATIC_LDFLAGS=""
COMPILE_ICU=0
COMPILED_ICU_CFLAGS="-I${DEP_PATH}/icu/source/build/include"
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_ICU_FILES="${DEP_PATH}/icu/lib/icuio.lib ${DEP_PATH}/icu/lib/icudata.lib ${DEP_PATH}/icu/lib/icuuc.lib ${DEP_PATH}/icu/lib/icui18n.lib"
else
COMPILED_ICU_LDFLAGS="-L${DEP_PATH}/icu/source/build/lib -licui18n -licuuc -licudata"
COMPILED_ICU_STATIC_LDFLAGS="${DEP_PATH}/icu/source/build/lib/libicui18n.a ${DEP_PATH}/icu/source/build/lib/libicuuc.a ${DEP_PATH}/icu/source/build/lib/libicudata.a"
COMPILED_ICU_CFLAGS="-I${DEP_PATH}/icu/source/build/include"
COMPILED_ICU_FILES="${DEP_PATH}/icu/source/build/lib/libicui18n.${SHARED_EXT} ${DEP_PATH}/icu/source/build/lib/libicuuc.${SHARED_EXT} ${DEP_PATH}/icu/source/build/lib/libicudata.${SHARED_EXT}"
fi
COMPILED_ICUDATA_DAT="${DEP_PATH}/icudt56l.dat"
# used only for building kiwix-serve.
MICROHTTPD_CFLAGS=""
MICROHTTPD_LDFLAGS="-lmicrohttpd"
MICROHTTPD_STATIC_LDFLAGS=""
COMPILE_MICROHTTPD=0
if test [ $IS_WIN -eq 1 ]
then
COMPILED_MICROHTTPD_FILES="${DEP_PATH}/libmicrohttpd/lib/libmicrohttpd.dll.a"
COMPILED_MICROHTTPD_CFLAGS="-I${DEP_PATH}/libmicrohttpd/inlcude"
COMPILED_MICROHTTPD_LDFLAGS="-L${DEP_PATH}/libmicrohttpd/lib"
COMPILED_MICROHTTPD_STATIC_LDFLAGS="${DEP_PATH}/libmicrohttpd/lib/libmicrohttpd.dll.a"
else
COMPILED_MICROHTTPD_FILES="${DEP_PATH}/libmicrohttpd-0.9.19/build/lib/libmicrohttpd.${SHARED_EXT}"
COMPILED_MICROHTTPD_CFLAGS="-I${DEP_PATH}/libmicrohttpd-0.9.19/build/include"
COMPILED_MICROHTTPD_LDFLAGS="-L${DEP_PATH}/libmicrohttpd-0.9.19/build/lib -lmicrohttpd"
COMPILED_MICROHTTPD_STATIC_LDFLAGS="${DEP_PATH}/libmicrohttpd-0.9.19/build/lib/libmicrohttpd.a"
fi
LZMA_CFLAGS=""
LZMA_LDFLAGS=" -llzma"
LZMA_STATIC_LDFLAGS=""
COMPILE_LZMA=0
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_LZMA_FILES="${DEP_PATH}/xz-win/bin_i486/liblzma.lib"
else
COMPILED_LZMA_LDFLAGS="-L${DEP_PATH}/xz/build/lib -llzma"
COMPILED_LZMA_STATIC_LDFLAGS="${DEP_PATH}/xz/build/lib/liblzma.a"
COMPILED_LZMA_FILES="${DEP_PATH}/xz/build/lib/liblzma.${SHARED_EXT}"
fi
COMPILED_LZMA_CFLAGS="-I${DEP_PATH}/xz/src/liblzma/api"
LIBZIM_CFLAGS=" -I${prefix}/include -I${prefix}/include"
LIBZIM_LDFLAGS=" -lzim"
LIBZIM_STATIC_LDFLAGS=""
COMPILE_LIBZIM=0
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_LIBZIM_FILES="${DEP_PATH}/zimlib-1.4/src/zim.lib"
else
COMPILED_LIBZIM_CFLAGS="-I${DEP_PATH}/zimlib-1.4/include"
COMPILED_LIBZIM_LDFLAGS="-L${DEP_PATH}/zimlib-1.4/build/lib -lzim"
COMPILED_LIBZIM_STATIC_LDFLAGS="${DEP_PATH}/zimlib-1.4/build/lib/libzim.a"
COMPILED_LIBZIM_FILES="${DEP_PATH}/zimlib-1.4/build/lib/libzim.${SHARED_EXT}"
fi
LIBPUGIXML_CFLAGS=" -I${prefix}/include"
LIBPUGIXML_LDFLAGS=" -lpugixml"
LIBPUGIXML_STATIC_LDFLAGS=""
COMPILE_LIBPUGIXML=0
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_LIBPUGIXML_FILES="${DEP_PATH}/pugixml-1.2/src/pugixml.lib"
else
COMPILED_LIBPUGIXML_CFLAGS="-I${DEP_PATH}/pugixml-1.2/src"
COMPILED_LIBPUGIXML_LDFLAGS="-L${DEP_PATH}/pugixml-1.2 -lpugixml"
COMPILED_LIBPUGIXML_STATIC_LDFLAGS="${DEP_PATH}/pugixml-1.2/libpugixml.a"
COMPILED_LIBPUGIXML_FILES="${DEP_PATH}/pugixml-1.2/libpugixml.${SHARED_EXT} ${DEP_PATH}/pugixml-1.2/libpugixml.a"
fi
if test [ $IS_OSX -eq 1 ] ; then
COMPILED_LIBPUGIXML_STATIC_LDFLAGS="${DEP_PATH}/pugixml-1.2/build/libpugixml.a"
COMPILED_LIBPUGIXML_LDFLAGS="-L${DEP_PATH}/pugixml-1.2/build -lpugixml"
COMPILED_LIBPUGIXML_STATIC_LDFLAGS="${DEP_PATH}/pugixml-1.2/build/libpugixml.a"
COMPILED_LIBPUGIXML_FILES="${DEP_PATH}/pugixml-1.2/build/libpugixml.${SHARED_EXT} ${DEP_PATH}/pugixml-1.2/build/libpugixml.a"
fi
LIBCTPP2_CFLAGS=" -I${prefix}/include "
LIBCTPP2_LDFLAGS=" -lctpp2"
LIBCTPP2_STATIC_LDFLAGS=""
COMPILE_LIBCTPP2=0
if test [ $IS_WIN -eq 1 ] ; then
COMPILED_LIBCTPP2_FILES="${DEP_PATH}/ctpp2-2.8.3/src/ctpp2.lib"
else
COMPILED_LIBCTPP2_CFLAGS="-I${DEP_PATH}/ctpp2-2.8.3/build/complete/include"
COMPILED_LIBCTPP2_LDFLAGS="-L${DEP_PATH}/ctpp2-2.8.3/build/complete/lib -lctpp2"
COMPILED_LIBCTPP2_STATIC_LDFLAGS="${DEP_PATH}/ctpp2-2.8.3/build/complete/lib/libctpp2-st.a"
COMPILED_LIBCTPP2_FILES="${DEP_PATH}/ctpp2-2.8.3/build/complete/lib/libctpp2.${SHARED_EXT}"
# find C++ compiler
AC_CHECK_TOOL(HAVE_CMAKE, "cmake")
if test [ ! "$HAVE_CMAKE" ]
then
AC_MSG_ERROR([[cannot find cmake]])
fi
fi
if test [ $IS_OSX -eq 1 ] ; then
COMPILED_LIBCTPP2_STATIC_LDFLAGS="ctpp2-2.8.3/build/lib/libctpp2-st.a"
COMPILED_LIBCTPP2_FILES="${DEP_PATH}/ctpp2-2.8.3/build/lib/libctpp2.${SHARED_EXT}"
COMPILED_LIBCTPP2_LDFLAGS="-L${DEP_PATH}/ctpp2-2.8.3/build/lib -lctpp2"
COMPILED_LIBCTPP2_CFLAGS="-I${DEP_PATH}/ctpp2-2.8.3/build/include"
fi
ARIA2_CFLAGS=""
ARIA2_LDFLAGS=""
COMPILE_ARIA2=0
if test [ $IS_OSX -eq 1 ] ; then
COMPILED_ARIA2_FILES="${DEP_PATH}/aria2c-1.18.5-universal"
elif test [ $IS_WIN -eq 1 ] ; then
COMPILED_ARIA2_FILES="${DEP_PATH}/aria2c.exe"
else
COMPILED_ARIA2_FILES="${DEP_PATH}/aria2c"
fi
# OSX only
if test [ $IS_OSX -eq 1 ] ; then
COMPILED_XULRUNNERBIN_FILES="${DEP_PATH}/kiwix-osx-xulrunner-bin"
else
COMPILED_XULRUNNERBIN_FILES=""
fi
# uuid is used for binaries. only static.
UUID_CFLAGS=""
UUID_LDFLAGS=""
UUID_STATIC_LDFLAGS=""
COMPILE_UUID=0
COMPILED_UUID_CFLAGS="-I${DEP_PATH}/e2fsprogs-1.42/lib"
COMPILED_UUID_LDFLAGS=""
if test [ $IS_OSX -eq 1 -o $IS_WIN -eq 1 ] ; then
COMPILED_UUID_STATIC_LDFLAGS=""
COMPILED_UUID_FILES=""
else
COMPILED_UUID_STATIC_LDFLAGS="${DEP_PATH}/e2fsprogs-1.42/lib/libuuid.a"
COMPILED_UUID_FILES="${DEP_PATH}/e2fsprogs-1.42/lib/libuuid.a"
fi
# for binaries
LIBICONV_CFLAGS=""
LIBICONV_LDFLAGS="-liconv"
LIBICONV_STATIC_LDFLAGS=""
COMPILE_LIBICONV=0
if test [ $IS_OSX -eq 1 ]
then
COMPILE_LIBICONV=1
COMPILED_LIBICONV_FILES="${DEP_PATH}/libiconv-1.13.1/build/lib/libiconv.${SHARED_EXT}"
COMPILED_LIBICONV_CFLAGS="-I${DEP_PATH}/libiconv-1.13.1/build-x86_64/include"
COMPILED_LIBICONV_LDFLAGS="-L${DEP_PATH}/libiconv-1.13.1/build/lib/ -liconv"
COMPILED_LIBICONV_STATIC_LDFLAGS="${DEP_PATH}/libiconv-1.13.1/build/lib/libiconv.a"
LIBICONV_CFLAGS=$COMPILED_LIBICONV_CFLAGS
LIBICONV_LDFLAGS=$COMPILED_LIBICONV_LDFLAGS
LIBICONV_FILES=$COMPILED_LIBICONV_FILES
LIBICONV_STATIC_LDFLAGS=$COMPILED_LIBICONV_STATIC_LDFLAGS
fi
# for binaries
GETTEXT_CFLAGS=""
GETTEXT_LDFLAGS="-lintl"
GETTEXT_STATIC_LDFLAGS=""
COMPILE_GETTEXT=0
if test [ $IS_OSX -eq 1 ]
then
COMPILE_GETTEXT=1
COMPILED_GETTEXT_FILES="${DEP_PATH}/gettext-0.18.3.2/build/lib/libintl.${SHARED_EXT}"
COMPILED_GETTEXT_CFLAGS="-I${DEP_PATH}/gettext-0.18.3.2/build-x86_64/include"
COMPILED_GETTEXT_LDFLAGS="-L${DEP_PATH}/gettext-0.18.3.2/build/lib/ -lintl"
COMPILED_GETTEXT_STATIC_LDFLAGS="${DEP_PATH}/gettext-0.18.3.2/build/lib/libintl.a"
GETTEXT_CFLAGS=$COMPILED_GETTEXT_CFLAGS
GETTEXT_LDFLAGS=$COMPILED_GETTEXT_LDFLAGS
GETTEXT_FILES=$COMPILED_GETTEXT_FILES
GETTEXT_STATIC_LDFLAGS=$COMPILED_GETTEXT_STATIC_LDFLAGS
fi
# argtable & pthread is required only on Windows
COMPILED_ARGTABLE_FILES="${DEP_PATH}/argtable2-13/src/argtable2.lib"
COMPILED_PTHREAD_FILES="${DEP_PATH}/pthread-win32/lib/pthreadVC2.lib"
COMPILED_MSVC_FILES="${DEP_PATH}/msvc100/msvcr100.dll ${DEP_PATH}/msvc100/msvcp100.dll"
WITH_COMPONENTS=1
WITH_MANAGER=1
WITH_SERVER=1
WITH_LAUNCHER=1
WITH_INDEXER=1
WITH_INSTALLER=1
WITH_SEARCHER=0
WITH_READER=0
WITH_ANDROID=0
COMPILE_ARGTABLE=0
COMPILE_PTHREAD=0
# --enable-compileall
AC_ARG_ENABLE(compileall,
AC_HELP_STRING([--enable-compileall],
[mark every package for self compilation (default is no)]),
[], [enable_compileall=no])
AS_IF([test "x$enable_compileall" = "xyes"], [COMPIL_DEPS=1], [COMPIL_DEPS=0])
if test [ $COMPIL_DEPS -eq 1 ]
then
COMPILE_GECKO_SDK=1
COMPILE_ZLIB=1
COMPILE_XAPIAN=1
COMPILE_ICU=1
COMPILE_MICROHTTPD=1
COMPILE_LZMA=1
COMPILE_LIBZIM=1
COMPILE_LIBPUGIXML=1
COMPILE_LIBCTPP2=1
COMPILE_ARIA2=1
COMPILE_UUID=1
WITH_LAUNCHER=1
WITH_SERVER=1
WITH_ANDROID=1
WITH_READER=1
WITH_SEARCHER=1
REQUIRE_STATIC=1
elif test [ $IS_WIN -eq 1 ]
then
COMPILE_GECKO_SDK=1
COMPILE_ZLIB=1
COMPILE_XAPIAN=1
COMPILE_ICU=1
COMPILE_MICROHTTPD=1
COMPILE_LZMA=1
COMPILE_LIBZIM=1
COMPILE_LIBPUGIXML=1
COMPILE_LIBCTPP2=1
COMPILE_ARIA2=1
COMPILE_UUID=0
COMPILE_ARGTABLE=1
COMPILE_PTHREAD=1
WITH_LAUNCHER=1
WITH_SERVER=1
WITH_INDEXER=1
REQUIRE_STATIC=1
else
COMPIL_DEPS=0
REQUIRE_STATIC=0
fi
####################################################
############ Optional packages
####################################################
# enable this to compile binaries (CLI) staticaly
AC_ARG_ENABLE(staticbins,
AC_HELP_STRING([--enable-staticbins],
[compile CLI binaries staticaly (default is no)]),
[], [enable_staticbins=$STATIC_BINS])
AS_IF([test "x$enable_staticbins" = "xyes" -o "x$enable_staticbins" = "x1" ], [STATIC_BINS=1], [STATIC_BINS=0])
# manager is a command line to to build library
AC_ARG_ENABLE(manager,
AC_HELP_STRING([--enable-manager],
[compile manager (default is no)]),
[], [enable_manager=$WITH_MANAGER])
AS_IF([test "x$enable_manager" = "xyes" -o "x$enable_manager" = "x1" ], [WITH_MANAGER=1], [WITH_MANAGER=0])
# HTTP server
AC_ARG_ENABLE(server,
AC_HELP_STRING([--enable-server],
[compile HTTP server (default is yes)]),
[], [enable_server=$WITH_SERVER])
AS_IF([test "x$enable_server" = "xyes" -o "x$enable_server" = "x1" ], [WITH_SERVER=1], [WITH_SERVER=0])
# static launcher
AC_ARG_ENABLE(launcher,
AC_HELP_STRING([--enable-launcher],
[compile launcher for static (default is yes)]),
[], [enable_launcher=$WITH_LAUNCHER])
AS_IF([test "x$enable_launcher" = "xyes" -o "x$enable_launcher" = "x1" ], [WITH_LAUNCHER=1], [WITH_LAUNCHER=0])
# zim indexer is a command line tool to create xapian index
AC_ARG_ENABLE(indexer,
AC_HELP_STRING([--enable-indexer],
[compile indexer (default is no)]),
[], [enable_indexer=$WITH_INDEXER])
AS_IF([test "x$enable_indexer" = "xyes" -o "x$enable_indexer" = "x1" ], [WITH_INDEXER=1], [WITH_INDEXER=0])
# installer is GUI on windows or command line on linux
AC_ARG_ENABLE(installer,
AC_HELP_STRING([--enable-installer],
[compile installer (default is no)]),
[], [enable_installer=$WITH_INSTALLER])
AS_IF([test "x$enable_installer" = "xyes" -o "x$enable_installer" = "x1" ], [WITH_INSTALLER=1], [WITH_INSTALLER=0])
# searcher is a command line binary to test search engine
AC_ARG_ENABLE(searcher,
AC_HELP_STRING([--enable-searcher],
[compile searcher (default is no)]),
[], [enable_searcher=$WITH_SEARCHER])
AS_IF([test "x$enable_searcher" = "xyes" -o "x$enable_searcher" = "x1" ], [WITH_SEARCHER=1], [WITH_SEARCHER=0])
# reader is a command line tool
AC_ARG_ENABLE(reader,
AC_HELP_STRING([--enable-reader],
[compile reader (default is no)]),
[], [enable_reader=$WITH_READER])
AS_IF([test "x$enable_reader" = "xyes" -o "x$enable_reader" = "x1" ], [WITH_READER=1], [WITH_READER=0])
# HTTP server
AC_ARG_ENABLE(components,
AC_HELP_STRING([--enable-components],
[compile gecko components (default is yes)]),
[], [enable_components=$WITH_COMPONENTS])
AS_IF([test "x$enable_components" = "xyes" -o "x$enable_components" = "x1" ], [WITH_COMPONENTS=1], [WITH_COMPONENTS=0])
# android version
AC_ARG_ENABLE(android,
AC_HELP_STRING([--enable-android],
[compile android version (default is no)]),
[], [enable_android=$WITH_ANDROID])
AS_IF([test "x$enable_android" = "xyes" -o "x$enable_android" = "x1" ], [WITH_ANDROID=1], [WITH_ANDROID=0])
# all enables all optional tools
AC_ARG_ENABLE(all,
AC_HELP_STRING([--enable-all],
[compile all optional tools (default is no)]),
[], [enable_all=no])
AS_IF([test "x$enable_all" = "xyes"], [WITH_LAUNCHER=1;WITH_INDEXER=1;WITH_INSTALLER=1;WITH_SEARCHER=1;WITH_READER=1;WITH_MANAGER=1;WITH_SERVER=1;WITH_COMPONENTS=1], [])
# --enable-oldgcc for GCC < 3.4 without char16_t (fedora9 for sugar)
AC_ARG_ENABLE(oldgcc,
AC_HELP_STRING([--enable-oldgcc],
[gcc has no support for char16_t (default is no)]),
[], [enable_oldgcc=$IS_OLD_GCC])
AS_IF([test "x$enable_oldgcc" = "xyes" -o "x$enable_oldgcc" = "x1" ], [IS_OLD_GCC=1], [IS_OLD_GCC=0])
# extra includes allow to specify extra -I paths
AC_ARG_WITH(extra-includes,
[ --with-extra-includes=DIR:DIR PATH like list of folder to add to include lookup],
export CPATH="${withval}")
# add debug symbols
AC_ARG_WITH([debug],
AC_HELP_STRING([--with-debug],
[add debug symbols]),
CFLAGS="${CFLAGS} -g3 -O0 -Wall -W -ansi"; CXXFLAGS="${CXXFLAGS} -g3 -O0 -Wall -W -ansi")
# add limited debug symbols
AC_ARG_WITH([minor-debug],
AC_HELP_STRING([--with-minor-debug],
[add minor debug symbols]),
CFLAGS="${CFLAGS} -g3 -O0"; CXXFLAGS="${CXXFLAGS} -g3 -O0")
# test hardening
AC_ARG_WITH([hardening],
AC_HELP_STRING([--with-hardening],
[add hardening flags]),
CXXFLAGS="${CXXFLAGS} -D_FORTIFY_SOURCE=2 ")
# manager is a command line to to build library
AC_ARG_ENABLE(ldcheck,
AC_HELP_STRING([--enable-ldcheck],
[enable ld check for unresolved dependencies (default is yes)]),
[], [enable_ldchecks=yes])
AS_IF([test "x$enable_ldchecks" = "xyes"], [], [CHECK_LDFLAGS=""])
# move chrome content to a jar file
AC_ARG_ENABLE(jar,
AC_HELP_STRING([--enable-jar],
[pack chrome contents to jar files (default is no)]),
[], [enable_jar=$JAR_CONTENT])
AS_IF([test "x$enable_jar" = "xyes" -o "x$enable_jar" = "x1" ], [JAR_CONTENT=1], [JAR_CONTENT=0])
# apply debian cleaning rules
AC_ARG_ENABLE(debian,
AC_HELP_STRING([--enable-debian],
[apply Debian packaging cleaning rules (default is no)]),
[], [enable_debian=$DEBIAN_RULES])
AS_IF([test "x$enable_debian" = "xyes" -o "x$enable_debian" = "x1" ], [DEBIAN_RULES=1], [DEBIAN_RULES=0])
# TODO
#if test [ $WITH_MANAGER -eq 1 -o $WITH_SERVER -eq 1 -o $WITH_LAUNCHER -eq 1 -o $WITH_INDEXER -eq 1 -o $WITH_INSTALLER -eq 1 -o $WITH_SEARCHER -eq 1 -o $WITH_READER -eq 1 ] ; then
# REQUIRE_STATIC=1
#else
# REQUIRE_STATIC=0
#fi
####################################################
############ GECKO SDK
####################################################
# --enable-old-gecko
AC_ARG_ENABLE(oldgecko,
AC_HELP_STRING([--enable-oldgecko],
[download and use Gecko SDK 1.9.2 instead of latest (default is no)]),
[], [enable_oldgecko=no])
AS_IF([test "x$enable_oldgecko" = "xyes"], [IS_OLD_GECKO=1], [IS_OLD_GECKO=0])
AC_ARG_WITH(gecko-sdk,
AC_HELP_STRING([--with-gecko-sdk=DIR], [Gecko SDK path]),
GECKO_SDK_PATH=`echo "${withval}"`)
if test [ "$GECKO_SDK_PATH" != "" -a "$GECKO_SDK_PATH" != "$SELF" ]
then
GECKO_SDK_PATH=`cd ${GECKO_SDK_PATH} && pwd || echo ""`
fi
# try to find installed gecko-sdk. default to SELF
if test [ "$GECKO_SDK_PATH" = "" ]
then
GECKO_SDK_PATH=`pkg-config --variable=sdkdir libxul`
if test [ ! "$GECKO_SDK_PATH" ]
then
GECKO_SDK_PATH=$SELF
fi
fi
if test [ "$GECKO_SDK_PATH" = "$SELF" -o $COMPILE_GECKO_SDK -eq 1 ]
then
COMPILE_GECKO_SDK=1
GECKO_SDK_PATH=$COMPILED_GECKO_SDK_PATH
fi
if test [ $IS_OSX -eq 1 ] ; then
GECKO_INCLUDE_PATH="${GECKO_SDK_PATH}/i386/include"
GECKO_SDK_INCLUDE="${GECKO_SDK_PATH}/i386/sdk/include"
GECKO_SDK_LIB="${GECKO_SDK_PATH}/${ARCH}/lib"
GECKO_IDL_PATH=${GECKO_SDK_PATH}/i386/idl
XPIDL_PATH=${GECKO_SDK_PATH}/i386/sdk/bin
else
GECKO_INCLUDE_PATH="${GECKO_SDK_PATH}/include"
GECKO_SDK_INCLUDE="${GECKO_SDK_PATH}/sdk/include"
GECKO_SDK_LIB="${GECKO_SDK_PATH}/sdk/lib"
GECKO_IDL_PATH=${GECKO_SDK_PATH}/idl
XPIDL_PATH=${GECKO_SDK_PATH}/sdk/bin
fi
#GCC# -std=gnu++0x
#CLANG# -stdlib=libstdc++ -std=c++11
if test [ $IS_OSX -eq 1 ]
then
CXXFLAGS="${CXXFLAGS} -stdlib=libstdc++ -std=c++11 -fexceptions -DMOZ_CPP_EXCEPTIONS -DMOZ_NO_MOZALLOC"
else
CXXFLAGS="${CXXFLAGS} -std=gnu++0x -fexceptions -DMOZ_CPP_EXCEPTIONS -DMOZ_NO_MOZALLOC"
fi
# Gecko version
for FILE in mozilla-config64.h mozilla-config32.h mozilla-config.h
do
if [[ -f "${GECKO_INCLUDE_PATH}/${FILE}" ]]
then
GECKO_VERSION=`grep MOZILLA_VERSION_U "${GECKO_INCLUDE_PATH}/${FILE}" | cut -d " " -f 3 | cut -d "." -f 1`
MAJOR_GECKO_VERSION=`grep MOZILLA_VERSION_U "${GECKO_INCLUDE_PATH}/${FILE}" | cut -d " " -f 3 | cut -d "." -f1,2`
EXACT_GECKO_VERSION=`grep MOZILLA_VERSION_U "${GECKO_INCLUDE_PATH}/${FILE}" | cut -d " " -f 3`
fi
if [[ ! "${GECKO_VERSION}" = "" ]]
then
break
fi
done
if [[ "${GECKO_VERSION}" = "" ]]
then
ErrorOrWarning "$COMPILE_GECKO_SDK" "unable to determine Gecko SDK version"
fi
let GECKO_VERSION=GECKO_VERSION
if [[ ${GECKO_VERSION} -lt 2 ]]
then
XPIDL_PATH="${GECKO_SDK_PATH}/bin"
else
if [[ ${GECKO_VERSION} -lt 10 ]]
then
GECKO_OLD_BOOL_TYPE=1
fi
if [[ ${GECKO_VERSION} -lt 17 ]]
then
GECKO_OLD_INT_TYPE=1
fi
fi
AC_MSG_RESULT(checking for Gecko version... ${GECKO_VERSION})
AM_CONDITIONAL([GECKO_OLD_BOOL_TYPE], [test "$GECKO_OLD_BOOL_TYPE"])
AM_CONDITIONAL([GECKO_OLD_INT_TYPE], [test "$GECKO_OLD_INT_TYPE"])
LIBXUL_CFLAGS="-I${GECKO_SDK_INCLUDE} -I${GECKO_INCLUDE_PATH} -I${GECKO_INCLUDE_PATH}/nspr/ -I/usr/include/nspr4 -fshort-wchar"
if test [ $IS_OSX -eq 0 ]; then
LIBXUL_CFLAGS+=" -D__STDC_LIMIT_MACROS"
fi
# replaced -lxpcomglue_s with libxpcomglue_s_nomozalloc.a to prevent
# undefined symbols. supposed to be compatible wth 1.9.
# -lmozalloc ${GECKO_SDK_LIB}/libxpcomglue_s.a
if test [ $IS_OSX -eq 1 ] ; then
LIBXUL_LDFLAGS="-L${GECKO_SDK_LIB} ${GECKO_SDK_LIB}/libxpcomglue_s_nomozalloc.a ${GECKO_SDK_LIB}/XUL"
else
# LIBXUL_LDFLAGS="-L${GECKO_SDK_LIB} -lxul -lxpcom -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lxpcomglue_s"
LIBXUL_LDFLAGS="-L${GECKO_SDK_LIB} -lxul -lplds4 -lplc4 -lnspr4 -lpthread -ldl ${GECKO_SDK_LIB}/libxpcomglue_s.a"
fi
if test [ ! -f "$GECKO_IDL_PATH/nsISupports.idl" ]
then
ErrorOrWarning "$COMPILE_GECKO_SDK" "unable to find nsISupports.idl"
fi
AC_CHECK_TOOL(HAVE_XPIDL, "xpidl", [], $XPIDL_PATH)
if test [ "$HAVE_XPIDL" ]
then
AC_PATH_PROG([XPIDL], "xpidl", [], $XPIDL_PATH)
else
# SDK 0.9 and further do not have an xpidl binary anymore
# This is replace by the python script typelib.py and header.py
AC_PATH_PROG([PYTHON], "python")
if test [ ! "$PYTHON" ]
then
AC_MSG_ERROR([[cannot find python]])
fi
if test [ ! -f "$XPIDL_PATH/header.py" -o ! -f "$XPIDL_PATH/typelib.py" ]
then
ErrorOrWarning "$COMPILE_GECKO_SDK" "unable to find either the xpidl binary or the typelib.py or header.py scripts in '$XPIDL_PATH' directory."
fi
HEADER_PY="$PYTHON $XPIDL_PATH/header.py"
TYPELIB_PY="$PYTHON $XPIDL_PATH/typelib.py"
fi
# special flags for XPCOM components
XPCOM_LDFLAGS="-Xcompiler -shared -Wl"
if test [ $IS_OLD_GCC -eq 1 ] ; then
XPCOM_CFLAGS="-fPIC"
else
XPCOM_CFLAGS="-fno-rtti -fPIC"
fi
####################################################
############ ZLIB
####################################################
# if --with-x, add path to LIBRARY_PATH
AC_ARG_WITH(z,
AC_HELP_STRING([--with-z=DIR], [alternate location for zlib]),
export LIBRARY_PATH="${withval}:${LIBRARY_PATH}";ZLIB_PATH=${withval})
# if --with-static-x, set path as X_ARCHIVE
AC_ARG_WITH(static-z,
AC_HELP_STRING([--with-static-z=DIR/libx.a],
[Path to static archive]),
ZLIB_ARCHIVE=${withval})
# compilation required
if test [ $COMPILE_ZLIB -eq 1 -o "$ZLIB_PATH" == "$SELF" -o "$ZLIB_ARCHIVE" == "$SELF"] ; then
COMPILE_ZLIB=1
ZLIB_CFLAGS=$COMPILED_ZLIB_CFLAGS
ZLIB_LDFLAGS=$COMPILED_ZLIB_LDFLAGS
ZLIB_FILES=$COMPILED_ZLIB_FILES
ZLIB_STATIC_LDFLAGS=$COMPILED_ZLIB_STATIC_LDFLAGS
else
# look for shared library.
AC_CHECK_HEADER([zlib.h],, [AC_MSG_ERROR([[cannot find zlib header]])])
AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]]);COMPILE_ZLIB=1])
ZLIB_FILES=`findLibrary "libz.${SHARED_EXT}"`
# if static is required
if test [ $REQUIRE_STATIC -eq 1 ] ; then
AC_CHECK_FILE($ZLIB_ARCHIVE, [ZLIB_ARCHIVE_FOUND=1], [ZLIB_ARCHIVE_FOUND=0])
AUTO_ZLIB_ARCHIVE=`findLibrary "libz.a"`
if test [ $ZLIB_ARCHIVE_FOUND -eq 0 -a "$AUTO_ZLIB_ARCHIVE" == "no" ] ; then
# can't stat files. force compile
COMPILE_ZLIB=1
ZLIB_CFLAGS=$COMPILED_ZLIB_CFLAGS
ZLIB_LDFLAGS=$COMPILED_ZLIB_LDFLAGS
ZLIB_FILES=$COMPILED_ZLIB_FILES
ZLIB_STATIC_LDFLAGS=$COMPILED_ZLIB_STATIC_LDFLAGS
elif test [ $ZLIB_ARCHIVE_FOUND -eq 1 ] ; then
# can stat suplied file.
ZLIB_STATIC_LDFLAGS="${ZLIB_ARCHIVE}"
else
# can stat auto file
ZLIB_STATIC_LDFLAGS="${AUTO_ZLIB_ARCHIVE}"
fi
fi
fi
####################################################
############ XAPIAN
####################################################
# if --with-x, add path to LIBRARY_PATH
AC_ARG_WITH(xapian,
AC_HELP_STRING([--with-xapian=DIR], [alternate location for xapian-config]),
export LIBRARY_PATH="${withval}:${LIBRARY_PATH}";XAPIAN_PATH=${withval})
# if --with-static-x, set path as X_ARCHIVE
AC_ARG_WITH(static-xapian,
AC_HELP_STRING([--with-static-xapian=DIR/libx.a],
[Path to static archive]),
XAPIAN_ARCHIVE=${withval})
# compilation required
if test [ $COMPILE_XAPIAN -eq 1 -o "$XAPIAN_PATH" == "$SELF" -o "$XAPIAN_ARCHIVE" == "$SELF" ]
then
COMPILE_XAPIAN=1
XAPIAN_CFLAGS=$COMPILED_XAPIAN_CFLAGS
XAPIAN_LDFLAGS=$COMPILED_XAPIAN_LDFLAGS
XAPIAN_FILES=$COMPILED_XAPIAN_FILES
XAPIAN_STATIC_LDFLAGS=$COMPILED_XAPIAN_STATIC_LDFLAGS
XAPIAN_COMPACT=$COMPILED_XAPIAN_COMPACT
else
# look for shared library.
AC_CHECK_TOOL(HAVE_XAPIAN_CONFIG, xapian-config,, "${XAPIAN_PATH}:${PATH}")
if test [ ! "$HAVE_XAPIAN_CONFIG" ]
then
AC_MSG_ERROR([[cannot find xapian-config]])
else
OLDPATH=$PATH
PATH="${XAPIAN_PATH}:${PATH}"
XAPIAN_CFLAGS=`xapian-config --cxxflags`;
XAPIAN_LDFLAGS=`xapian-config --ltlibs`;
XAPIAN_FILES=`findLibrary "libxapian.${SHARED_EXT}"`
PATH=$OLDPATH
fi
AC_CHECK_TOOL([XAPIAN_COMPACT],[xapian-compact],[])
XAPIAN_COMPACT=`which $XAPIAN_COMPACT`
if test [ ! "$XAPIAN_COMPACT" ]
then
AC_MSG_ERROR([[cannot find xapian-compact]])
fi
# if static is required
if test [ $REQUIRE_STATIC -eq 1 ] ; then
AC_CHECK_FILE($XAPIAN_ARCHIVE, [XAPIAN_ARCHIVE_FOUND=1], [XAPIAN_ARCHIVE_FOUND=0])
AUTO_XAPIAN_ARCHIVE=`findLibrary "libxapian.a"`
if test [ $XAPIAN_ARCHIVE_FOUND -eq 0 -a "$AUTO_XAPIAN_ARCHIVE" == "no" ] ; then
# can't stat files. force compile
COMPILE_XAPIAN=1
XAPIAN_CFLAGS=$COMPILED_XAPIAN_CFLAGS
XAPIAN_LDFLAGS=$COMPILED_XAPIAN_LDFLAGS
XAPIAN_FILES=$COMPILED_XAPIAN_FILES
XAPIAN_STATIC_LDFLAGS=$COMPILED_XAPIAN_STATIC_LDFLAGS
XAPIAN_COMPACT=$COMPILED_XAPIAN_COMPACT
elif test [ $XAPIAN_ARCHIVE_FOUND -eq 1 ] ; then
# can stat suplied file.
XAPIAN_STATIC_LDFLAGS="${XAPIAN_ARCHIVE}"
else
# can stat auto file
XAPIAN_STATIC_LDFLAGS="${AUTO_XAPIAN_ARCHIVE}"
fi
fi
fi
####################################################
############ ICU
####################################################
# if --with-x, add path to LIBRARY_PATH
AC_ARG_WITH(icu,
AC_HELP_STRING([--with-icu=DIR], [alternate location for icu-config]),
export LIBRARY_PATH="${withval}:${LIBRARY_PATH}";ICU_PATH=${withval})
# if --with-static-x, set path as X_ARCHIVE
AC_ARG_WITH(static-icu,
AC_HELP_STRING([--with-static-icu=DIR],
[Path to static archives folder]),
ICU_ARCHIVE=${withval})