Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(14104)

Issue 3772042: Fix corner case in acx_pthread.m4, patch from Kacper Kowalik

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 4 months ago by Jisi Liu
Modified:
13 years, 4 months ago
Reviewers:
kenton
CC:
kenton+urgent_google.com
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -0 lines) Patch
M m4/acx_pthread.m4 View 1 chunk +34 lines, -0 lines 0 comments Download

Messages

Total messages: 3
Jisi Liu
13 years, 4 months ago (2010-12-20 08:16:30 UTC) #1
kenton
What happens if the compiler doesn't support the -nostdlib flag? On Mon, Dec 20, 2010 ...
13 years, 4 months ago (2010-12-20 18:16:09 UTC) #2
Jisi Liu
13 years, 4 months ago (2010-12-21 03:53:54 UTC) #3
From the code, it seems the 2 tests will both fail, and no flag will be added.
Should be a no-op for compiler that doesn't support the -nostdlib flag.

On 2010/12/20 18:16:09, kenton wrote:
> What happens if the compiler doesn't support the -nostdlib flag?
> 
> On Mon, Dec 20, 2010 at 12:16 AM, <mailto:liujisi@google.com> wrote:
> 
> > Reviewers: kenton,
> >
> >
> >
> > Please review this at http://codereview.appspot.com/3772042/
> >
> > Affected files:
> >  M m4/acx_pthread.m4
> >
> >
> > Index: m4/acx_pthread.m4
> > diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
> > index
> >
>
cb1a4bbe4d00d95e4658c347bad129700bdebbbb..81a1f667671cec9748bbe8a0a89bf85dd19ff49a
> > 100644
> > --- a/m4/acx_pthread.m4
> > +++ b/m4/acx_pthread.m4
> > @@ -342,6 +342,40 @@ if test "x$acx_pthread_ok" = xyes; then
> >           acx_pthread_ok=no
> >        fi
> >
> > +       AC_MSG_CHECKING([whether what we have so far is sufficient with
> > -nostdlib])
> > +       CFLAGS="-nostdlib $CFLAGS"
> > +       # we need c with nostdlib
> > +       LIBS="$LIBS -lc"
> > +       AC_TRY_LINK([#include <pthread.h>],
> > +             [pthread_t th; pthread_join(th, 0);
> > +              pthread_attr_init(0); pthread_cleanup_push(0, 0);
> > +              pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
> > +             [done=yes],[done=no])
> > +
> > +       if test "x$done" = xyes; then
> > +          AC_MSG_RESULT([yes])
> > +       else
> > +          AC_MSG_RESULT([no])
> > +       fi
> > +
> > +       if test x"$done" = xno; then
> > +          AC_MSG_CHECKING([whether -lpthread saves the day])
> > +          LIBS="-lpthread $LIBS"
> > +          AC_TRY_LINK([#include <pthread.h>],
> > +             [pthread_t th; pthread_join(th, 0);
> > +              pthread_attr_init(0); pthread_cleanup_push(0, 0);
> > +              pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
> > +             [done=yes],[done=no])
> > +
> > +          if test "x$done" = xyes; then
> > +             AC_MSG_RESULT([yes])
> > +             PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
> > +          else
> > +             AC_MSG_RESULT([no])
> > +             AC_MSG_WARN([Impossible to determine how to use pthreads with
> > shared libraries and -nostdlib])
> > +          fi
> > +       fi
> > +
> >        CFLAGS="$save_CFLAGS"
> >        LIBS="$save_LIBS"
> >        CC="$save_CC"
> >
> >
> >
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b