[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 | |
---|
[34afea7] | 59 | GLIB_MIN_VERSION=2.16 |
---|
[670204f] | 60 | |
---|
[25c4c78] | 61 | # Cygwin and Darwin don't support PIC/PIE |
---|
| 62 | case "$arch" in |
---|
[a85a8ab] | 63 | CYGWIN* ) |
---|
| 64 | pie=0;; |
---|
| 65 | Darwin ) |
---|
| 66 | pie=0;; |
---|
[25c4c78] | 67 | esac |
---|
| 68 | |
---|
[70ec7ab] | 69 | get_version() { |
---|
| 70 | REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/') |
---|
[041777e] | 71 | |
---|
| 72 | if [ -n "$BITLBEE_VERSION" ]; then |
---|
| 73 | # environment variable already set to something to spoof it |
---|
| 74 | # don't replace it with the git stuff |
---|
| 75 | return |
---|
| 76 | fi |
---|
| 77 | |
---|
[70ec7ab] | 78 | BITLBEE_VERSION=$REAL_BITLBEE_VERSION |
---|
| 79 | |
---|
| 80 | if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then |
---|
| 81 | timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g') |
---|
| 82 | branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD) |
---|
| 83 | |
---|
[1d8cbc9] | 84 | search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)' |
---|
[70ec7ab] | 85 | replace="\1+$timestamp+$branch+\2-\3-git" |
---|
| 86 | |
---|
[e28c449] | 87 | describe=$(cd $srcdir; git describe --long --tags 2>/dev/null) |
---|
| 88 | if [ $? -ne 0 ]; then |
---|
| 89 | describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD) |
---|
| 90 | fi |
---|
[70ec7ab] | 91 | |
---|
[c984ee3] | 92 | BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#") |
---|
[e28c449] | 93 | |
---|
| 94 | unset timestamp branch search replace describe |
---|
[70ec7ab] | 95 | fi |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | if [ "$1" = "--dump-version" ]; then |
---|
| 99 | srcdir=$(cd $(dirname $0);pwd) |
---|
| 100 | get_version |
---|
| 101 | echo $BITLBEE_VERSION |
---|
| 102 | exit |
---|
| 103 | fi |
---|
| 104 | |
---|
| 105 | echo BitlBee configure |
---|
| 106 | |
---|
[b7d3cc34] | 107 | while [ -n "$1" ]; do |
---|
[4966712a] | 108 | e="$(expr "X$1" : 'X--\(.*=.*\)')" |
---|
[b7d3cc34] | 109 | if [ -z "$e" ]; then |
---|
| 110 | cat<<EOF |
---|
| 111 | |
---|
| 112 | Usage: $0 [OPTIONS] |
---|
| 113 | |
---|
| 114 | Option Description Default |
---|
| 115 | |
---|
| 116 | --prefix=... Directories to put files in $prefix |
---|
| 117 | --bindir=... $bindir |
---|
[57da960] | 118 | --sbindir=... $sbindir |
---|
[b7d3cc34] | 119 | --etcdir=... $etcdir |
---|
| 120 | --mandir=... $mandir |
---|
| 121 | --datadir=... $datadir |
---|
[7b23afd] | 122 | --plugindir=... $plugindir |
---|
[417002e] | 123 | --systemdsystemunitdir=... $systemdsystemunitdir |
---|
[34b17d9] | 124 | --pidfile=... $pidfile |
---|
[b7d3cc34] | 125 | --config=... $config |
---|
| 126 | |
---|
| 127 | --msn=0/1 Disable/enable MSN part $msn |
---|
| 128 | --jabber=0/1 Disable/enable Jabber part $jabber |
---|
| 129 | --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar |
---|
| 130 | --yahoo=0/1 Disable/enable Yahoo part $yahoo |
---|
[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 |
---|
[56f260a] | 289 | [ -z "$CFLAGS" ] && CFLAGS="-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 | |
---|
| 336 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then |
---|
[670204f] | 337 | if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then |
---|
[b95b0c8] | 338 | cat<<EOF >>Makefile.settings |
---|
[4966712a] | 339 | EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0) |
---|
| 340 | CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0) |
---|
[b7d3cc34] | 341 | EOF |
---|
[670204f] | 342 | else |
---|
| 343 | echo |
---|
[4966712a] | 344 | echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.' |
---|
[670204f] | 345 | exit 1 |
---|
| 346 | fi |
---|
[b7d3cc34] | 347 | else |
---|
[670204f] | 348 | echo |
---|
[574af7e] | 349 | echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)' |
---|
[670204f] | 350 | exit 1 |
---|
[b7d3cc34] | 351 | fi |
---|
| 352 | |
---|
[85cf37f] | 353 | if [ "$events" = "libevent" ]; then |
---|
[003553b] | 354 | if ! [ -f "${libevent}include/event.h" ]; then |
---|
[85cf37f] | 355 | echo |
---|
| 356 | echo 'Warning: Could not find event.h, you might have to install it and/or specify' |
---|
| 357 | echo 'its location using the --libevent= argument. (Example: If event.h is in' |
---|
| 358 | echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)' |
---|
| 359 | fi |
---|
| 360 | |
---|
| 361 | echo '#define EVENTS_LIBEVENT' >> config.h |
---|
[b95b0c8] | 362 | cat <<EOF >>Makefile.settings |
---|
[85cf37f] | 363 | EFLAGS+=-levent -L${libevent}lib |
---|
| 364 | CFLAGS+=-I${libevent}include |
---|
| 365 | EOF |
---|
| 366 | elif [ "$events" = "glib" ]; then |
---|
| 367 | ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...): |
---|
| 368 | echo '#define EVENTS_GLIB' >> config.h |
---|
[b7d3cc34] | 369 | else |
---|
| 370 | echo |
---|
[85cf37f] | 371 | echo 'ERROR: Unknown event handler specified.' |
---|
| 372 | exit 1 |
---|
[b7d3cc34] | 373 | fi |
---|
[85cf37f] | 374 | echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings |
---|
[b7d3cc34] | 375 | |
---|
| 376 | detect_gnutls() |
---|
| 377 | { |
---|
[4af7b4f] | 378 | if $PKG_CONFIG --exists gnutls; then |
---|
[b95b0c8] | 379 | cat <<EOF >>Makefile.settings |
---|
[4966712a] | 380 | EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs) |
---|
| 381 | CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags) |
---|
[4af7b4f] | 382 | EOF |
---|
| 383 | ssl=gnutls |
---|
[a59bd11] | 384 | if ! $PKG_CONFIG gnutls --atleast-version=2.8; then |
---|
[5513f3e] | 385 | echo |
---|
| 386 | echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.' |
---|
| 387 | fi |
---|
[4af7b4f] | 388 | ret=1 |
---|
| 389 | elif libgnutls-config --version > /dev/null 2> /dev/null; then |
---|
[b95b0c8] | 390 | cat <<EOF >>Makefile.settings |
---|
[4966712a] | 391 | EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs) |
---|
| 392 | CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags) |
---|
[b7d3cc34] | 393 | EOF |
---|
| 394 | |
---|
| 395 | ssl=gnutls |
---|
| 396 | ret=1; |
---|
| 397 | else |
---|
| 398 | ret=0; |
---|
| 399 | fi; |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | detect_nss() |
---|
| 403 | { |
---|
[ef043d3] | 404 | if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then |
---|
[b95b0c8] | 405 | cat<<EOF >>Makefile.settings |
---|
[4966712a] | 406 | EFLAGS+=$($PKG_CONFIG --libs nss) |
---|
| 407 | CFLAGS+=$($PKG_CONFIG --cflags nss) |
---|
[b7d3cc34] | 408 | EOF |
---|
| 409 | |
---|
| 410 | ssl=nss |
---|
| 411 | ret=1; |
---|
| 412 | else |
---|
| 413 | ret=0; |
---|
| 414 | fi; |
---|
| 415 | } |
---|
| 416 | |
---|
[36cf9fd] | 417 | RESOLV_TESTCODE=' |
---|
[aee8c19] | 418 | #include <sys/types.h> |
---|
| 419 | #include <netinet/in.h> |
---|
[36cf9fd] | 420 | #include <arpa/nameser.h> |
---|
| 421 | #include <resolv.h> |
---|
| 422 | |
---|
[632627e] | 423 | int main() |
---|
| 424 | { |
---|
| 425 | |
---|
| 426 | res_query( NULL, 0, 0, NULL, 0); |
---|
| 427 | dn_expand( NULL, NULL, NULL, NULL, 0); |
---|
| 428 | dn_skipname( NULL, NULL); |
---|
| 429 | } |
---|
| 430 | ' |
---|
| 431 | RESOLV_NS_TESTCODE=' |
---|
| 432 | #include <sys/types.h> |
---|
| 433 | #include <netinet/in.h> |
---|
| 434 | #include <arpa/nameser.h> |
---|
| 435 | #include <resolv.h> |
---|
| 436 | |
---|
[36cf9fd] | 437 | int main() |
---|
| 438 | { |
---|
| 439 | ns_initparse( NULL, 0, NULL ); |
---|
| 440 | ns_parserr( NULL, ns_s_an, 0, NULL ); |
---|
| 441 | } |
---|
| 442 | ' |
---|
[632627e] | 443 | RESOLV_NS_TYPES_TESTCODE=' |
---|
| 444 | #include <sys/types.h> |
---|
| 445 | #include <netinet/in.h> |
---|
| 446 | #include <arpa/nameser.h> |
---|
| 447 | |
---|
| 448 | int main() |
---|
| 449 | { |
---|
| 450 | ns_msg nsh; |
---|
| 451 | ns_rr rr; |
---|
| 452 | |
---|
[fb87924] | 453 | /* Not all platforms we want to work on have |
---|
| 454 | ns_* routines, so use this to make sure |
---|
| 455 | the compiler uses it.*/ |
---|
| 456 | return (int)(sizeof(nsh) + sizeof(rr)); |
---|
[632627e] | 457 | } |
---|
| 458 | ' |
---|
[36cf9fd] | 459 | |
---|
| 460 | detect_resolv_dynamic() |
---|
| 461 | { |
---|
[aee8c19] | 462 | case "$arch" in |
---|
[632627e] | 463 | OpenBSD ) |
---|
| 464 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
| 465 | LIBRESOLV=;; |
---|
[aee8c19] | 466 | FreeBSD ) |
---|
[632627e] | 467 | # In FreeBSD res_*/dn_* routines are present in libc.so |
---|
| 468 | LIBRESOLV=;; |
---|
| 469 | CYGWIN* ) |
---|
| 470 | # In Cygwin res_*/dn_* routines are present in libc.so |
---|
[aee8c19] | 471 | LIBRESOLV=;; |
---|
| 472 | * ) |
---|
| 473 | LIBRESOLV=-lresolv;; |
---|
| 474 | esac |
---|
[4fca1db] | 475 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 476 | ret=1 |
---|
[aee8c19] | 477 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
[36cf9fd] | 478 | if [ "$?" = "0" ]; then |
---|
[aee8c19] | 479 | echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings |
---|
[8462239] | 480 | ret=0 |
---|
[36cf9fd] | 481 | fi |
---|
| 482 | |
---|
[8462239] | 483 | rm -f $TMPFILE |
---|
| 484 | return $ret |
---|
[36cf9fd] | 485 | } |
---|
| 486 | |
---|
| 487 | detect_resolv_static() |
---|
| 488 | { |
---|
[4fca1db] | 489 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
[8462239] | 490 | ret=1 |
---|
[36cf9fd] | 491 | for i in $systemlibdirs; do |
---|
| 492 | if [ -f $i/libresolv.a ]; then |
---|
[8462239] | 493 | echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[36cf9fd] | 494 | if [ "$?" = "0" ]; then |
---|
| 495 | echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings |
---|
[8462239] | 496 | ret=0 |
---|
[36cf9fd] | 497 | fi |
---|
| 498 | fi |
---|
| 499 | done |
---|
| 500 | |
---|
[8462239] | 501 | rm -f $TMPFILE |
---|
| 502 | return $ret |
---|
[36cf9fd] | 503 | } |
---|
| 504 | |
---|
[632627e] | 505 | detect_resolv_ns_dynamic() |
---|
| 506 | { |
---|
| 507 | case "$arch" in |
---|
| 508 | FreeBSD ) |
---|
| 509 | # In FreeBSD ns_ routines are present in libc.so |
---|
| 510 | LIBRESOLV=;; |
---|
| 511 | * ) |
---|
| 512 | LIBRESOLV=-lresolv;; |
---|
| 513 | esac |
---|
| 514 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 515 | ret=1 |
---|
| 516 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null |
---|
[a67e781] | 517 | if [ "$?" = "0" ]; then |
---|
| 518 | ret=0 |
---|
| 519 | fi |
---|
[632627e] | 520 | |
---|
| 521 | rm -f $TMPFILE |
---|
| 522 | return $ret |
---|
| 523 | } |
---|
| 524 | |
---|
| 525 | detect_resolv_ns_static() |
---|
| 526 | { |
---|
| 527 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 528 | ret=1 |
---|
| 529 | for i in $systemlibdirs; do |
---|
| 530 | if [ -f $i/libresolv.a ]; then |
---|
| 531 | echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null |
---|
[a67e781] | 532 | if [ "$?" = "0" ]; then |
---|
| 533 | ret=0 |
---|
| 534 | fi |
---|
[632627e] | 535 | fi |
---|
| 536 | done |
---|
| 537 | |
---|
| 538 | rm -f $TMPFILE |
---|
| 539 | return $ret |
---|
| 540 | } |
---|
| 541 | |
---|
| 542 | detect_nameser_has_ns_types() |
---|
| 543 | { |
---|
[a67e781] | 544 | TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX) |
---|
| 545 | ret=1 |
---|
| 546 | # since we aren't actually linking with ns_* routines |
---|
| 547 | # we can just compile the test code |
---|
| 548 | echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c - >/dev/null 2>/dev/null |
---|
| 549 | if [ "$?" = "0" ]; then |
---|
| 550 | ret=0 |
---|
| 551 | fi |
---|
| 552 | |
---|
| 553 | rm -f $TMPFILE |
---|
| 554 | return $ret |
---|
[632627e] | 555 | } |
---|
| 556 | |
---|
[b3c467b] | 557 | if [ "$ssl" = "auto" ]; then |
---|
| 558 | detect_gnutls |
---|
[b7d3cc34] | 559 | if [ "$ret" = "0" ]; then |
---|
[c5920df] | 560 | # Disable NSS for now as it's known to not work very well ATM. |
---|
| 561 | #detect_nss |
---|
[191cfb1] | 562 | : |
---|
[b7d3cc34] | 563 | fi |
---|
[b3c467b] | 564 | elif [ "$ssl" = "gnutls" ]; then |
---|
| 565 | detect_gnutls |
---|
| 566 | elif [ "$ssl" = "nss" ]; then |
---|
| 567 | detect_nss |
---|
| 568 | elif [ "$ssl" = "openssl" ]; then |
---|
| 569 | echo |
---|
| 570 | echo 'No detection code exists for OpenSSL. Make sure that you have a complete' |
---|
[b3eee9b] | 571 | echo 'installation of OpenSSL (including devel/header files) before reporting' |
---|
[b3c467b] | 572 | echo 'compilation problems.' |
---|
| 573 | echo |
---|
| 574 | echo 'Also, keep in mind that the OpenSSL is, according to some people, not' |
---|
[b3eee9b] | 575 | echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported' |
---|
| 576 | echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the' |
---|
| 577 | echo 'operating system, which makes it GPL-compatible.' |
---|
[b3c467b] | 578 | echo |
---|
| 579 | echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2' |
---|
| 580 | echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html' |
---|
| 581 | echo |
---|
| 582 | echo 'Please note that distributing a BitlBee binary which links to OpenSSL is' |
---|
| 583 | echo 'probably illegal. If you want to create and distribute a binary BitlBee' |
---|
[b3eee9b] | 584 | echo 'package, you really should use GnuTLS instead.' |
---|
[b3c467b] | 585 | echo |
---|
| 586 | echo 'Also, the OpenSSL license requires us to say this:' |
---|
| 587 | echo ' * "This product includes software developed by the OpenSSL Project' |
---|
| 588 | echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"' |
---|
[b7d3cc34] | 589 | |
---|
[b3c467b] | 590 | echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings |
---|
| 591 | |
---|
| 592 | ret=1 |
---|
| 593 | else |
---|
| 594 | echo |
---|
| 595 | echo 'ERROR: Unknown SSL library specified.' |
---|
| 596 | exit 1 |
---|
[b7d3cc34] | 597 | fi |
---|
| 598 | |
---|
[b3c467b] | 599 | if [ "$ret" = "0" ]; then |
---|
| 600 | echo |
---|
| 601 | echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).' |
---|
| 602 | echo ' Please note that this script doesn'\''t have detection code for OpenSSL,' |
---|
[e1d3f98] | 603 | echo ' so if you want to use that, you have to select it by hand.' |
---|
[b7d3cc34] | 604 | |
---|
[b3c467b] | 605 | exit 1 |
---|
| 606 | fi; |
---|
| 607 | |
---|
| 608 | echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings |
---|
| 609 | |
---|
[632627e] | 610 | if detect_nameser_has_ns_types; then |
---|
| 611 | echo '#define NAMESER_HAS_NS_TYPES' >> config.h |
---|
| 612 | fi |
---|
[36cf9fd] | 613 | if detect_resolv_dynamic || detect_resolv_static; then |
---|
| 614 | echo '#define HAVE_RESOLV_A' >> config.h |
---|
[a67e781] | 615 | if detect_resolv_ns_dynamic || detect_resolv_ns_static; then |
---|
| 616 | echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h |
---|
| 617 | fi |
---|
[632627e] | 618 | else |
---|
[a67e781] | 619 | echo 'Insufficient resolv routines. Jabber server must be set explicitly' |
---|
[36cf9fd] | 620 | fi |
---|
[36e9f62] | 621 | |
---|
[632627e] | 622 | |
---|
[ba7d16f] | 623 | STORAGES="xml" |
---|
[b3c467b] | 624 | |
---|
| 625 | for i in $STORAGES; do |
---|
| 626 | STORAGE_OBJS="$STORAGE_OBJS storage_$i.o" |
---|
| 627 | done |
---|
| 628 | echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings |
---|
| 629 | |
---|
[8e6ecfe] | 630 | authobjs= |
---|
| 631 | authlibs= |
---|
[a6005da] | 632 | if [ "$pam" = 0 ]; then |
---|
| 633 | echo '#undef WITH_PAM' >> config.h |
---|
| 634 | else |
---|
| 635 | if ! echo '#include <security/pam_appl.h>' | $CC -E - >/dev/null 2>/dev/null; then |
---|
| 636 | echo 'Cannot find libpam development libraries, aborting. (Install libpam0g-dev?)' |
---|
| 637 | exit 1 |
---|
| 638 | fi |
---|
| 639 | echo '#define WITH_PAM' >> config.h |
---|
| 640 | authobjs=$authobjs'auth_pam.o ' |
---|
| 641 | authlibs=$authlibs'-lpam ' |
---|
| 642 | fi |
---|
[50bb490] | 643 | if [ "$ldap" = 0 ]; then |
---|
| 644 | echo '#undef WITH_LDAP' >> config.h |
---|
| 645 | else |
---|
| 646 | if ! echo '#include <ldap.h>' | $CC -E - >/dev/null 2>/dev/null; then |
---|
| 647 | echo 'Cannot find libldap development libraries, aborting. (Install libldap2-dev?)' |
---|
| 648 | exit 1 |
---|
| 649 | fi |
---|
| 650 | echo '#define WITH_LDAP' >> config.h |
---|
| 651 | authobjs=$authobjs'auth_ldap.o ' |
---|
| 652 | authlibs=$authlibs'-lldap ' |
---|
| 653 | fi |
---|
[8e6ecfe] | 654 | echo AUTH_OBJS=$authobjs >> Makefile.settings |
---|
| 655 | echo EFLAGS+=$authlibs >> Makefile.settings |
---|
| 656 | |
---|
[b7d3cc34] | 657 | if [ "$strip" = 0 ]; then |
---|
| 658 | echo "STRIP=\# skip strip" >> Makefile.settings; |
---|
| 659 | else |
---|
| 660 | if [ "$debug" = 1 ]; then |
---|
| 661 | echo |
---|
| 662 | echo 'Stripping binaries does not make sense when debugging. Stripping disabled.' |
---|
| 663 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 664 | strip=0; |
---|
| 665 | elif [ -n "$STRIP" ]; then |
---|
| 666 | echo "STRIP=$STRIP" >> Makefile.settings; |
---|
| 667 | elif type strip > /dev/null 2> /dev/null; then |
---|
| 668 | echo "STRIP=strip" >> Makefile.settings; |
---|
| 669 | else |
---|
| 670 | echo |
---|
| 671 | echo 'No strip utility found, cannot remove unnecessary parts from executable.' |
---|
| 672 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
| 673 | strip=0; |
---|
| 674 | fi; |
---|
| 675 | fi |
---|
| 676 | |
---|
[417002e] | 677 | if [ -z "$systemdsystemunitdir" ]; then |
---|
| 678 | if $PKG_CONFIG --exists systemd; then |
---|
[4966712a] | 679 | systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
---|
[417002e] | 680 | fi |
---|
| 681 | fi |
---|
| 682 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 683 | if [ "$systemdsystemunitdir" != "no" ]; then |
---|
| 684 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
---|
| 685 | fi |
---|
| 686 | fi |
---|
| 687 | |
---|
[66b9e86e] | 688 | if [ "$gcov" = "1" ]; then |
---|
[31fc3970] | 689 | echo "CFLAGS+=--coverage" >> Makefile.settings |
---|
| 690 | echo "EFLAGS+=--coverage" >> Makefile.settings |
---|
[66b9e86e] | 691 | fi |
---|
| 692 | |
---|
[2abfbc5] | 693 | if [ "$plugins" = 0 ]; then |
---|
[489847f] | 694 | plugindir="" |
---|
[2abfbc5] | 695 | echo '#undef WITH_PLUGINS' >> config.h |
---|
| 696 | else |
---|
| 697 | echo '#define WITH_PLUGINS' >> config.h |
---|
| 698 | fi |
---|
| 699 | |
---|
[6738a67] | 700 | otrprefix="" |
---|
[764c7d1] | 701 | if [ "$otr" = "auto" ]; then |
---|
[a59bd11] | 702 | ! $PKG_CONFIG --exists libotr |
---|
| 703 | otr=$? |
---|
| 704 | fi |
---|
| 705 | |
---|
| 706 | if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then |
---|
| 707 | exit 1 |
---|
[764c7d1] | 708 | fi |
---|
[a59bd11] | 709 | |
---|
[6738a67] | 710 | if [ "$otr" = 1 ]; then |
---|
[858ea01] | 711 | # BI == built-in |
---|
| 712 | echo '#define OTR_BI' >> config.h |
---|
[872e017] | 713 | echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings |
---|
| 714 | echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings |
---|
[858ea01] | 715 | echo 'OTR_BI=otr.o' >> Makefile.settings |
---|
| 716 | elif [ "$otr" = "plugin" ]; then |
---|
[a59bd11] | 717 | # for some mysterious reason beyond the comprehension of my mortal mind, |
---|
| 718 | # the libgcrypt flags aren't needed when building as plugin. add them anyway. |
---|
[858ea01] | 719 | echo '#define OTR_PI' >> config.h |
---|
[872e017] | 720 | echo "OTRFLAGS=$($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_PI=otr.so' >> Makefile.settings |
---|
[764c7d1] | 723 | fi |
---|
| 724 | |
---|
[17f6079] | 725 | if [ "$skype" = "1" -o "$skype" = "plugin" ]; then |
---|
[b2b7f52] | 726 | if [ "$arch" = "Darwin" ]; then |
---|
| 727 | echo "SKYPEFLAGS=-dynamiclib -undefined dynamic_lookup" >> Makefile.settings |
---|
| 728 | else |
---|
| 729 | echo "SKYPEFLAGS=-fPIC -shared" >> Makefile.settings |
---|
| 730 | fi |
---|
[370899f] | 731 | echo 'SKYPE_PI=skype.so' >> Makefile.settings |
---|
[17f6079] | 732 | protocols_mods="$protocol_mods skype(plugin)" |
---|
[370899f] | 733 | fi |
---|
| 734 | |
---|
[1cef55f] | 735 | if [ -z "$PYTHON" ]; then |
---|
| 736 | PYTHON=python |
---|
| 737 | fi |
---|
| 738 | |
---|
[a85a8ab] | 739 | if [ "$doc" = "1" ]; then |
---|
[beb0f54] | 740 | # check this here just in case someone tries to install it in python2.4... |
---|
[1cef55f] | 741 | if ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then |
---|
[a85a8ab] | 742 | echo |
---|
[beb0f54] | 743 | echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs' |
---|
[1cef55f] | 744 | echo "(Use the PYTHON environment variable if it's in a weird location)" |
---|
[beb0f54] | 745 | exit 1 |
---|
[a85a8ab] | 746 | fi |
---|
[beb0f54] | 747 | echo "DOC=1" >> Makefile.settings |
---|
[1cef55f] | 748 | echo "PYTHON=$PYTHON" >> Makefile.settings |
---|
[ceebeb1] | 749 | fi |
---|
| 750 | |
---|
[70ec7ab] | 751 | get_version |
---|
[e26aa72] | 752 | |
---|
[70ec7ab] | 753 | if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then |
---|
[b7d3cc34] | 754 | echo 'Spoofing version number: '$BITLBEE_VERSION |
---|
| 755 | echo '#undef BITLBEE_VERSION' >> config.h |
---|
[f287f04] | 756 | echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h |
---|
[ffea9b9] | 757 | echo |
---|
[b7d3cc34] | 758 | fi |
---|
| 759 | |
---|
[4fca1db] | 760 | if ! make helloworld > /dev/null 2>&1; then |
---|
| 761 | echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles." |
---|
| 762 | echo "BitlBee needs GNU make to build properly. On most systems GNU make is available" |
---|
| 763 | echo "under the name 'gmake'." |
---|
| 764 | echo |
---|
| 765 | if gmake helloworld > /dev/null 2>&1; then |
---|
| 766 | echo "gmake seems to be available on your machine, great." |
---|
| 767 | echo |
---|
| 768 | else |
---|
| 769 | echo "gmake is not installed (or not working). Please try to install it." |
---|
| 770 | echo |
---|
| 771 | fi |
---|
| 772 | fi |
---|
| 773 | |
---|
[b95b0c8] | 774 | cat <<EOF >bitlbee.pc |
---|
[e506d6c] | 775 | prefix=$prefix |
---|
| 776 | includedir=$includedir |
---|
[489847f] | 777 | plugindir=$plugindir |
---|
[e506d6c] | 778 | |
---|
| 779 | Name: bitlbee |
---|
| 780 | Description: IRC to IM gateway |
---|
| 781 | Requires: glib-2.0 |
---|
| 782 | Version: $BITLBEE_VERSION |
---|
| 783 | Libs: |
---|
| 784 | Cflags: -I\${includedir} |
---|
| 785 | |
---|
| 786 | EOF |
---|
| 787 | |
---|
[b7d3cc34] | 788 | protocols='' |
---|
| 789 | protoobjs='' |
---|
| 790 | |
---|
[e248c7f] | 791 | if [ "$purple" = 0 ]; then |
---|
| 792 | echo '#undef WITH_PURPLE' >> config.h |
---|
| 793 | else |
---|
[e08e53c] | 794 | if ! $PKG_CONFIG purple; then |
---|
| 795 | echo |
---|
| 796 | echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)' |
---|
| 797 | exit 1 |
---|
| 798 | fi |
---|
[e248c7f] | 799 | echo '#define WITH_PURPLE' >> config.h |
---|
[b95b0c8] | 800 | cat<<EOF >>Makefile.settings |
---|
[e08e53c] | 801 | EFLAGS += $($PKG_CONFIG purple --libs) |
---|
| 802 | PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags) |
---|
| 803 | EOF |
---|
[e248c7f] | 804 | protocols=$protocols'purple ' |
---|
| 805 | protoobjs=$protoobjs'purple_mod.o ' |
---|
| 806 | |
---|
[04e2a05] | 807 | # only disable these if the user didn't enable them explicitly |
---|
| 808 | [ "$msn" = "default-on" ] && msn=0 |
---|
| 809 | [ "$jabber" = "default-on" ] && jabber=0 |
---|
| 810 | [ "$oscar" = "default-on" ] && oscar=0 |
---|
| 811 | [ "$yahoo" = "default-on" ] && yahoo=0 |
---|
[18e1f3b] | 812 | |
---|
| 813 | echo '#undef PACKAGE' >> config.h |
---|
| 814 | echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h |
---|
[bda2975] | 815 | |
---|
| 816 | if [ "$events" = "libevent" ]; then |
---|
| 817 | echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling' |
---|
| 818 | echo 'outside libpurple, talking to GLib directly. At least for now the combination' |
---|
| 819 | echo 'libpurple + libevent is *not* recommended!' |
---|
[c775a58] | 820 | echo |
---|
[bda2975] | 821 | fi |
---|
[e248c7f] | 822 | fi |
---|
| 823 | |
---|
[b0a89cc] | 824 | case "$CC" in |
---|
| 825 | *gcc* ) |
---|
[e371011] | 826 | echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings |
---|
[fe92921] | 827 | for i in . lib tests protocols protocols/*/; do |
---|
[b0a89cc] | 828 | mkdir -p $i/.depend |
---|
| 829 | done |
---|
| 830 | esac |
---|
| 831 | |
---|
[b7d3cc34] | 832 | if [ "$msn" = 0 ]; then |
---|
| 833 | echo '#undef WITH_MSN' >> config.h |
---|
| 834 | else |
---|
| 835 | echo '#define WITH_MSN' >> config.h |
---|
| 836 | protocols=$protocols'msn ' |
---|
[b5a22e3] | 837 | protoobjs=$protoobjs'msn_mod.o ' |
---|
[b7d3cc34] | 838 | fi |
---|
| 839 | |
---|
| 840 | if [ "$jabber" = 0 ]; then |
---|
| 841 | echo '#undef WITH_JABBER' >> config.h |
---|
| 842 | else |
---|
| 843 | echo '#define WITH_JABBER' >> config.h |
---|
| 844 | protocols=$protocols'jabber ' |
---|
[b5a22e3] | 845 | protoobjs=$protoobjs'jabber_mod.o ' |
---|
[b7d3cc34] | 846 | fi |
---|
| 847 | |
---|
| 848 | if [ "$oscar" = 0 ]; then |
---|
| 849 | echo '#undef WITH_OSCAR' >> config.h |
---|
| 850 | else |
---|
| 851 | echo '#define WITH_OSCAR' >> config.h |
---|
| 852 | protocols=$protocols'oscar ' |
---|
[b5a22e3] | 853 | protoobjs=$protoobjs'oscar_mod.o ' |
---|
[b7d3cc34] | 854 | fi |
---|
| 855 | |
---|
| 856 | if [ "$yahoo" = 0 ]; then |
---|
| 857 | echo '#undef WITH_YAHOO' >> config.h |
---|
| 858 | else |
---|
| 859 | echo '#define WITH_YAHOO' >> config.h |
---|
| 860 | protocols=$protocols'yahoo ' |
---|
[b5a22e3] | 861 | protoobjs=$protoobjs'yahoo_mod.o ' |
---|
[b7d3cc34] | 862 | fi |
---|
| 863 | |
---|
[1b221e0] | 864 | if [ "$twitter" = 0 ]; then |
---|
| 865 | echo '#undef WITH_TWITTER' >> config.h |
---|
| 866 | else |
---|
| 867 | echo '#define WITH_TWITTER' >> config.h |
---|
| 868 | protocols=$protocols'twitter ' |
---|
| 869 | protoobjs=$protoobjs'twitter_mod.o ' |
---|
| 870 | fi |
---|
| 871 | |
---|
[b7d3cc34] | 872 | if [ "$protocols" = "PROTOCOLS = " ]; then |
---|
[43462708] | 873 | echo "Warning: You haven't selected any communication protocol to compile!" |
---|
[b3c467b] | 874 | echo " BitlBee will run, but you will be unable to connect to IM servers!" |
---|
[b7d3cc34] | 875 | fi |
---|
| 876 | |
---|
| 877 | echo "PROTOCOLS = $protocols" >> Makefile.settings |
---|
| 878 | echo "PROTOOBJS = $protoobjs" >> Makefile.settings |
---|
| 879 | |
---|
| 880 | echo Architecture: $arch |
---|
| 881 | case "$arch" in |
---|
| 882 | Linux ) |
---|
| 883 | ;; |
---|
| 884 | GNU/* ) |
---|
| 885 | ;; |
---|
| 886 | *BSD ) |
---|
| 887 | ;; |
---|
| 888 | Darwin ) |
---|
[caceb06] | 889 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[b7d3cc34] | 890 | ;; |
---|
| 891 | IRIX ) |
---|
| 892 | ;; |
---|
| 893 | SunOS ) |
---|
| 894 | echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings |
---|
| 895 | echo 'STRIP=\# skip strip' >> Makefile.settings |
---|
[70d7795] | 896 | echo '#define NO_FD_PASSING' >> config.h |
---|
[b7d3cc34] | 897 | ;; |
---|
[8de63c3] | 898 | AIX ) |
---|
| 899 | echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings |
---|
[b7d3cc34] | 900 | ;; |
---|
| 901 | CYGWIN* ) |
---|
| 902 | ;; |
---|
[aec56b0] | 903 | Windows ) |
---|
[e252d8c] | 904 | echo 'Native windows compilation is not supported anymore, use cygwin instead.' |
---|
[aec56b0] | 905 | ;; |
---|
[b7d3cc34] | 906 | * ) |
---|
[8d6c4b1] | 907 | echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.' |
---|
| 908 | echo 'Please report any problems at http://bugs.bitlbee.org/.' |
---|
[b7d3cc34] | 909 | ;; |
---|
| 910 | esac |
---|
| 911 | |
---|
[f1e7407] | 912 | if [ -n "$target" ]; then |
---|
| 913 | echo "Cross-compiling for: $target" |
---|
| 914 | fi |
---|
| 915 | |
---|
[b7d3cc34] | 916 | echo |
---|
| 917 | echo 'Configuration done:' |
---|
| 918 | |
---|
| 919 | if [ "$debug" = "1" ]; then |
---|
[b3c467b] | 920 | echo ' Debugging enabled.' |
---|
[b7d3cc34] | 921 | else |
---|
[b3c467b] | 922 | echo ' Debugging disabled.' |
---|
[b7d3cc34] | 923 | fi |
---|
| 924 | |
---|
[e2472dd] | 925 | if [ "$asan" = "1" ]; then |
---|
| 926 | echo ' AddressSanitizer (ASAN) enabled.' |
---|
| 927 | else |
---|
| 928 | echo ' AddressSanitizer (ASAN) disabled.' |
---|
| 929 | fi |
---|
| 930 | |
---|
[7281ad1] | 931 | if [ "$pie" = "1" ]; then |
---|
| 932 | echo ' Building PIE executable' |
---|
| 933 | else |
---|
| 934 | echo ' Building non-PIE executable' |
---|
| 935 | fi |
---|
| 936 | |
---|
[b7d3cc34] | 937 | if [ "$strip" = "1" ]; then |
---|
[b3c467b] | 938 | echo ' Binary stripping enabled.' |
---|
[b7d3cc34] | 939 | else |
---|
[b3c467b] | 940 | echo ' Binary stripping disabled.' |
---|
[b7d3cc34] | 941 | fi |
---|
| 942 | |
---|
[764c7d1] | 943 | if [ "$otr" = "1" ]; then |
---|
| 944 | echo ' Off-the-Record (OTR) Messaging enabled.' |
---|
[858ea01] | 945 | elif [ "$otr" = "plugin" ]; then |
---|
| 946 | echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).' |
---|
[764c7d1] | 947 | else |
---|
| 948 | echo ' Off-the-Record (OTR) Messaging disabled.' |
---|
| 949 | fi |
---|
| 950 | |
---|
[417002e] | 951 | if [ -n "$systemdsystemunitdir" ]; then |
---|
| 952 | echo ' systemd enabled.' |
---|
| 953 | else |
---|
| 954 | echo ' systemd disabled.' |
---|
| 955 | fi |
---|
| 956 | |
---|
[b3c467b] | 957 | echo ' Using event handler: '$events |
---|
| 958 | echo ' Using SSL library: '$ssl |
---|
[4e3df8a] | 959 | #echo ' Building with these storage backends: '$STORAGES |
---|
[b7d3cc34] | 960 | |
---|
| 961 | if [ -n "$protocols" ]; then |
---|
[17f6079] | 962 | echo ' Building with these protocols:' $protocols$protocols_mods |
---|
[4e3df8a] | 963 | case "$protocols" in |
---|
| 964 | *purple*) |
---|
| 965 | echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's" |
---|
| 966 | echo " not *fully* compatible with normal BitlBee. Don't use it unless you" |
---|
| 967 | echo " absolutely need it (i.e. support for a certain protocol or feature)." |
---|
| 968 | esac |
---|
[b7d3cc34] | 969 | else |
---|
[b3c467b] | 970 | echo ' Building without IM-protocol support. We wish you a lot of fun...' |
---|
[b7d3cc34] | 971 | fi |
---|