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