From cbd73bbbb7df080d5204098aa02e5f5d0d48823c Mon Sep 17 00:00:00 2001
From: Ben Gamari <bgamari.foss@gmail.com>
Date: Thu, 19 Apr 2018 15:05:50 -0400
Subject: [PATCH] configure: Use -Werror to check for existence of -no-pie

Clang throws a warning instead of an error when it is passed -no-pie,

    clang: warning: argument unused during compilation: '-nopie'
    [-Wunused-command-line-argument]

Consequently configure concludes that it supports -no-pie. However, this
will fail when used with -Werror. The solution is to simply use -Werror
in the configure check.

Thanks to @goldfire for reporting this.

Reviewers: hvr

Subscribers: thomie, carter, goldfire

Differential Revision: https://phabricator.haskell.org/D4557
---
 aclocal.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a48a5af23880..1cef8427fc6a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1294,7 +1294,7 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE],
    AC_MSG_CHECKING([whether GCC supports -no-pie])
    echo 'int main() { return 0; }' > conftest.c
    # Some GCC versions only warn when passed an unrecognized flag.
-   if $CC -no-pie -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then
+   if $CC -no-pie -Werror -x c /dev/null -dM -E > conftest.txt 2>&1 && ! grep -i unrecognized conftest.txt > /dev/null 2>&1; then
        CONF_GCC_SUPPORTS_NO_PIE=YES
        AC_MSG_RESULT([yes])
    else
-- 
GitLab