Skip to content

Commit

Permalink
Fix and cleanup PTHREAD linking.
Browse files Browse the repository at this point in the history
Add in missing $PTHREAD_LIBS to all backends that can make use of it.
Rename --enable-fork-process to --enable-pthread to maatch internal
logic.  Also, stop linking in pthreads needlessly if its been
disabled.
  • Loading branch information
cbagwell committed May 5, 2009
1 parent 6e4ed52 commit 41a6a5d
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 95 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2009-05-04 Chris Bagwell <cbagwell-guest at users.alioth.debian.org>
* acinclude.m4: Rename --enable-fork-process to --enable-pthreads
to match internal usage. Stop linking in pthread when disabled.
* backend/Makefile.am: Add $PTHREAD_LIBS to all backends that
include sanei_thread.
* Makefile.am: Add new ChangeLog-1.0.20 to distribution list.

2009-05-03 m. allan noah <kitno455 at gmail dot com>
* ChangeLog-1.0.20, Makefile.in: ChangeLog from 1.0.20 release
* configure, configure.in: version 1.0.21cvs
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ EXTRA_DIST = ChangeLog-1.0.0 ChangeLog-1.0.1 ChangeLog-1.0.2 \
ChangeLog-1.0.7 ChangeLog-1.0.8 ChangeLog-1.0.9 ChangeLog-1.0.10 \
ChangeLog-1.0.12 ChangeLog-1.0.13 ChangeLog-1.0.14 ChangeLog-1.0.15 \
ChangeLog-1.0.16 ChangeLog-1.0.17 ChangeLog-1.0.18 ChangeLog-1.0.19 \
ChangeLog-1.0.20 \
$(PACKAGE).lsm

#
Expand Down
22 changes: 16 additions & 6 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,24 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
*)
use_pthread=no
esac
have_pthread=no
#
# now that we have the systems preferences, we check
# the user
AC_ARG_ENABLE( [fork-process],
AC_HELP_STRING([--enable-fork-process],
[use fork instead of pthread (default=no for MacOS X, yes for everything else)]),
AC_ARG_ENABLE([pthread],
AC_HELP_STRING([--enable-pthread],
[use pthread instead of fork (default=yes for MacOS X, no for everything else)]),
[
if test $enableval != yes ; then
if test $enableval = yes ; then
use_pthread=yes
else
use_pthread=no
fi
])
if test $use_pthread = yes ; then
AC_CHECK_HEADERS(pthread.h,
[
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-lpthread")
Expand All @@ -246,17 +252,21 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS([pthread_create pthread_kill pthread_join pthread_detach pthread_cancel pthread_testcancel],
,[ have_pthread=no; use_pthread=no ])
LIBS="$save_LIBS"
LIBS="$save_LIBS"
],)
AC_SUBST(PTHREAD_LIBS)
fi
if test $use_pthread = yes ; then
AC_DEFINE_UNQUOTED(USE_PTHREAD, "$use_pthread",
[Define if pthreads should be used instead of forked processes.])
else
dnl Reset library in case it was found but we are not going to use it.
PTHREAD_LIBS=""
fi
if test "$have_pthread" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
fi
AC_SUBST(PTHREAD_LIBS)
AC_MSG_CHECKING([whether to enable pthread support])
AC_MSG_RESULT([$have_pthread])
AC_MSG_CHECKING([whether to use pthread instead of fork])
Expand Down
Loading

0 comments on commit 41a6a5d

Please sign in to comment.