Okay with your help, I change a little...
I write a rule ti check if an header is present, and if it's present I return the first flag

rule evaluate-header-is-available ( properties * : header-file * )

{

    if [ path.exists $(header-file) ]

    {

        echo $(header-file) "= found" ;

        return $(properties) ;

    }

    else

    {

        echo $(header-file) "= not found" ;

    }

}


and after in my project I use the rule:


[ evaluate-header-is-available <define>FLAG_NEEDED_TO_DEFINE : /usr/include/unistd.h ]


With that I add flag only when rhe header /usr/include/unistd.h is present ;)

2012/3/16 Steven Watanabe <watanabesj@gmail.com>
AMDG

On 03/16/2012 06:58 AM, Marc-Antoine ARNAUD wrote:
> I'm using boost BJam to build my project with externals librairies.
> And I need to define variables if I found headers on the machine.
>
> How can we do that ?
>
> project
>     : requirements
>     <include>.
>     <define>FLAG_NEEDED_TO_DEFINE     => I need to define only if I found
> header.
>     ;
>
>
> lib library : [ glob *.cpp ] ;
>

At the moment the easiest way to do this is:

// header.cpp
#include <header.h>

# Jamfile

import configure ;

obj header_test : header.cpp ;

project
 : requirements
   [ configure.check-target-builds header_test
     "header.h exists" : <define>FLAG_NEEDED_TO_DEFINE ] ;

In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Marc-Antoine ARNAUD
Software Engineer

Mikros Image - Digital Post-Production for Video and Film
www.mikrosimage.eu