[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding $includedir and $libdir in CPPFLAGS and LDFLAGS
From: |
John D. Burger |
Subject: |
Re: Adding $includedir and $libdir in CPPFLAGS and LDFLAGS |
Date: |
Fri, 28 Dec 2001 11:34:46 -0500 |
Alexandre Duret-Lutz wrote:
> John> I've tried:
> John> AC_INIT(libspec, 1.0, address@hidden)
> John> CPPFLAGS="-I$includedir $CPPFLAGS"
> John> LDFLAGS="-L$libdir $LDFLAGS"
> John> ...
> John> but this doesn't quite work - ac_cpp and friends end up with an
> John> unexpanded ${prefix} or ${exec_prefix}, I believe.
>
> Appart from the `NONE' stuff, is that a problem?
> IIRC autoconf will `eval' any call to ac_cpp and friends.
You're right - I was confused. I had earlier decided that
${exec_prefix} wasn't being expanded properly in the eval of ac_cpp,
because I didn't know about the default value of "NONE".
> Aside: you may want to protect your code against the following
> issue described in the GCC manual:
>
> | * Use of `-I/usr/include' may cause trouble.
Yow - I would like to protect against that.
> You might also like
> http://www.gnu.org/software/ac-archive/Installed_Packages/smr_with_build_path.html
I do like that, although I will be dealing with pretty unsophisticated
users - I'd like to just tell them about -prefix. Here's what I've come
up with:
eval test -d $includedir && CPPFLAGS="-I$includedir $CPPFLAGS"
eval jb_expanded_libdir=$libdir
jb_expanded_libdir=`echo $jb_expanded_libdir | sed "s%^NONE%$prefix%"`
eval test -d $jb_expanded_libdir && LDFLAGS="-L$libdir $LDFLAGS"
I decided not to simply replace NONE with the appropriate values, as in
the code I pointed to earlier:
http://sources.redhat.com/ml/autoconf-patches/2000-07/msg00133.html
I'm leaving NONE in for prefix in order to implicitly deal with the
issue described in the GCC manual. I realize that if the user has a
NONE/include or NONE/lib subdirectory, I will be screwed, but barring
that, nothing will be added to the CPPFLAGS unless the user configures
with -includedir or -prefix, and similarly for LDFLAGS. I guess I
really should check for NONE explicitly ...
The expanded_libdir business is because I =do= want to change NONE to
$prefix in the case of exec_prefix.
This is my first experience with configure hacking, and indeed my most
substantial sh code to date, believe it or not, so any criticisms are
welcome.
Thanks!
- John Burger
MITRE