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