Index: amaya-9.55~dfsg.0/Makefile.in
===================================================================
--- amaya-9.55~dfsg.0.orig/Makefile.in	2007-03-31 14:48:04.000000000 +0100
+++ amaya-9.55~dfsg.0/Makefile.in	2007-04-07 18:01:59.000000000 +0100
@@ -12,11 +12,10 @@
 include Options
 
 LIBWWW	   = libwww
-REDLAND    = redland
 
 #MKP: adding davlib
 SUBDIRS	= @SUBDIRS@ tools thotlib batch annotlib @DAVDIR@ amaya
-EXTRA_SUBDIRS= $(REDLAND) $(LIBWWW) $(WX_BUILDDIR) $(GL_BUILDDIR)
+EXTRA_SUBDIRS= redland $(LIBWWW) $(WX_BUILDDIR) $(GL_BUILDDIR)
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
@@ -25,7 +24,7 @@
 
 srcdir	= $(THOTDIR)
 
-default : tools gl @BUILDWXWIDGETS@ thotlib batch amaya_prog print_prog
+default : tools gl @BUILDWXWIDGETS@ @BUILDREDLAND@ thotlib batch amaya_prog print_prog
 
 amaya : tools thotlib amaya_prog print_prog
 
@@ -263,53 +262,8 @@
 #
 # Rules to build the redland RDF library
 #
-
-# Previous rule used to link and compile expat inside redland... to be removed
-# after checking all is ok in all the platforms
-# we're using the expat from inside libwww
-# @(if test ! -e "$(THOTDIR)/../$(REDLAND)/expat"  ; then \
-#   libwwwdir="$(THOTDIR)/../$(LIBWWW)" ; \
-#    echo $$libwwwdir ; \
-#    $(LN_S) "$$libwwwdir/modules/expat" "$(THOTDIR)/../$(REDLAND)/expat" ; \
-# fi)
-
-# Because redland 0.9.14 forces the check on a glib-2.0 function, we remove the
-# results of the configure to force its non use.
-
-redland_config: @MAKEREDLAND@ force
-	@(if test ! -e "$(THOTDIR)/../$(REDLAND)"  ; then \
-	      $(ECHO) "Error redland dir not found at $(THOTDIR)/$(REDLAND)" ; \
-	  fi)
-	 @(if test ! -d "$(REDLAND)"  ; then \
-		$(MKDIR) $(REDLAND) ; \
-          fi)
-	 @(localdir=`pwd` ; redlanddir="$$localdir/../../$(REDLAND)" ; \
-	  cd $(REDLAND) ; unset LANG; \
-	  if test ! -f Makefile -o ! -f  redland-src-config ; then \
-			CPPFLAGS="-I$$localdir/../../$(LIBWWW)/modules/expat/lib" \
-			LDFLAGS="-L$$localdir/libwww/modules/expat -L$$localdir/libwww/modules/expat/.libs" \
-			$$redlanddir/configure \
-			--build=@build_alias@ --host=@host_alias@ --target=@target_alias@ \
-			--disable-shared \
-			--disable-nfc-check \
-			--without-bdb \
-	 		--with-raptor=internal \
-			--with-xml-parser=expat \
-			--with-www=none \
-			--without-libwww \
-			--without-openssl-digests \
-			--without-mysql ;\
-		$(ECHO) "redland is configured" ; \
-	  fi)
-
-
-# the -DLIBRDF_INTERNAL=1 is needed if we're going to pass our own CFLAGS.
-redland_make: @MAKEREDLAND@ force
-	@(cd $(REDLAND) ; \
-	  $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS) -DLIBRDF_INTERNAL=1"; \
-	)
-
-redland: @MAKEREDLAND@ redland_config redland_make
+redland: force
+	$(MAKE) -C redland
 	@($(ECHO) "redland is installed")
 
 #
Index: amaya-9.55~dfsg.0/configure.in
===================================================================
--- amaya-9.55~dfsg.0.orig/configure.in	2007-03-31 14:48:04.000000000 +0100
+++ amaya-9.55~dfsg.0/configure.in	2007-04-07 18:01:59.000000000 +0100
@@ -666,18 +666,8 @@
 
 # Check if debug is enable
 AC_ARG_WITH(debug,              [  --with-debug            compiles Amaya with debuging options (-g) ])
-if test "$with_debug" = "yes" ; then
-  with_debug="yes"
-  CFLAGS="-g"
-  CXXFLAGS="-g"
-else
-  with_debug="no"
-  CFLAGS="-O2"
-  CXXFLAGS="-O2"
-fi
 
 if test "${CC}" = "gcc" ; then
- CFLAGS="${CFLAGS} -Wall"
   case "${host}" in
       *-*-irix5* | *-*irix6* )
          CFLAGS="${CFLAGS} -fsigned-char"
@@ -689,13 +679,8 @@
   CFLAGS="${CFLAGS} -DCONST= "
 fi
 
-
-# force C mode (-x c)
-CFLAGS="${CFLAGS} -x c"
-
-# C++ options (-x c++)
-CXX_OPTIONS="-D__cplusplus"
-CXXFLAGS="${CXXFLAGS} -Wall -x c++ ${CXX_OPTIONS}"
+CFLAGS="${CFLAGS} -Wall"
+CXXFLAGS="${CXXFLAGS} -Wall"
 
 # setup LDFLAGS
 # on macosx, specific flags must be set to avoid conflicts with allready installed libwww
@@ -1081,7 +1066,6 @@
 	-a ! -d "$srcdir/../redland" ; then
 	AC_MSG_WARN(Redland source dir not found !!)
 	AC_MSG_WARN(Disabling redland build !)
-	MAKEREDLAND=['#']
 	with_redland="no"
 fi
 
@@ -1091,13 +1075,36 @@
 if test "$with_redland" = "yes" ; then
 	AMAYA_ANNOT_OPTIONS="$AMAYA_ANNOT_OPTIONS -DAM_REDLAND"
 	if test "$with_system_redland" != "yes" ; then
-		AMAYA_RAPTOR_SRC="amaya_comp_redland"
 		AMAYA_ANNOT_OPTIONS="$AMAYA_ANNOT_OPTIONS -I\$(THOTDIR)/../redland/librdf -I\$(THOTDIR)/../redland/raptor "
 		AMAYA_RAPTOR_LIBS="../redland/librdf/.libs/librdf.a ../redland/raptor/.libs/libraptor.a"
 		AMAYA_RAPTOR_INCLUDES="-I\$(THOTDIR)/../redland/librdf -I\$(THOTDIR)/../redland/raptor"
+		BUILDREDLAND="redland"
+		CURRENTPATH="`pwd`"
+		mkdir $BUILDREDLAND
+		cd $BUILDREDLAND &&
+			CC="$CC" CXX="$CXX" \
+			CPPFLAGS="-I$CURRENTPATH/../../libwww/modules/expat/lib" \
+			LDFLAGS="-L$CURRENTPATH/libwww/modules/expat -L$CURRENTPATH/libwww/modules/expat/.libs" \
+			../../../redland/configure \
+			--build=$build_alias --host=$host_alias --target=$target_alias \
+			--disable-shared \
+			--without-bdb \
+	 		--enable-parsers=raptor \
+	 		--with-raptor=internal \
+			--with-xml-parser=expat \
+			--with-www=none \
+			--without-libwww \
+			--without-openssl-digests \
+			--without-mysql
+			$ECHO "redland is configured"
+			$ECHO "Patching the raptor_config.h file to avoid including glib2-0"
+			$CP raptor/raptor_config.h raptor/raptor_config.h.orig
+			$SED "s/\(\#define HAVE_G_UTF8_NORMALIZE 1\)/\/* \1 *\//" \
+				raptor/raptor_config.h.orig > raptor/raptor_config.h
+			$RM raptor/raptor_config.h.orig
+			$ECHO "Raptor is patched"
+		cd ..
 	else
-		MAKEREDLAND=['#']
-		AMAYA_RAPTOR_SRC=
 		redland_includes=`$REDLAND_CONFIG --cflags`
 	  redland_libs=`$REDLAND_CONFIG --libs`
  		AMAYA_ANNOT_OPTIONS="$AMAYA_ANNOT_OPTIONS"
@@ -1111,6 +1118,8 @@
 
 ANNOTLIB_COMPILE_BM=['#']
 
+AC_SUBST(BUILDREDLAND)
+
 ###################End of Annotations Support####################
 
 
@@ -1325,9 +1334,7 @@
 AC_SUBST(WITHDAV)
 AC_SUBST(WWWDAV)
 
-AC_SUBST(MAKEREDLAND)
 AC_SUBST(ANNOTLIB_COMPILE_BM)
-AC_SUBST(AMAYA_RAPTOR_SRC)
 AC_SUBST(AMAYA_RAPTOR_LIBS)
 AC_SUBST(AMAYA_RAPTOR_INCLUDES)
 AC_SUBST(MAKE_LIBWWW_RDF_PARSER)
Index: amaya-9.55~dfsg.0/amaya/Makefile.in
===================================================================
--- amaya-9.55~dfsg.0.orig/amaya/Makefile.in	2007-03-31 14:52:57.000000000 +0100
+++ amaya-9.55~dfsg.0/amaya/Makefile.in	2007-04-07 18:01:59.000000000 +0100
@@ -92,8 +92,8 @@
 
 ../redland/librdf/.libs/librdf.a \
 ../redland/raptor/.libs/libraptor.a \
-amaya_comp_redland: @MAKEREDLAND@ force
-	@(cd .. ; $(MAKE) redland CC="$(CC)" CFLAGS="-O2")
+redland:
+	$(MAKE) -C ../redland
 
 .depends depend : ../tools/mkdep/mkdep
 	../tools/mkdep/mkdep -relative -vpath $(VPATH) $(INCLUDES) $(VPATH)/*.c > .depends
@@ -145,7 +145,7 @@
          $(AMAYA_ANNOT_OBJ) $(AMAYA_DAV_OBJ) $(AMAYA_TEMPLATES_OBJ)
 
 AMAYA_SRC= \
-         $(AMAYA_LIBWWW_SRC) @AMAYA_RAPTOR_SRC@ \
+         $(AMAYA_LIBWWW_SRC) \
 	 $(AMAYA_MATH_SRC) $(AMAYA_SVG_SRC) \
          $(AMAYA_ANNOT_SRC) $(AMAYA_DAV_SRC) $(AMAYA_TEMPLATES_SRC)
 

