Description: Change Configure to honor EXTRAMODLDFLAGS, DLCFLAGS and CFLAGS.
 Change the Configure system to use the value of the environment variables
 EXTRAMODLDFLAGS, DLCFLAGS, CFLAGS (when set) so that we can set them in
 debian/rules.

Author: Bill Allombert <ballombe@debian.org>
Last-Update: 2009-11-26
Index: pari-2.3.5~pre1/config/get_cc
===================================================================
--- pari-2.3.5~pre1.orig/config/get_cc	2009-12-31 14:11:34.000000000 +0100
+++ pari-2.3.5~pre1/config/get_cc	2009-12-31 14:11:43.000000000 +0100
@@ -172,7 +172,9 @@
   debugging) suffix=.dbg; cflags="-DMEMSTEP=1048576 $DBGFLAGS $cflags";;
 esac
 
-CFLAGS="$cflags $CFLAGS $CPPFLAGS"
+if test "${CFLAGS+set}" != "set" ; then
+  CFLAGS="$cflags $CFLAGS $CPPFLAGS"
+fi
 if test "$fastread" != yes; then
   echo $n ..."With which flags ? $c"
   dflt=$CFLAGS; rep=; . ./myread
Index: pari-2.3.5~pre1/config/get_dlcflags
===================================================================
--- pari-2.3.5~pre1.orig/config/get_dlcflags	2009-12-31 14:11:34.000000000 +0100
+++ pari-2.3.5~pre1/config/get_dlcflags	2009-12-31 14:11:43.000000000 +0100
@@ -1,21 +1,23 @@
 _dl_list="DLCFLAGS"
-if test -n "$__gnuc__"; then
-  # Some architectures need -fPIC for building dynamic lib
-  # *-i?86|*-sparc*|*-powerpc|*-s390|*-mips) DLCFLAGS=
-  case "$osname-$arch" in
-    *-hppa|*-ia64|*-alpha|*-arm|*-m68k) DLCFLAGS=-fPIC ;;
-    *-x86_64|*-sparc*) case "$sizeof_long" in 
-              8) DLCFLAGS=-fPIC;;
-              esac;;
-    darwin-*) DLCFLAGS=-fno-common;;
-  esac
-else
-  case "$osname-$arch" in
-    hpux-*) DLCFLAGS=+z;;
-    solaris-sparc*) case "$sizeof_long" in 
-              8) DLCFLAGS=-KPIC;; # assume sun cc
-              esac;;
-  esac
+if test "${DLCFLAGS+set}" != "set" ; then
+  if test -n "$__gnuc__"; then
+    # Some architectures need -fPIC for building dynamic lib
+    # *-i?86|*-sparc*|*-powerpc|*-s390|*-mips) DLCFLAGS=
+    case "$osname-$arch" in
+      *-hppa|*-ia64|*-alpha|*-arm|*-m68k) DLCFLAGS=-fPIC ;;
+      *-x86_64|*-sparc*) case "$sizeof_long" in 
+                8) DLCFLAGS=-fPIC;;
+                esac;;
+      darwin-*) DLCFLAGS=-fno-common;;
+    esac
+  else
+    case "$osname-$arch" in
+      hpux-*) DLCFLAGS=+z;;
+      solaris-sparc*) case "$sizeof_long" in 
+                8) DLCFLAGS=-KPIC;; # assume sun cc
+                esac;;
+    esac
+  fi
 fi
 
 echo "C compiler is          $CC $CFLAGS $DLCFLAGS"
Index: pari-2.3.5~pre1/config/get_modld
===================================================================
--- pari-2.3.5~pre1.orig/config/get_modld	2009-12-31 14:11:34.000000000 +0100
+++ pari-2.3.5~pre1/config/get_modld	2009-12-31 14:11:43.000000000 +0100
@@ -2,14 +2,15 @@
 _modld_list='EXTRAMODLDFLAGS MODLD MODLDFLAGS modules_build'
 
 # EXTRADLLDFLAGS might refer to $LIBS
-__LIBS=$LIBS
-if test "$static" = n; then LIBS="$LIBS $LDDYN"; fi
-case $osname in
-cygwin) EXTRAMODLDFLAGS="-L$libdir -lpari.dll";;
-*)      EXTRAMODLDFLAGS=`eval echo $EXTRADLLDFLAGS`;;
-esac;
-LIBS=$__LIBS
-
+if test "${EXTRAMODLDFLAGS+set}" != "set" ; then
+  __LIBS=$LIBS
+  if test "$static" = n; then LIBS="$LIBS $LDDYN"; fi
+  case $osname in
+  cygwin) EXTRAMODLDFLAGS="-L$libdir -lpari.dll";;
+  *)      EXTRAMODLDFLAGS=`eval echo $EXTRADLLDFLAGS`;;
+  esac;
+  LIBS=$__LIBS
+fi  
 case $osname in
 darwin) MODLD=$CC;
         MODLDFLAGS="-bundle -flat_namespace -undefined suppress \
