Skip to content

Commit

Permalink
configure: restrict pthreads to where it's actually needed
Browse files Browse the repository at this point in the history
mq_open() is no longer relevant beyond 70a9623 (Remove message queues).
  • Loading branch information
wferi committed Dec 12, 2016
1 parent 56754d0 commit cb5ee92
Show file tree
Hide file tree
Showing 3 changed files with 496 additions and 11 deletions.
19 changes: 9 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@ case $exec_prefix in
esac

# Checks for libraries.
dnl librt from glibc NEEDs libpthread
dnl so. if test for libpthread after librt
dnl it will always be "none needed", but it is not true
dnl when linking libraries. Looks like a bug.
AC_SEARCH_LIBS([pthread_create], [pthread])
AC_SEARCH_LIBS([mq_open], [rt])
AX_PTHREAD
AX_SAVE_FLAGS
AC_SEARCH_LIBS([dlopen],[dl],,[AC_MSG_ERROR([cannot find dlopen() function])])
AC_SUBST([dlopen_LIBS],[$LIBS])
Expand Down Expand Up @@ -201,13 +196,17 @@ AC_CHECK_FUNCS([alarm clock_gettime ftruncate gettimeofday \
strchr strrchr strdup strstr strcasecmp \
poll epoll_create epoll_create1 kqueue \
random rand getrlimit sysconf \
pthread_spin_lock pthread_setschedparam \
pthread_mutexattr_setpshared \
pthread_condattr_setpshared \
sem_timedwait semtimedop \
getpeerucred getpeereid \
openat unlinkat])

AX_SAVE_FLAGS
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"
AC_CHECK_FUNCS([pthread_spin_lock pthread_setschedparam \
pthread_mutexattr_setpshared \
pthread_condattr_setpshared \
sem_timedwait semtimedop])
AX_RESTORE_FLAGS

# Checks for defined macros
AC_MSG_CHECKING(for MSG_NOSIGNAL)
Expand Down
3 changes: 2 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \
map.c skiplist.c hashtable.c trie.c

libqb_la_SOURCES = $(source_to_lint) unix.c
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS)
libqb_la_CFLAGS = $(PTHREAD_CFLAGS)
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS)

AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=)

Expand Down
Loading

0 comments on commit cb5ee92

Please sign in to comment.