PageRenderTime 60ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/bitlbee-3.0.5/configure

#
Shell | 789 lines | 662 code | 96 blank | 31 comment | 81 complexity | 51c47f6b7255b379bca7fc832f4abf87 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. #!/bin/sh
  2. ##############################
  3. ## Configurer for BitlBee ##
  4. ## ##
  5. ## Copyright 2004 Lintux ##
  6. ## Copyright 2002 Lucumo ##
  7. ##############################
  8. prefix='/usr/local/'
  9. bindir='$prefix/bin/'
  10. sbindir='$prefix/sbin/'
  11. etcdir='$prefix/etc/bitlbee/'
  12. mandir='$prefix/share/man/'
  13. datadir='$prefix/share/bitlbee/'
  14. config='/var/lib/bitlbee/'
  15. plugindir='$prefix/lib/bitlbee/'
  16. includedir='$prefix/include/bitlbee/'
  17. systemdsystemunitdir=''
  18. libevent='/usr/'
  19. pidfile='/var/run/bitlbee.pid'
  20. ipcsocket=''
  21. pcdir='$prefix/lib/pkgconfig'
  22. systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
  23. msn=1
  24. jabber=1
  25. oscar=1
  26. yahoo=1
  27. twitter=1
  28. purple=0
  29. debug=0
  30. strip=1
  31. gcov=0
  32. plugins=1
  33. otr=0
  34. skype=0
  35. events=glib
  36. ldap=0
  37. ssl=auto
  38. arch=`uname -s`
  39. cpu=`uname -m`
  40. GLIB_MIN_VERSION=2.4
  41. echo BitlBee configure
  42. while [ -n "$1" ]; do
  43. e="`expr "X$1" : 'X--\(.*=.*\)'`"
  44. if [ -z "$e" ]; then
  45. cat<<EOF
  46. Usage: $0 [OPTIONS]
  47. Option Description Default
  48. --prefix=... Directories to put files in $prefix
  49. --bindir=... $bindir
  50. --sbindir=... $sbindir
  51. --etcdir=... $etcdir
  52. --mandir=... $mandir
  53. --datadir=... $datadir
  54. --plugindir=... $plugindir
  55. --systemdsystemunitdir=... $systemdsystemunitdir
  56. --pidfile=... $pidfile
  57. --config=... $config
  58. --msn=0/1 Disable/enable MSN part $msn
  59. --jabber=0/1 Disable/enable Jabber part $jabber
  60. --oscar=0/1 Disable/enable Oscar part (ICQ, AIM) $oscar
  61. --yahoo=0/1 Disable/enable Yahoo part $yahoo
  62. --twitter=0/1 Disable/enable Twitter part $twitter
  63. --purple=0/1 Disable/enable libpurple support $purple
  64. (automatically disables other protocol modules)
  65. --debug=0/1 Disable/enable debugging $debug
  66. --strip=0/1 Disable/enable binary stripping $strip
  67. --gcov=0/1 Disable/enable test coverage reporting $gcov
  68. --plugins=0/1 Disable/enable plugins support $plugins
  69. --otr=0/1/auto/plugin
  70. Disable/enable OTR encryption support $otr
  71. --skype=0/1/plugin
  72. Disable/enable Skype support $skype
  73. --events=... Event handler (glib, libevent) $events
  74. --ssl=... SSL library to use (gnutls, nss, openssl, bogus, auto)
  75. $ssl
  76. --target=... Cross compilation target same as host
  77. EOF
  78. exit;
  79. fi
  80. eval "$e"
  81. shift;
  82. done
  83. # Expand $prefix and get rid of double slashes
  84. bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
  85. sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'`
  86. etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
  87. mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
  88. datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
  89. config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
  90. plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
  91. includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
  92. libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
  93. pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
  94. ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
  95. pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
  96. protocols_mods=""
  97. cat<<EOF>Makefile.settings
  98. ## BitlBee settings, generated by configure
  99. PREFIX=$prefix
  100. BINDIR=$bindir
  101. SBINDIR=$sbindir
  102. ETCDIR=$etcdir
  103. MANDIR=$mandir
  104. DATADIR=$datadir
  105. PLUGINDIR=$plugindir
  106. CONFIG=$config
  107. INCLUDEDIR=$includedir
  108. PCDIR=$pcdir
  109. TARGET=$target
  110. ARCH=$arch
  111. CPU=$cpu
  112. INSTALL=install -p
  113. DESTDIR=
  114. LFLAGS=
  115. EFLAGS=
  116. EOF
  117. srcdir=$(cd $(dirname $0);pwd)
  118. currdir=$(pwd)
  119. if [ "$srcdir" != "$currdir" ]; then
  120. echo
  121. echo "configure script run from a different directory. Will create some symlinks..."
  122. if [ ! -e Makefile -o -L Makefile ]; then
  123. COPYDIRS="doc lib protocols tests utils"
  124. mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
  125. find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
  126. dst="$PWD"
  127. cd "$srcdir"
  128. for i in $(find . -name Makefile -type f); do
  129. ln -s "$PWD${i#.}" "$dst/$i";
  130. done
  131. cd "$dst"
  132. rm -rf .bzr
  133. fi
  134. echo "_SRCDIR_=$srcdir/" >> Makefile.settings
  135. CFLAGS="$CFLAGS -I${dst}"
  136. else
  137. srcdir=$PWD
  138. fi
  139. cat<<EOF>config.h
  140. /* BitlBee settings, generated by configure
  141. Do *NOT* use any of these defines in your code without thinking twice, most
  142. of them can/will be overridden at run-time */
  143. #define CONFIG "$config"
  144. #define ETCDIR "$etcdir"
  145. #define VARDIR "$datadir"
  146. #define PLUGINDIR "$plugindir"
  147. #define PIDFILE "$pidfile"
  148. #define IPCSOCKET "$ipcsocket"
  149. #define ARCH "$arch"
  150. #define CPU "$cpu"
  151. EOF
  152. if [ -n "$target" ]; then
  153. PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
  154. export PKG_CONFIG_LIBDIR
  155. PATH=/usr/$target/bin:$PATH
  156. CC=$target-cc
  157. LD=$target-ld
  158. systemlibdirs="/usr/$target/lib"
  159. fi
  160. if [ "$debug" = "1" ]; then
  161. [ -z "$CFLAGS" ] && CFLAGS=-g
  162. echo 'DEBUG=1' >> Makefile.settings
  163. CFLAGS="$CFLAGS -DDEBUG"
  164. else
  165. [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
  166. fi
  167. echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
  168. echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
  169. echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
  170. if [ -n "$CC" ]; then
  171. CC=$CC
  172. elif type gcc > /dev/null 2> /dev/null; then
  173. CC=gcc
  174. elif type cc > /dev/null 2> /dev/null; then
  175. CC=cc
  176. else
  177. echo 'Cannot find a C compiler, aborting.'
  178. exit 1;
  179. fi
  180. echo "CC=$CC" >> Makefile.settings;
  181. if echo $CC | grep -qw gcc; then
  182. # Apparently -Wall is gcc-specific?
  183. echo CFLAGS+=-Wall >> Makefile.settings
  184. fi
  185. if [ -z "$LD" ]; then
  186. if type ld > /dev/null 2> /dev/null; then
  187. LD=ld
  188. else
  189. echo 'Cannot find ld, aborting.'
  190. exit 1;
  191. fi
  192. fi
  193. echo "LD=$LD" >> Makefile.settings
  194. if [ -z "$PKG_CONFIG" ]; then
  195. PKG_CONFIG=pkg-config
  196. fi
  197. if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
  198. if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
  199. cat<<EOF>>Makefile.settings
  200. EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
  201. CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
  202. EOF
  203. else
  204. echo
  205. echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
  206. exit 1
  207. fi
  208. else
  209. echo
  210. echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
  211. exit 1
  212. fi
  213. if [ "$events" = "libevent" ]; then
  214. if ! [ -f "${libevent}include/event.h" ]; then
  215. echo
  216. echo 'Warning: Could not find event.h, you might have to install it and/or specify'
  217. echo 'its location using the --libevent= argument. (Example: If event.h is in'
  218. echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
  219. fi
  220. echo '#define EVENTS_LIBEVENT' >> config.h
  221. cat <<EOF>>Makefile.settings
  222. EFLAGS+=-levent -L${libevent}lib
  223. CFLAGS+=-I${libevent}include
  224. EOF
  225. elif [ "$events" = "glib" ]; then
  226. ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
  227. echo '#define EVENTS_GLIB' >> config.h
  228. else
  229. echo
  230. echo 'ERROR: Unknown event handler specified.'
  231. exit 1
  232. fi
  233. echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
  234. detect_gnutls()
  235. {
  236. if $PKG_CONFIG --exists gnutls; then
  237. cat <<EOF>>Makefile.settings
  238. EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
  239. CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
  240. EOF
  241. ssl=gnutls
  242. if ! pkg-config gnutls --atleast-version=2.8; then
  243. echo
  244. echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
  245. fi
  246. ret=1
  247. elif libgnutls-config --version > /dev/null 2> /dev/null; then
  248. cat <<EOF>>Makefile.settings
  249. EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
  250. CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
  251. EOF
  252. ssl=gnutls
  253. ret=1;
  254. else
  255. ret=0;
  256. fi;
  257. }
  258. detect_nss()
  259. {
  260. if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
  261. cat<<EOF>>Makefile.settings
  262. EFLAGS+=`$PKG_CONFIG --libs nss`
  263. CFLAGS+=`$PKG_CONFIG --cflags nss`
  264. EOF
  265. ssl=nss
  266. ret=1;
  267. else
  268. ret=0;
  269. fi;
  270. }
  271. detect_ldap()
  272. {
  273. TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
  274. if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
  275. cat<<EOF>>Makefile.settings
  276. EFLAGS+=-lldap
  277. CFLAGS+=
  278. EOF
  279. ldap=1
  280. rm -f $TMPFILE
  281. ret=1
  282. else
  283. ldap=0
  284. ret=0
  285. fi
  286. }
  287. RESOLV_TESTCODE='
  288. #include <sys/types.h>
  289. #include <netinet/in.h>
  290. #include <arpa/nameser.h>
  291. #include <resolv.h>
  292. int main()
  293. {
  294. ns_initparse( NULL, 0, NULL );
  295. ns_parserr( NULL, ns_s_an, 0, NULL );
  296. }
  297. '
  298. detect_resolv_dynamic()
  299. {
  300. case "$arch" in
  301. FreeBSD )
  302. # In FreeBSD res_* routines are present in libc.so
  303. LIBRESOLV=;;
  304. * )
  305. LIBRESOLV=-lresolv;;
  306. esac
  307. TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
  308. ret=1
  309. echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
  310. if [ "$?" = "0" ]; then
  311. echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
  312. ret=0
  313. fi
  314. rm -f $TMPFILE
  315. return $ret
  316. }
  317. detect_resolv_static()
  318. {
  319. TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
  320. ret=1
  321. for i in $systemlibdirs; do
  322. if [ -f $i/libresolv.a ]; then
  323. echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
  324. if [ "$?" = "0" ]; then
  325. echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
  326. ret=0
  327. fi
  328. fi
  329. done
  330. rm -f $TMPFILE
  331. return $ret
  332. }
  333. if [ "$ssl" = "auto" ]; then
  334. detect_gnutls
  335. if [ "$ret" = "0" ]; then
  336. # Disable NSS for now as it's known to not work very well ATM.
  337. #detect_nss
  338. :
  339. fi
  340. elif [ "$ssl" = "gnutls" ]; then
  341. detect_gnutls
  342. elif [ "$ssl" = "nss" ]; then
  343. detect_nss
  344. elif [ "$ssl" = "sspi" ]; then
  345. echo
  346. elif [ "$ssl" = "openssl" ]; then
  347. echo
  348. echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
  349. echo 'install of OpenSSL (including devel/header files) before reporting'
  350. echo 'compilation problems.'
  351. echo
  352. echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
  353. echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
  354. echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
  355. echo 'part of the operating system, which makes it GPL-compatible.'
  356. echo
  357. echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
  358. echo ' http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
  359. echo
  360. echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
  361. echo 'probably illegal. If you want to create and distribute a binary BitlBee'
  362. echo 'package, you really should use GnuTLS or NSS instead.'
  363. echo
  364. echo 'Also, the OpenSSL license requires us to say this:'
  365. echo ' * "This product includes software developed by the OpenSSL Project'
  366. echo ' * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
  367. echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
  368. ret=1
  369. elif [ "$ssl" = "bogus" ]; then
  370. echo
  371. echo 'Using bogus SSL code. This means some features will not work properly.'
  372. ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
  373. if [ "$msn" = "1" -o "$yahoo" = "1" ]; then
  374. echo
  375. echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.'
  376. msn=0
  377. yahoo=0
  378. fi
  379. ret=1
  380. else
  381. echo
  382. echo 'ERROR: Unknown SSL library specified.'
  383. exit 1
  384. fi
  385. if [ "$ret" = "0" ]; then
  386. echo
  387. echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
  388. echo ' Please note that this script doesn'\''t have detection code for OpenSSL,'
  389. echo ' so if you want to use that, you have to select it by hand. If you don'\''t'
  390. echo ' need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
  391. exit 1
  392. fi;
  393. if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" -a "$ssl" != "nss" ]; then
  394. # Needed for MSN only. OpenSSL and NSS export nice cipher functions already,
  395. # in case of GnuTLS we should be able to use gcrypt. Otherwise, use
  396. # built-in stuff. (Since right now those are the only three supported
  397. # SSL modules anyway, this is mostly unnecessary.)
  398. echo 'DES=des.o' >> Makefile.settings
  399. fi
  400. echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
  401. if detect_resolv_dynamic || detect_resolv_static; then
  402. echo '#define HAVE_RESOLV_A' >> config.h
  403. fi
  404. STORAGES="xml"
  405. if [ "$ldap" = "auto" ]; then
  406. detect_ldap
  407. fi
  408. if [ "$ldap" = 0 ]; then
  409. echo "#undef WITH_LDAP" >> config.h
  410. elif [ "$ldap" = 1 ]; then
  411. echo
  412. echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
  413. echo
  414. exit 1
  415. echo "#define WITH_LDAP 1" >> config.h
  416. STORAGES="$STORAGES ldap"
  417. fi
  418. for i in $STORAGES; do
  419. STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
  420. done
  421. echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
  422. if [ "$strip" = 0 ]; then
  423. echo "STRIP=\# skip strip" >> Makefile.settings;
  424. else
  425. if [ "$debug" = 1 ]; then
  426. echo
  427. echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
  428. echo 'STRIP=\# skip strip' >> Makefile.settings
  429. strip=0;
  430. elif [ -n "$STRIP" ]; then
  431. echo "STRIP=$STRIP" >> Makefile.settings;
  432. elif type strip > /dev/null 2> /dev/null; then
  433. echo "STRIP=strip" >> Makefile.settings;
  434. else
  435. echo
  436. echo 'No strip utility found, cannot remove unnecessary parts from executable.'
  437. echo 'STRIP=\# skip strip' >> Makefile.settings
  438. strip=0;
  439. fi;
  440. fi
  441. if [ -z "$systemdsystemunitdir" ]; then
  442. if $PKG_CONFIG --exists systemd; then
  443. systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
  444. fi
  445. fi
  446. if [ -n "$systemdsystemunitdir" ]; then
  447. if [ "$systemdsystemunitdir" != "no" ]; then
  448. echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
  449. fi
  450. fi
  451. if [ "$gcov" = "1" ]; then
  452. echo "CFLAGS+=--coverage" >> Makefile.settings
  453. echo "EFLAGS+=--coverage" >> Makefile.settings
  454. fi
  455. if [ "$plugins" = 0 ]; then
  456. echo '#undef WITH_PLUGINS' >> config.h
  457. else
  458. echo '#define WITH_PLUGINS' >> config.h
  459. fi
  460. otrprefix=""
  461. for i in / /usr /usr/local; do
  462. if [ -f ${i}/lib/libotr.a ]; then
  463. otrprefix=${i}
  464. break
  465. fi
  466. done
  467. if [ "$otr" = "auto" ]; then
  468. if [ -n "$otrprefix" ]; then
  469. otr=1
  470. else
  471. otr=0
  472. fi
  473. fi
  474. if [ "$otr" = 1 ]; then
  475. # BI == built-in
  476. echo '#define OTR_BI' >> config.h
  477. echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
  478. echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
  479. echo 'OTR_BI=otr.o' >> Makefile.settings
  480. elif [ "$otr" = "plugin" ]; then
  481. echo '#define OTR_PI' >> config.h
  482. echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
  483. echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
  484. echo 'OTR_PI=otr.so' >> Makefile.settings
  485. fi
  486. if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
  487. echo 'SKYPE_PI=skype.so' >> Makefile.settings
  488. protocols_mods="$protocol_mods skype(plugin)"
  489. fi
  490. if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then
  491. echo
  492. echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
  493. echo 'Install xmlto if you want online help to work.'
  494. fi
  495. echo
  496. if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
  497. nick=`bzr nick`
  498. if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
  499. nick="-$nick"
  500. else
  501. nick=""
  502. fi
  503. rev=`bzr revno`
  504. echo 'Using bzr revision #'$rev' as version number'
  505. BITLBEE_VERSION=\"bzr$nick-$rev\"
  506. fi
  507. if [ -n "$BITLBEE_VERSION" ]; then
  508. echo 'Spoofing version number: '$BITLBEE_VERSION
  509. echo '#undef BITLBEE_VERSION' >> config.h
  510. echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
  511. echo
  512. fi
  513. if ! make helloworld > /dev/null 2>&1; then
  514. echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
  515. echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
  516. echo "under the name 'gmake'."
  517. echo
  518. if gmake helloworld > /dev/null 2>&1; then
  519. echo "gmake seems to be available on your machine, great."
  520. echo
  521. else
  522. echo "gmake is not installed (or not working). Please try to install it."
  523. echo
  524. fi
  525. fi
  526. cat <<EOF>bitlbee.pc
  527. prefix=$prefix
  528. includedir=$includedir
  529. Name: bitlbee
  530. Description: IRC to IM gateway
  531. Requires: glib-2.0
  532. Version: $BITLBEE_VERSION
  533. Libs:
  534. Cflags: -I\${includedir}
  535. EOF
  536. protocols=''
  537. protoobjs=''
  538. if [ "$purple" = 0 ]; then
  539. echo '#undef WITH_PURPLE' >> config.h
  540. else
  541. if ! $PKG_CONFIG purple; then
  542. echo
  543. echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
  544. exit 1
  545. fi
  546. echo '#define WITH_PURPLE' >> config.h
  547. cat<<EOF>>Makefile.settings
  548. EFLAGS += $($PKG_CONFIG purple --libs)
  549. PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
  550. EOF
  551. protocols=$protocols'purple '
  552. protoobjs=$protoobjs'purple_mod.o '
  553. # Having both libpurple and native IM modules in one binary may
  554. # do strange things. Let's not do that.
  555. msn=0
  556. jabber=0
  557. oscar=0
  558. yahoo=0
  559. if [ "$events" = "libevent" ]; then
  560. echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
  561. echo 'outside libpurple, talking to GLib directly. At least for now the combination'
  562. echo 'libpurple + libevent is *not* recommended!'
  563. echo
  564. fi
  565. fi
  566. case "$CC" in
  567. *gcc* )
  568. echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings
  569. for i in . lib protocols protocols/*/; do
  570. mkdir -p $i/.depend
  571. done
  572. esac
  573. if [ "$msn" = 0 ]; then
  574. echo '#undef WITH_MSN' >> config.h
  575. else
  576. echo '#define WITH_MSN' >> config.h
  577. protocols=$protocols'msn '
  578. protoobjs=$protoobjs'msn_mod.o '
  579. fi
  580. if [ "$jabber" = 0 ]; then
  581. echo '#undef WITH_JABBER' >> config.h
  582. else
  583. echo '#define WITH_JABBER' >> config.h
  584. protocols=$protocols'jabber '
  585. protoobjs=$protoobjs'jabber_mod.o '
  586. fi
  587. if [ "$oscar" = 0 ]; then
  588. echo '#undef WITH_OSCAR' >> config.h
  589. else
  590. echo '#define WITH_OSCAR' >> config.h
  591. protocols=$protocols'oscar '
  592. protoobjs=$protoobjs'oscar_mod.o '
  593. fi
  594. if [ "$yahoo" = 0 ]; then
  595. echo '#undef WITH_YAHOO' >> config.h
  596. else
  597. echo '#define WITH_YAHOO' >> config.h
  598. protocols=$protocols'yahoo '
  599. protoobjs=$protoobjs'yahoo_mod.o '
  600. fi
  601. if [ "$twitter" = 0 ]; then
  602. echo '#undef WITH_TWITTER' >> config.h
  603. else
  604. echo '#define WITH_TWITTER' >> config.h
  605. protocols=$protocols'twitter '
  606. protoobjs=$protoobjs'twitter_mod.o '
  607. fi
  608. if [ "$protocols" = "PROTOCOLS = " ]; then
  609. echo "Warning: You haven't selected any communication protocol to compile!"
  610. echo " BitlBee will run, but you will be unable to connect to IM servers!"
  611. fi
  612. echo "PROTOCOLS = $protocols" >> Makefile.settings
  613. echo "PROTOOBJS = $protoobjs" >> Makefile.settings
  614. echo Architecture: $arch
  615. case "$arch" in
  616. Linux )
  617. ;;
  618. GNU/* )
  619. ;;
  620. *BSD )
  621. ;;
  622. Darwin )
  623. echo 'STRIP=\# skip strip' >> Makefile.settings
  624. ;;
  625. IRIX )
  626. ;;
  627. SunOS )
  628. echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
  629. echo 'STRIP=\# skip strip' >> Makefile.settings
  630. echo '#define NO_FD_PASSING' >> config.h
  631. ;;
  632. AIX )
  633. echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
  634. ;;
  635. CYGWIN* )
  636. echo 'Cygwin is not officially supported.'
  637. ;;
  638. Windows )
  639. ;;
  640. * )
  641. echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
  642. echo 'Please report any problems at http://bugs.bitlbee.org/.'
  643. ;;
  644. esac
  645. if [ -n "$target" ]; then
  646. echo "Cross-compiling for: $target"
  647. fi
  648. echo
  649. echo 'Configuration done:'
  650. if [ "$debug" = "1" ]; then
  651. echo ' Debugging enabled.'
  652. else
  653. echo ' Debugging disabled.'
  654. fi
  655. if [ "$strip" = "1" ]; then
  656. echo ' Binary stripping enabled.'
  657. else
  658. echo ' Binary stripping disabled.'
  659. fi
  660. if [ "$otr" = "1" ]; then
  661. echo ' Off-the-Record (OTR) Messaging enabled.'
  662. elif [ "$otr" = "plugin" ]; then
  663. echo ' Off-the-Record (OTR) Messaging enabled (as a plugin).'
  664. else
  665. echo ' Off-the-Record (OTR) Messaging disabled.'
  666. fi
  667. if [ -n "$systemdsystemunitdir" ]; then
  668. echo ' systemd enabled.'
  669. else
  670. echo ' systemd disabled.'
  671. fi
  672. echo ' Using event handler: '$events
  673. echo ' Using SSL library: '$ssl
  674. #echo ' Building with these storage backends: '$STORAGES
  675. if [ -n "$protocols" ]; then
  676. echo ' Building with these protocols:' $protocols$protocols_mods
  677. case "$protocols" in
  678. *purple*)
  679. echo " Note that BitlBee-libpurple is supported on a best-effort basis. It's"
  680. echo " not *fully* compatible with normal BitlBee. Don't use it unless you"
  681. echo " absolutely need it (i.e. support for a certain protocol or feature)."
  682. esac
  683. else
  684. echo ' Building without IM-protocol support. We wish you a lot of fun...'
  685. fi