Blob Blame History Raw
--- Makefile.PL
+++ Makefile.PL
@@ -52,6 +52,16 @@ if ($parilib) {
 Trying to use existing PARI library (at $parilib)
      (integer-formatted version $pari_version).
 EOP
+  $common::parilib = $parilib;
+  $define .= " -DPARI_VERSION_EXP=$pari_version";
+  my $offset = index($Config{byteorder}, "1");
+  $offset = 3 if $offset > 3;	# SvFLAGS is actually I32
+  $define .= " -DLSB_in_U32=$offset";
+  my $longsize = length(eval { pack 'l!', 1 } or pack 'l', 1);
+  my $perl_int_size = $Config{'ivsize'} || $Config{'intsize'}
+          or die "Can't deduce Perl int size";
+  $define .= ' -DLONG_SHORTER_THAN_IV' if $perl_int_size > $longsize;
+  $define .= ' -Derr=pari_err'; # On linux it can get a wrong dynamic loading
 } else {
   $paridir   = find_pari_dir() unless defined $paridir or $parisrc or $force_download;
   ($paridir, my @patch_rc) = download_and_patch_pari($parisrc, $force_download)
@@ -241,9 +251,11 @@ EOP
 		  LIBS	     =>  $parilib,
 		  INC	     =>  "-I $pariincludes/include -I $pariincludes/src",
 		 ) :
-		 (MYEXTLIB   =>  'libPARI/libPARI$(LIB_EXT)')),
+		 (MYEXTLIB   =>  'libPARI/libPARI$(LIB_EXT)',
 		  LIBS	     =>  $libs,
 		  INC	     =>  $extra_inc . ' -I $(PARI_DIR)/src/headers -I $(PARI_DIR)/src -I ./libPARI',
+                 )
+               ),
 	       VERSION_FROM  => 'Pari.pm',
     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM  => 'Pari.pm', # retrieve abstract from module
--- Pari.xs
+++ Pari.xs
@@ -8,6 +8,7 @@
 #ifdef USE_STANDALONE_PARILIB
 #  include <pari/pari.h>
 #  include <pari/paripriv.h>
+#  include <language/anal.h>
 #else
 #  include <pari.h>
 #  include <graph/rect.h>
--- utils/Math/PariBuild.pm
+++ utils/Math/PariBuild.pm
@@ -254,7 +254,7 @@ sub extract_pari_archive ($) {
     return $dir;
 }
 
-sub fmt_version {sprintf "%03d%03d%03d", split /\./, shift}
+sub fmt_version {sprintf "%d%03d%03d", split /\./, shift}
 
 sub pari_formatted_version_from_includes($) {	# Unsupported; to enable parilib option; based on
     my $prefix = shift;			#  http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/math/p5-Math-Pari/patches/patch-aa