Permalink
Browse files

Use pandora build system

Change-Id: Idd13e9c5460ba0ffebe5efcf53a00ec7b0b07a41
Reviewed-on: http://review.northscale.com/2185
Reviewed-by: Dustin Sallings <dustin@spy.net>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent b35e6fd commit 3dd4e50341dffe0fa74b8ff2fd6fcb7d37adad97 @trondn trondn committed Aug 30, 2010
Showing with 263 additions and 197 deletions.
  1. +20 −10 Makefile.am
  2. +15 −0 adhoc_commands.c
  3. +39 −165 configure.ac
  4. +23 −1 examples/bot.c
  5. +2 −0 logging.c
  6. +62 −0 m4/pandora_have_libcurl.m4
  7. +43 −0 m4/pandora_have_libstrophe.m4
  8. +1 −1 m4/pandora_use_pipe.m4
  9. +20 −9 m4/pandora_warnings.m4
  10. +18 −0 persist.c
  11. +3 −3 rest.c
  12. +8 −8 tests/Makefile.am
  13. +9 −0 xmpp.c
View
@@ -11,19 +11,29 @@ pkgconfig_DATA = libconflate.pc
BUILT_SOURCES=
-SUBDIRS= $(MAYBE_LIBSTROPHE) . tests
-DIST_SUBDIRS = $(MAYBE_LIBSTROPHE) . tests
+SUBDIRS= . tests
+DIST_SUBDIRS = . tests
examples_bot_DEPENDENCIES = libconflate.la
examples_bot_SOURCES = examples/bot.c
-examples_bot_CFLAGS = $(libstrophe_CFLAGS)
-examples_bot_LDADD = -L. -lconflate @PROFILER_LDFLAGS@
-
-libconflate_la_CFLAGS = @PROFILER_FLAGS@ $(libstrophe_CFLAGS)
-libconflate_la_SOURCES = conflate.h conflate_internal.h conflate_convenience.h alarm.h rest.h\
- alarm.c kvpair.c util.c persist.c xmpp.c logging.c adhoc_commands.c \
- conflate.c rest.c
-libconflate_la_LIBADD = $(libstrophe_LIBS)
+examples_bot_LDADD = libconflate.la $(GCOV_LIBS)
+
+libconflate_la_SOURCES = adhoc_commands.c \
+ alarm.c \
+ alarm.h \
+ conflate.c \
+ conflate.h \
+ conflate_convenience.h \
+ conflate_internal.h \
+ kvpair.c \
+ logging.c \
+ persist.c \
+ rest.c \
+ rest.h \
+ util.c \
+ xmpp.c
+
+libconflate_la_LIBADD = $(LIBCONFLATE_LINKFLAGS) $(LTLIBCURL)
MOSTLYCLEANFILES = *.gcov *.gcno *.gcda *.tcov
View
@@ -17,6 +17,10 @@ static enum conflate_mgmt_cb_result process_serverlist(void *opaque,
kvpair_t *conf,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)cmd;
+ (void)r;
+
/* If we have "config_is_private" set to "yes" we should only
process this if it's direct (i.e. ignore pubsub) */
if (!direct) {
@@ -52,6 +56,10 @@ static enum conflate_mgmt_cb_result process_set_private(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)cmd;
+ (void)r;
+
/* Only direct stat requests are handled. */
assert(direct);
enum conflate_mgmt_cb_result rv = RV_ERROR;
@@ -78,6 +86,9 @@ static enum conflate_mgmt_cb_result process_get_private(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)cmd;
+
/* Only direct stat requests are handled. */
assert(direct);
enum conflate_mgmt_cb_result rv = RV_ERROR;
@@ -109,6 +120,10 @@ static enum conflate_mgmt_cb_result process_delete_private(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)cmd;
+ (void)r;
+
/* Only direct stat requests are handled. */
assert(direct);
enum conflate_mgmt_cb_result rv = RV_ERROR;
View
@@ -1,98 +1,19 @@
-AC_PREREQ(2.52)
-AC_INIT(libconflate, 1.0, dustin@spy.net)
+AC_PREREQ(2.59)
+m4_include([m4/version.m4])
+AC_INIT(libconflate, VERSION_NUMBER, dustin@spy.noet)
+AC_CONFIG_SRCDIR([conflate.h])
+AC_CONFIG_AUX_DIR(config)
+AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
-AC_CANONICAL_SYSTEM
-AC_CONFIG_SRCDIR(conflate.h)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-AM_CONFIG_HEADER(config.h)
-AC_PROG_LIBTOOL
+AC_DISABLE_STATIC
-AC_PROG_CC
-AC_PROG_CC_C99
+PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, force-gcc42)
+PANDORA_REQUIRE_PTHREAD
+PANDORA_HAVE_LIBCURL
+PANDORA_HAVE_LIBSQLITE3
+PANDORA_HAVE_LIBSTROPHE
-dnl **********************************************************************
-dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
-dnl
-dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
-dnl sets the $ICC variable to "yes" or "no"
-dnl **********************************************************************
-AC_DEFUN([DETECT_ICC],
-[
- ICC="no"
- AC_MSG_CHECKING([for icc in use])
- if test "$GCC" = "yes"; then
- dnl check if this is icc acting as gcc in disguise
- AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
- AC_MSG_RESULT([no])
- [$2],
- AC_MSG_RESULT([yes])
- [$1]
- ICC="yes")
- else
- AC_MSG_RESULT([no])
- [$2]
- fi
-])
-
-DETECT_ICC([], [])
-
-dnl **********************************************************************
-dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
-dnl
-dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
-dnl sets the $SUNCC variable to "yes" or "no"
-dnl **********************************************************************
-AC_DEFUN([DETECT_SUNCC],
-[
- SUNCC="no"
- AC_MSG_CHECKING([for Sun cc in use])
- AC_EGREP_CPP([^__SUNPRO_C], [__SUNPRO_C],
- AC_MSG_RESULT([no])
- [$2],
- AC_MSG_RESULT([yes])
- [$1]
- SUNCC="yes")
-])
-
-AS_IF(test "$GCC" != "yes", DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], []))
-
-AM_PROG_CC_C_O
-AC_PROG_INSTALL
-
-AC_ARG_ENABLE(coverage,
- [AS_HELP_STRING([--enable-coverage],
- [Enable code coverage @<:@default=off@:>@])],
- [ac_cv_enable_coverage="$enableval"],
- [ac_cv_enable_coverage="no"])
-
-AS_IF(test "x$enable_coverage" = "xyes", [
- AS_IF([ test "$ICC" = "yes" -o "$SUNCC" = "yes"],
- [ AC_MSG_ERROR([coverage only supported for gcc])])
- AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
- AS_IF([test "x$PROFILER" = "xno"],
- [ AC_MSG_ERROR([Can't do code coverage without gcov])])
- AC_CHECK_LIB(gcov, main,
- [
- PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
- PROFILER_LDFLAGS="-lgcov"
- ], [
- AC_MSG_ERROR([Can't do code coverage without libgcov])])
- ])
-AC_SUBST(PROFILER_LDFLAGS)
-AC_SUBST(PROFILER_FLAGS)
-
-AC_SEARCH_LIBS(pthread_create, pthread,
- [], AC_MSG_ERROR([Can't enable pthreads.]))
-
-AC_ARG_WITH([curl],
- [AS_HELP_STRING([--with-curl=yes], [search libs for curl])])
-
-if test "x$with_curl" != "xno"; then
- AC_SEARCH_LIBS(curl_global_init, curl, [],
- AC_MSG_ERROR([Can't find curl]))
-else
- AC_MSG_NOTICE([skipping search for curl library])
-fi
+AC_HEADER_STDBOOL
AC_ARG_WITH([check],
[AS_HELP_STRING([--with-check=yes], [look for check tool for unit tests])])
@@ -103,97 +24,50 @@ else
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
fi
-AC_HEADER_STDBOOL
-
AC_ARG_WITH([rest],
[AS_HELP_STRING([--without-rest],
[Use XMPP instead of REST (yes|no) @<:@default=no@:>@])],
[with_rest=$withval],
[with_rest=yes])
AC_ARG_WITH([sqlite],
- [AS_HELP_STRING([--with-sqlite=no], [use sqlite to store configs locally])])
-
-AC_ARG_WITH([bundled-libstrophe],
- [AS_HELP_STRING([--with-bundled-libstrophe=no], [force building with bundled libstrophe])])
-
-if test "x$with_sqlite" = "xyes"; then
- CFLAGS="$CFLAGS -DCONFLATE_USE_SQLITE"
- AC_SEARCH_LIBS(sqlite3_open, sqlite3, [],
- AC_MSG_ERROR([Can't locate sqlite3]))
-else
- CFLAGS="$CFLAGS -DCONFLATE_NO_SQLITE"
-fi
-
-if test "x$with_rest" = "xyes"; then
- CFLAGS="$CFLAGS -DCONFLATE_USE_REST"
-else
- CFLAGS="$CFLAGS -DCONFLATE_USE_XMPP"
-
- if test "x$with_bundled_libstrophe" = "xyes"; then
- libstrophe_pkg_missing=yes
- else
- PKG_CHECK_MODULES([libstrophe], [libstrophe], [], [
- libstrophe_pkg_missing=yes
- ])
- fi
-
- if test "x$libstrophe_pkg_missing" = "xyes"; then
- if test -f "$srcdir/libstrophe/configure"; then
- if test "x$with_bundled_libstrophe" = "xyes"; then
- AC_MSG_NOTICE([forced use of bundled libstrophe])
- else
- AC_MSG_NOTICE([will use bundled libstrophe])
- fi
- AC_CONFIG_SUBDIRS([libstrophe])
- libstrophe_CFLAGS='-I$(top_srcdir)/libstrophe'
- libstrophe_LIBS="-Llibstrophe -lstrophe"
- AC_SUBST([MAYBE_LIBSTROPHE], [libstrophe])
- else
- if test "x$with_bundled_libstrophe" = "xyes"; then
- AC_MSG_FAILURE([use of bundled libstrophe is requested, but libstrophe/configure is missing])
- fi
- AC_MSG_CHECKING([for old version of libstrophe])
- AC_CHECK_HEADER(strophe.h,
- [], AC_MSG_ERROR([Ensure strophe.h is available.]))
- AC_SEARCH_LIBS(xmpp_initialize, strophe,
- [], AC_MSG_ERROR([Can't find libstrophe.]))
- fi
- fi
-fi
-
-AM_CONDITIONAL([BUILD_BUNDLED_LIBSTROPHE], [test "x$build_bundled_libstrophe" = xyes])
-
-AC_C_CONST
+ [AS_HELP_STRING([--with-sqlite], [Use sqlite to store configs locally @<:@default=no@:>@])],
+ [with_sqlite=$withval],
+ [with_sqlite=no])
+
+AS_IF([test "x$with_sqlite" = "xyes" ],
+ [ AS_IF([test "x${ac_cv_libsqlite3}" != "xyes"],
+ AC_MSG_ERROR([libsqlite3 is required for ${PACKAGE}]))
+ AM_CFLAGS="$AM_CFLAGS -DCONFLATE_USE_SQLITE"
+ LIBCONFLATE_LINKFLAGS="$LTLIBSQLITE3"
+ ],
+ [AM_CFLAGS="$AM_CFLAGS -DCONFLATE_NO_SQLITE"])
+
+AS_IF([test "x$with_rest" = "xyes"],
+ [AM_CFLAGS="$AM_CFLAGS -DCONFLATE_USE_REST"],
+ [AS_IF([test "x${ac_cv_libstrophe}" != "xyes"],
+ AC_MSG_ERROR([libstrophe is required for ${PACKAGE}]))
+ AM_CFLAGS="$AM_CFLAGS -DCONFLATE_USE_XMPP"
+ LIBCONFLATE_LINKFLAGS="$LIBCONFLATE_LINKFLAGS $LTLIBSTROPHE"
+ ])
+
+AC_SUBST(LIBCONFLATE_LINKFLAGS)
AC_CHECK_HEADERS_ONCE([syslog.h])
AC_CHECK_FUNCS_ONCE(strsep)
AH_BOTTOM([
+/* There is a problem with some of the macros in typecheck-gcc.h that
+** generates warnings with -Wlogical-op. Just disable the checks instead
+*/
+#define __CURL_TYPECHECK_GCC_H 1
+
#ifdef WIN32
#include <windows.h>
#define pause(a) while (1) { Sleep(100000); }
#define sleep(a) Sleep(a * 1000)
#endif
])
-
-dnl Let the compiler be a bit more picky. Please note that you cannot
-dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
-dnl the test program will generate a compilation warning and hence fail
-dnl to detect the function ;-)
-dnl Lines borrowed from memcached.
-if test "$ICC" = "yes"
-then
- dnl ICC trying to be gcc.
- CFLAGS="$CFLAGS -w2 -Wcheck -Wall -Werror"
-elif test "$GCC" = "yes"
-then
- CFLAGS="$CFLAGS -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
-elif test "$SUNCC" = "yes"
-then
- CFLAGS="$CFLAGS -errfmt=error -erroff=E_ATTRIBUTE_UNKNOWN"
-fi
-
AC_CONFIG_FILES(Makefile tests/Makefile libconflate.pc)
AC_OUTPUT
View
@@ -21,6 +21,7 @@
*/
static bool config_visitor(void *opaque, const char *key, const char **values)
{
+ (void)opaque;
printf("\t%s\n", key);
for (int i = 0; values[i]; i++) {
@@ -51,6 +52,10 @@ static enum conflate_mgmt_cb_result process_stats(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)handle;
+ (void)cmd;
+
/* Only direct stat requests are handled. */
assert(direct);
@@ -75,6 +80,11 @@ static enum conflate_mgmt_cb_result process_reset_stats(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)handle;
+ (void)cmd;
+ (void)direct;
+ (void)r;
char *subtype = get_simple_kvpair_val(form, "-subtype-");
fprintf(stderr, "Handling stats reset with subtype: %s\n",
@@ -93,6 +103,11 @@ static enum conflate_mgmt_cb_result process_ping_test(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
+ (void)opaque;
+ (void)handle;
+ (void)cmd;
+ (void)direct;
+
kvpair_t *servers_p = find_kvpair(form, "servers");
if (!servers_p) {
return RV_BADARG;
@@ -122,7 +137,14 @@ static enum conflate_mgmt_cb_result process_alarm_create(void *opaque,
kvpair_t *form,
conflate_form_result *r)
{
- if(add_alarm(handle->alarms, "test", "This is a test alarm!")) {
+ (void)opaque;
+ (void)handle;
+ (void)cmd;
+ (void)direct;
+ (void)form;
+ (void)r;
+
+ if(add_alarm(handle->alarms, "test", "This is a test alarm!")) {
fprintf(stderr, "Created alarm!\n");
} else {
fprintf(stderr, "Error queueing an alarm.\n");
View
@@ -50,6 +50,7 @@ static int prio_map(enum conflate_log_level lvl)
void conflate_syslog_logger(void *userdata, enum conflate_log_level lvl,
const char *msg, ...)
{
+ (void)userdata;
char fmt[strlen(msg) + 16];
snprintf(fmt, sizeof(fmt), "%s: %s\n", lvl_name(lvl), msg);
@@ -63,6 +64,7 @@ void conflate_syslog_logger(void *userdata, enum conflate_log_level lvl,
void conflate_stderr_logger(void *userdata, enum conflate_log_level lvl,
const char *msg, ...)
{
+ (void)userdata;
char fmt[strlen(msg) + 16];
snprintf(fmt, sizeof(fmt), "%s: %s\n", lvl_name(lvl), msg);
Oops, something went wrong. Retry.

0 comments on commit 3dd4e50

Please sign in to comment.