# Ngx\_version\_hex

**URL:** <https://www.ruby-forum.com/t/ngx-version-hex/121090>\
**Category:** NGINX\
**Created:** [November 23, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090 "2007-11-23T16:51:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [November 23, 2007, 4:51pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090/1 "2007-11-23T16:51:51Z")

</div>

Igor, do you plan to add a macro with an usable nginx version number?

Thanks and regards Manlio P.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [November 23, 2007, 5:47pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090/2 "2007-11-23T17:47:00Z")

</div>

2007/11/23, Manlio P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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

Best regards,  
Grzegorz N.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [November 23, 2007, 5:58pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090/3 "2007-11-23T17:58:47Z")

</div>

On Fri, Nov 23, 2007 at 04:43:05PM +0100, Manlio P. wrote:

> Igor, do you plan to add a macro with an usable nginx version number?

Yes, I will add it.

However, I do not want to stabilize API before 1.0.0.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [November 23, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090/4 "2007-11-23T19:47:16Z")

</div>

Grzegorz N. ha scritto:

> #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 N.

Manlio P.

---

<div class="post-metadata">

**Author:** ![Manlio\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Manlio\_P](https://www.ruby-forum.com/u/Manlio_P)\
**Post date:** [November 23, 2007, 7:48pm UTC](https://www.ruby-forum.com/t/ngx-version-hex/121090/5 "2007-11-23T19:48:26Z")

</div>

Igor S. ha scritto:

> On Fri, Nov 23, 2007 at 04:43:05PM +0100, Manlio P. wrote:
> 
> > Igor, do you plan to add a macro with an usable nginx version number?
> 
> Yes, I will add it.

Great, thanks.

> However, I do not want to stabilize API before 1.0.0.

Not a problem for me.

I can also provide support for different nginx version using patches, if  
there are big changes.

Manlio P.
