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