[PATCH 3 of 3] auto/lib/*: prepend include location with sysroot path

Maxim Dounin mdounin at mdounin.ru
Fri May 9 03:55:07 UTC 2014


Hello!

On Sun, May 04, 2014 at 09:33:55PM +0200, Samuel Martin wrote:

> # HG changeset patch
> # User Samuel Martin <s.martin49 at gmail.com>
> # Date 1399231473 -7200
> #      Sun May 04 21:24:33 2014 +0200
> # Node ID b9787fdc8bac3559fd9da679dc04e8fc50cb74f3
> # Parent  03617a96c528d1f02abf829df964fcb29b06c942
> auto/lib/*: prepend include location with sysroot path
> 
> This patch introduce a new NGX_SYSROOT variable used when
> cross-compiling with gcc.
> 
> When cross-compiling nginx, the gcc-based cross-compiler will
> automatically set the NGX_SYSROOT value to the right value. This
> variable remains empty if not cross-compiling or no gcc compiler is
> detected.
> This NGX_SYSROOT is prepended to the ngx_feature_path content when
> additional location should be added to the include directory list.
> 
> This is necessary to prevent gcc from complaining about unsafe include
> location for cross-compilation (-Wpoision-system-directories), currently
> only triggered by libxslt.
> 
> diff -r 03617a96c528 -r b9787fdc8bac auto/cc/gcc
> --- a/auto/cc/gcc	Sun May 04 00:40:49 2014 +0200
> +++ b/auto/cc/gcc	Sun May 04 21:24:33 2014 +0200
> @@ -15,6 +15,10 @@
>  
>  have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
>  
> +# set sysroot in case of cross-compilation
> +if [ x$NGX_CROSSBUILD = xcrossbuild ]; then
> +    NGX_SYSROOT=`$CC -print-sysroot`
> +fi

$ gcc -print-sysroot
gcc: unrecognized option '-print-sysroot'
gcc: No input files specified

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



More information about the nginx-devel mailing list