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