Index: .bzrignore
===================================================================
--- .bzrignore	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ .bzrignore	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -17,2 +17,4 @@
 *.gcno
 *.o
+coverage
+bitlbee.info
Index: bitlbee.h
===================================================================
--- bitlbee.h	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ bitlbee.h	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -95,8 +95,4 @@
 #define g_main_quit		__PLEASE_USE_B_MAIN_QUIT__
 
-#ifndef F_OK
-#define F_OK 0
-#endif
-
 #ifndef G_GNUC_MALLOC
 /* Doesn't exist in GLib <=2.4 while everything else in BitlBee should
Index: configure
===================================================================
--- configure	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ configure	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -74,4 +74,6 @@
 --ssl=...	SSL library to use (gnutls, nss, openssl, bogus, auto)
 							$ssl
+
+--target=...	Cross compilation target 		same as host
 EOF
 		exit;
@@ -132,4 +134,11 @@
 EOF
 
+if [ -n "$target" ]; then
+	PKG_CONFIG_PATH=/usr/$target/lib/pkgconfig
+	PATH=/usr/$target/bin:$PATH
+	CC=$target-cc
+	LD=$target-ld
+fi
+
 if [ "$debug" = "1" ]; then
 	[ -z "$CFLAGS" ] && CFLAGS=-g
@@ -158,12 +167,14 @@
 echo "CC=$CC" >> Makefile.settings;
 
-if [ -n "$LD" ]; then
-	echo "LD=$LD" >> Makefile.settings;
-elif type ld > /dev/null 2> /dev/null; then
-	echo "LD=ld" >> Makefile.settings;
-else
-	echo 'Cannot find ld, aborting.'
-	exit 1;
-fi
+if [ -z "$LD" ]; then
+	if type ld > /dev/null 2> /dev/null; then
+		LD=ld
+	else
+		echo 'Cannot find ld, aborting.'
+		exit 1;
+	fi
+fi
+
+echo "LD=$LD" >> Makefile.settings
 
 if [ -z "$PKG_CONFIG" ]; then
@@ -213,5 +224,12 @@
 detect_gnutls()
 {
-	if libgnutls-config --version > /dev/null 2> /dev/null; then
+	if $PKG_CONFIG --exists gnutls; then
+		cat <<EOF>>Makefile.settings
+EFLAGS+=`$PKG_CONFIG --libs gnutls`
+CFLAGS+=`$PKG_CONFIG --cflags gnutls`
+EOF
+		ssl=gnutls
+		ret=1
+	elif libgnutls-config --version > /dev/null 2> /dev/null; then
 		cat <<EOF>>Makefile.settings
 EFLAGS+=`libgnutls-config --libs`
@@ -375,6 +393,6 @@
 
 if [ "$gcov" = "1" ]; then
-	echo "CFLAGS+=-ftest-coverage -fprofile-arcs" >> Makefile.settings
-	echo "EFLAGS+=-lgcov" >> Makefile.settings
+	echo "CFLAGS+=--coverage" >> Makefile.settings
+	echo "EFLAGS+=--coverage" >> Makefile.settings
 fi
 
@@ -489,4 +507,8 @@
 esac
 
+if [ -n "$target" ]; then
+	echo "Cross-compiling for: $target"
+fi
+
 echo
 echo 'Configuration done:'
Index: debian/changelog
===================================================================
--- debian/changelog	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ debian/changelog	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -1,2 +1,8 @@
+bitlbee (1.2-5) UNRELEASED; urgency=low
+
+  * Add Homepage and Vcs-Bzr fields.
+
+ -- Jelmer Vernooij <jelmer@samba.org>  Sun, 11 May 2008 14:18:16 +0200
+
 bitlbee (1.2-4) unstable; urgency=low
 
Index: debian/control
===================================================================
--- debian/control	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ debian/control	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -5,4 +5,6 @@
 Standards-Version: 3.5.9
 Build-Depends: libglib2.0-dev (>= 2.4), libevent-dev, libgnutls-dev | libnss-dev (>= 1.6), debconf-2.0, po-debconf
+Homepage: http://www.bitlbee.org/
+Vcs-Bzr: http://code.bitlbee.org/bitlbee/
 
 Package: bitlbee
Index: storage_xml.c
===================================================================
--- storage_xml.c	(revision de8e584d7f4fea214934af094a4df2672d7e0be8)
+++ storage_xml.c	(revision b6cd9e9fe0aa86e83fc4a43b3db2240839e2103a)
@@ -29,4 +29,5 @@
 #include "arc.h"
 #include "md5.h"
+#include <glib/gstdio.h>
 
 typedef enum
@@ -243,7 +244,7 @@
 static void xml_init( void )
 {
-	if( access( global.conf->configdir, F_OK ) != 0 )
+	if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) )
 		log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir );
-	else if( access( global.conf->configdir, R_OK ) != 0 || access( global.conf->configdir, W_OK ) != 0 )
+	else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 )
 		log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir );
 }
@@ -372,5 +373,5 @@
 	g_free( path2 );
 	
-	if( !overwrite && access( path, F_OK ) != -1 )
+	if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) )
 		return STORAGE_ALREADY_EXISTS;
 	
