Skip to content

Commit

Permalink
Merge pull request #241 from jnpkrn/PR240-addendum
Browse files Browse the repository at this point in the history
PR #240 + addendum (drop syslog-tests opt-in switch)
  • Loading branch information
chrissie-c authored Dec 16, 2016
2 parents 52db499 + 602d04d commit 5a54a51
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ addons:
script: RPMBUILDOPTS_="--nodeps --define '_without_check 1'";
./autogen.sh
&& ./configure
&& DISTCHECK_CONFIGURE_FLAGS=--enable-syslog-tests VERBOSE=1 make distcheck
&& VERBOSE=1 make distcheck
&& sed "s|RPMBUILDOPTS =|\\0 ${RPMBUILDOPTS_}|" Makefile | make -f- rpm

after_failure:
Expand Down
63 changes: 27 additions & 36 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,19 @@ 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])
AC_SEARCH_LIBS([dlopen], [dl])
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AX_PTHREAD
AX_SAVE_FLAGS
AC_SEARCH_LIBS([dlopen],[dl],,[AC_MSG_ERROR([cannot find dlopen() function])])
AC_SUBST([dlopen_LIBS],[$LIBS])
AX_RESTORE_FLAGS
AX_SAVE_FLAGS
AC_SEARCH_LIBS([socket], [socket],,[AC_MSG_ERROR([cannot find socket() function])])
AC_SUBST([socket_LIBS],[$LIBS])
AX_RESTORE_FLAGS
AX_SAVE_FLAGS
AC_SEARCH_LIBS([gethostbyname], [nsl],,[AC_MSG_ERROR([cannot find gethostbyname() function])])
AC_SUBST([nsl_LIBS],[$LIBS])
AX_RESTORE_FLAGS

# look for testing harness "check"
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],[with_check=yes],[with_check=no])
Expand Down Expand Up @@ -198,13 +202,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 Expand Up @@ -452,33 +460,22 @@ LINT_FLAGS="-weak -D__gnuc_va_list=va_list -D__attribute\(x\)= \

# local options
AC_ARG_ENABLE([ansi],
[ --enable-ansi : force to build with ANSI standards. ],
[ default="no" ])
[AS_HELP_STRING([--enable-ansi],[force to build with ANSI standards])])

AC_ARG_ENABLE([fatal-warnings],
[ --enable-fatal-warnings : enable fatal warnings. ],
[ default="no" ])
[AS_HELP_STRING([--enable-fatal-warnings],[enable fatal warnings])])

AC_ARG_ENABLE([debug],
[ --enable-debug : enable debug build. ],
[ default="no" ])
[AS_HELP_STRING([--enable-debug],[enable debug build])])

AC_ARG_ENABLE([coverage],
[ --enable-coverage : coverage analysis of the codebase. ],
[ default="no" ])
[AS_HELP_STRING([--enable-coverage],[coverage analysis of the codebase])])

AC_ARG_ENABLE([slow-tests],
[ --enable-slow-tests : build and run slow tests. ],
[ default="no" ])

if test x"$with_check" = xyes; then
AC_ARG_ENABLE([syslog-tests],
[ --enable-syslog-tests : build and run syslog tests. ],
[ default="no" ])
fi
[AS_HELP_STRING([--enable-slow-tests],[build and run slow tests])])

AC_ARG_WITH([socket-dir],
[ --with-socket-dir=DIR : socket dir. ],
[AS_HELP_STRING([--with-socket-dir=DIR],[socket directory @<:@LOCALSTATEDIR/run@:>@])],
[ SOCKETDIR="$withval" ],
[ SOCKETDIR="$localstatedir/run" ])

Expand Down Expand Up @@ -576,12 +573,6 @@ if test "x${enable_slow_tests}" = xyes ; then
fi
AM_CONDITIONAL(HAVE_SLOW_TESTS, [test "x${enable_slow_tests}" = xyes])
AC_SUBST(HAVE_SLOW_TESTS)
if test "x${enable_syslog_tests}" = xyes ; then
AC_DEFINE([HAVE_SYSLOG_TESTS], 1,[have syslog tests])
AC_MSG_NOTICE([Enabling syslog tests])
fi
AM_CONDITIONAL(HAVE_SYSLOG_TESTS, [test "x${enable_syslog_tests}" = xyes])
AC_SUBST(HAVE_SYSLOG_TESTS)

# --- callsite sections ---
if test "x${GCC}" = xyes; then
Expand Down
4 changes: 2 additions & 2 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ simplelog_LDADD = $(top_builddir)/lib/libqb.la

tcpclient_SOURCES = tcpclient.c $(top_builddir)/include/qb/qbloop.h
tcpclient_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
tcpclient_LDADD = $(top_builddir)/lib/libqb.la
tcpclient_LDADD = $(top_builddir)/lib/libqb.la $(socket_LIBS) $(nsl_LIBS)

tcpserver_SOURCES = tcpserver.c $(top_builddir)/include/qb/qbloop.h
tcpserver_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
tcpserver_LDADD = $(top_builddir)/lib/libqb.la
tcpserver_LDADD = $(top_builddir)/lib/libqb.la $(socket_LIBS)

ipcclient_SOURCES = ipcclient.c $(top_builddir)/include/qb/qbloop.h \
$(top_builddir)/include/qb/qbipcc.h
Expand Down
2 changes: 1 addition & 1 deletion include/qb/qbatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
* You must not directly read integers or pointers concurrently
* accessed by multiple threads, but use the atomic accessor functions
* instead. That is, always use qb_atomic_int_get() and qb_atomic_pointer_get()
* for read outs. They provide the necessary synchonization mechanisms
* for read outs. They provide the necessary synchronization mechanisms
* like memory barriers to access memory locations concurrently.
*
* If you are using those functions for anything apart from
Expand Down
2 changes: 1 addition & 1 deletion include/qb/qbloop.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int32_t qb_loop_job_add(qb_loop_t *l,
* This will try to delete the job if it hasn't run yet.
*
* @note this will remove the first job that matches the
* paramaters (priority, data, dispatch_fn).
* parameters (priority, data, dispatch_fn).
*
* @param l pointer to the loop instance
* @param p the priority
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@
libqb_la_CFLAGS = $(PTHREAD_CFLAGS)
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS) $(socket_LIBS)

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

Expand Down
4 changes: 1 addition & 3 deletions libqb.spec.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
%bcond_without check
%bcond_without syslog_tests

%global alphatag @alphatag@
%global numcomm @numcomm@
Expand Down Expand Up @@ -27,8 +26,7 @@ and polling.

%build
./autogen.sh
%configure --disable-static \
%{?with_syslog_tests:--enable-syslog-tests}
%configure --disable-static
make %{?_smp_mflags}

%if 0%{?with_check}
Expand Down
Loading

0 comments on commit 5a54a51

Please sign in to comment.