Bug 9082 - link fails under MSYS because -lpthread is not automatic...
Summary: link fails under MSYS because -lpthread is not automatic...
Status: RESOLVED DUPLICATE of bug 4475
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.3.2
Hardware: x86 (IA32) Windows (All)
: high trivial
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-19 21:32 UTC by Alexis Wilke
Modified: 2008-10-10 13:59 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alexis Wilke 2006-11-19 21:32:07 UTC
Whenever I run configure, I need to add:

   export LIBS=-lpthread

to make sure that it links the DLL properly.

I have the pthread from RedHat which works nicely. The configure script detects
it, and has the proper CFLAGS since the headers are as expected in
/mingw/include. However, the link fails because the pthread library is not
specified.

There are some AC_CHECK_PTHREAD macros around such as the one below which I did
not test... 8-}

(source: http://oss.oetiker.ch/rrdtool-trac/changeset/244 )

----------------------------------------------------------

dnl Check for pthreads (pieces of code from Bert Driehuis) 
  
AC_SUBST(MULTITHREAD_CFLAGS) 
AC_SUBST(MULTITHREAD_LDFLAGS) 
 
AC_DEFUN(AC_CHECK_PTHREAD, [ 
   AC_MSG_CHECKING([pthreads: trying no flags]) 
   AC_CACHE_VAL(ac_cv_flag_pthread,[ 
        AC_TRY_LINK([ 
                #include <pthread.h> 
        ], 
        [pthread_exit(0);], 
        eval "ac_cv_flag_pthread=no", 
        [ 
                AC_MSG_RESULT([didn't work]) 
                AC_MSG_CHECKING([pthreads: trying to add -pthread]) 
                ac_save_CFLAGS="$CFLAGS" 
                CFLAGS="$CFLAGS -pthread" 
     AC_TRY_LINK([ 
       #include <pthread.h> 
       ], 
       [pthread_exit(0);], 
       eval "ac_cv_flag_pthread=yes", 
       AC_MSG_ERROR([Can't figure out pthreads]) 
     ) 
     CFLAGS="$ac_save_CFLAGS" 
        ]) 
   ]) 
  
   if test "$ac_cv_flag_pthread" = "no"; then 
     AC_MSG_RESULT([good, -pthread flag not necessary]) 
   else 
     AC_MSG_RESULT([adding -pthread flag]) 
     MULTITHREAD_CFLAGS="-pthread" 
   fi 
  
   AC_MSG_CHECKING([for libpthread]) 
   AC_CACHE_VAL(ac_cv_lib_pthread,[ 
     ac_save_LIBS="$LIBS" 
     LIBS="-lpthread" 
     AC_TRY_LINK([ 
       #include <pthread.h> 
       ], 
       [pthread_exit(0);], 
       eval "ac_cv_lib_pthread=-lphtread", 
       eval "ac_cv_lib_pthread=no" 
     ) 
     LIBS="$ac_save_LIBS" 
   ]) 
   if test "$ac_cv_lib_pthread" = "no"; then 
     AC_MSG_RESULT([no -lpthread necessary]) 
   else 
     AC_MSG_RESULT([adding -lpthread to LIBS]) 
     MULTITHREAD_LDFLAGS="-lpthread" 
   fi 
]) 
  
AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support], 
[],[enable_pthread=yes]) 
  
if test $enable_pthread != no; then  
        AC_CHECK_PTHREAD 
fi 
  
AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
Comment 1 Chris Wilson 2008-10-10 13:59:10 UTC

*** This bug has been marked as a duplicate of bug 4475 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.