Karim Belabas on Fri, 28 Oct 2005 18:36:21 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Configure bug when CPPFLAGS is set


* Vincent Lefevre [2005-10-28 17:54]:
> I've tried to compile pari 2.2.11 on Mac OS X (from an updated
> DarwinPorts portfile), but get the following error:
[...]
> I think the problem is the following. When I run
> 
>   sudo env LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include ./Configure
> 
> manually, I get:
> 
> ...Found readline header in /usr/include/readline
> 
> but the real header is in "/opt/local/include/readline". Hence
> the failure. Configure should take some environment variables
> (such as CPPFLAGS) into account to get the real header.

Configure does take a few environment variables into account, but not CPPFLAGS 
(AS, CC, DLLD, LD, CFLAGS, LDFLAGS, GP_INSTALL_PREFIX is the complete list)

I agree that CPPFLAGS is standard and could be heeded also.

As a temporary workaround, you can presumably get the effect you wanted with

  env LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include ./Configure

(sudo shouldn't be necessary for this). You may also apply the following patch:

--- config/get_cc       20 Jul 2005 22:59:44 -0000      1.29
+++ config/get_cc       28 Oct 2005 16:26:58 -0000
@@ -166,7 +166,7 @@
   debugging) suffix=.dbg; cflags="-DMEMSTEP=1048576 $DBGFLAGS $cflags";;
 esac

-CFLAGS="$cflags $CFLAGS"
+CFLAGS="$cflags $CFLAGS $CPPFLAGS"
 if test "$fastread" != yes; then
   echo $n ..."With which flags ? $c"
   dflt=$CFLAGS; rep=; . ./myread


Cheers,

    Karim.

P.S: I just noticed that GP_INSTALL_PREFIX is undocumented. This old
hack should probably be removed.
-- 
Karim Belabas                  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]