Commit de65fe0f9b25bb2257b0188e06f472991c87ce47

Authored by Sebastian Herbszt
Committed by Anthony Liguori
1 parent 1c6ed9f3

Add detection of pthread library name

Try to detect the name of the pthread library.
Currently it looks for "-pthread" and "-pthreadGC2".

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 9 additions and 5 deletions
configure
... ... @@ -1155,18 +1155,22 @@ fi
1155 1155  
1156 1156 ##########################################
1157 1157 # pthread probe
  1158 +PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1158 1159 PTHREADLIBS=""
1159 1160  
1160 1161 if test "$pthread" = yes; then
1161 1162 pthread=no
1162 1163 cat > $TMPC << EOF
1163 1164 #include <pthread.h>
1164   -int main(void) { pthread_mutex_t lock; return 0; }
  1165 +int main(void) { pthread_create(0,0,0,0); return 0; }
1165 1166 EOF
1166   - if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
1167   - pthread=yes
1168   - PTHREADLIBS="-lpthread"
1169   - fi
  1167 + for pthread_lib in $PTHREADLIBS_LIST; do
  1168 + if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
  1169 + pthread=yes
  1170 + PTHREADLIBS="$pthread_lib"
  1171 + break
  1172 + fi
  1173 + done
1170 1174 fi
1171 1175  
1172 1176 if test "$pthread" = no; then
... ...