Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r8e5751e r2f8e3ca  
    1616config='/var/lib/bitlbee/'
    1717plugindir='$prefix/lib/bitlbee/'
    18 rpcplugindir='$plugindir/rpc/'
    1918includedir='$prefix/include/bitlbee/'
    2019systemdsystemunitdir=''
     
    2423pcdir='$prefix/lib/pkgconfig'
    2524systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
     25sysroot=''
     26
     27configure_args="$@"
    2628
    2729# Set these to default-on to let it be overriden by either the user or purple
     
    3739twitter=1
    3840purple=0
    39 rpc=1
    4041
    4142doc=1
     
    5354pie=1
    5455
    55 arch=`uname -s`
    56 cpu=`uname -m`
     56arch=$(uname -s)
     57cpu=$(uname -m)
    5758
    5859GLIB_MIN_VERSION=2.16
     
    105106
    106107while [ -n "$1" ]; do
    107         e="`expr "X$1" : 'X--\(.*=.*\)'`"
     108        e="$(expr "X$1" : 'X--\(.*=.*\)')"
    108109        if [ -z "$e" ]; then
    109110                cat<<EOF
     
    120121--datadir=...                                           $datadir
    121122--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
    136135
    137136--doc=0/1       Disable/enable help.txt generation      $doc
     
    153152
    154153--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 rpcplugindir=$(eval echo "$rpcplugindir/" | sed 's/\/\{1,\}/\//g')
    171 includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
    172 libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
    173 
    174 pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
    175 ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
    176 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')
     170includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g')
     171libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g')
     172
     173pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g')
     174ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g')
     175pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g')
    177176
    178177protocols_mods=""
     
    180179cat <<EOF >Makefile.settings
    181180## BitlBee settings, generated by configure
     181
     182# ./configure $configure_args
     183
    182184PREFIX=$prefix
    183185BINDIR=$bindir
     
    187189DATADIR=$datadir
    188190PLUGINDIR=$plugindir
    189 RPCPLUGINDIR=$rpcplugindir
    190191CONFIG=$config
    191192INCLUDEDIR=$includedir
     
    233234   of them can/will be overridden at run-time */
    234235
     236#define BITLBEE_CONFIGURE_ARGS "$configure_args"
     237
    235238#define CONFIG "$config"
    236239#define ETCDIR "$etcdir"
    237240#define VARDIR "$datadir"
    238241#define PLUGINDIR "$plugindir"
    239 #define RPCPLUGINDIR "$rpcplugindir"
    240242#define PIDFILE "$pidfile"
    241243#define IPCSOCKET "$ipcsocket"
     
    247249
    248250if [ -n "$target" ]; then
    249         PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
    250         export PKG_CONFIG_LIBDIR
    251         PATH=/usr/$target/bin:$PATH
     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
    252275        CC=$target-cc
    253276        LD=$target-ld
    254         systemlibdirs="/usr/$target/lib"
     277        STRIP=$target-strip
    255278fi
    256279
     
    259282        LDFLAGS="$LDFLAGS -fsanitize=address"
    260283        debug=1
    261 fi
    262 
    263 if [ "$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!"
    267284fi
    268285
     
    321338        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
    322339                cat<<EOF >>Makefile.settings
    323 EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
    324 CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
     340EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
     341CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
    325342EOF
    326343        else
    327344                echo
    328                 echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
     345                echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
    329346                exit 1
    330347        fi
     
    362379        if $PKG_CONFIG --exists gnutls; then
    363380                cat <<EOF >>Makefile.settings
    364 EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
    365 CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
     381EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
     382CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
    366383EOF
    367384                ssl=gnutls
    368                 if ! pkg-config gnutls --atleast-version=2.8; then
     385                if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
    369386                        echo
    370387                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
     
    373390        elif libgnutls-config --version > /dev/null 2> /dev/null; then
    374391                cat <<EOF >>Makefile.settings
    375 EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
    376 CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
     392EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
     393CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
    377394EOF
    378395               
     
    388405        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
    389406                cat<<EOF >>Makefile.settings
    390 EFLAGS+=`$PKG_CONFIG --libs nss`
    391 CFLAGS+=`$PKG_CONFIG --cflags nss`
     407EFLAGS+=$($PKG_CONFIG --libs nss)
     408CFLAGS+=$($PKG_CONFIG --cflags nss)
    392409EOF
    393410               
     
    634651if [ -z "$systemdsystemunitdir" ]; then
    635652        if $PKG_CONFIG --exists systemd; then
    636                 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
     653                systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
    637654        fi
    638655fi
     
    655672fi
    656673
    657 if [ "$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=""
    661 fi
    662 
    663674otrprefix=""
    664 for i in / /usr /usr/local; do
    665         if [ -f ${i}/lib/libotr.a ]; then
    666                 otrprefix=${i}
    667                 break
    668         fi
    669 done
    670675if [ "$otr" = "auto" ]; then
    671         if [ -n "$otrprefix" ]; then
    672                 otr=1
    673         else
    674                 otr=0
    675         fi
    676 fi
     676        ! $PKG_CONFIG --exists libotr
     677        otr=$?
     678fi
     679
     680if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
     681        exit 1
     682fi
     683
    677684if [ "$otr" = 1 ]; then
    678685        # BI == built-in
    679686        echo '#define OTR_BI' >> config.h
    680         echo "EFLAGS+=-L${otrprefix}/lib -lotr -lgcrypt" >> Makefile.settings
    681         echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
     687        echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
     688        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
    682689        echo 'OTR_BI=otr.o' >> Makefile.settings
    683690elif [ "$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.
    684693        echo '#define OTR_PI' >> config.h
    685         echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
    686         echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
     694        echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
     695        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
    687696        echo 'OTR_PI=otr.so' >> Makefile.settings
    688 fi
    689 if [ "$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...
    694697fi
    695698
     
    747750includedir=$includedir
    748751plugindir=$plugindir
    749 rpcplugindir=$rpcplugindir
    750752
    751753Name: bitlbee
     
    840842        protocols=$protocols'twitter '
    841843        protoobjs=$protoobjs'twitter_mod.o '
    842 fi
    843 
    844 if [ "$rpc" = 0 ]; then
    845         echo '#undef WITH_RPC' >> config.h
    846 else
    847         echo '#define WITH_RPC' >> config.h
    848         protocols=$protocols'rpc '
    849         protoobjs=$protoobjs'rpc_mod.o '
    850844fi
    851845
     
    937931echo '  Using event handler: '$events
    938932echo '  Using SSL library: '$ssl
     933#echo '  Building with these storage backends: '$STORAGES
    939934
    940935if [ -n "$protocols" ]; then
Note: See TracChangeset for help on using the changeset viewer.