discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patches to support libxml on FreeBSD


From: Kim Shrier
Subject: Patches to support libxml on FreeBSD
Date: Mon, 18 Dec 2000 12:43:02 -0600

I have worked up some patches to the following files to support libxml
under FreeBSD 4.2:

core/base/Headers/gnustep/base/GSXML.h
core/base/Headers/gnustep/base/config.h.in
core/base/Source/GSXML.m
core/base/Tools/gsdoc.m
core/base/configure.in
core/make/configure.in

On FreeBSD, the headers are in /usr/local/include/libxml2 instead of
/usr/local/include/libxml.  Also, the library is called libxml2.so
instead of libxml.so.  These patches enable the configure scripts
to locate the correct headers and the correct library.  These patches
were done against the 20001217 snapshot.  I would appreciate feedback
on these patches and if they look OK, would someone with commit
privileges apply these patches to the CVS repository.

Thanks.
Kim Shrier
-- 
 Kim Shrier - principal, Shrier and Deihl - mailto:kim@tinker.com
Remote Unix Network Admin, Security, Internet Software Development
  Tinker Internet Services - Superior FreeBSD-based Web Hosting
                     http://www.tinker.com/
--- core/base/Headers/gnustep/base/GSXML.h,orig Wed Nov  1 21:31:38 2000
+++ core/base/Headers/gnustep/base/GSXML.h      Sun Dec 17 19:29:26 2000
@@ -31,8 +31,13 @@
 #ifndef __GSXML_H__
 #define __GSXML_H__
 
+#ifdef LIBXML2
+#include <libxml2/tree.h>
+#include <libxml2/entities.h>
+#else
 #include <libxml/tree.h>
 #include <libxml/entities.h>
+#endif
 
 #include <Foundation/NSObject.h>
 #include <Foundation/NSString.h>
--- core/base/Headers/gnustep/base/config.h.in.orig     Fri Dec  8 16:03:25 2000
+++ core/base/Headers/gnustep/base/config.h.in  Sun Dec 17 20:27:15 2000
@@ -162,6 +162,9 @@
 /* Define if you have the <libxml/xmlversion.h> header file.  */
 #undef HAVE_LIBXML_XMLVERSION_H
 
+/* Define if the libxml header files are in libxml2 */
+#undef LIBXML2
+
 /* Define if you have the <locale.h> header file.  */
 #undef HAVE_LOCALE_H
 
@@ -230,3 +233,4 @@
 
 /* Define if you have the <windows.h> header file.  */
 #undef HAVE_WINDOWS_H
+
--- core/base/Source/GSXML.m.orig       Wed Nov  1 21:31:38 2000
+++ core/base/Source/GSXML.m    Sun Dec 17 20:40:23 2000
@@ -26,10 +26,19 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 */
 
+#include <config.h>
+
+#ifdef LIBXML2
+#include <libxml2/parser.h>
+#include <libxml2/parserInternals.h>
+#include <libxml2/SAX.h>
+#include <libxml2/HTMLparser.h>
+#else
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
 #include <libxml/SAX.h>
 #include <libxml/HTMLparser.h>
+#endif
 
 #include <Foundation/GSXML.h>
 #include <Foundation/NSData.h>
--- core/base/Tools/gsdoc.m.orig        Wed Sep 20 09:02:03 2000
+++ core/base/Tools/gsdoc.m     Sun Dec 17 20:42:48 2000
@@ -80,6 +80,8 @@
        .gsdoc files
 */
 
+#include <config.h>
+
 #include <Foundation/Foundation.h>
 
 #if    HAVE_LIBXML
@@ -87,7 +89,11 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef LIBXML2
+#include <libxml2/parser.h>
+#else
 #include <libxml/parser.h>
+#endif
 
 NSString       *pathExtension_GSDocRefs = @"gsdocrefs";
 NSString       *pathExtension_GSDoc = @"gsdoc";
--- core/base/configure.in.orig Fri Dec  8 16:03:24 2000
+++ core/base/configure.in      Mon Dec 18 12:14:37 2000
@@ -840,14 +840,26 @@
   LIBS="$LIBS -L$libxml_libdir"
 fi
 
-AC_CHECK_HEADERS(libxml/xmlversion.h)
-if test $ac_cv_header_libxml_xmlversion_h = no; then
+xmlhdrdir=no
+# The order of these tests is important.
+AC_TRY_CPP([#include <libxml/xmlversion.h>
+#if LIBXML_VERSION < 20203
+#error libxml needs to be version 2.2.3 or later
+#endif], xmlhdrdir=libxml)
+if test $xmlhdrdir = no; then
+AC_TRY_CPP([#include <libxml2/xmlversion.h>
+#if LIBXML_VERSION < 20203
+#error libxml needs to be version 2.2.3 or later
+#endif], AC_DEFINE(LIBXML2) xmlhdrdir=libxml2)
+fi
+AC_MSG_RESULT($xmlhdrdir)
+if test $xmlhdrdir = no; then
   echo "Could not find libxml headers"
   echo "Check to make sure you have libxml version 2 or later installed"
   AC_MSG_WARN(Could not find libxml headers)
   HAVE_LIBXML=0
 else
-  AC_TRY_CPP([#include "libxml/xmlversion.h"
+  AC_TRY_CPP([#include "$xmlhdrdir/xmlversion.h"
     #if LIBXML_VERSION < 20203
     #error
     #endif], libxml2plus=1, libxml2plus=0)
--- core/make/configure.in.orig Thu Dec 14 21:34:42 2000
+++ core/make/configure.in      Mon Dec 18 12:11:20 2000
@@ -557,13 +557,25 @@
   LIBS="$LIBS -L$libxml_libdir"
 fi
 
-AC_CHECK_HEADERS(libxml/xmlversion.h)
-if test $ac_cv_header_libxml_xmlversion_h = no; then
+xmlhdrdir=no
+# The order of these tests is important.
+AC_TRY_CPP([#include <libxml/xmlversion.h>
+#if LIBXML_VERSION < 20203
+#error libxml needs to be version 2.2.3 or later
+#endif], xmlhdrdir=libxml)
+if test $xmlhdrdir = no; then
+AC_TRY_CPP([#include <libxml2/xmlversion.h>
+#if LIBXML_VERSION < 20203
+#error libxml needs to be version 2.2.3 or later
+#endif], AC_DEFINE(LIBXML2) xmlhdrdir=libxml2)
+fi
+AC_MSG_RESULT($xmlhdrdir)
+if test $xmlhdrdir = no; then
   echo "Could not find libxml headers"
   echo "Check to make sure you have libxml version 2.2.3 or later installed"
   AC_MSG_WARN(Could not find libxml headers)
 else
-  AC_TRY_CPP([#include "libxml/xmlversion.h"
+  AC_TRY_CPP([#include "$xmlhdrdir/xmlversion.h"
     #if LIBXML_VERSION < 20203
     #error
     #endif], libxml2plus=1, libxml2plus=0)
@@ -571,11 +583,7 @@
     echo "libxml version older than 2.2.3"
     AC_MSG_WARN(libxml version older than 2.2.3)
   else
-    AC_CHECK_LIB(xml, xmlNewDoc, xml_ok=yes, xml_ok=no)
-    if test "$xml_ok" = yes; then
-      LIBS="$LIBS -lxml"
-      AC_SUBST(LIBS)
-    fi
+    AC_SEARCH_LIBS(xmlNewDoc, xml xml2, xml_ok=yes, xml_ok=no)
   fi
 fi
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]