Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r2f8e3ca r8e5751e  
    1616config='/var/lib/bitlbee/'
    1717plugindir='$prefix/lib/bitlbee/'
     18rpcplugindir='$plugindir/rpc/'
    1819includedir='$prefix/include/bitlbee/'
    1920systemdsystemunitdir=''
     
    2324pcdir='$prefix/lib/pkgconfig'
    2425systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
    25 sysroot=''
    26 
    27 configure_args="$@"
    2826
    2927# Set these to default-on to let it be overriden by either the user or purple
     
    3937twitter=1
    4038purple=0
     39rpc=1
    4140
    4241doc=1
     
    5453pie=1
    5554
    56 arch=$(uname -s)
    57 cpu=$(uname -m)
     55arch=`uname -s`
     56cpu=`uname -m`
    5857
    5958GLIB_MIN_VERSION=2.16
     
    106105
    107106while [ -n "$1" ]; do
    108         e="$(expr "X$1" : 'X--\(.*=.*\)')"
     107        e="`expr "X$1" : 'X--\(.*=.*\)'`"
    109108        if [ -z "$e" ]; then
    110109                cat<<EOF
     
    121120--datadir=...                                           $datadir
    122121--plugindir=...                                         $plugindir
     122--rpcplugindir=...                                      $rpcplugindir
    123123--systemdsystemunitdir=...                              $systemdsystemunitdir
    124124--pidfile=...                                           $pidfile
     
    133133--purple=0/1    Disable/enable libpurple support        $purple
    134134                (automatically disables other protocol modules)
     135--rpc=0/1       Disable/enable RPC plugin interface     $rpc
    135136
    136137--doc=0/1       Disable/enable help.txt generation      $doc
     
    152153
    153154--target=...    Cross compilation target                same as host
    154 --sysroot=...   Cross compilation sysroot               $sysroot
    155155EOF
    156156                exit;
     
    161161
    162162# Expand $prefix and get rid of double slashes
    163 bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g')
    164 sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g')
    165 etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g')
    166 mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g')
    167 datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g')
    168 config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g')
    169 plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
    170 includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g')
    171 libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g')
    172 
    173 pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g')
    174 ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g')
    175 pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g')
     163bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
     164sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'`
     165etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
     166mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
     167datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
     168config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
     169plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
     170rpcplugindir=$(eval echo "$rpcplugindir/" | sed 's/\/\{1,\}/\//g')
     171includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
     172libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
     173
     174pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
     175ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
     176pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
    176177
    177178protocols_mods=""
     
    179180cat <<EOF >Makefile.settings
    180181## BitlBee settings, generated by configure
    181 
    182 # ./configure $configure_args
    183 
    184182PREFIX=$prefix
    185183BINDIR=$bindir
     
    189187DATADIR=$datadir
    190188PLUGINDIR=$plugindir
     189RPCPLUGINDIR=$rpcplugindir
    191190CONFIG=$config
    192191INCLUDEDIR=$includedir
     
    234233   of them can/will be overridden at run-time */
    235234
    236 #define BITLBEE_CONFIGURE_ARGS "$configure_args"
    237 
    238235#define CONFIG "$config"
    239236#define ETCDIR "$etcdir"
    240237#define VARDIR "$datadir"
    241238#define PLUGINDIR "$plugindir"
     239#define RPCPLUGINDIR "$rpcplugindir"
    242240#define PIDFILE "$pidfile"
    243241#define IPCSOCKET "$ipcsocket"
     
    249247
    250248if [ -n "$target" ]; then
    251         # prepend sysroot to system lib dirs
    252 
    253         systemlibdirs_cross=''
    254         for i in $systemlibdirs; do
    255                 systemlibdirs_cross="$systemlibdirs_cross $sysroot$i"
    256         done
    257         systemlibdirs=$systemlibdirs_cross
    258         unset systemlibdirs_cross
    259 
    260         # backward compatibility
    261 
    262         if [ -z "$PKG_CONFIG_LIBDIR" ]; then
    263                 PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
    264                 export PKG_CONFIG_LIBDIR
    265         fi
    266 
    267         if [ -d /usr/$target/bin ]; then
    268                 PATH=/usr/$target/bin:$PATH
    269         fi
    270 
    271         if [ -d /usr/$target/lib ]; then
    272                 systemlibdirs="$systemlibdirs /usr/$target/lib"
    273         fi
    274 
     249        PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
     250        export PKG_CONFIG_LIBDIR
     251        PATH=/usr/$target/bin:$PATH
    275252        CC=$target-cc
    276253        LD=$target-ld
    277         STRIP=$target-strip
     254        systemlibdirs="/usr/$target/lib"
    278255fi
    279256
     
    282259        LDFLAGS="$LDFLAGS -fsanitize=address"
    283260        debug=1
     261fi
     262
     263if [ "$tsan" = "1" ]; then
     264        echo
     265        echo "Threaded BitlBee? Have a nice tall glass of http://imgur.com/gallery/tX4qxzS"
     266        echo "No need to sanitise threads in a single-threaded process!"
    284267fi
    285268
     
    338321        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
    339322                cat<<EOF >>Makefile.settings
    340 EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
    341 CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
     323EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
     324CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
    342325EOF
    343326        else
    344327                echo
    345                 echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
     328                echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
    346329                exit 1
    347330        fi
     
    379362        if $PKG_CONFIG --exists gnutls; then
    380363                cat <<EOF >>Makefile.settings
    381 EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
    382 CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
     364EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
     365CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
    383366EOF
    384367                ssl=gnutls
    385                 if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
     368                if ! pkg-config gnutls --atleast-version=2.8; then
    386369                        echo
    387370                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
     
    390373        elif libgnutls-config --version > /dev/null 2> /dev/null; then
    391374                cat <<EOF >>Makefile.settings
    392 EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
    393 CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
     375EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
     376CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
    394377EOF
    395378               
     
    405388        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
    406389                cat<<EOF >>Makefile.settings
    407 EFLAGS+=$($PKG_CONFIG --libs nss)
    408 CFLAGS+=$($PKG_CONFIG --cflags nss)
     390EFLAGS+=`$PKG_CONFIG --libs nss`
     391CFLAGS+=`$PKG_CONFIG --cflags nss`
    409392EOF
    410393               
     
    651634if [ -z "$systemdsystemunitdir" ]; then
    652635        if $PKG_CONFIG --exists systemd; then
    653                 systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
     636                systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
    654637        fi
    655638fi
     
    672655fi
    673656
     657if [ "$rpc" = 0 ]; then
     658        # Somewhat pointless at this stage already but at least this keeps it
     659        # out of bitlbee.pc which is probably a good thing.
     660        rpcplugindir=""
     661fi
     662
    674663otrprefix=""
     664for i in / /usr /usr/local; do
     665        if [ -f ${i}/lib/libotr.a ]; then
     666                otrprefix=${i}
     667                break
     668        fi
     669done
    675670if [ "$otr" = "auto" ]; then
    676         ! $PKG_CONFIG --exists libotr
    677         otr=$?
    678 fi
    679 
    680 if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
    681         exit 1
    682 fi
    683 
     671        if [ -n "$otrprefix" ]; then
     672                otr=1
     673        else
     674                otr=0
     675        fi
     676fi
    684677if [ "$otr" = 1 ]; then
    685678        # BI == built-in
    686679        echo '#define OTR_BI' >> config.h
    687         echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
    688         echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
     680        echo "EFLAGS+=-L${otrprefix}/lib -lotr -lgcrypt" >> Makefile.settings
     681        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
    689682        echo 'OTR_BI=otr.o' >> Makefile.settings
    690683elif [ "$otr" = "plugin" ]; then
    691         # for some mysterious reason beyond the comprehension of my mortal mind,
    692         # the libgcrypt flags aren't needed when building as plugin. add them anyway.
    693684        echo '#define OTR_PI' >> config.h
    694         echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
    695         echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
     685        echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
     686        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
    696687        echo 'OTR_PI=otr.so' >> Makefile.settings
     688fi
     689if [ "$otr" != 0 ] && ! pkg-config libotr --atleast-version=4.0; then
     690        echo
     691        echo 'WARNING: Your libotr seems to be old. BitlBee now needs at least libotr 4.0.'
     692        # Not hard-failing because the code above doesn't use pkg-config, so who knows
     693        # what's true at this point...
    697694fi
    698695
     
    750747includedir=$includedir
    751748plugindir=$plugindir
     749rpcplugindir=$rpcplugindir
    752750
    753751Name: bitlbee
     
    842840        protocols=$protocols'twitter '
    843841        protoobjs=$protoobjs'twitter_mod.o '
     842fi
     843
     844if [ "$rpc" = 0 ]; then
     845        echo '#undef WITH_RPC' >> config.h
     846else
     847        echo '#define WITH_RPC' >> config.h
     848        protocols=$protocols'rpc '
     849        protoobjs=$protoobjs'rpc_mod.o '
    844850fi
    845851
     
    931937echo '  Using event handler: '$events
    932938echo '  Using SSL library: '$ssl
    933 #echo '  Building with these storage backends: '$STORAGES
    934939
    935940if [ -n "$protocols" ]; then
Note: See TracChangeset for help on using the changeset viewer.