Blame polymake-lrs-system-fix.patch

8897c6
diff -up ./bundled/lrs/configure.pl.systemfix ./bundled/lrs/configure.pl
8897c6
--- ./bundled/lrs/configure.pl.systemfix	2015-08-10 14:22:38.628817921 -0400
8897c6
+++ ./bundled/lrs/configure.pl	2015-08-10 14:37:43.261181962 -0400
8897c6
@@ -17,14 +17,16 @@
8897c6
 
8897c6
 sub allowed_options {
8897c6
    my ($allowed_options, $allowed_with)=@_;
8897c6
-   @$allowed_with{ qw( lrs ) }=();
8897c6
+   @$allowed_with{ qw( lrs lrs-include lrs-lib) }=();
8897c6
 }
8897c6
 
8897c6
 
8897c6
 sub usage {
8897c6
    print STDERR "  --with-lrs=PATH  Installation path of lrslib, if non-standard.\n",
8897c6
                 "                   Uses the bundled lrslib (bundled/lrs/external/lrs) if it exists\n",
8897c6
-                "                   and either no path or 'bundled' is given as option.\n";
8897c6
+                "                   and either no path or 'bundled' is given as option.\n",
8897c6
+                "  --with-lrs-include=PATH  Path to the folder containing lrslib.h.  \n",
8897c6
+                "  --with-lrs-lib=PATH      Path to the folder containing liblrsgmp.{a,so,dylib} \n";
8897c6
 }
8897c6
 
8897c6
 sub check_bundled {
8897c6
@@ -39,19 +41,34 @@ sub proceed {
8897c6
 
8897c6
    if (defined ($lrs_path=$options->{lrs}) and $lrs_path ne "bundled") {
8897c6
       my $lrs_inc="$lrs_path/include";
8897c6
-      my $lrs_lib=Polymake::Configure::get_libdir($lrs_path, "lrs");
8897c6
-      if (-f "$lrs_inc/lrslib.h" && -f "$lrs_lib/liblrsgmp.$Config::Config{so}" ) {
8897c6
+      if (-f "$lrs_inc/lrslib.h") {
8897c6
          $CXXflags="-I$lrs_inc";
8897c6
-         $LDflags="-L$lrs_lib -Wl,-rpath,$lrs_lib";
8897c6
-      } elsif (-f "$lrs_inc/lrslib.h" && -f "$lrs_lib/liblrsgmp.a" ) {
8897c6
-         $CXXflags="-I$lrs_inc";
8897c6
-         $LDflags="-L$lrs_lib";
8897c6
-      } else {
8897c6
-         die "Invalid installation location of lrslib: header file lrslib.h and/or library liblrsgmp.$Config::Config{so} / liblrsgmp.a not found\n";
8897c6
+      } elsif (-f "$lrs_inc/lrslib/lrslib.h") {
8897c6
+         # This is for fedora where the includes are moved to a subdirectory
8897c6
+         $CXXflags = "-I$lrs_inc/lrslib";
8897c6
+      }
8897c6
+      my $lrs_lib=Polymake::Configure::get_libdir($lrs_path, "lrsgmp");
8897c6
+      if (-f "$lrs_lib/liblrsgmp.$Config::Config{so}" ) {
8897c6
+         $LDflags = "-L$lrs_lib";
8897c6
+         $LDflags .= " -Wl,-rpath,$lrs_lib" unless ($lrs_path eq "/usr");
8897c6
+      }      
8897c6
+   
8897c6
+      if (!$CXXflags or !$LDflags) {
8897c6
+         die "Invalid installation location of lrslib: header file lrslib.h and/or library liblrsgmp.$Config::Config{so} not found.\n",
8897c6
+             "You might try to use --with-lrs-include and --with-lrs-lib.\n";
8897c6
       }
8897c6
       $LrsCflags = $CXXflags;
8897c6
    }
8897c6
 
8897c6
+   if (defined (my $lrs_inc=$options->{'lrs-include'})) {
8897c6
+      $CXXflags="-I$lrs_inc";
8897c6
+      $cdd_path .= "include: $lrs_inc ";
8897c6
+   }
8897c6
+   if (defined ($cdd_lib=$options->{'lrs-lib'})) {
8897c6
+      $LDflags = "-L$lrs_lib -Wl,-rpath,$lrs_lib";
8897c6
+      $cdd_path .= "lib: $lrs_lib";
8897c6
+   }
8897c6
+
8897c6
    if ($lrs_path ne "bundled") {
8897c6
       my $error=Polymake::Configure::build_test_program(<<'---', Libs => "-llrsgmp -lgmp", CXXflags => "$CXXflags", LDflags => "$LDflags");
8897c6
 #include <iostream>