lundi 3 août 2015

Calling C/C++ library function from PHP - How to send a -std=c+11 to compiler

I´m building a C++ extension to PHP, using a template of config.m4 from this post and this article.

I need to use the C++11 in standard to compile my classes, so I´ve used the EXTRA_FLAGS clause as:

EXTRA_FLAGS="-std=c++11"

in my config.m4. The final code:

PHP_ARG_ENABLE(vehicles,
    [Whether to enable the "vehicles" extension],
    [  --enable-vehicles      Enable "vehicles" extension support])

if test $PHP_VEHICLES != "no"; then
    EXTRA_FLAGS="-std=c++11"
    PHP_REQUIRE_CXX()
    PHP_SUBST(VEHICLES_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, VEHICLES_SHARED_LIBADD)
    PHP_NEW_EXTENSION(vehicles, vehicles.cc car.cc, $ext_shared)
fi

This is not working at all (the compiler does not receive the extra flags). I then assume that this EXTRA_FLAGS parameter is not related to the compiler at all, but to the script....

How can I send a flag to the g++ compiler to them him to use C++11 ?

Thanks for helping.

Aucun commentaire:

Enregistrer un commentaire