~ubuntu-branches/ubuntu/trusty/protobuf/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/link-pthread.diff/m4/acx_pthread.m4

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-31 14:41:47 UTC
  • mfrom: (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110531144147-s41g5fozgvyo462l
Tags: 2.4.0a-2ubuntu1
* Merge with Debian; remaining changes:
  - Fix linking with -lpthread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
           acx_pthread_ok=no
341
341
        fi
342
342
        
 
343
        AC_MSG_CHECKING([whether what we have so far is sufficient with -nostdlib])
 
344
        CFLAGS="-nostdlib $CFLAGS"
 
345
        # we need c with nostdlib
 
346
        LIBS="$LIBS -lc"
 
347
        AC_TRY_LINK([#include <pthread.h>],
 
348
              [pthread_t th; pthread_join(th, 0);
 
349
               pthread_attr_init(0); pthread_cleanup_push(0, 0);
 
350
               pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
 
351
              [done=yes],[done=no])
 
352
 
 
353
        if test "x$done" = xyes; then
 
354
           AC_MSG_RESULT([yes])
 
355
        else
 
356
           AC_MSG_RESULT([no])
 
357
        fi
 
358
        
 
359
        if test x"$done" = xno; then
 
360
           AC_MSG_CHECKING([whether -lpthread saves the day])
 
361
           LIBS="-lpthread $LIBS"
 
362
           AC_TRY_LINK([#include <pthread.h>],
 
363
              [pthread_t th; pthread_join(th, 0);
 
364
               pthread_attr_init(0); pthread_cleanup_push(0, 0);
 
365
               pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
 
366
              [done=yes],[done=no])
 
367
 
 
368
           if test "x$done" = xyes; then
 
369
              AC_MSG_RESULT([yes])
 
370
              PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
 
371
           else
 
372
              AC_MSG_RESULT([no])
 
373
              AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries and -nostdlib])
 
374
           fi
 
375
        fi
 
376
 
343
377
        CFLAGS="$save_CFLAGS"
344
378
        LIBS="$save_LIBS"
345
379
        CC="$save_CC"