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