forked from psi-im/psi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·3942 lines (3472 loc) · 94.4 KB
/
configure
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
#!/bin/sh
#
# Generated by qconf 2.0 ( http://delta.affinix.com/qconf/ )
#
show_usage() {
cat <<EOT
Usage: $0 [OPTION]...
This script creates necessary configuration files to build/install.
Main options:
--prefix=[path] Base path for build/install. Default: /usr/local
--bindir=[path] Directory for binaries. Default: PREFIX/bin
--libdir=[path] Directory for libraries. Default: PREFIX/lib
--datadir=[path] Directory for data. Default: PREFIX/share
--qtdir=[path] Directory where Qt is installed.
--extraconf=[conf] Extra configuration for nonstandard cases.
--verbose Show extra configure output.
--qtselect=[N] Select major Qt version (4 or 5).
--help This help text.
Project options:
--release Build with debugging turned off (default).
--debug Build with debugging turned on.
--no-separate-debug-info Do not store debug information in a separate
file (default for mac).
--separate-debug-info Strip debug information into a separate .debug
file (default for non-mac).
Dependency options:
--with-idn-inc=[path] Path to libidn include files
--with-idn-lib=[path] Path to libidn library or framework files
--with-qca-inc=[path] Path to QCA include files
--with-qca-lib=[path] Path to QCA library or framework files
--with-zlib-inc=[path] Path to zlib include files
--with-zlib-lib=[path] Path to zlib library files
--with-qjdns-inc=[path] Path to QJDns include files
--with-qjdns-lib=[path] Path to QJDns library files
--enable-universal Enable use of Mac OS X universal binary
support
--disable-qdbus Disable use of QDBUS
--disable-keychain Disable use of Qt Keychain
--enable-webkit Enable use of webkit
--with-webkit=[type] type of webkit QtWebKit/QtWebEngine
--with-http-parser-inc=[path] Path to HTTP Parser include files
--with-http-parser-lib=[path] Path to HTTP Parser library files
--bundled-http-parser Build with bundled HTTP Parser
--disable-growl Disable use of Growl
--with-growl=[path] Path to the Growl framework
--enable-whiteboarding Enable use of White Board support
--disable-xss Disable use of the XScreenSaver extension
--disable-aspell Disable use of aspell
--with-aspell-inc=[path] Path to Aspell include files
--with-aspell-lib=[path] Path to Aspell library files
--disable-enchant Disable use of enchant
--disable-hunspell Disable use of hunspell
--with-hunspell-inc=[path] Path to Hunspell include files
--with-hunspell-lib=[path] Path to Hunspell library files
--disable-plugins Disable use of Psi Plugin support
EOT
}
# which/make detection adapted from Qt
which_command() {
ALL_MATCHES=
if [ "$1" = "-a" ]; then
ALL_MATCHES="-a"
shift
fi
OLD_HOME=$HOME
HOME=/dev/null
export HOME
WHICH=`which which 2>/dev/null`
if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
WHICH=which
elif [ -z "$WHICH" ]; then
if which which >/dev/null 2>&1; then
WHICH=which
else
for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
if [ -x $a/which ]; then
WHICH=$a/which
break
fi
done
fi
fi
RET_CODE=1
if [ -z "$WHICH" ]; then
OLD_IFS=$IFS
IFS=:
for a in $PATH; do
if [ -x $a/$1 ]; then
echo "$a/$1"
RET_CODE=0
[ -z "$ALL_MATCHES" ] && break
fi
done
IFS=$OLD_IFS
export IFS
else
a=`"$WHICH" "$ALL_MATCHES" "$1" 2>/dev/null`
if [ ! -z "$a" -a -x "$a" ]; then
echo "$a"
RET_CODE=0
fi
fi
HOME=$OLD_HOME
export HOME
return $RET_CODE
}
WHICH=which_command
# find a make command
if [ -z "$MAKE" ]; then
MAKE=
for mk in gmake make; do
if $WHICH $mk >/dev/null 2>&1; then
MAKE=`$WHICH $mk`
break
fi
done
if [ -z "$MAKE" ]; then
echo "You don't seem to have 'make' or 'gmake' in your PATH."
echo "Cannot proceed."
exit 1
fi
fi
show_qt_info() {
printf "Be sure you have a proper Qt 4.0+ build environment set up. This means not\n"
printf "just Qt, but also a C++ compiler, a make tool, and any other packages\n"
printf "necessary for compiling C++ programs.\n"
printf "\n"
printf "If you are certain everything is installed, then it could be that Qt is not\n"
printf "being recognized or that a different version of Qt is being detected by\n"
printf "mistake (for example, this could happen if \$QTDIR is pointing to a Qt 3\n"
printf "installation). At least one of the following conditions must be satisfied:\n"
printf "\n"
printf " 1) --qtdir is set to the location of Qt\n"
printf " 2) \$QTDIR is set to the location of Qt\n"
printf " 3) QtCore is in the pkg-config database\n"
printf " 4) qmake is in the \$PATH\n"
printf "\n"
printf "This script will use the first one it finds to be true, checked in the above\n"
printf "order. #3 and #4 are the recommended options. #1 and #2 are mainly for\n"
printf "overriding the system configuration.\n"
printf "\n"
}
while [ $# -gt 0 ]; do
optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
case "$1" in
--prefix=*)
PREFIX=$optarg
shift
;;
--bindir=*)
BINDIR=$optarg
shift
;;
--libdir=*)
LIBDIR=$optarg
shift
;;
--datadir=*)
DATADIR=$optarg
shift
;;
--qtdir=*)
EX_QTDIR=$optarg
shift
;;
--extraconf=*)
QC_EXTRACONF=$optarg
shift
;;
--release)
QC_RELEASE="Y"
shift
;;
--debug)
QC_DEBUG="Y"
shift
;;
--no-separate-debug-info)
QC_NO_SEPARATE_DEBUG_INFO="Y"
shift
;;
--separate-debug-info)
QC_SEPARATE_DEBUG_INFO="Y"
shift
;;
--with-idn-inc=*)
QC_WITH_IDN_INC=$optarg
shift
;;
--with-idn-lib=*)
QC_WITH_IDN_LIB=$optarg
shift
;;
--with-qca-inc=*)
QC_WITH_QCA_INC=$optarg
shift
;;
--with-qca-lib=*)
QC_WITH_QCA_LIB=$optarg
shift
;;
--with-zlib-inc=*)
QC_WITH_ZLIB_INC=$optarg
shift
;;
--with-zlib-lib=*)
QC_WITH_ZLIB_LIB=$optarg
shift
;;
--with-qjdns-inc=*)
QC_WITH_QJDNS_INC=$optarg
shift
;;
--with-qjdns-lib=*)
QC_WITH_QJDNS_LIB=$optarg
shift
;;
--enable-universal)
QC_ENABLE_universal="Y"
shift
;;
--disable-qdbus)
QC_DISABLE_qdbus="Y"
shift
;;
--disable-keychain)
QC_DISABLE_keychain="Y"
shift
;;
--enable-webkit)
QC_ENABLE_webkit="Y"
shift
;;
--with-webkit=*)
QC_WITH_WEBKIT=$optarg
shift
;;
--with-http-parser-inc=*)
QC_WITH_HTTP_PARSER_INC=$optarg
shift
;;
--with-http-parser-lib=*)
QC_WITH_HTTP_PARSER_LIB=$optarg
shift
;;
--bundled-http-parser)
QC_BUNDLED_HTTP_PARSER="Y"
shift
;;
--disable-growl)
QC_DISABLE_growl="Y"
shift
;;
--with-growl=*)
QC_WITH_GROWL=$optarg
shift
;;
--enable-whiteboarding)
QC_ENABLE_whiteboarding="Y"
shift
;;
--disable-xss)
QC_DISABLE_xss="Y"
shift
;;
--disable-aspell)
QC_DISABLE_aspell="Y"
shift
;;
--with-aspell-inc=*)
QC_WITH_ASPELL_INC=$optarg
shift
;;
--with-aspell-lib=*)
QC_WITH_ASPELL_LIB=$optarg
shift
;;
--disable-enchant)
QC_DISABLE_enchant="Y"
shift
;;
--disable-hunspell)
QC_DISABLE_hunspell="Y"
shift
;;
--with-hunspell-inc=*)
QC_WITH_HUNSPELL_INC=$optarg
shift
;;
--with-hunspell-lib=*)
QC_WITH_HUNSPELL_LIB=$optarg
shift
;;
--disable-plugins)
QC_DISABLE_plugins="Y"
shift
;;
--verbose)
QC_VERBOSE="Y"
shift
;;
--qtselect=*)
QC_QTSELECT="${optarg}"
shift
;;
--help) show_usage; exit ;;
*) echo "configure: WARNING: unrecognized options: $1" >&2; shift; ;;
esac
done
PREFIX=${PREFIX:-/usr/local}
BINDIR=${BINDIR:-$PREFIX/bin}
LIBDIR=${LIBDIR:-$PREFIX/lib}
DATADIR=${DATADIR:-$PREFIX/share}
echo "Configuring Psi ..."
if [ "$QC_VERBOSE" = "Y" ]; then
echo
echo PREFIX=$PREFIX
echo BINDIR=$BINDIR
echo LIBDIR=$LIBDIR
echo DATADIR=$DATADIR
echo EX_QTDIR=$EX_QTDIR
echo QC_EXTRACONF=$QC_EXTRACONF
echo QC_RELEASE=$QC_RELEASE
echo QC_DEBUG=$QC_DEBUG
echo QC_NO_SEPARATE_DEBUG_INFO=$QC_NO_SEPARATE_DEBUG_INFO
echo QC_SEPARATE_DEBUG_INFO=$QC_SEPARATE_DEBUG_INFO
echo QC_WITH_IDN_INC=$QC_WITH_IDN_INC
echo QC_WITH_IDN_LIB=$QC_WITH_IDN_LIB
echo QC_WITH_QCA_INC=$QC_WITH_QCA_INC
echo QC_WITH_QCA_LIB=$QC_WITH_QCA_LIB
echo QC_WITH_ZLIB_INC=$QC_WITH_ZLIB_INC
echo QC_WITH_ZLIB_LIB=$QC_WITH_ZLIB_LIB
echo QC_WITH_QJDNS_INC=$QC_WITH_QJDNS_INC
echo QC_WITH_QJDNS_LIB=$QC_WITH_QJDNS_LIB
echo QC_ENABLE_universal=$QC_ENABLE_universal
echo QC_DISABLE_qdbus=$QC_DISABLE_qdbus
echo QC_DISABLE_keychain=$QC_DISABLE_keychain
echo QC_ENABLE_webkit=$QC_ENABLE_webkit
echo QC_WITH_WEBKIT=$QC_WITH_WEBKIT
echo QC_WITH_HTTP_PARSER_INC=$QC_WITH_HTTP_PARSER_INC
echo QC_WITH_HTTP_PARSER_LIB=$QC_WITH_HTTP_PARSER_LIB
echo QC_BUNDLED_HTTP_PARSER=$QC_BUNDLED_HTTP_PARSER
echo QC_DISABLE_growl=$QC_DISABLE_growl
echo QC_WITH_GROWL=$QC_WITH_GROWL
echo QC_ENABLE_whiteboarding=$QC_ENABLE_whiteboarding
echo QC_DISABLE_xss=$QC_DISABLE_xss
echo QC_DISABLE_aspell=$QC_DISABLE_aspell
echo QC_WITH_ASPELL_INC=$QC_WITH_ASPELL_INC
echo QC_WITH_ASPELL_LIB=$QC_WITH_ASPELL_LIB
echo QC_DISABLE_enchant=$QC_DISABLE_enchant
echo QC_DISABLE_hunspell=$QC_DISABLE_hunspell
echo QC_WITH_HUNSPELL_INC=$QC_WITH_HUNSPELL_INC
echo QC_WITH_HUNSPELL_LIB=$QC_WITH_HUNSPELL_LIB
echo QC_DISABLE_plugins=$QC_DISABLE_plugins
echo
fi
printf "Verifying Qt build environment ... "
if [ -z "$QC_QTSELECT" ]; then
QC_QTSELECT="$(echo $QT_SELECT | tr -d "qt")"
fi
if [ ! -z "$QC_QTSELECT" ]; then
QTSEARCHTEXT="$QC_QTSELECT"
else
QTSEARCHTEXT="4 or 5"
fi
# run qmake and check version
qmake_check() {
if [ -x "$1" ]; then
cmd="\"$1\" -query QT_VERSION"
if [ "$QC_VERBOSE" = "Y" ]; then
echo "running: $cmd"
fi
vout=`/bin/sh -c "$cmd" 2>&1`
case "${vout}" in
*.*.*)
vmaj="${vout%%.*}"
if [ ! -z "$QC_QTSELECT" ]; then
if [ "$vmaj" = "$QC_QTSELECT" ]; then
return 0
fi
else
if [ "$vmaj" = "4" ] || [ "$vmaj" = "5" ]; then
return 0
fi
fi
;;
esac
if [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: $1 not for Qt ${QTSEARCHTEXT}"
fi
fi
return 1
}
if [ "$QC_VERBOSE" = "Y" ]; then
echo
fi
qm=""
qt4_names="qmake-qt4 qmake4"
qt5_names="qmake-qt5 qmake5"
names="qmake"
if [ -z "$QC_QTSELECT" ]; then
names="${qt5_names} ${qt4_names} $names"
else
if [ "$QC_QTSELECT" = "4" ]; then
names="${qt4_names} $names"
elif [ "$QC_QTSELECT" -ge "5" ]; then
names="${qt5_names} $names"
fi
fi
if [ -z "$qm" ] && [ ! -z "$EX_QTDIR" ]; then
# qt4 check: --qtdir
for n in $names; do
qstr=$EX_QTDIR/bin/$n
if qmake_check "$qstr"; then
qm=$qstr
break
fi
done
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: qmake not found via --qtdir"
fi
elif [ -z "$qm" ] && [ ! -z "$QTDIR" ]; then
# qt4 check: QTDIR
for n in $names; do
qstr=$QTDIR/bin/$n
if qmake_check "$qstr"; then
qm=$qstr
break
fi
done
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: qmake not found via \$QTDIR"
fi
else
# Try all other implicit checks
# qtchooser
if [ -z "$qm" ]; then
qtchooser=$($WHICH qtchooser 2>/dev/null)
if [ ! -z "$qtchooser" ]; then
if [ ! -z "$QC_QTSELECT" ]; then
versions="$QC_QTSELECT"
else
cmd="$qtchooser --list-versions"
if [ "$QC_VERBOSE" = "Y" ]; then
echo "running: $cmd"
fi
versions=`$cmd`
fi
for version in $versions; do
cmd="$qtchooser -run-tool=qmake -qt=${version} -query QT_INSTALL_BINS"
if [ "$QC_VERBOSE" = "Y" ]; then
echo "running: $cmd"
fi
qtbins=`$cmd 2>/dev/null`
if [ ! -z "$qtbins" ] && qmake_check "$qtbins/qmake"; then
qm="$qtbins/qmake"
break
fi
done
fi
fi
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: qmake not found via qtchooser"
fi
# qt4: pkg-config
if [ -z "$qm" ]; then
cmd="pkg-config QtCore --variable=exec_prefix"
if [ "$QC_VERBOSE" = "Y" ]; then
echo "running: $cmd"
fi
str=`$cmd 2>/dev/null`
if [ ! -z "$str" ]; then
for n in $names; do
qstr=$str/bin/$n
if qmake_check "$qstr"; then
qm=$qstr
break
fi
done
fi
fi
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: qmake not found via pkg-config"
fi
# qmake in PATH
if [ -z "$qm" ]; then
for n in $names; do
qstr=`$WHICH -a $n 2>/dev/null`
for q in $qstr; do
if qmake_check "$q"; then
qm="$q"
break
fi
done
if [ ! -z "$qm" ]; then
break
fi
done
fi
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
echo "Warning: qmake not found via \$PATH"
fi
# end of implicit checks
fi
if [ -z "$qm" ]; then
if [ "$QC_VERBOSE" = "Y" ]; then
echo " -> fail"
else
echo "fail"
fi
printf "\n"
printf "Reason: Unable to find the 'qmake' tool for Qt ${QTSEARCHTEXT}.\n"
printf "\n"
show_qt_info
exit 1;
fi
if [ "$QC_VERBOSE" = "Y" ]; then
echo qmake found in "$qm"
fi
# try to determine the active makespec
defmakespec=$QMAKESPEC
if [ -z "$defmakespec" ]; then
if $WHICH readlink >/dev/null 2>&1; then
READLINK=`$WHICH readlink`
fi
if [ ! -z "$READLINK" ]; then
qt_mkspecsdir=`"$qm" -query QT_INSTALL_DATA`/mkspecs
if [ -d "$qt_mkspecsdir" ] && [ -h "$qt_mkspecsdir/default" ]; then
defmakespec=`$READLINK $qt_mkspecsdir/default`
fi
fi
fi
if [ "$QC_VERBOSE" = "Y" ]; then
echo makespec is $defmakespec
fi
qm_spec=""
# if the makespec is macx-xcode, force macx-g++
if [ "$defmakespec" = "macx-xcode" ]; then
qm_spec=macx-g++
QMAKESPEC=$qm_spec
export QMAKESPEC
if [ "$QC_VERBOSE" = "Y" ]; then
echo overriding makespec to $qm_spec
fi
fi
gen_files() {
cat >"$1/modules.cpp" <<EOT
#line 1 "qt5.qcm"
/*
-----BEGIN QCMOD-----
name: Qt >= 5.0.0
-----END QCMOD-----
*/
class qc_qt5 : public ConfObj
{
public:
qc_qt5(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 5.0.0"; }
QString shortname() const { return "qt5"; }
bool exec()
{
return(QT_VERSION >= 0x050000);
}
QString resultString() const
{
return QT_VERSION_STR;
}
};
class QtCompFinder : public ConfObj
{
protected:
QString compId;
QString compShortName;
QString compName;
QString extraConfIfFound;
QString finderResult;
public:
/**
* id - (QT += <id>)
* shortName - used with QC_ENABLE_<shortName> | QC_DISABLE_<shortName> env vars
* MUST MATCH with qcm module name without extension
* name - something visible in the log
* extraConfIfFound - extra string added to conf.pri if found
*/
QtCompFinder(const QString &id,const QString &shortName, const QString &name,
const QString &extraConfIfFound, Conf *c) :
ConfObj(c), compId(id), compShortName(shortName), compName(name),
extraConfIfFound(extraConfIfFound)
{}
QString name() const { return compName; }
QString shortname() const { return compShortName; }
QString resultString() const
{
if (!finderResult.isEmpty())
return finderResult;
return ConfObj::resultString();
}
bool exec()
{
if (!conf->getenv("QC_DISABLE_" + compShortName).isEmpty()) {
finderResult = "disabled";
return false;
}
QString proextra =
"CONFIG += qt\\n"
"QT -= gui\\n"
"QT += ";
proextra += compId;
QString str =
"\\n"
"int main()\\n"
"{\\n"
" return 0;\\n"
"}\\n";
int ret;
if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret))
return false;
if(ret != 0)
return false;
if (!extraConfIfFound.isEmpty()) {
conf->addExtra(extraConfIfFound);
}
return true;
}
};
#define QC_AS_STR(s) #s
#define QC_SILENT_NOT_FOUND(modname) \\
class qc_##modname : public ConfObj \\
{ \\
public: \\
qc_##modname(Conf *c) : ConfObj(c) {} \\
QString name() const { return QC_AS_STR(modname); } \\
QString shortname() const { return QC_AS_STR(modname); } \\
QString checkString() const { return QString(); } \\
bool exec() { return false; } \\
};
#define QC_FIND_QT_COMP_BASE(id, shortname, name, extraConfIfFound, suffix) \\
class qc_##shortname##suffix : public QtCompFinder \\
{ \\
public: \\
qc_##shortname##suffix(Conf *c) : QtCompFinder(QC_AS_STR(id), QC_AS_STR(shortname), QC_AS_STR(name), extraConfIfFound, c) {} \\
};
#define QC_FIND_QT_COMP_E(id, shortname, name, extraConfIfFound) QC_FIND_QT_COMP_BASE(id, shortname, name, extraConfIfFound,)
#define QC_FIND_QT_COMP(id, shortname, name) QC_FIND_QT_COMP_E(id, shortname, name, "")
#line 1 "buildmodeapp.qcm"
/*
-----BEGIN QCMOD-----
name: buildmodeapp
section: project
arg: release,Build with debugging turned off (default).
arg: debug,Build with debugging turned on.
arg: no-separate-debug-info,Do not store debug information in a separate file (default for mac).
arg: separate-debug-info,Strip debug information into a separate .debug file (default for non-mac).
-----END QCMOD-----
arg: debug-and-release,Build two versions, with and without debugging turned on (mac only).
*/
#define QC_BUILDMODE
bool qc_buildmode_release = false;
bool qc_buildmode_debug = false;
bool qc_buildmode_separate_debug_info = false;
#define PSI_DIR_NAME "psi"
static QString sourceDir;
// this is a utility function required by few other modules
static bool psiGenerateFile(const QString &inFile, const QString &outFile, const QHash<QString,QString> &vars)
{
QFile fin(inFile);
QFile fout(outFile);
if(!fin.open(QIODevice::ReadOnly | QIODevice::Text) || !fout.open(QIODevice::WriteOnly | QIODevice::Truncate))
return false;
QTextStream tin(&fin);
QTextStream tout(&fout);
while(!tin.atEnd())
{
QString line = tin.readLine();
QHashIterator<QString,QString> it(vars);
while(it.hasNext())
{
it.next();
line.replace("@@" + it.key() + "@@", it.value());
}
tout << line << endl;
}
return true;
}
class qc_buildmodeapp : public ConfObj
{
public:
qc_buildmodeapp(Conf *c) : ConfObj(c) {}
QString name() const { return "buildmodeapp"; }
QString shortname() const { return "buildmodeapp"; }
// no output
QString checkString() const { return QString(); }
bool exec()
{
QFileInfo fi(qc_getenv("QC_COMMAND"));
sourceDir = fi.absolutePath();
// first, parse out the options
bool opt_release = false;
bool opt_debug = false;
bool opt_debug_and_release = false;
bool opt_no_separate_debug_info = false;
bool opt_separate_debug_info = false;
if(conf->getenv("QC_RELEASE") == "Y")
opt_release = true;
if(conf->getenv("QC_DEBUG") == "Y")
opt_debug = true;
if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y")
opt_debug_and_release = true;
if(conf->getenv("QC_NO_SEPARATE_DEBUG_INFO") == "Y")
opt_no_separate_debug_info = true;
if(conf->getenv("QC_SEPARATE_DEBUG_INFO") == "Y")
opt_separate_debug_info = true;
bool staticmode = false;
if(conf->getenv("QC_STATIC") == "Y")
staticmode = true;
#ifndef Q_OS_MAC
if(opt_debug_and_release)
{
printf("\\nError: The --debug-and-release option is for mac only.\\n");
exit(1);
}
#endif
// sanity check exclusive options
int x;
// build mode
x = 0;
if(opt_release)
++x;
if(opt_debug)
++x;
if(opt_debug_and_release)
++x;
if(x > 1)
{
printf("\\nError: Use only one of --release, --debug, or --debug-and-release.\\n");
exit(1);
}
// debug info
x = 0;
if(opt_no_separate_debug_info)
++x;
if(opt_separate_debug_info)
++x;
if(x > 1)
{
printf("\\nError: Use only one of --separate-debug-info or --no-separate-debug-info\\n");
exit(1);
}
// now process the options
if(opt_release)
qc_buildmode_release = true;
else if(opt_debug)
qc_buildmode_debug = true;
else if(opt_debug_and_release)
{
qc_buildmode_release = true;
qc_buildmode_debug = true;
}
else // default
qc_buildmode_release = true;
if(opt_separate_debug_info)
qc_buildmode_separate_debug_info = true;
else if(opt_no_separate_debug_info)
{
// nothing to do
}
else // default
{
#ifndef Q_OS_MAC
qc_buildmode_separate_debug_info = true;
#endif
}
// make the string
QStringList opts;
QString other;
if(qc_buildmode_release && qc_buildmode_debug)
{
opts += "debug_and_release";
opts += "build_all";
}
else if(qc_buildmode_release)
opts += "release";
else // qc_buildmode_debug
opts += "debug";
if(qc_buildmode_separate_debug_info)
{
opts += "separate_debug_info";
other += "*-g++*:QMAKE_CFLAGS += -g\\n";
other += "*-g++*:QMAKE_CXXFLAGS += -g\\n";
}
QString str = "CONFIG -= debug_and_release debug release\\n";
str += QString("CONFIG += ") + opts.join(" ") + '\\n';
conf->addExtra(str);
if(!other.isEmpty())
conf->addExtra(other);
return true;
}
};
#line 1 "idn.qcm"
/*
-----BEGIN QCMOD-----
name: libidn
arg: with-idn-inc=[path],Path to libidn include files
arg: with-idn-lib=[path],Path to libidn library or framework files
-----END QCMOD-----
*/
//----------------------------------------------------------------------------
// qc_idn
//----------------------------------------------------------------------------
class qc_idn : public ConfObj
{
public:
qc_idn(Conf *c) : ConfObj(c) {}
QString name() const { return "LibIDN"; }
QString shortname() const { return "libidn"; }
bool exec()
{
QString idn_incdir, idn_libdir, idn_prefixdir;
idn_incdir = conf->getenv("QC_WITH_IDN_INC");
idn_libdir = conf->getenv("QC_WITH_IDN_LIB");
idn_prefixdir = conf->getenv("PREFIX");
if (!idn_incdir.isEmpty() || !idn_libdir.isEmpty() || !idn_prefixdir.isEmpty()) { // prefer this if given
if ((!idn_incdir.isEmpty() && conf->checkHeader(idn_incdir, "stringprep.h")) ||
(idn_incdir.isEmpty() && conf->findHeader("stringprep.h", QStringList(), &idn_incdir))) {
conf->addIncludePath(idn_incdir);
} else {
printf("Headers not found!\\n");
return false;
}
#ifdef Q_OS_WIN
conf->addDefine("LIBIDN_STATIC"); // it's need only for iris anyway
QString staticLibName = qc_buildmode_debug? "libidnd" : "libidn";
QString dynamicLibName = qc_buildmode_debug? "idnd" : "idn";
QStringList libNames = QStringList() << staticLibName << dynamicLibName;
#else
QStringList libNames = QStringList() << "idn";
#endif
bool libFound = false;
foreach (const QString &libName, libNames) {
if((!idn_libdir.isEmpty() && conf->checkLibrary(idn_libdir, libName)) ||
(idn_libdir.isEmpty() && conf->findLibrary(libName, &idn_libdir))) {
conf->addLib(idn_libdir.isEmpty()? QString("-l") + libName : QString("-L%1 -l%2").arg(idn_libdir, libName));
libFound = true;
break;
}
}
if (!libFound) {
printf("Libraries not found!\\n");
}
return libFound;
}
QStringList incs;
QString version, libs, other;
if(conf->findPkgConfig("libidn", VersionAny, QString::null, &version, &incs, &libs, &other))
{
for(int n = 0; n < incs.count(); ++n)
conf->addIncludePath(incs[n]);
if(!libs.isEmpty())
conf->addLib(libs);
return true;
}
return false;
}
};
#line 1 "qca.qcm"
/*
-----BEGIN QCMOD-----
name: QCA >= 2.0
arg: with-qca-inc=[path],Path to QCA include files
arg: with-qca-lib=[path],Path to QCA library or framework files
-----END QCMOD-----
*/
// adapted from crypto.prf
static QString internal_crypto_prf(const QString &incdir, const QString &libdir, const QString &frameworkdir)
{
QString out = QString(
"QCA_INCDIR = %1\\n"
"QCA_LIBDIR = %2\\n"
"QMAKE_RPATHDIR = %2\\n"