[PATCH] Compare linker/compiler output with their default output

From: Max Filippov <jcmvbkbc(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Max Filippov <jcmvbkbc(at)gmail(dot)com>
Subject: [PATCH] Compare linker/compiler output with their default output
Date: 2015-03-20 14:05:21
Message-ID: 1426860321-13586-1-git-send-email-jcmvbkbc@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

linker and compiler may have noisy output by default, making
acx_pthread.m4 believe that pthread options that it tries are ignored
as invalid.

Record default compiler and linker output and see if adding pthread
option changes that, instead of assuming that linker and compiler are
silent by default.

Signed-off-by: Max Filippov <jcmvbkbc(at)gmail(dot)com>
---
config/acx_pthread.m4 | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/config/acx_pthread.m4 b/config/acx_pthread.m4
index 581164b..028fdb1 100644
--- a/config/acx_pthread.m4
+++ b/config/acx_pthread.m4
@@ -79,6 +79,22 @@ case "${host_cpu}-${host_os}" in
esac

if test x"$acx_pthread_ok" = xno; then
+
+cat >conftest.$ac_ext <<_ACEOF
+int
+main (int argc, char **argv)
+{
+ (void) argc;
+ (void) argv;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+
+# Record the default linker and compiler output
+ld_default_output="`(eval $ac_link 2>&1 1>&5)`"
+cc_default_output="`(eval $ac_compile 2>&1 1>&5)`"
+
for flag in $acx_pthread_flags; do

tryPTHREAD_CFLAGS=""
@@ -142,7 +158,7 @@ main (int argc, char **argv)
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
# Check both linking and compiling, because they might tolerate different options.
- if test "`(eval $ac_link 2>&1 1>&5)`" = "" && test "`(eval $ac_compile 2>&1 1>&5)`" = ""; then
+ if test "`(eval $ac_link 2>&1 1>&5)`" = "$ld_default_output" && test "`(eval $ac_compile 2>&1 1>&5)`" = "$cc_default_output"; then
# The original macro breaks out of the loop at this point,
# but we continue trying flags because Linux needs -lpthread
# too to build libpq successfully. The test above only
--
1.8.1.4

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2015-03-20 14:10:17 Re: printing table in asciidoc with psql
Previous Message Thom Brown 2015-03-20 13:55:52 Re: assessing parallel-safety