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