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