[PATCH] Fix flag detection on MinGW

Maxim Dounin mdounin at mdounin.ru
Wed Jul 5 17:49:48 UTC 2017


Hello!

On Wed, Jul 05, 2017 at 11:51:06AM +0300, Orgad Shaneh wrote:

> ---
>  auto/cc/conf | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/auto/cc/conf b/auto/cc/conf
> index afbca62b..2d062c31 100644
> --- a/auto/cc/conf
> +++ b/auto/cc/conf
> @@ -144,7 +144,7 @@ fi
>  CFLAGS="$CFLAGS $NGX_CC_OPT"
>  NGX_TEST_LD_OPT="$NGX_LD_OPT"
> 
> -if [ "$NGX_PLATFORM" != win32 ]; then
> +if [ "$NGX_PLATFORM" != win32 -o "$NGX_CC_NAME" = "gcc" -o
> "$NGX_CC_NAME" = "clang" ]; then
> 
>      if test -n "$NGX_LD_OPT"; then
>          ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\"
> @@ -164,17 +164,19 @@ if [ "$NGX_PLATFORM" != win32 ]; then
>      fi
> 
> 
> -    ngx_feature="-Wl,-E switch"
> -    ngx_feature_name=
> -    ngx_feature_run=no
> -    ngx_feature_incs=
> -    ngx_feature_path=
> -    ngx_feature_libs=-Wl,-E
> -    ngx_feature_test=
> -    . auto/feature
> +    if [ "$NGX_PLATFORM" != win32 ]; then
> +        ngx_feature="-Wl,-E switch"
> +        ngx_feature_name=
> +        ngx_feature_run=no
> +        ngx_feature_incs=
> +        ngx_feature_path=
> +        ngx_feature_libs=-Wl,-E
> +        ngx_feature_test=
> +        . auto/feature
> 
> -    if [ $ngx_found = yes ]; then
> -        MAIN_LINK="-Wl,-E"
> +        if [ $ngx_found = yes ]; then
> +            MAIN_LINK="-Wl,-E"
> +        fi
>      fi

No, thanks.  We generally avoid any feature tests on win32, as we 
support cross-compilation for win32, and feature tests, especially 
ones with ngx_feature_run=yes, can easily produce wrong results or 
fail.  Most of the information is defined in the 
src/os/win32/ngx_win32_config.h instead, and some in 
auto/os/win32.

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


More information about the nginx-devel mailing list