Shlomi Fish avatar Shlomi Fish committed 9190532

docs/libxml.dbk

Comments (0)

Files changed (3)

 # -------------------------------------------------------------------------- #
 
 
+my $config_LIBS_alternatives;
 # -------------------------------------------------------------------------- #
 # fix the ld flags
 # -------------------------------------------------------------------------- #
 if (!defined $config{LIBS} || $config{LIBS} !~ /\-l(?:lib)?xml2\b/) {
     # in this case we are not able to run xml2-config. therefore we need to
     # expand the libz as well.
-  if ($is_Win32) {
-    if( $ENV{ACTIVEPERL_MINGW} ) {
-      $config{LIBS} .= ' -llibxml2.lib -lzlib.lib';
-    } else {
-      $config{LIBS} .= ' -llibxml2 -lzlib -llibgettextlib.dll';
+    if ($is_Win32) {
+        if( $ENV{ACTIVEPERL_MINGW} ) {
+            $config{LIBS} .= ' -llibxml2.lib -lzlib.lib';
+        }
+        else {
+            # Put several options.
+            $config_LIBS_alternatives = [
+                map { "$config{LIBS} $_" }
+                q/ -lxml2 -lzlib/,
+                q/ -llibxml2 -lzlib -llibgettextlib.dll/
+            ];
+            $config{LIBS} = $config_LIBS_alternatives->[1];
+        }
     }
-  } else {
-    $config{LIBS} .= ' -lxml2 -lz -lm';
-  }
+    else {
+        $config{LIBS} .= ' -lxml2 -lz -lm';
+    }
 }
-
-if ($config{LIBS} !~ /\-lz\b/ and !($is_Win32 && $config{LIBS} !~ /\-lzlib\b/)) {
+elsif ($config{LIBS} !~ /\-lz\b/ and !($is_Win32 && $config{LIBS} !~ /\-lzlib\b/)) {
     # note if libxml2 has not -lz within its cflags, we should not use
     # it! We should trust libxml2 and assume libz is not available on the
     # current system (this is ofcourse not true with win32 systems.
 my $incpath = $config{INC} || "";
 $incpath =~ s#(\A|\s)\s*-I#$1#g;
 
-sub _libxml_check_lib
+sub _libxml_check_lib_with_config_LIBs
 {
-    my ($lib_name) = @_;
+    my ($lib_name, $conf_LIBS) = @_;
 
     return
     check_lib(
-        LIBS => $config{LIBS},
+        LIBS => $conf_LIBS,
         # fill in what you prompted the user for here
         lib => [$lib_name],
         incpath => [split(/\s/,$incpath)],
     );
 }
 
+sub _libxml_check_lib {
+    my ($libname) = @_;
+
+    if (defined($config_LIBS_alternatives)) {
+        foreach my $conf_LIBS (@$config_LIBS_alternatives) {
+            if (_libxml_check_lib_with_config_LIBs($libname, $conf_LIBS)) {
+                $config{LIBS} = $conf_LIBS;
+                return 1;
+            }
+        }
+    }
+    else {
+        return _libxml_check_lib_with_config_LIBs($libname, $config{LIBS});
+    }
+}
+
 print "Checking for ability to link against xml2...";
 if ( _libxml_check_lib('xml2') ) {
     print "yes\n";
 	xmlTextReader
 	<emphasis>http://xmlsoft.org/html/libxml-xmlreader.html</emphasis>.
 	This feature requires at least libxml2-2.6.21.
-	Pull-parser (StAX in Java, XmlReader in C#) use an iterator
+	Pull-parsers (such as StAX in Java, XmlReader in C#) use an iterator
 	approach to parse XML documents. They are easier to program than
 	event-based parser (SAX) and much more lightweight than
 	tree-based parser (DOM), which load the complete tree into
 void
 _domReconcileNs(xmlNodePtr tree, xmlNsPtr * unused)
 {
-        if( tree->ns != NULL )
+        if ( tree->ns != NULL )
         {
                 xmlNsPtr ns = xmlSearchNs( tree->doc, tree->parent, tree->ns->prefix );
                 if( ns != NULL && ns->href != NULL && tree->ns->href != NULL &&
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.