Nginx Configuration supports C + +

Source: Internet
Author: User

1. Add a new compiler and linker to the Auto/make script:

#LINK = $LINK #原25行附近注释掉原链接器
cxx=g++ #新增C + + compiler
Cxxflags=-std=c++0x-wall #新增C + + compile option, enable c++11
link=g++ #新增C + + linker

2. Near 340 rows, Red Bottom bold is the modified part

# The Stream sources

If [$STREAM = YES]; Then

If Test-n "$NGX _pch", then
ngx_cc= "\$ (cc) $ngx _compile_opt \$ (CFLAGS) $ngx _use_pch \$ (all_incs)"
ngx_cxx= "\$ (cxx) $ngx _compile_opt \$ (cxxflags) $ngx _use_pch \$ (all_incs)"
Else
ngx_cc= "\$ (cc) $ngx _compile_opt \$ (CFLAGS) \$ (core_incs) \$ (stream_incs)"
" Span style= "background-color: #ff0000" >ngx_cxx= "\$ (cxx) $ngx _compile_opt \$ (cxxflags) \$ (core_incs) \$ (stream_incs)"
Fi

For NGX_SRC in $STREAM _srcs
Do
Ngx_src= ' echo $ngx _src | SED-E "s/\//$ngx _regex_dirsep/g"
Ngx_obj= ' echo $ngx _src \
| Sed-e "s#^\ (. *\.\) cpp\\$# $ngx _objs_dir\1$ngx_objext#g" \
-e "s#^\ (. *\.\) cc\\$# $ngx _objs_dir\1$ngx_objext#g" \
-e "s#^\ (. *\.\) c\\$# $ngx _objs_dir\1$ngx_objext#g" \
-e "s#^\ (. *\.\) s\\$# $ngx _objs_dir\1$ngx_objext#g" '

ext= ' echo ${ngx_src} | cut-d.-f 2 '
ngx_gcc= $ngx _CC
If [$ext = "cpp"]; Then
ngx_gcc= $ngx _cxx
Fi

Cat << END >> $NGX _makefile

$ngx _obj:\$ (core_deps) \$ (stream_deps) $ngx _cont$ngx_src
$ngx _gcc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$ngx_aux

END

Nginx Configuration supports C + +

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.