Welcome! Log In Create A New Profile

Advanced

Re: Custom compilation flag for an nginx module

Maxim Dounin
December 03, 2014 01:44PM
Hello!

On Wed, Dec 03, 2014 at 11:28:28AM -0500, erankor2 wrote:

> Thank you Maxim, your suggestion will definitely work for me.
>
> Are you familiar with any simple "non-core" module that does it ? I will
> need to test for the existence of this function or the need to explicitly
> add librt, and update CORE_LIBS accordingly + define some preprocessor macro
> that I can later #ifdef on in my code.

The code as in feature tests in auto/unix is more or less the same
you'll need in your module config file, e.g.:

ngx_feature="sched_yield()"
ngx_feature_name="NGX_HAVE_SCHED_YIELD"
ngx_feature_run=no
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="sched_yield()"
.. auto/feature


if [ $ngx_found != yes ]; then

ngx_feature="sched_yield() in librt"
ngx_feature_libs="-lrt"
. auto/feature

if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS -lrt"
fi
fi

Replacing sched_yield() here with clock_gettime() as appropriate
should do the trick.

Note well that the whole configure system is in shell, so it's
easy to read and understand.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Custom compilation flag for an nginx module

erankor2 December 03, 2014 10:47AM

Re: Custom compilation flag for an nginx module

Maxim Dounin December 03, 2014 11:06AM

Re: Custom compilation flag for an nginx module

erankor2 December 03, 2014 11:28AM

Re: Custom compilation flag for an nginx module

Maxim Dounin December 03, 2014 01:44PM

Re: Custom compilation flag for an nginx module

erankor2 December 04, 2014 09:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 166
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready