Ticket #9722: trac_9722-combined.patch

File trac_9722-combined.patch, 23.8 KB (added by mpatel, 11 years ago)

Combined p2-p4 SPKG patch

  • .hgignore

    # HG changeset patch
    # User Mitesh Patel <qed777@gmail.com>
    # Date 1282570639 25200
    # Node ID a7600daa3991c23c96498baa84beebb4a6a90d82
    # Parent  b475dd68b19a8063b06065095ffb8c684bb3cee5
    #9722: Combined patch of Leif Leonhardy's p2-p3 and p3-p4 patches
    
    * * *
    #9722: Explicitly link against libstdc++ if FLTK is used, to support Fedora 13.
    
    === pari-2.3.5.p3 (Leif Leonhardy, August 11th 2010) ===
     * #9722: Explicitly link against libstdc++ if FLTK is used, to support
       Fedora 13.
     * TODO/FIXME: On Fedora 13, PARI was reported to try to use FLTK even if
       just the library (as opposed to the required developer) package of FLTK is
       installed, which resulted in a compiler (not the fixed linker) error.
       I though couldn't reproduce this on neither 32-bit nor 64-bit Fedora 13,
       so I believe this error is due to a broken/invalid FLTK installation on
       the machines at ETH Zurich. (One could add an extra test for presence of
       the FLTK include directory to make the build more robust.)
    * * *
    #9722: pari-2.3.5.p4: Further improvements wrt. graphics support, some clean-up. (See also #9343.)
    
    === pari-2.3.5.p4 (Leif Leonhardy, August 23th 2010) ===
     * #9722: "--graphic=none" is now respected by PARI. We still look
       for graphics libraries, but don't use them in that case (see below,
       too).
     * #9722: Improved patch to config/get_fltk (makes sure the header
       files are present, too, if the FLTK library was found - fixes
       compiler error on IMHO misconfigured installations).
       We still look for FLTK components even if "--graphic=none" was
       specified, and print appropriate messages, but then simply do not
       use them.
     * #9722: New patch to config/get_X11:
       - Added/corrected/clarified messages regarding what was (not) found,
         and if this is really relevant.
       - An X11 library in */lib64/* will be found now, too (if we do a
         64-bit build); on Fedora, libX11.so is located in /usr/lib64.
       - Added comments.
     * spkg-install:
       - Clear (unset) lots of variables that might (unintentionally) be
         used by PARI; perhaps upstream should initialize them.
       - Clear GP_INSTALL_PREFIX, which is interpreted by PARI.
       - Added help & informational message regarding PARI_EXTRA_OPTS; in
         addition, allow the user to override Sage's "--graphic=none"
         since this now works (see above; we don't want to annoy users
         that perhaps previously made use of GP's plotting support).
     * Clean-up in spkg-install:
       - Quote more environment variables (including SAGE_LOCAL).
       - Consistently use $UNAME instead of `uname` (set in sage-env).
       - Always use $MAKE instead of "make" (changed once, for install-data).
       - Added some comments.
     * NOTE: At least some of these changes should be incorporated into
       our PARI 2.4.3 (svn 12577, see #9343), and/or reported upstream.
       I haven't changed config/get_Qt. It seems Qt support is broken on
       newer systems (because Qt <=3 is expected), but this doesn't break
       the build, only Qt will not be used.
    
    diff --git a/.hgignore b/.hgignore
    a b  
    11src/
     2patches/get_fltk.patch.p3
  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b exactly where it says native, but I woul 
    6565
    6666== Changelog ==
    6767
     68=== pari-2.3.5.p4 (Leif Leonhardy, August 23th 2010) ===
     69 * #9722: "--graphic=none" is now respected by PARI. We still look
     70   for graphics libraries, but don't use them in that case (see below,
     71   too).
     72 * #9722: Improved patch to config/get_fltk (makes sure the header
     73   files are present, too, if the FLTK library was found - fixes
     74   compiler error on IMHO misconfigured installations).
     75   We still look for FLTK components even if "--graphic=none" was
     76   specified, and print appropriate messages, but then simply do not
     77   use them.
     78 * #9722: New patch to config/get_X11:
     79   - Added/corrected/clarified messages regarding what was (not) found,
     80     and if this is really relevant.
     81   - An X11 library in */lib64/* will be found now, too (if we do a
     82     64-bit build); on Fedora, libX11.so is located in /usr/lib64.
     83   - Added comments.
     84 * spkg-install:
     85   - Clear (unset) lots of variables that might (unintentionally) be
     86     used by PARI; perhaps upstream should initialize them.
     87   - Clear GP_INSTALL_PREFIX, which is interpreted by PARI.
     88   - Added help & informational message regarding PARI_EXTRA_OPTS; in
     89     addition, allow the user to override Sage's "--graphic=none"
     90     since this now works (see above; we don't want to annoy users
     91     that perhaps previously made use of GP's plotting support).
     92 * Clean-up in spkg-install:
     93   - Quote more environment variables (including SAGE_LOCAL).
     94   - Consistently use $UNAME instead of `uname` (set in sage-env).
     95   - Always use $MAKE instead of "make" (changed once, for install-data).
     96   - Added some comments.
     97 * NOTE: At least some of these changes should be incorporated into
     98   our PARI 2.4.3 (svn 12577, see #9343), and/or reported upstream.
     99   I haven't changed config/get_Qt. It seems Qt support is broken on
     100   newer systems (because Qt <=3 is expected), but this doesn't break
     101   the build, only Qt will not be used.
     102
     103=== pari-2.3.5.p3 (Leif Leonhardy, August 11th 2010) ===
     104 * #9722: Explicitly link against libstdc++ if FLTK is used, to support
     105   Fedora 13.
     106 * TODO/FIXME: On Fedora 13, PARI was reported to try to use FLTK even if
     107   just the library (as opposed to the required developer) package of FLTK is
     108   installed, which resulted in a compiler (not the fixed linker) error.
     109   I though couldn't reproduce this on neither 32-bit nor 64-bit Fedora 13,
     110   so I believe this error is due to a broken/invalid FLTK installation on
     111   the machines at ETH Zurich. (One could add an extra test for presence of
     112   the FLTK include directory to make the build more robust.)
     113
    68114=== pari-2.3.5.p2 (Mitesh Patel, July 26th 2010) ===
    69115 * #9597: Clean up first line of spkg-install.  Also, use
    70116    '/usr/bin/env bash' instead of '/bin/sh'.
  • new file patches/get_X11

    diff --git a/patches/get_X11 b/patches/get_X11
    new file mode 100644
    - +  
     1tdir=$osname-$arch-X11$$
     2mkdir $tdir; cp Imakefile $tdir; cd $tdir
     3if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
     4  echo "Using 'xmkmf' to locate X11 headers and libraries..."
     5  eval `make gp-X11 2> /dev/null | grep -v make`
     6  x11pth="$usrlibdir $libdir";
     7else
     8  echo "'xmkmf' seems not to be available..."
     9fi
     10cd ..; rm -rf $tdir
     11
     12# DEBUG (leif):
     13echo "... (\$Xincroot after xmkmf attempt is \"$Xincroot\".)"
     14echo "... (\$x11pth after xmkmf attempt is \"$x11pth\".)"
     15
     16# Check xmkmf answer
     17# X11 -- Headers
     18if test ! -f $Xincroot/X11/Xos.h; then
     19  x11pth="\
     20    /usr/openwin/share/lib\
     21    /usr/openwin/lib\
     22    /usr/X11R6/lib       /usr/X11R5/lib       /usr/X11R4/lib\
     23    /usr/lib/X11R6       /usr/lib/X11R5       /usr/lib/X11R4\
     24    /usr/local/X11R6/lib /usr/local/X11R5/lib /usr/local/X11R4/lib\
     25    /usr/local/lib/X11R6 /usr/local/lib/X11R5 /usr/local/lib/X11R4\
     26    /usr/X11/lib\
     27    /usr/lib/X11\
     28    /usr/local/X11/lib\
     29    /usr/local/lib/X11\
     30    /usr/XFree86/lib/X11\
     31    /usr/lib\
     32    /usr/local/lib\
     33    /usr/athena/lib\
     34  ";
     35  pth=`echo $x11pth | sed 's,/lib,/include,g'`
     36  x=`./locate X11/Xos.h '' $pth`
     37  case $x in
     38   /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`
     39       echo "...Found X11 header files in \"$Xincroot/X11\".";;
     40   *)  Xincroot=""
     41       echo "### Could not find X11 header files."
     42       case $which_graphic_lib in
     43         none)
     44           echo "(This is just informational - no graphics support was requested anyway.)";;
     45       esac
     46       ;;
     47  esac
     48else
     49  echo "...Found X11 header files in \"$Xincroot/X11\"."
     50fi
     51
     52# X11 -- Lib
     53pth=$x11pth
     54lib=X11; . ./locatelib
     55# Comment by leif:
     56# The above doesn't find a libX11.so in, e.g., /usr/lib64 (Fedora 13),
     57# so try again if we are on a 64-bit system (added by me):
     58if test -z "$X11" -a "$sizeof_long" -eq 8; then
     59  echo "...libX11.so not yet found, searching 64-bit directories..."
     60  pth=`echo $x11pth | sed 's,/lib,/lib64,g'`
     61  lib=X11; . ./locatelib
     62fi
     63
     64if test -f $Xincroot/X11/Xos.h -a -n "$X11"; then
     65  case $which_graphic_lib in
     66    auto) which_graphic_lib=X11;;
     67  esac
     68  echo ..."Found X11 header files in $Xincroot/X11"
     69  echo ..."Found X11 library in $X11"
     70  test -n "$extralib" && echo ..."Extra Libraries are $extralib"
     71  X11_LIBS="-L$X11 -lX11 $extralib"
     72  X11_INC="-I$Xincroot"
     73else
     74  echo "### Not all necessary parts of X11 found"
     75  case $which_graphic_lib in
     76    none)
     77      echo "(This is just informational - no graphics support was requested anyway.)";;
     78  esac
     79  X11=
     80fi
     81
  • new file patches/get_X11.patch

    diff --git a/patches/get_X11.patch b/patches/get_X11.patch
    new file mode 100644
    - +  
     1--- ../src/config/get_X11       2008-03-31 13:43:59.000000000 +0200
     2+++ get_X11     2010-08-23 08:04:45.000000000 +0200
     3@@ -1,11 +1,18 @@
     4 tdir=$osname-$arch-X11$$
     5 mkdir $tdir; cp Imakefile $tdir; cd $tdir
     6 if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
     7+  echo "Using 'xmkmf' to locate X11 headers and libraries..."
     8   eval `make gp-X11 2> /dev/null | grep -v make`
     9   x11pth="$usrlibdir $libdir";
     10+else
     11+  echo "'xmkmf' seems not to be available..."
     12 fi
     13 cd ..; rm -rf $tdir
     14 
     15+# DEBUG (leif):
     16+echo "... (\$Xincroot after xmkmf attempt is \"$Xincroot\".)"
     17+echo "... (\$x11pth after xmkmf attempt is \"$x11pth\".)"
     18+
     19 # Check xmkmf answer
     20 # X11 -- Headers
     21 if test ! -f $Xincroot/X11/Xos.h; then
     22@@ -28,22 +35,47 @@
     23   pth=`echo $x11pth | sed 's,/lib,/include,g'`
     24   x=`./locate X11/Xos.h '' $pth`
     25   case $x in
     26-   /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`;;
     27-   *)  Xincroot=;;
     28+   /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`
     29+       echo "...Found X11 header files in \"$Xincroot/X11\".";;
     30+   *)  Xincroot=""
     31+       echo "### Could not find X11 header files."
     32+       case $which_graphic_lib in
     33+         none)
     34+           echo "(This is just informational - no graphics support was requested anyway.)";;
     35+       esac
     36+       ;;
     37   esac
     38+else
     39+  echo "...Found X11 header files in \"$Xincroot/X11\"."
     40 fi
     41+
     42 # X11 -- Lib
     43 pth=$x11pth
     44 lib=X11; . ./locatelib
     45+# Comment by leif:
     46+# The above doesn't find a libX11.so in, e.g., /usr/lib64 (Fedora 13),
     47+# so try again if we are on a 64-bit system (added by me):
     48+if test -z "$X11" -a "$sizeof_long" -eq 8; then
     49+  echo "...libX11.so not yet found, searching 64-bit directories..."
     50+  pth=`echo $x11pth | sed 's,/lib,/lib64,g'`
     51+  lib=X11; . ./locatelib
     52+fi
     53+
     54 if test -f $Xincroot/X11/Xos.h -a -n "$X11"; then
     55   case $which_graphic_lib in
     56     auto) which_graphic_lib=X11;;
     57   esac
     58   echo ..."Found X11 header files in $Xincroot/X11"
     59+  echo ..."Found X11 library in $X11"
     60   test -n "$extralib" && echo ..."Extra Libraries are $extralib"
     61   X11_LIBS="-L$X11 -lX11 $extralib"
     62   X11_INC="-I$Xincroot"
     63 else
     64-  echo "### X11 not found"
     65+  echo "### Not all necessary parts of X11 found"
     66+  case $which_graphic_lib in
     67+    none)
     68+      echo "(This is just informational - no graphics support was requested anyway.)";;
     69+  esac
     70   X11=
     71 fi
     72+
  • new file patches/get_fltk

    diff --git a/patches/get_fltk b/patches/get_fltk
    new file mode 100644
    - +  
     1if test -z "$with_fltk"; then
     2  case "$which_graphic_lib" in
     3    fltk) with_fltk=yes;;
     4  esac
     5  # (Just the) Comment by leif:
     6  # In case not all necessary parts of X11 (headers *and* lib)
     7  # were found, look for FLTK:
     8  if test -z "$X11"; then with_fltk=yes; fi
     9fi
     10if test -n "$with_fltk"; then
     11  orig_which_graphic_lib=$which_graphic_lib
     12  which_graphic_lib=fltk
     13  FLTKDIR=
     14  case "$with_fltk" in
     15  yes)
     16     pth=$libpth; lib=fltk; . ./locatelib
     17     if test -n "$fltk"; then
     18       FLTKDIR=`dirname $fltk | sed -e 's/lib\/$//'`
     19     fi
     20     ;;
     21  *) if test ! -d "$with_fltk"; then
     22      echo "### Specified FLTK directory '$with_fltk' not found."
     23    else
     24      FLTKDIR=$with_fltk
     25    fi;;
     26  esac
     27  if test -n "$FLTKDIR"; then
     28    case "$FLTKDIR" in /) FLTKDIR=;; esac # leif: ???
     29    case "$orig_which_graphic_lib" in
     30      none)
     31        # echo "...Found FLTK library in \"$FLTKDIR\"."
     32        if test -n "$fltk"; then
     33          echo "...Found FLTK library in \"$fltk\"."
     34        else
     35          echo "...Assuming FLTK library is in specified directory \"$FLTKDIR\"."
     36        fi
     37        if test -d "$FLTKDIR/include/FL"; then
     38          echo "...Found FLTK header files in \"$FLTKDIR/include/FL\"."
     39        else
     40          echo "...But FLTK header files/include directory not found."
     41        fi
     42        which_graphic_lib=none # =$orig_which_graphic_lib
     43        ;;
     44      *)
     45        if test -d "$FLTKDIR/include/FL"; then
     46          echo "Using FLTK library, FLTKDIR = \"$FLTKDIR\"."
     47        else
     48          echo "### Found FLTK library, but not the necessary headers."
     49          echo "### Building without FLTK support."
     50          which_graphic_lib=none
     51        fi
     52        ;;
     53    esac
     54  else
     55    echo "### FLTK not found. Building without FLTK support."
     56    case "$orig_which_graphic_lib" in
     57      none)
     58        echo "(This is just informational - no graphics support was requested anyway.)"
     59        ;;
     60    esac
     61    which_graphic_lib=none
     62  fi
     63  case "$osname" in
     64    cygwin) FLTK_LIBS="-lgdi32 -lole32 -luuid -lwsock32 -lsupc++" ;;
     65    darwin) FLTK_LIBS="-framework Carbon -lsupc++" ;;
     66    *)      FLTK_LIBS="$X11_LIBS -lstdc++" ;;
     67  esac
     68fi
  • new file patches/get_fltk.patch

    diff --git a/patches/get_fltk.patch b/patches/get_fltk.patch
    new file mode 100644
    - +  
     1--- ../src/config/get_fltk      2008-03-31 13:43:59.000000000 +0200
     2+++ get_fltk    2010-08-23 08:39:45.000000000 +0200
     3@@ -2,9 +2,13 @@
     4   case "$which_graphic_lib" in
     5     fltk) with_fltk=yes;;
     6   esac
     7+  # (Just the) Comment by leif:
     8+  # In case not all necessary parts of X11 (headers *and* lib)
     9+  # were found, look for FLTK:
     10   if test -z "$X11"; then with_fltk=yes; fi
     11 fi
     12 if test -n "$with_fltk"; then
     13+  orig_which_graphic_lib=$which_graphic_lib
     14   which_graphic_lib=fltk
     15   FLTKDIR=
     16   case "$with_fltk" in
     17@@ -15,21 +19,50 @@
     18      fi
     19      ;;
     20   *) if test ! -d "$with_fltk"; then
     21-      echo "### FLTK directory '$with_fltk' not found"
     22+      echo "### Specified FLTK directory '$with_fltk' not found."
     23     else
     24       FLTKDIR=$with_fltk
     25     fi;;
     26   esac
     27   if test -n "$FLTKDIR"; then
     28-    case "$FLTKDIR" in /) FLTKDIR=;; esac
     29-    echo "Using FLTK library, FLTKDIR = $FLTKDIR"
     30+    case "$FLTKDIR" in /) FLTKDIR=;; esac # leif: ???
     31+    case "$orig_which_graphic_lib" in
     32+      none)
     33+        # echo "...Found FLTK library in \"$FLTKDIR\"."
     34+        if test -n "$fltk"; then
     35+          echo "...Found FLTK library in \"$fltk\"."
     36+        else
     37+          echo "...Assuming FLTK library is in specified directory \"$FLTKDIR\"."
     38+        fi
     39+        if test -d "$FLTKDIR/include/FL"; then
     40+          echo "...Found FLTK header files in \"$FLTKDIR/include/FL\"."
     41+        else
     42+          echo "...But FLTK header files/include directory not found."
     43+        fi
     44+        which_graphic_lib=none # =$orig_which_graphic_lib
     45+        ;;
     46+      *)
     47+        if test -d "$FLTKDIR/include/FL"; then
     48+          echo "Using FLTK library, FLTKDIR = \"$FLTKDIR\"."
     49+        else
     50+          echo "### Found FLTK library, but not the necessary headers."
     51+          echo "### Building without FLTK support."
     52+          which_graphic_lib=none
     53+        fi
     54+        ;;
     55+    esac
     56   else
     57-    echo "### FLTK not found. Building without FLTK support"
     58+    echo "### FLTK not found. Building without FLTK support."
     59+    case "$orig_which_graphic_lib" in
     60+      none)
     61+        echo "(This is just informational - no graphics support was requested anyway.)"
     62+        ;;
     63+    esac
     64     which_graphic_lib=none
     65   fi
     66   case "$osname" in
     67     cygwin) FLTK_LIBS="-lgdi32 -lole32 -luuid -lwsock32 -lsupc++" ;;
     68     darwin) FLTK_LIBS="-framework Carbon -lsupc++" ;;
     69-    *)      FLTK_LIBS="$X11_LIBS" ;;
     70+    *)      FLTK_LIBS="$X11_LIBS -lstdc++" ;;
     71   esac
     72 fi
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b TOP=`pwd` 
    99# needs to be if using gcc. I assume the equivalent will be needed on
    1010# other compilers.
    1111
    12 if [ `uname` = "SunOS" ]; then
     12if [ "$UNAME" = "SunOS" ]; then
    1313    sed 's/-fomit-frame-pointer/-fomit-frame-pointer -fPIC/g' src/config/get_cc > src/config/get_cc.$$
    1414    mv src/config/get_cc.$$ src/config/get_cc
    1515fi
    cd src 
    1919cp "$TOP"/patches/get_dlld config/
    2020
    2121# mabshoff: This patch is to get around problem in PPC 32-bit Linux build
    22 # (but it is ok on any other machine)
     22#           (but it is ok on any other machine)
     23# leif: And also on MacOS X 10.4 (Tiger, at least on PPC),
     24#       which in addition needs "-fno-common".
    2325cp "$TOP"/patches/get_dlcflags config/
    2426
    2527# pjeremy: fix for FreeBSD: #7825
    cp "$TOP"/patches/gphelp.in doc/ 
    3335
    3436# Minh Van Nguyen: copy over patched get_cc (see ticket #7092). It's
    3537# reported that 32-bit Fedora 11 would fail to build otherwise.
    36 if [ `uname` = "Linux" ]; then
     38if [ "$UNAME" = "Linux" ]; then
    3739    cp "$TOP"/patches/get_cc config/get_cc
    3840fi
    3941
     42# leif: Add libstdc++ for Fedora 13 (if FLTK is present, see #9722),
     43# and in addition make sure the necessary FLTK include directory is
     44# really there, since on some sites otherwise a compiler error might
     45# break the build. Also respect "--graphic=none":
     46cp "$TOP"/patches/get_fltk config/
     47
     48# leif: Clarify PARI's "X11 not found" message (see #9722, too),
     49#       add some messages. Also search */lib64/* directories if
     50#       we are doing a 64-bit build, and respect "--graphic=none":
     51cp "$TOP"/patches/get_X11 config/
     52
    4053# This is needed or there are weird locale problems involving rpath
    4154# with building Sage.
    4255LC_ALL=C
    build() 
    4861{
    4962    #  add the proper flags for 64-bit build mode on OS X and Open Solaris x64
    5063    if [ "x$SAGE64" = xyes ]; then
    51         CFLAGS="-g -m64 " && export CFLAGS
     64        echo "Building a 64-bit version of PARI/GP"
     65        CFLAGS="$CFLAGS -g -m64" && export CFLAGS
    5266    fi
    5367
    5468    CUR=`pwd`
    build() 
    6175    unset AS
    6276
    6377    if [ "$PARI_EXTRA_OPTS" = "" ]; then
    64         PARI_EXTRA_OPTS=" --graphic=none "
     78        echo "============================================================"
     79        echo "Configuring PARI/GP without graphics support (for plotting)."
     80        echo "If you need it, pass the appropriate option(s) to PARI by"
     81        echo "setting and exporting \$PARI_EXTRA_OPTS prior to building"
     82        echo "Sage (or at least before you build/install the PARI spkg),"
     83        echo "e.g. by typing at the shell prompt:"
     84        echo "    export PARI_EXTRA_OPTS=\"--graphic=auto\""
     85        echo "or"
     86        echo "    export PARI_EXTRA_OPTS=\"--with-fltk\""
     87        echo "Please consult the PARI documentation for further details."
     88        echo "============================================================"
     89
     90        PARI_EXTRA_OPTS="--graphic=none"
     91    else
     92        echo "============================================================"
     93        echo "Configuring PARI/GP with additional user-specified options:"
     94        echo "    PARI_EXTRA_OPTS=\"$PARI_EXTRA_OPTS\""
     95
     96        # Do NOT add "--graphic=none" if the user provided one of these:
     97        if ! (echo "$PARI_EXTRA_OPTS" | egrep -- "--with-fltk|--with-qt") >/dev/null; then
     98          echo "To avoid unexpected behavior, we prepend \"--graphic=none\":"
     99          PARI_EXTRA_OPTS="--graphic=none $PARI_EXTRA_OPTS"
     100          echo "    \"$PARI_EXTRA_OPTS\""
     101          echo "(Disabling graphics can be overridden by user settings.)"
     102        fi
     103        echo "============================================================"
    65104    fi
    66105
    67     ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none
     106    unset GP_INSTALL_PREFIX # we do not want this to be set by the user
     107
     108    # In addition, a lot of variables used (internally) by PARI might un-
     109    # intentionally get their values from the "global" environment, so it's
     110    # safer to clear them here (not further messing up PARI's scripts):
     111    unset static tune timing_fun error
     112    unset with_fltk with_qt
     113    unset with_ncurses_lib
     114    unset with_readline_include with_readline_lib without_readline
     115    unset with_gmp_include with_gmp_lib without_gmp
     116    unset dfltbindir dfltdatadir dfltemacsdir dfltincludedir
     117    unset dfltlibdir dfltmandir dfltsysdatadir dfltobjdir
     118    # The following get set because we pass the respective parameters:
     119    # prefix kernel with_gmp with_readline
     120   
     121
     122    # echo "Configuring PARI/GP..." # already said above
     123    ./Configure $PARI_EXTRA_OPTS --prefix="$SAGE_LOCAL" --with-readline="$SAGE_LOCAL" \
     124        --with-gmp="$SAGE_LOCAL" --kernel=gmp
    68125
    69126    if [ $? -ne 0 ]; then
    70         echo "ERROR - configure PARI with readline and gmp failed."
     127        echo "ERROR: Configuring PARI with readline and gmp failed."
    71128        exit 1
    72129    fi
    73130
    74131    if [ ! -f Makefile ]; then
    75         echo "Unable to configure PARI."
     132        echo "ERROR: Unable to configure PARI: No Makefile generated!"
    76133        exit 1
    77134    fi
    78135
    79     echo "Building and install PARI"
     136    echo "Building and installing PARI..."
    80137    if [ "$UNAME" = "CYGWIN" ]; then
    81138        # There are weird bugs in PARI's build process on Windows XP
    82139        # under Cygwin.
    build() 
    112169    # Instead of "make install" we do the following, to avoid building
    113170    # the PARI documentation (which requires latex; or more precisely,
    114171    # *hangs* under a default cygwin with latex, since some fonts are missing).
    115     cd `config/objdir`
     172    cd "`config/objdir`"
    116173    $MAKE install-include
    117174
    118175    if [ $? -ne 0 ]; then
    build() 
    120177        exit 1
    121178    fi
    122179
    123     cp -f libpari* $SAGE_LOCAL/lib/
     180    cp -f libpari* "$SAGE_LOCAL/lib/"
    124181    cd "$CUR"
    125182
    126183    # On CYGWIN, need the dll for PARI to be in the same
    build() 
    145202            exit 1
    146203        fi
    147204
    148         cd `config/objdir`
    149         cp -f libpari* $SAGE_LOCAL/lib
     205        cd "`config/objdir`"
     206        cp -f libpari* "$SAGE_LOCAL/lib"
    150207        cd "$CUR"
    151208
    152209        # Also another patch since paripriv.h won't compile right on OS X
    153210        # when used by client Sage code.  So we replace it by a slightly
    154211        # modified version.
    155         cp -pf "$TOP"/patches/paripriv-osx.h $SAGE_LOCAL/include/pari/paripriv.h
     212        cp -pf "$TOP"/patches/paripriv-osx.h "$SAGE_LOCAL/include/pari/paripriv.h"
    156213    fi
    157214    # Like on OS X (see above), the Sage library would not build
    158215    # without some changes. Though on Solaris the changes are much simpler than
    159216    # on OS X.
    160     if [ `uname` = "SunOS" ]; then
     217    if [ "$UNAME" = "SunOS" ]; then
    161218       set -e
    162219       echo "Patching include/pari/paripriv.h so it works on Solaris"
    163220       echo "The changes are much smaller than needed on OS X"
    164        cp  "$TOP"/patches/paripriv-Solaris.h $SAGE_LOCAL/include/pari/paripriv.h
     221       cp  "$TOP"/patches/paripriv-Solaris.h "$SAGE_LOCAL/include/pari/paripriv.h"
    165222       set +e
    166223    elif [ "$UNAME" = "CYGWIN" ]; then
    167224       # We need to the same thing on Cygwin that we have to do on Solaris
    168        cp  "$TOP"/patches/paripriv-Solaris.h $SAGE_LOCAL/include/pari/paripriv.h
     225       cp  "$TOP"/patches/paripriv-Solaris.h "$SAGE_LOCAL/include/pari/paripriv.h"
    169226    fi
    170227
    171228    echo "Installing extra Galois groups data."
    172     make install-data
     229    $MAKE install-data
    173230    if [ $? -ne 0 ]; then
    174         echo "Error installing extra galois groups data."
     231        echo "Error installing extra Galois groups data."
    175232        exit 1
    176233    fi
    177234}
    178235
    179236build
    180237
     238# leif: This is redundant, and will never occur since we would have exited earlier:
    181239if [ $? -ne 0 ]; then
    182240    echo "Error building PARI."
    183241    exit 1
    184242fi
    185243
    186 if [ $UNAME="Darwin" -a -f $SAGE_LOCAL/lib/libpari.dylib ]; then
     244if [ "$UNAME"="Darwin" -a -f "$SAGE_LOCAL/lib/libpari.dylib" ]; then
    187245    exit 0
    188246fi
    189247
    190 if [ -f $SAGE_LOCAL/lib/libpari.so ]; then
     248if [ -f "$SAGE_LOCAL/lib/libpari.so" ]; then
    191249    exit 0
    192250fi
    193251
     252# leif: This is redundant, again:
    194253if [ $? -ne 0 ]; then
    195254    echo "Error building PARI."
    196255    exit 1