[redland-dev] raptor: add --with_expatsrc=PATH option for configure

Mark Smith mcs at umich.edu
Fri Jun 18 21:28:12 BST 2004


I am using Raptor 1.3.1 with expat and building on Linux.  For various 
reasons, I want the Raptor build to use a copy of expat that I built 
from source.  But I ran into three minor problems:

1) The Raptor configure script assumes the expat source is in 
raptor-1.3.1/expat (I can work around this by adding a symlink before I 
run configure, but that is a little inconvenient).

2) If Raptor configure finds a system libexpat it uses that even if the 
expat source is present.  My Linux system includes libexpat under 
/usr/lib, so this makes it impossible to have Raptor use the expat I 
built from source.

3) When it does use expat from source, Raptor configure assumes the 
expat directory structure matches an older expat layout.

I fixed problems 1 and 2 by modifying the Raptor configure script to 
support a new option:  --with_expatsrc=PATH.  If this option is used, 
configure assumes you want to use expat from source and looks in PATH 
for the source tree.  I fixed problem 3 by adding a check for the 
existence of one of the directories that should be present if you are 
using older expat source.

A patch for configure is attached.  I am not an autoconf expert, but I 
think the correct thing to patch is actually configure.ac. 
Unfortunately, I found that I do not have new enough tools installed to 
run the autogen.sh script.  But if someone (Dave?) needs a patch for 
configure.ac I can work on that next week.

-Mark

-------------- next part --------------
--- configure.orig	2004-06-12 00:44:23.000000000 -0400
+++ configure	2004-06-18 15:27:55.000000000 -0400
@@ -1046,16 +1046,17 @@
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-tags[=TAGS]
                           include additional configurations [automatic]
   --with-xml2-config=PATH Location of libxml xml2-config
+  --with-expatsrc=PATH    Location of expat source tree.
   --with-curl-config=PATH Location of libcurl curl-config
   --with-pkg-config=PATH Location of GNOME pkg-config
   --with-libwww-config=PATH Location of W3C libwww libwww-config
   --with-xml-parser=NAME  Use XML parser - libxml (default), expat
   --with-xml-names=1.1|1.0  Select XML version name checking (default 1.0)
   --with-www=NAME         Use WWW library - curl (default), xml, libwww, libfetch, none
   --with-dmalloc          Use dmalloc debugging library (default=auto)
 
@@ -20884,17 +20885,24 @@
 have_expat_lib=0
 have_expat_source=0
 need_expat=0
 need_expat_source=0
 expat_source_dir=
 expat_obj_dir=
 echo "$as_me:$LINENO: checking for expat sources" >&5
 echo $ECHO_N "checking for expat sources... $ECHO_C" >&6
-if test -d $srcdir/expat; then
+if "${with_expatsrc+set}" = set; then
+  have_expat_source=1
+  have_expat=1
+  expat_source_dir="$with_expatsrc"
+  expat_obj_dir="$with_expatsrc"
+  echo "$as_me:$LINENO: result: yes - with_expatsrc" >&5
+echo "${ECHO_T}yes - expat" >&6
+elif test -d $srcdir/expat; then
   have_expat_source=1
   have_expat=1
   expat_source_dir="\$(top_srcdir)/expat"
   expat_obj_dir="\$(top_builddir)/expat"
   echo "$as_me:$LINENO: result: yes - expat" >&5
 echo "${ECHO_T}yes - expat" >&6
 else
   echo "$as_me:$LINENO: result: no" >&5
@@ -22489,17 +22497,17 @@
   xml_parser="$withval"
 else
   xml_parser="libxml"
 fi;
 
 for xml_parser_name in $xml_parser libxml expat; do
   case $xml_parser_name in
     expat)
-      if test $have_expat_lib = 1; then
+      if test "${with_expatsrc+set}" != set -a $have_expat_lib = 1; then
 	need_expat=1
 
 cat >>confdefs.h <<\_ACEOF
 #define RAPTOR_XML_EXPAT 1
 _ACEOF
 
         break
       elif test $have_expat_source = 1; then
@@ -23114,18 +23122,25 @@
   fi
 fi
 
 
 if test $need_expat = 1; then
   # Only build local copy if it is needed
   if test $need_expat_source = 1; then
     SD="$SD expat"
-    CPPFLAGS="-I$expat_source_dir/xmlparse $CPPFLAGS"
-    LIBS="$LIBS $expat_obj_dir/xmlparse/xmlparse.o $expat_obj_dir/xmlparse/hashtable.o $expat_obj_dir/xmltok/xmlrole.o $expat_obj_dir/xmltok/xmltok.o"
+	if test -d "$expat_source_dir/xmlparse"; then
+		# old expat
+		CPPFLAGS="-I$expat_source_dir/xmlparse $CPPFLAGS"
+		LIBS="$LIBS $expat_obj_dir/xmlparse/xmlparse.o $expat_obj_dir/xmlparse/hashtable.o $expat_obj_dir/xmltok/xmlrole.o $expat_obj_dir/xmltok/xmltok.o"
+	else
+		# new expat
+		CPPFLAGS="-I$expat_source_dir/lib $CPPFLAGS"
+		LIBS="$LIBS $expat_obj_dir/lib/xmlparse.o $expat_obj_dir/lib/xmlrole.o $expat_obj_dir/lib/xmltok.o"
+	fi
   else
     LIBS="$LIBS $expat_libs"
   fi
 fi
 
 if test $need_glib2 = 1; then
   CPPFLAGS="$CPPFLAGS `$PKG_CONFIG glib-2.0 --cflags`"
   LIBS="$LIBS `$PKG_CONFIG glib-2.0 --libs`"


More information about the redland-dev mailing list