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