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