Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed d391e97

Modified Files:
Makefile.PL
+ causes less harm to preset LIBS and INCs

  • Participants
  • Parent commits 652e7cc

Comments (0)

Files changed (1)

         $xml2cfg = $libprefix . '/bin/' . $xml2cfg;
     }
 
-    print "running xml2-config...";
-    eval {
-        try_libconfig( $xml2cfg, \%config, @blacklist );
-    };
+    # if a user defined INC and LIBS on the command line we must not 
+    # override them
+    if ( not defined $config{LIBS} and not defined $config{INC} ) {
+        print "running xml2-config...";
+        eval {
+            try_libconfig( $xml2cfg, \%config, @blacklist );
+        };
 
-    if ( $@ ) {
-        if ( $@ =~ /^VERSION/ ) {
-            die "The installed version of libxml2 is known not to work.\n".
-                 "  Don't expect XML::LibXML to build or work correctly.\n".
-                 "  Don't report errors!!!\n".
-                 "  Check the README file for more informations\n";
-        }
-        if ( $@ =~ /^UNTESTED/ ) {
-            warn <<UNTESTED;
+        if ( $@ ) {
+            if ( $@ =~ /^VERSION/ ) {
+                die "The installed version of libxml2 is known not to work.\n".
+                    "  Don't expect XML::LibXML to build or work correctly.\n".
+                    "  Don't report errors!!!\n".
+                    "  Check the README file for more informations\n";
+            }
+            if ( $@ =~ /^UNTESTED/ ) {
+                warn <<UNTESTED;
 WARNING!
 The installed version of libxml2 was not tested with this version of XML::LibXML.
 
     Check the README file for more informations
 END OF WARNING
 UNTESTED
-        }
+            }
 
-        if ( not defined $config{LIBS} and not defined $config{INC} ) {
-            warn "\nusing fallback values for LIBS and INC\n";
-            $config{LIBS} = '-L/usr/local/lib -L/usr/lib -lxml2 -lz -lm';
-            $config{INC} = '-I/usr/local/include -I/usr/include';
-            print <<OPT;
+            if ( not defined $config{LIBS} and not defined $config{INC} ) {
+                warn "\nusing fallback values for LIBS and INC\n";
+                $config{LIBS} = '-L/usr/local/lib -L/usr/lib -lxml2 -lm';
+                $config{INC} = '-I/usr/local/include -I/usr/include';
+                print <<OPT;
 options:
   LIBS='$config{LIBS}'
   INC='$config{INC}'
   \$ $^X Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'
 
 OPT
+            }
         }
     }
 }