Skip to content

bpo-33473: Be slightly better about CFLAGS, LDFLAGS, and related #6771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
configure.ac was fixed to correctly report CC, CFLAGS, and LDFLAGS
27 changes: 13 additions & 14 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -7529,11 +7529,9 @@ if ${ac_cv_pthread+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cc="$CC"
CC="$CC -pthread"
if test "$cross_compiling" = yes; then :
ac_cv_pthread=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
CC="$CC"
CFLAGS="-pthread"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <stdio.h>
Expand All @@ -7550,15 +7548,13 @@ int main(){
}

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_pthread=yes
else
ac_cv_pthread=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CC="$ac_save_cc"
fi

Expand All @@ -7585,7 +7581,8 @@ then
ac_cv_cxx_thread=yes
elif test "$ac_cv_pthread" = "yes"
then
CXX="$CXX -pthread"
CXX="$CXX"
CXXFLAGS="-pthread"
ac_cv_cxx_thread=yes
fi

Expand Down Expand Up @@ -8865,7 +8862,7 @@ then CC="$CC -Kpthread"
elif test "$ac_cv_kthread" = "yes"
then CC="$CC -Kthread"
elif test "$ac_cv_pthread" = "yes"
then CC="$CC -pthread"
then CC="$CC"; BASECFLAGS="$BASECFLAGS -pthread"; BASECXXFLAGS="$BASECXXFLAGS -pthread"
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_t" >&5
Expand Down Expand Up @@ -10298,9 +10295,11 @@ then
posix_threads=yes
elif test "$ac_cv_pthread" = "yes"
then
CC="$CC -pthread"
CC="$CC"
BASECFLAGS="$BASECFLAGS -pthread"
if test "$ac_cv_cxx_thread" = "yes"; then
CXX="$CXX -pthread"
CXX="$CXX"
BASECXXFLAGS="$BASECFLAGS -pthread"
fi
posix_threads=yes
else
Expand Down
16 changes: 10 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1993,8 +1993,9 @@ then
AC_MSG_CHECKING(whether $CC accepts -pthread)
AC_CACHE_VAL(ac_cv_pthread,
[ac_save_cc="$CC"
CC="$CC -pthread"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
CC="$CC"
CFLAGS="-pthread"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're going to change it, you need to save and restore CFLAGS as is done for CC

AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <pthread.h>

Expand Down Expand Up @@ -2030,7 +2031,8 @@ then
ac_cv_cxx_thread=yes
elif test "$ac_cv_pthread" = "yes"
then
CXX="$CXX -pthread"
CXX="$CXX"
CXXFLAGS="-pthread"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also stamps over whatever CXXFLAGS was before

Also, it seems the cases above need this treatment?

ac_cv_cxx_thread=yes
fi

Expand Down Expand Up @@ -2261,7 +2263,7 @@ then CC="$CC -Kpthread"
elif test "$ac_cv_kthread" = "yes"
then CC="$CC -Kthread"
elif test "$ac_cv_pthread" = "yes"
then CC="$CC -pthread"
then CC="$CC"; BASECFLAGS="$BASECFLAGS -pthread"; BASECXXFLAGS="$BASECXXFLAGS -pthread"
fi

AC_MSG_CHECKING(for pthread_t)
Expand Down Expand Up @@ -2973,9 +2975,11 @@ then
posix_threads=yes
elif test "$ac_cv_pthread" = "yes"
then
CC="$CC -pthread"
CC="$CC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line seems rather otiose now

BASECFLAGS="$BASECFLAGS -pthread"
if test "$ac_cv_cxx_thread" = "yes"; then
CXX="$CXX -pthread"
CXX="$CXX"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

BASECXXFLAGS="$BASECFLAGS -pthread"
fi
posix_threads=yes
else
Expand Down