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