[dev] NGX_VERSION_HEX

Manlio Perillo manlio_perillo at libero.it
Fri Nov 23 21:37:22 MSK 2007


Grzegorz Nosek ha scritto:
> 2007/11/23, Manlio Perillo <manlio_perillo at libero.it>:
>> Igor, do you plan to add a macro with an usable nginx version number?
> 
> Seconded. I think it's a good idea. Maybe stuff like (off the top of my head):
> 
> #define NGX_VERSION_NUMBER(a,b,c) (((a) << 24) | ((b) << 16) | ((c) << 8))
> #define NGX_VERSION NGX_VERSION_NUMBER(0,5,33)
> 
> #if (NGX_VERSION < NGX_VERSION_NUMBER(0,6,0))
> #error Development version only!
> #endif
> 

Here is some ugly code for an addon module configuration script:

NGX_RAW_VERSION=`awk '/#define NGINX_VERSION/  {print $3}' \
         src/core/nginx.h`

NGX_VERSION_HEX=`${PYTHON} -c 'import sys; raw_version = sys.argv[1]; \
         v = map(int, raw_version[1:-1].split(".")); \
         print v[0] << 24 | v[1] << 16 | v[2] << 8' ${NGX_RAW_VERSION}`

have=NGX_VERSION_HEX value="$NGX_VERSION_HEX" . auto/define


It requires awk and Python.


> Best regards,
>  Grzegorz Nosek
> 


Manlio Perillo





More information about the nginx mailing list