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