forked from bitlbee/bitlbee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·1002 lines (853 loc) · 24.2 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
##############################
## Configurer for BitlBee ##
## ##
## Copyright 2004 Lintux ##
## Copyright 2002 Lucumo ##
##############################
prefix='/usr/local/'
bindir='$prefix/bin/'
sbindir='$prefix/sbin/'
etcdir='$prefix/etc/bitlbee/'
mandir='$prefix/share/man/'
datadir='$prefix/share/bitlbee/'
config='/var/lib/bitlbee/'
libdir='$prefix/lib/'
plugindir='$prefix/lib/bitlbee/'
includedir='$prefix/include/bitlbee/'
systemdsystemunitdir=''
libevent='/usr/'
pidfile='/var/run/bitlbee.pid'
ipcsocket=''
pcdir='$prefix/lib/pkgconfig'
systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
sysroot=''
configure_args="$@"
# Set these to default-on to let it be overriden by either the user or purple
#
# If the user sets one of these to 1, purple won't disable them.
# Otherwise, if it's still default-on, it gets included in normal builds,
# but not purple ones.
jabber="default-on"
twitter=1
purple=0
verbose=0
doc=1
debug=0
strip=0
gcov=0
asan=0
plugins=1
otr=0
events=glib
ssl=auto
pam=0
ldap=0
pie=1
arch=$(uname -s)
GLIB_MIN_VERSION=2.32
# Cygwin and Darwin don't support PIC/PIE
case "$arch" in
CYGWIN* )
pie=0;;
Darwin )
pie=0;;
esac
get_version() {
REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
if [ -n "$BITLBEE_VERSION" ]; then
# environment variable already set to something to spoof it
# don't replace it with the git stuff
return
fi
BITLBEE_VERSION=$REAL_BITLBEE_VERSION
if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
replace="\1+$timestamp+$branch+\2-\3-git"
describe=$(cd $srcdir; git describe --long --tags 2>/dev/null)
if [ $? -ne 0 ]; then
describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD)
fi
BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
unset timestamp branch search replace describe
fi
}
if [ "$1" = "--dump-version" ]; then
srcdir=$(cd $(dirname $0);pwd)
get_version
echo $BITLBEE_VERSION
exit
fi
echo BitlBee configure
while [ -n "$1" ]; do
e="$(expr "X$1" : 'X--\(.*=.*\)')"
if [ -z "$e" ]; then
cat<<EOF
Usage: $0 [OPTIONS]
Option Description Default
--prefix=... Directories to put files in $prefix
--bindir=... $bindir
--sbindir=... $sbindir
--etcdir=... $etcdir
--mandir=... $mandir
--datadir=... $datadir
--plugindir=... $plugindir
--systemdsystemunitdir=... $systemdsystemunitdir
--pidfile=... $pidfile
--config=... $config
--verbose=0/1 Disable/enable verbose build $verbose
--jabber=0/1 Disable/enable Jabber part $jabber
--twitter=0/1 Disable/enable Twitter part $twitter
--purple=0/1 Disable/enable libpurple support $purple
(automatically disables other protocol modules)
--pam=0/1 Disable/enable PAM authentication $pam
--ldap=0/1 Disable/enable LDAP authentication $ldap
--doc=0/1 Disable/enable help.txt generation $doc
--debug=0/1 Disable/enable debugging $debug
--strip=0/1 Disable/enable binary stripping $strip
--pie=0/1 Build position independent executable $pie
--gcov=0/1 Disable/enable test coverage reporting $gcov
--asan=0/1 Disable/enable AddressSanitizer $asan
--plugins=0/1 Disable/enable plugins support $plugins
--otr=0/1/auto/plugin
Disable/enable OTR encryption support $otr
--events=... Event handler (glib, libevent) $events
--ssl=... SSL library to use (gnutls, nss, openssl, auto)
$ssl
--target=... Cross compilation target same as host
--sysroot=... Cross compilation sysroot $sysroot
EOF
exit;
fi
eval "$e"
shift;
done
# Expand $prefix and get rid of double slashes
bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g')
sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g')
etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g')
mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g')
datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g')
config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g')
libdir=$(eval echo "$libdir/" | sed 's/\/\{1,\}/\//g')
plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g')
libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g')
pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g')
ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g')
pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g')
protocols_mods=""
cat <<EOF >Makefile.settings
## BitlBee settings, generated by configure
# ./configure $configure_args
PREFIX=$prefix
BINDIR=$bindir
SBINDIR=$sbindir
ETCDIR=$etcdir
MANDIR=$mandir
DATADIR=$datadir
PLUGINDIR=$plugindir
CONFIG=$config
LIBDIR=$libdir
INCLUDEDIR=$includedir
PCDIR=$pcdir
TARGET=$target
INSTALL=install -p
DESTDIR=
LFLAGS=
EFLAGS=-lm
EOF
srcdir=$(cd $(dirname $0);pwd)
currdir=$(pwd)
if [ "$srcdir" != "$currdir" ]; then
echo
echo "configure script run from a different directory. Will create some symlinks..."
if [ ! -e Makefile -o -L Makefile ]; then
COPYDIRS="doc lib protocols tests utils"
mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
dst="$PWD"
cd "$srcdir"
for i in $(find . -name Makefile -type f); do
ln -s "$PWD${i#.}" "$dst/$i";
done
cd "$dst"
rm -rf .bzr
fi
echo "_SRCDIR_=$srcdir/" >> Makefile.settings
CFLAGS="$CFLAGS -I${dst}"
else
srcdir=$PWD
fi
cat<<EOF >config.h
/* BitlBee settings, generated by configure
Do *NOT* use any of these defines in your code without thinking twice, most
of them can/will be overridden at run-time */
#define BITLBEE_CONFIGURE_ARGS "$configure_args"
#define CONFIG "$config"
#define ETCDIR "$etcdir"
#define VARDIR "$datadir"
#define PLUGINDIR "$plugindir"
#define DATADIR "$datadir"
#define PIDFILE "$pidfile"
#define IPCSOCKET "$ipcsocket"
EOF
if [ -n "$target" ]; then
# prepend sysroot to system lib dirs
systemlibdirs_cross=''
for i in $systemlibdirs; do
systemlibdirs_cross="$systemlibdirs_cross $sysroot$i"
done
systemlibdirs=$systemlibdirs_cross
unset systemlibdirs_cross
# backward compatibility
if [ -z "$PKG_CONFIG_LIBDIR" ]; then
PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
export PKG_CONFIG_LIBDIR
fi
if [ -d /usr/$target/bin ]; then
PATH=/usr/$target/bin:$PATH
fi
if [ -d /usr/$target/lib ]; then
systemlibdirs="$systemlibdirs /usr/$target/lib"
fi
CC=$target-cc
LD=$target-ld
STRIP=$target-strip
fi
if [ "$asan" = "1" ]; then
CFLAGS="$CFLAGS -fsanitize=address"
LDFLAGS="$LDFLAGS -fsanitize=address"
debug=1
fi
if [ "$verbose" = "0" ]; then
echo 'VERBOSE=@' >> Makefile.settings
else
echo 'VERBOSE=' >> Makefile.settings
fi
cat <<EOF >>Makefile.settings
# Enable/disable output verbosity
ifdef V
ifeq (\$(V),1)
VERBOSE=
else
VERBOSE=@
endif
endif
EOF
if [ "$debug" = "1" ]; then
echo 'DEBUG=1' >> Makefile.settings
CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
else
[ -z "$CFLAGS" ] && CFLAGS="-g -O2 -fno-strict-aliasing"
fi
if [ "$pie" = "1" ]; then
echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
fi
echo LDFLAGS=$LDFLAGS >> Makefile.settings
echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
if [ -n "$CC" ]; then
CC=$CC
elif type gcc > /dev/null 2> /dev/null; then
CC=gcc
elif type cc > /dev/null 2> /dev/null; then
CC=cc
else
echo 'Cannot find a C compiler, aborting.'
exit 1;
fi
echo "CC=$CC" >> Makefile.settings;
if echo $CC | grep -qw 'gcc\|clang'; then
# Apparently -Wall is gcc-specific?
echo CFLAGS+=-Wall -Wformat -Werror=format-security >> Makefile.settings
fi
if [ -z "$LD" ]; then
if type ld > /dev/null 2> /dev/null; then
LD=ld
else
echo 'Cannot find ld, aborting.'
exit 1;
fi
fi
echo "LD=$LD" >> Makefile.settings
if [ -z "$PKG_CONFIG" ]; then
PKG_CONFIG=pkg-config
fi
if ! $PKG_CONFIG --version > /dev/null 2>/dev/null; then
echo
echo 'Cannot find pkg-config, aborting.'
exit 1
fi
if $PKG_CONFIG glib-2.0; then
if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
cat<<EOF >>Makefile.settings
EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
EOF
else
echo
echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
exit 1
fi
else
echo
echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
exit 1
fi
if [ "$events" = "libevent" ]; then
if ! [ -f "${libevent}include/event.h" ]; then
echo
echo 'Warning: Could not find event.h, you might have to install it and/or specify'
echo 'its location using the --libevent= argument. (Example: If event.h is in'
echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
fi
echo '#define EVENTS_LIBEVENT' >> config.h
cat <<EOF >>Makefile.settings
EFLAGS+=-levent -L${libevent}lib
CFLAGS+=-I${libevent}include
EOF
elif [ "$events" = "glib" ]; then
## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
echo '#define EVENTS_GLIB' >> config.h
else
echo
echo 'ERROR: Unknown event handler specified.'
exit 1
fi
echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
detect_gnutls()
{
if $PKG_CONFIG --exists gnutls; then
cat <<EOF >>Makefile.settings
EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
EOF
ssl=gnutls
if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
echo
echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
fi
ret=1
elif libgnutls-config --version > /dev/null 2> /dev/null; then
cat <<EOF >>Makefile.settings
EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
EOF
ssl=gnutls
ret=1;
else
ret=0;
fi;
}
detect_nss()
{
if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
cat<<EOF >>Makefile.settings
EFLAGS+=$($PKG_CONFIG --libs nss)
CFLAGS+=$($PKG_CONFIG --cflags nss)
EOF
ssl=nss
ret=1;
else
ret=0;
fi;
}
RESOLV_TESTCODE='
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int main()
{
res_query( NULL, 0, 0, NULL, 0);
dn_expand( NULL, NULL, NULL, NULL, 0);
dn_skipname( NULL, NULL);
}
'
RESOLV_NS_TESTCODE='
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int main()
{
ns_initparse( NULL, 0, NULL );
ns_parserr( NULL, ns_s_an, 0, NULL );
}
'
RESOLV_NS_TYPES_TESTCODE='
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
int main()
{
ns_msg nsh;
ns_rr rr;
/* Not all platforms we want to work on have
ns_* routines, so use this to make sure
the compiler uses it.*/
return (int)(sizeof(nsh) + sizeof(rr));
}
'
BACKTRACE_TESTCODE='
#include <execinfo.h>
int main()
{
void *trace[16];
return backtrace(trace, 16);
}
'
detect_resolv_dynamic()
{
case "$arch" in
OpenBSD )
# In FreeBSD res_*/dn_* routines are present in libc.so
LIBRESOLV=;;
FreeBSD )
# In FreeBSD res_*/dn_* routines are present in libc.so
LIBRESOLV=;;
CYGWIN* )
# In Cygwin res_*/dn_* routines are present in libc.so
LIBRESOLV=;;
* )
LIBRESOLV=-lresolv;;
esac
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
ret=0
fi
rm -f $TMPFILE
return $ret
}
detect_resolv_static()
{
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
for i in $systemlibdirs; do
if [ -f $i/libresolv.a ]; then
echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
ret=0
fi
fi
done
rm -f $TMPFILE
return $ret
}
detect_resolv_ns_dynamic()
{
case "$arch" in
FreeBSD )
# In FreeBSD ns_ routines are present in libc.so
LIBRESOLV=;;
* )
LIBRESOLV=-lresolv;;
esac
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
ret=0
fi
rm -f $TMPFILE
return $ret
}
detect_resolv_ns_static()
{
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
for i in $systemlibdirs; do
if [ -f $i/libresolv.a ]; then
echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
ret=0
fi
fi
done
rm -f $TMPFILE
return $ret
}
detect_nameser_has_ns_types()
{
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
# since we aren't actually linking with ns_* routines
# we can just compile the test code
echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
ret=0
fi
rm -f $TMPFILE
return $ret
}
detect_backtrace()
{
TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
ret=1
echo "$BACKTRACE_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null
if [ "$?" = "0" ]; then
ret=0
fi
rm -f $TMPFILE
return $ret
}
if [ "$ssl" = "auto" ]; then
detect_gnutls
if [ "$ret" = "0" ]; then
# Disable NSS for now as it's known to not work very well ATM.
#detect_nss
:
fi
elif [ "$ssl" = "gnutls" ]; then
detect_gnutls
elif [ "$ssl" = "nss" ]; then
detect_nss
elif [ "$ssl" = "openssl" ]; then
echo
echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
echo 'installation of OpenSSL (including devel/header files) before reporting'
echo 'compilation problems.'
echo
echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported'
echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the'
echo 'operating system, which makes it GPL-compatible.'
echo
echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
echo
echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
echo 'probably illegal. If you want to create and distribute a binary BitlBee'
echo 'package, you really should use GnuTLS instead.'
echo
echo 'Also, the OpenSSL license requires us to say this:'
echo ' * "This product includes software developed by the OpenSSL Project'
echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
ret=1
else
echo
echo 'ERROR: Unknown SSL library specified.'
exit 1
fi
if [ "$ret" = "0" ]; then
echo
echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
echo ' Please note that this script doesn'\''t have detection code for OpenSSL,'
echo ' so if you want to use that, you have to select it by hand.'
exit 1
fi;
echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
if detect_nameser_has_ns_types; then
echo '#define NAMESER_HAS_NS_TYPES' >> config.h
fi
if detect_resolv_dynamic || detect_resolv_static; then
echo '#define HAVE_RESOLV_A' >> config.h
if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
fi
else
echo 'Insufficient resolv routines. Jabber server must be set explicitly'
fi
if detect_backtrace; then
echo '#define HAVE_BACKTRACE' >> config.h
echo '#define CRASHFILE "'$config'crash.log"' >> config.h
fi
STORAGES="xml"
for i in $STORAGES; do
STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
done
echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
authobjs=
authlibs=
if [ "$pam" = 0 ]; then
echo '#undef WITH_PAM' >> config.h
else
if ! echo '#include <security/pam_appl.h>' | $CC -E - >/dev/null 2>/dev/null; then
echo 'Cannot find libpam development libraries, aborting. (Install libpam0g-dev?)'
exit 1
fi
echo '#define WITH_PAM' >> config.h
authobjs=$authobjs'auth_pam.o '
authlibs=$authlibs'-lpam '
fi
if [ "$ldap" = 0 ]; then
echo '#undef WITH_LDAP' >> config.h
else
if ! echo '#include <ldap.h>' | $CC -E - >/dev/null 2>/dev/null; then
echo 'Cannot find libldap development libraries, aborting. (Install libldap2-dev?)'
exit 1
fi
echo '#define WITH_LDAP' >> config.h
authobjs=$authobjs'auth_ldap.o '
authlibs=$authlibs'-lldap '
fi
echo AUTH_OBJS=$authobjs >> Makefile.settings
echo EFLAGS+=$authlibs >> Makefile.settings
if [ "$strip" = 0 ]; then
echo "STRIP=\# skip strip" >> Makefile.settings;
else
if [ "$debug" = 1 ]; then
echo
echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
elif [ -n "$STRIP" ]; then
echo "STRIP=$STRIP" >> Makefile.settings;
elif type strip > /dev/null 2> /dev/null; then
echo "STRIP=strip" >> Makefile.settings;
else
echo
echo 'No strip utility found, cannot remove unnecessary parts from executable.'
echo 'STRIP=\# skip strip' >> Makefile.settings
strip=0;
fi;
fi
if [ -z "$systemdsystemunitdir" ]; then
if $PKG_CONFIG --exists systemd; then
systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
fi
fi
if [ -n "$systemdsystemunitdir" ]; then
if [ "$systemdsystemunitdir" != "no" ]; then
echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
fi
fi
if [ "$gcov" = "1" ]; then
echo "CFLAGS+=--coverage" >> Makefile.settings
echo "EFLAGS+=--coverage" >> Makefile.settings
fi
if [ "$plugins" = 0 ]; then
plugindir=""
echo '#undef WITH_PLUGINS' >> config.h
else
echo '#define WITH_PLUGINS' >> config.h
fi
otrprefix=""
if [ "$otr" = "auto" ]; then
! $PKG_CONFIG --exists libotr
otr=$?
fi
if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
exit 1
fi
if [ "$otr" = 1 ]; then
# BI == built-in
echo '#define OTR_BI' >> config.h
echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
echo 'OTR_BI=otr.o' >> Makefile.settings
elif [ "$otr" = "plugin" ]; then
# for some mysterious reason beyond the comprehension of my mortal mind,
# the libgcrypt flags aren't needed when building as plugin. add them anyway.
echo '#define OTR_PI' >> config.h
echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
echo 'OTR_PI=otr.so' >> Makefile.settings
fi
if [ -z "$PYTHON" ]; then
for pp in python python3 python2; do
if which $pp > /dev/null; then
PYTHON=$pp
break
fi
done
fi
if [ "$doc" = "1" ]; then
# check this here just in case someone tries to install it in python2.4...
if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
echo
echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
echo "(Use the PYTHON environment variable if it's in a weird location)"
exit 1
fi
echo "DOC=1" >> Makefile.settings
echo "PYTHON=$PYTHON" >> Makefile.settings
fi
get_version
if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
echo 'Spoofing version number: '$BITLBEE_VERSION
echo '#undef BITLBEE_VERSION' >> config.h
echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
echo
fi
if ! make helloworld > /dev/null 2>&1; then
echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
echo "under the name 'gmake'."
echo
if gmake helloworld > /dev/null 2>&1; then
echo "gmake seems to be available on your machine, great."
echo
else
echo "gmake is not installed (or not working). Please try to install it."
echo
fi
fi
pkgconfiglibs=''
case "$arch" in
CYGWIN* )
pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined'
esac
cat <<EOF >bitlbee.pc
prefix=$prefix
includedir=$includedir
plugindir=$plugindir
libdir=$libdir
datadir=$datadir
Name: bitlbee
Description: IRC to IM gateway
Requires: glib-2.0
Version: $BITLBEE_VERSION
Libs: $pkgconfiglibs
Cflags: -I\${includedir}
EOF
protocols=''
protoobjs=''
if [ "$purple" = 0 ]; then
echo '#undef WITH_PURPLE' >> config.h
else
if ! $PKG_CONFIG purple; then
echo
echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
exit 1
fi
echo '#define WITH_PURPLE' >> config.h
cat<<EOF >>Makefile.settings
EFLAGS += $($PKG_CONFIG purple --libs)
PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
EOF
protocols=$protocols'purple '
protoobjs=$protoobjs'purple_mod.o '
# only disable these if the user didn't enable them explicitly
[ "$jabber" = "default-on" ] && jabber=0
echo '#undef PACKAGE' >> config.h
echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
if [ "$events" = "libevent" ]; then
echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
echo 'outside libpurple, talking to GLib directly. At least for now the combination'
echo 'libpurple + libevent is *not* recommended!'
echo
fi
fi
case "$CC" in
*gcc* )
echo CFLAGS+=-MMD -MF .depend/\[email protected] >> Makefile.settings
for i in . lib tests protocols protocols/*/; do
mkdir -p $i/.depend
done
esac
if [ "$jabber" = 0 ]; then
echo '#undef WITH_JABBER' >> config.h
else
echo '#define WITH_JABBER' >> config.h
protocols=$protocols'jabber '
protoobjs=$protoobjs'jabber_mod.o '
fi
if [ "$twitter" = 0 ]; then
echo '#undef WITH_TWITTER' >> config.h
else
echo '#define WITH_TWITTER' >> config.h
protocols=$protocols'twitter '
protoobjs=$protoobjs'twitter_mod.o '
fi
if [ "$protocols" = "PROTOCOLS = " ]; then
echo "Warning: You haven't selected any communication protocol to compile!"
echo " BitlBee will run, but you will be unable to connect to IM servers!"
fi
echo "PROTOCOLS = $protocols" >> Makefile.settings
echo "PROTOOBJS = $protoobjs" >> Makefile.settings
echo Architecture: $arch
case "$arch" in
Linux )
;;
GNU/* )
;;
*BSD )
;;
Darwin )
echo 'STRIP=\# skip strip' >> Makefile.settings
;;
IRIX )
;;
SunOS )
echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
echo 'STRIP=\# skip strip' >> Makefile.settings
echo '#define NO_FD_PASSING' >> config.h
;;
AIX )
echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
;;
CYGWIN* )
echo 'EFLAGS+=-Wl,--export-all,--out-implib,libbitlbee.dll.a' >> Makefile.settings
echo 'IMPLIB=libbitlbee.dll.a' >> Makefile.settings
;;
Windows )
echo 'Native windows compilation is not supported anymore, use cygwin instead.'
;;
* )
echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
echo 'Please report any problems at http://bugs.bitlbee.org/.'
;;
esac
if [ -n "$target" ]; then
echo "Cross-compiling for: $target"
fi
echo
echo 'Configuration done:'
if [ "$debug" = "1" ]; then
echo ' Debugging enabled.'
else
echo ' Debugging disabled.'
fi
if [ "$asan" = "1" ]; then
echo ' AddressSanitizer (ASAN) enabled.'
else
echo ' AddressSanitizer (ASAN) disabled.'
fi
if [ "$pie" = "1" ]; then
echo ' Building PIE executable'
else
echo ' Building non-PIE executable'
fi
if [ "$strip" = "1" ]; then
echo ' Binary stripping enabled.'
else
echo ' Binary stripping disabled.'
fi
if [ "$otr" = "1" ]; then
echo ' Off-the-Record (OTR) Messaging enabled.'
elif [ "$otr" = "plugin" ]; then
echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).'
else
echo ' Off-the-Record (OTR) Messaging disabled.'
fi
if [ -n "$systemdsystemunitdir" ]; then
echo ' systemd enabled.'
else
echo ' systemd disabled.'
fi
echo ' Using python: '$PYTHON
echo ' Using event handler: '$events
echo ' Using SSL library: '$ssl
#echo ' Building with these storage backends: '$STORAGES
if [ -n "$protocols" ]; then
echo ' Building with these protocols:' $protocols$protocols_mods
case "$protocols" in
*purple*)
echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's"
echo " not *fully* compatible with normal BitlBee. Don't use it unless you"
echo " absolutely need it (i.e. support for a certain protocol or feature)."
esac
else