[Top][All Lists]

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

Re: Adding $includedir and $libdir in CPPFLAGS and LDFLAGS

From: Alexandre Duret-Lutz
Subject: Re: Adding $includedir and $libdir in CPPFLAGS and LDFLAGS
Date: 28 Dec 2001 19:14:56 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

>>> "John" == John D Burger <address@hidden> writes:


 John> Here's what I've come up with:

 John> eval test -d $includedir && CPPFLAGS="-I$includedir $CPPFLAGS"

 John> eval jb_expanded_libdir=$libdir
 John> jb_expanded_libdir=`echo $jb_expanded_libdir | sed "s%^NONE%$prefix%"`
 John> eval test -d $jb_expanded_libdir && LDFLAGS="-L$libdir $LDFLAGS"

 John> I decided not to simply replace NONE with the appropriate values, as in
 John> the code I pointed to earlier:


 John> I'm leaving NONE in for prefix in order to implicitly deal with the
 John> issue described in the GCC manual.  

That won't do it: NONE/include stands for /usr/local/include
while you want to protect against -I/usr/include.

 John> I realize that if the user has a NONE/include or NONE/lib
 John> subdirectory, I will be screwed, but barring that,
 John> nothing will be added to the CPPFLAGS unless the user
 John> configures with -includedir or -prefix, and similarly for
 John> LDFLAGS.  I guess I really should check for NONE
 John> explicitly ...

 John> The expanded_libdir business is because I =do= want to change NONE to
 John> $prefix in the case of exec_prefix.

$prefix might also be NONE at this stage.  That means the
default prefix /usr/local will be used, and if I understand you
correctly you want to add -I /usr/local/include and -L
/usr/local/lib in this case.

The following suggestion is completly untested:

dnl -------------------------
dnl Expand $prefix and $exec_prefix in $VARNAME and assign the
dnl result to jb_expanded_VARNAME.
dnl (Adapted from AC_DEFINE_DIR by Alexandre Oliva)
            test "x$prefix" = xNONE && prefix="$ac_default_prefix"
            test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
            eval echo \""[$]$1"\"


test "$jb_expanded_includedir" != /usr/include &&
  test -d $jb_expanded_includedir &&
    CPPFLAGS="-I$includedir $CPPFLAGS"

test -d $jb_expanded_libdir && LDFLAGS="-L$libdir $LDFLAGS"

Alexandre Duret-Lutz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]