source: configure @ e9eee04

Last change on this file since e9eee04 was e9eee04, checked in by Jelmer Vernooij <jelmer@…>, at 2022-08-22T14:48:16Z

configure: remove -fno-strict-aliasing

lib/json.c seems to be the last place where -fno-strict-aliasing was
needed. It is obsolete now and we can remove it.

Bug: https://bugs.gentoo.org/861371
Signed-off-by: Petr Vaněk <arkamar@…>

  • Property mode set to 100755
File size: 25.0 KB
Line 
1#!/bin/sh
2
3##############################
4##  Configurer for BitlBee  ##
5##                          ##
6##  Copyright 2004 Lintux   ##
7##  Copyright 2002 Lucumo   ##
8##############################
9
10prefix='/usr/local/'
11bindir='$prefix/bin/'
12sbindir='$prefix/sbin/'
13etcdir='$prefix/etc/bitlbee/'
14mandir='$prefix/share/man/'
15datadir='$prefix/share/bitlbee/'
16config='/var/lib/bitlbee/'
17libdir='$prefix/lib/'
18plugindir='$prefix/lib/bitlbee/'
19includedir='$prefix/include/bitlbee/'
20systemdsystemunitdir=''
21libevent='/usr/'
22pidfile='/var/run/bitlbee.pid'
23ipcsocket=''
24pcdir='$prefix/lib/pkgconfig'
25systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
26sysroot=''
27
28configure_args="$@"
29
30# Set these to default-on to let it be overriden by either the user or purple
31#
32# If the user sets one of these to 1, purple won't disable them.
33# Otherwise, if it's still default-on, it gets included in normal builds,
34# but not purple ones.
35jabber="default-on"
36
37twitter=1
38purple=0
39
40verbose=0
41doc=1
42debug=0
43strip=0
44gcov=0
45asan=0
46plugins=1
47otr=0
48
49events=glib
50external_json_parser=auto
51ssl=auto
52
53pam=0
54ldap=0
55
56pie=1
57
58arch=$(uname -s)
59arch_rel=$(uname -r)
60
61GLIB_MIN_VERSION=2.32
62
63# Cygwin, Darwin and SunOS < 5.11 do not support PIC/PIE
64case "$arch" in
65        CYGWIN* )
66                pie=0;;
67        Darwin )
68                pie=0;;
69        SunOS )
70                if [ "$arch_rel" = "5.10" ]; then
71                        pie=0
72                fi
73                ;;
74esac
75
76get_version() {
77        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
78
79        if [ -n "$BITLBEE_VERSION" ]; then
80                # environment variable already set to something to spoof it
81                # don't replace it with the git stuff
82                return
83        fi
84
85        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
86
87        if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
88                timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
89                branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
90
91                search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
92                replace="\1+$timestamp+$branch+\2-\3-git"
93
94                describe=$(cd $srcdir; git describe --long --tags 2>/dev/null)
95                if [ $? -ne 0 ]; then
96                        describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD)
97                fi
98
99                BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
100
101                unset timestamp branch search replace describe
102        fi
103}
104
105if [ "$1" = "--dump-version" ]; then
106        srcdir=$(cd $(dirname $0);pwd)
107        get_version
108        echo $BITLBEE_VERSION
109        exit
110fi
111
112echo BitlBee configure
113
114while [ -n "$1" ]; do
115        e="$(expr "X$1" : 'X--\(.*=.*\)')"
116        if [ -z "$e" ]; then
117                cat<<EOF
118
119Usage: $0 [OPTIONS]
120
121Option          Description                             Default
122
123--prefix=...    Directories to put files in             $prefix
124--bindir=...                                            $bindir
125--sbindir=...                                           $sbindir
126--etcdir=...                                            $etcdir
127--mandir=...                                            $mandir
128--datadir=...                                           $datadir
129--plugindir=...                                         $plugindir
130--systemdsystemunitdir=...                              $systemdsystemunitdir
131--pidfile=...                                           $pidfile
132--config=...                                            $config
133
134--verbose=0/1   Disable/enable verbose build            $verbose
135
136--jabber=0/1    Disable/enable Jabber part              $jabber
137--twitter=0/1   Disable/enable Twitter part             $twitter
138
139--purple=0/1    Disable/enable libpurple support        $purple
140                (automatically disables other protocol modules)
141
142--pam=0/1       Disable/enable PAM authentication       $pam
143--ldap=0/1      Disable/enable LDAP authentication      $ldap
144
145--doc=0/1       Disable/enable help.txt generation      $doc
146--debug=0/1     Disable/enable debugging                $debug
147--strip=0/1     Disable/enable binary stripping         $strip
148--pie=0/1       Build position independent executable   $pie
149--gcov=0/1      Disable/enable test coverage reporting  $gcov
150--asan=0/1      Disable/enable AddressSanitizer         $asan
151--plugins=0/1   Disable/enable plugins support          $plugins
152--otr=0/1/auto/plugin
153                Disable/enable OTR encryption support   $otr
154
155--events=...    Event handler (glib, libevent)          $events
156--ssl=...       SSL library to use (gnutls, nss, openssl, auto)
157                                                        $ssl
158--external_json_parser=0/1/auto Use External JSON parser $external_json_parser
159
160
161--target=...    Cross compilation target                same as host
162--sysroot=...   Cross compilation sysroot               $sysroot
163EOF
164                exit;
165        fi
166        eval "$e"
167        shift;
168done
169
170# Expand $prefix and get rid of double slashes
171bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g')
172sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g')
173etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g')
174mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g')
175datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g')
176config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g')
177libdir=$(eval echo "$libdir/" | sed 's/\/\{1,\}/\//g')
178plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
179includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g')
180libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g')
181
182pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g')
183ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g')
184pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g')
185
186protocols_mods=""
187
188cat <<EOF >Makefile.settings
189## BitlBee settings, generated by configure
190
191# ./configure $configure_args
192
193PREFIX=$prefix
194BINDIR=$bindir
195SBINDIR=$sbindir
196ETCDIR=$etcdir
197MANDIR=$mandir
198DATADIR=$datadir
199PLUGINDIR=$plugindir
200CONFIG=$config
201LIBDIR=$libdir
202INCLUDEDIR=$includedir
203PCDIR=$pcdir
204
205TARGET=$target
206
207INSTALL=install -p
208
209DESTDIR=
210LFLAGS=
211EFLAGS=-lm
212EOF
213
214srcdir=$(cd $(dirname $0);pwd)
215currdir=$(pwd)
216if [ "$srcdir" != "$currdir" ]; then 
217        echo
218        echo "configure script run from a different directory. Will create some symlinks..."
219        if [ ! -e Makefile -o -L Makefile ]; then
220                COPYDIRS="doc lib protocols tests utils"
221                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
222                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
223                dst="$PWD"
224                cd "$srcdir"
225                for i in $(find . -name Makefile -type f); do
226                        ln -s "$PWD${i#.}" "$dst/$i";
227                done
228                cd "$dst"
229                rm -rf .bzr
230        fi
231       
232        echo "_SRCDIR_=$srcdir/" >> Makefile.settings
233        CFLAGS="$CFLAGS -I${dst}"
234else
235        srcdir=$PWD
236fi
237
238cat<<EOF >config.h
239/* BitlBee settings, generated by configure
240   
241   Do *NOT* use any of these defines in your code without thinking twice, most
242   of them can/will be overridden at run-time */
243
244#define BITLBEE_CONFIGURE_ARGS "$configure_args"
245
246#define CONFIG "$config"
247#define ETCDIR "$etcdir"
248#define VARDIR "$datadir"
249#define PLUGINDIR "$plugindir"
250#define DATADIR "$datadir"
251#define PIDFILE "$pidfile"
252#define IPCSOCKET "$ipcsocket"
253EOF
254
255
256
257if [ -n "$target" ]; then
258        # prepend sysroot to system lib dirs
259
260        systemlibdirs_cross=''
261        for i in $systemlibdirs; do
262                systemlibdirs_cross="$systemlibdirs_cross $sysroot$i"
263        done
264        systemlibdirs=$systemlibdirs_cross
265        unset systemlibdirs_cross
266
267        # backward compatibility
268
269        if [ -z "$PKG_CONFIG_LIBDIR" ]; then
270                PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
271                export PKG_CONFIG_LIBDIR
272        fi
273
274        if [ -d /usr/$target/bin ]; then
275                PATH=/usr/$target/bin:$PATH
276        fi
277
278        if [ -d /usr/$target/lib ]; then
279                systemlibdirs="$systemlibdirs /usr/$target/lib"
280        fi
281
282        CC=$target-cc
283        LD=$target-ld
284        STRIP=$target-strip
285fi
286
287if [ "$asan" = "1" ]; then
288        CFLAGS="$CFLAGS -fsanitize=address"
289        LDFLAGS="$LDFLAGS -fsanitize=address"
290        debug=1
291fi
292
293if [ "$verbose" = "0" ]; then
294        echo 'VERBOSE=@' >> Makefile.settings
295else
296        echo 'VERBOSE=' >> Makefile.settings
297fi
298
299cat <<EOF >>Makefile.settings
300
301# Enable/disable output verbosity
302ifdef V
303ifeq (\$(V),1)
304        VERBOSE=
305else
306        VERBOSE=@
307endif
308endif
309
310EOF
311
312if [ "$debug" = "1" ]; then
313        echo 'DEBUG=1' >> Makefile.settings
314        CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
315else
316        [ -z "$CFLAGS" ] && CFLAGS="-g -O2"
317fi
318
319if [ "$pie" = "1" ]; then
320        echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
321        echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
322fi
323
324echo LDFLAGS=$LDFLAGS >> Makefile.settings
325
326echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
327echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
328
329echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
330
331if [ -n "$CC" ]; then
332        CC=$CC
333elif type gcc > /dev/null 2> /dev/null; then
334        CC=gcc
335elif type cc > /dev/null 2> /dev/null; then
336        CC=cc
337else
338        echo 'Cannot find a C compiler, aborting.'
339        exit 1;
340fi
341
342echo "CC=$CC" >> Makefile.settings;
343if echo $CC | grep -qw 'gcc\|clang'; then
344        # Apparently -Wall is gcc-specific?
345        echo CFLAGS+=-Wall -Wformat -Werror=format-security >> Makefile.settings
346fi
347
348if [ -z "$LD" ]; then
349        if type ld > /dev/null 2> /dev/null; then
350                LD=ld
351        else
352                echo 'Cannot find ld, aborting.'
353                exit 1;
354        fi
355fi
356
357echo "LD=$LD" >> Makefile.settings
358
359if [ -z "$PKG_CONFIG" ]; then
360        PKG_CONFIG=pkg-config
361fi
362
363if ! $PKG_CONFIG --version > /dev/null 2>/dev/null; then
364        echo
365        echo 'Cannot find pkg-config, aborting.'
366        exit 1
367fi
368
369if $PKG_CONFIG glib-2.0; then
370        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
371                cat<<EOF >>Makefile.settings
372EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
373CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
374EOF
375        else
376                echo
377                echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
378                exit 1
379        fi
380else
381        echo
382        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
383        exit 1
384fi
385
386if [ "$events" = "libevent" ]; then
387        if ! [ -f "${libevent}include/event.h" ]; then
388                echo
389                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
390                echo 'its location using the --libevent= argument. (Example: If event.h is in'
391                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
392        fi
393       
394        echo '#define EVENTS_LIBEVENT' >> config.h
395        cat <<EOF >>Makefile.settings
396EFLAGS+=-levent -L${libevent}lib
397CFLAGS+=-I${libevent}include
398EOF
399elif [ "$events" = "glib" ]; then
400        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
401        echo '#define EVENTS_GLIB' >> config.h
402else
403        echo
404        echo 'ERROR: Unknown event handler specified.'
405        exit 1
406fi
407echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
408
409if [ "$external_json_parser" = "auto" ]; then
410        if pkg-config --exists json-parser; then
411                external_json_parser=1
412        else
413                external_json_parser=0
414        fi
415fi
416echo "EXTERNAL_JSON_PARSER=$external_json_parser" >> Makefile.settings
417if [ "$external_json_parser" = "1" ]; then
418    echo "CFLAGS+=$(pkg-config --cflags json-parser)" >> Makefile.settings
419    echo "LDFLAGS_BITLBEE+=$(pkg-config --libs json-parser)" >> Makefile.settings
420    echo "LDFLAGS_TESTS+=$(pkg-config --libs json-parser)" >> Makefile.settings
421fi
422
423
424detect_gnutls()
425{
426        if $PKG_CONFIG --exists gnutls; then
427                cat <<EOF >>Makefile.settings
428EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
429CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
430EOF
431                ssl=gnutls
432                if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
433                        echo
434                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
435                fi
436                ret=1
437        elif libgnutls-config --version > /dev/null 2> /dev/null; then
438                cat <<EOF >>Makefile.settings
439EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
440CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
441EOF
442               
443                ssl=gnutls
444                ret=1;
445        else
446                ret=0;
447        fi;
448}
449
450detect_nss()
451{
452        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
453                cat<<EOF >>Makefile.settings
454EFLAGS+=$($PKG_CONFIG --libs nss)
455CFLAGS+=$($PKG_CONFIG --cflags nss)
456EOF
457               
458                ssl=nss
459                ret=1;
460        else
461                ret=0;
462        fi;
463}
464
465RESOLV_TESTCODE='
466#include <sys/types.h>
467#include <netinet/in.h>
468#include <arpa/nameser.h>
469#include <resolv.h>
470
471int main()
472{
473
474        res_query( NULL, 0, 0, NULL, 0);
475        dn_expand( NULL, NULL, NULL, NULL, 0);
476        dn_skipname( NULL, NULL);
477}
478'
479RESOLV_NS_TESTCODE='
480#include <sys/types.h>
481#include <netinet/in.h>
482#include <arpa/nameser.h>
483#include <resolv.h>
484
485int main()
486{
487        ns_initparse( NULL, 0, NULL );
488        ns_parserr( NULL, ns_s_an, 0, NULL );
489}
490'
491RESOLV_NS_TYPES_TESTCODE='
492#include <sys/types.h>
493#include <netinet/in.h>
494#include <arpa/nameser.h>
495
496int main()
497{
498        ns_msg nsh;
499        ns_rr rr;
500
501        /* Not all platforms we want to work on have
502         ns_* routines, so use this to make sure
503         the compiler uses it.*/
504        return (int)(sizeof(nsh) + sizeof(rr));
505}
506'
507
508BACKTRACE_TESTCODE='
509#include <execinfo.h>
510
511int main()
512{
513        void *trace[16];
514        return backtrace(trace, 16);
515}
516'
517
518detect_resolv_dynamic()
519{
520        case "$arch" in
521        OpenBSD )
522                # In FreeBSD res_*/dn_* routines are present in libc.so
523                LIBRESOLV=;;
524        FreeBSD )
525                # In FreeBSD res_*/dn_* routines are present in libc.so
526                LIBRESOLV=;;
527        CYGWIN* )
528                # In Cygwin res_*/dn_* routines are present in libc.so
529                LIBRESOLV=;;
530        * )
531                LIBRESOLV=-lresolv;;
532        esac
533        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
534        ret=1
535        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
536        if [ "$?" = "0" ]; then
537                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
538                ret=0
539        fi
540
541        rm -f $TMPFILE
542        return $ret
543}
544
545detect_resolv_static()
546{
547        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
548        ret=1
549        for i in $systemlibdirs; do
550                if [ -f $i/libresolv.a ]; then
551                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
552                        if [ "$?" = "0" ]; then
553                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
554                                ret=0
555                        fi
556                fi
557        done
558
559        rm -f $TMPFILE
560        return $ret
561}
562
563detect_resolv_ns_dynamic()
564{
565        case "$arch" in
566        FreeBSD )
567                # In FreeBSD ns_ routines are present in libc.so
568                LIBRESOLV=;;
569        * )
570                LIBRESOLV=-lresolv;;
571        esac
572        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
573        ret=1
574        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
575        if [ "$?" = "0" ]; then
576                ret=0
577        fi
578
579        rm -f $TMPFILE
580        return $ret
581}
582
583detect_resolv_ns_static()
584{
585        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
586        ret=1
587        for i in $systemlibdirs; do
588                if [ -f $i/libresolv.a ]; then
589                        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
590                        if [ "$?" = "0" ]; then
591                                ret=0
592                        fi
593                fi
594        done
595
596        rm -f $TMPFILE
597        return $ret
598}
599
600detect_nameser_has_ns_types()
601{
602        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
603        ret=1
604        # since we aren't actually linking with ns_* routines
605        # we can just compile the test code
606        echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
607        if [ "$?" = "0" ]; then
608                ret=0
609        fi
610
611        rm -f $TMPFILE
612        return $ret
613}
614
615detect_backtrace()
616{
617        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
618        ret=1
619        echo "$BACKTRACE_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
620        if [ "$?" = "0" ]; then
621                ret=0
622        fi
623
624        rm -f $TMPFILE
625        return $ret
626}
627
628if [ "$ssl" = "auto" ]; then
629        detect_gnutls
630        if [ "$ret" = "0" ]; then
631                # Disable NSS for now as it's known to not work very well ATM.
632                #detect_nss
633                :
634        fi
635elif [ "$ssl" = "gnutls" ]; then
636        detect_gnutls
637elif [ "$ssl" = "nss" ]; then
638        detect_nss
639elif [ "$ssl" = "openssl" ]; then
640        echo
641        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
642        echo 'installation of OpenSSL (including devel/header files) before reporting'
643        echo 'compilation problems.'
644        echo
645        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
646        echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported'
647        echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the'
648        echo 'operating system, which makes it GPL-compatible.'
649        echo
650        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
651        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
652        echo
653        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
654        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
655        echo 'package, you really should use GnuTLS instead.'
656        echo
657        echo 'Also, the OpenSSL license requires us to say this:'
658        echo ' *    "This product includes software developed by the OpenSSL Project'
659        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
660       
661        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
662       
663        ret=1
664else
665        echo
666        echo 'ERROR: Unknown SSL library specified.'
667        exit 1
668fi
669
670if [ "$ret" = "0" ]; then
671        echo
672        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
673        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
674        echo '       so if you want to use that, you have to select it by hand.'
675       
676        exit 1
677fi;
678
679echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
680
681if detect_nameser_has_ns_types; then
682        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
683fi
684if detect_resolv_dynamic || detect_resolv_static; then
685        echo '#define HAVE_RESOLV_A' >> config.h
686        if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
687                echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
688        fi
689else
690        echo 'Insufficient resolv routines. Jabber server must be set explicitly'
691fi
692
693if detect_backtrace; then
694        echo '#define HAVE_BACKTRACE' >> config.h
695        echo '#define CRASHFILE "'$config'crash.log"' >> config.h
696fi
697
698STORAGES="xml"
699
700for i in $STORAGES; do
701        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
702done
703echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
704
705authobjs=
706authlibs=
707if [ "$pam" = 0 ]; then
708        echo '#undef WITH_PAM' >> config.h
709else
710        if ! echo '#include <security/pam_appl.h>' | $CC -E - >/dev/null 2>/dev/null; then
711                echo 'Cannot find libpam development libraries, aborting. (Install libpam0g-dev?)'
712                exit 1
713        fi
714        echo '#define WITH_PAM' >> config.h
715        authobjs=$authobjs'auth_pam.o '
716        authlibs=$authlibs'-lpam '
717fi
718if [ "$ldap" = 0 ]; then
719        echo '#undef WITH_LDAP' >> config.h
720else
721        if ! echo '#include <ldap.h>' | $CC -E - >/dev/null 2>/dev/null; then
722                echo 'Cannot find libldap development libraries, aborting. (Install libldap2-dev?)'
723                exit 1
724        fi
725        echo '#define WITH_LDAP' >> config.h
726        authobjs=$authobjs'auth_ldap.o '
727        authlibs=$authlibs'-lldap '
728fi
729echo AUTH_OBJS=$authobjs >> Makefile.settings
730echo EFLAGS+=$authlibs >> Makefile.settings
731
732if [ "$strip" = 0 ]; then
733        echo "STRIP=\# skip strip" >> Makefile.settings;
734else
735        if [ "$debug" = 1 ]; then
736                echo
737                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
738                echo 'STRIP=\# skip strip' >> Makefile.settings
739                strip=0;
740        elif [ -n "$STRIP" ]; then
741                echo "STRIP=$STRIP" >> Makefile.settings;
742        elif type strip > /dev/null 2> /dev/null; then
743                echo "STRIP=strip" >> Makefile.settings;
744        else
745                echo
746                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
747                echo 'STRIP=\# skip strip' >> Makefile.settings
748                strip=0;
749        fi;
750fi
751
752if [ -z "$systemdsystemunitdir" ]; then
753        if $PKG_CONFIG --exists systemd; then
754                systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
755        fi
756fi
757if [ -n "$systemdsystemunitdir" ]; then
758        if [ "$systemdsystemunitdir" != "no" ]; then
759                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
760        fi
761fi
762
763if [ "$gcov" = "1" ]; then
764        echo "CFLAGS+=--coverage" >> Makefile.settings
765        echo "EFLAGS+=--coverage" >> Makefile.settings
766fi
767
768if [ "$plugins" = 0 ]; then
769        plugindir=""
770        echo '#undef WITH_PLUGINS' >> config.h
771else
772        echo '#define WITH_PLUGINS' >> config.h
773fi
774
775otrprefix=""
776if [ "$otr" = "auto" ]; then
777        ! $PKG_CONFIG --exists libotr
778        otr=$?
779fi
780
781if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
782        exit 1
783fi
784
785if [ "$otr" = 1 ]; then
786        # BI == built-in
787        echo '#define OTR_BI' >> config.h
788        echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
789        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
790        echo 'OTR_BI=otr.o' >> Makefile.settings
791elif [ "$otr" = "plugin" ]; then
792        # for some mysterious reason beyond the comprehension of my mortal mind,
793        # the libgcrypt flags aren't needed when building as plugin. add them anyway.
794        echo '#define OTR_PI' >> config.h
795        echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
796        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
797        echo 'OTR_PI=otr.so' >> Makefile.settings
798fi
799
800if [ -z "$PYTHON" ]; then
801        for pp in python python3 python2; do
802                if which $pp > /dev/null; then
803                        PYTHON=$pp
804                        break
805                fi
806        done
807fi
808
809if [ "$doc" = "1" ]; then
810        # check this here just in case someone tries to install it in python2.4...
811        if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
812                echo
813                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
814                echo "(Use the PYTHON environment variable if it's in a weird location)"
815                exit 1
816        fi
817        echo "DOC=1" >> Makefile.settings
818        echo "PYTHON=$PYTHON" >> Makefile.settings
819fi
820
821get_version
822
823if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
824        echo 'Spoofing version number: '$BITLBEE_VERSION
825        echo '#undef BITLBEE_VERSION' >> config.h
826        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
827        echo
828fi
829
830if ! make helloworld > /dev/null 2>&1; then
831        echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
832        echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
833        echo "under the name 'gmake'."
834        echo
835        if gmake helloworld > /dev/null 2>&1; then
836                echo "gmake seems to be available on your machine, great."
837                echo
838        else
839                echo "gmake is not installed (or not working). Please try to install it."
840                echo
841        fi
842fi
843
844pkgconfiglibs=''
845case "$arch" in
846CYGWIN* )
847        pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined'
848esac
849
850cat <<EOF >bitlbee.pc
851prefix=$prefix
852includedir=$includedir
853plugindir=$plugindir
854libdir=$libdir
855datadir=$datadir
856
857Name: bitlbee
858Description: IRC to IM gateway
859Requires: glib-2.0
860Version: $BITLBEE_VERSION
861Libs: $pkgconfiglibs
862Cflags: -I\${includedir}
863
864EOF
865
866protocols=''
867protoobjs=''
868
869if [ "$purple" = 0 ]; then
870        echo '#undef WITH_PURPLE' >> config.h
871else
872        if ! $PKG_CONFIG purple; then
873                echo
874                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
875                exit 1
876        fi
877        echo '#define WITH_PURPLE' >> config.h
878        cat<<EOF >>Makefile.settings
879EFLAGS += $($PKG_CONFIG purple --libs)
880PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
881EOF
882        protocols=$protocols'purple '
883        protoobjs=$protoobjs'purple_mod.o '
884
885        # only disable these if the user didn't enable them explicitly
886        [ "$jabber" = "default-on" ] && jabber=0
887
888        echo '#undef PACKAGE' >> config.h
889        echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
890       
891        if [ "$events" = "libevent" ]; then
892                echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
893                echo 'outside libpurple, talking to GLib directly. At least for now the combination'
894                echo 'libpurple + libevent is *not* recommended!'
895                echo
896        fi
897fi
898
899case "$CC" in
900*gcc* )
901        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
902        for i in . lib tests protocols protocols/*/; do
903                mkdir -p $i/.depend
904        done
905esac
906
907if [ "$jabber" = 0 ]; then
908        echo '#undef WITH_JABBER' >> config.h
909else
910        echo '#define WITH_JABBER' >> config.h
911        protocols=$protocols'jabber '
912        protoobjs=$protoobjs'jabber_mod.o '
913fi
914
915if [ "$twitter" = 0 ]; then
916        echo '#undef WITH_TWITTER' >> config.h
917else
918        echo '#define WITH_TWITTER' >> config.h
919        protocols=$protocols'twitter '
920        protoobjs=$protoobjs'twitter_mod.o '
921fi
922
923if [ "$protocols" = "PROTOCOLS = " ]; then
924        echo "Warning: You haven't selected any communication protocol to compile!"
925        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
926fi
927
928echo "PROTOCOLS = $protocols" >> Makefile.settings
929echo "PROTOOBJS = $protoobjs" >> Makefile.settings
930
931echo Architecture: $arch
932case "$arch" in
933Linux )
934;;
935GNU/* )
936;;
937*BSD )
938;;
939Darwin )
940        echo 'STRIP=\# skip strip' >> Makefile.settings
941;;
942IRIX )
943;;
944SunOS )
945        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
946        echo 'STRIP=\# skip strip' >> Makefile.settings
947        echo '#define NO_FD_PASSING' >> config.h
948        if [ "$arch_rel" = "5.10" ]; then
949                echo '#define NO_STRCASESTR' >> config.h
950        fi
951;;
952AIX )
953        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
954;;
955CYGWIN* )
956        echo 'EFLAGS+=-Wl,--export-all,--out-implib,libbitlbee.dll.a' >> Makefile.settings
957        echo 'IMPLIB=libbitlbee.dll.a' >> Makefile.settings
958;;
959Windows )
960        echo 'Native windows compilation is not supported anymore, use cygwin instead.'
961;;
962* )
963        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
964        echo 'Please report any problems at http://bugs.bitlbee.org/.'
965;;
966esac
967
968if [ -n "$target" ]; then
969        echo "Cross-compiling for: $target"
970fi
971
972echo
973echo 'Configuration done:'
974
975if [ "$debug" = "1" ]; then
976        echo '  Debugging enabled.'
977else
978        echo '  Debugging disabled.'
979fi
980
981if [ "$asan" = "1" ]; then
982        echo '  AddressSanitizer (ASAN) enabled.'
983else
984        echo '  AddressSanitizer (ASAN) disabled.'
985fi
986
987if [ "$pie" = "1" ]; then
988        echo '  Building PIE executable'
989else
990        echo '  Building non-PIE executable'
991fi
992
993if [ "$strip" = "1" ]; then
994        echo '  Binary stripping enabled.'
995else
996        echo '  Binary stripping disabled.'
997fi
998
999if [ "$otr" = "1" ]; then
1000        echo '  Off-the-Record (OTR) Messaging enabled.'
1001elif [ "$otr" = "plugin" ]; then
1002        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
1003else
1004        echo '  Off-the-Record (OTR) Messaging disabled.'
1005fi
1006
1007if [ -n "$systemdsystemunitdir" ]; then
1008        echo '  systemd enabled.'
1009else
1010        echo '  systemd disabled.'
1011fi
1012
1013echo '  Using python: '$PYTHON
1014
1015if [ "$external_json_parser" = "1" ]; then
1016    echo '  Using system JSON parser.'
1017else
1018    echo '  Using bundled JSON parser.'
1019fi
1020
1021echo '  Using event handler: '$events
1022echo '  Using SSL library: '$ssl
1023#echo '  Building with these storage backends: '$STORAGES
1024
1025if [ -n "$protocols" ]; then
1026        echo '  Building with these protocols:' $protocols$protocols_mods
1027        case "$protocols" in
1028        *purple*)
1029                echo "    Note that BitlBee-libpurple is supported on a best-effort basis. It's"
1030                echo "    not *fully* compatible with normal BitlBee. Don't use it unless you"
1031                echo "    absolutely need it (i.e. support for a certain protocol or feature)."
1032        esac
1033else
1034        echo '  Building without IM-protocol support. We wish you a lot of fun...'
1035fi
Note: See TracBrowser for help on using the repository browser.