summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-05-18 14:42:27 -0400
committerSimo Sorce <ssorce@redhat.com>2009-05-19 11:09:45 -0400
commit7d3d79c5b325ce5002c0f6a936b4e84d04edf5ce (patch)
treed24f76a3447790ae2ec770f98f1864a24de6c840 /common
parent7aeb9f1229d9db51dc7841e828aa89a55c2062ad (diff)
downloadsssd-7d3d79c5b325ce5002c0f6a936b4e84d04edf5ce.tar.gz
sssd-7d3d79c5b325ce5002c0f6a936b4e84d04edf5ce.tar.xz
sssd-7d3d79c5b325ce5002c0f6a936b4e84d04edf5ce.zip
Enable parallel builds for the common libraries
Diffstat (limited to 'common')
-rw-r--r--common/collection/Makefile.am9
-rw-r--r--common/collection/trace.h96
-rw-r--r--common/configure.ac2
-rw-r--r--common/dhash/Makefile.am2
-rw-r--r--common/ini/Makefile.am2
5 files changed, 103 insertions, 8 deletions
diff --git a/common/collection/Makefile.am b/common/collection/Makefile.am
index 37d3ddf6a..86488eddb 100644
--- a/common/collection/Makefile.am
+++ b/common/collection/Makefile.am
@@ -1,7 +1,7 @@
#DEBUG_FLAGS=@DEBUG_VAR@
TRACE_LEVEL=@TRACE_VAR@
-topdir=..
+topdir=$(srcdir)/..
AM_CPPFLAGS = -Wall -I$(topdir) -I$(topdir)/trace $(TRACE_LEVEL)
ACLOCAL_AMFLAGS = -I m4
@@ -13,10 +13,9 @@ pkgconfig_DATA = collection.pc
lib_LTLIBRARIES = libcollection.la
libcollection_la_SOURCES = \
collection.c \
- collection_tools.c
-
-noinst_HEADERS = \
- collection_priv.h
+ collection_tools.c \
+ collection_priv.h \
+ trace.h
include_HEADERS = collection.h collection_tools.h
diff --git a/common/collection/trace.h b/common/collection/trace.h
new file mode 100644
index 000000000..9211e20d6
--- /dev/null
+++ b/common/collection/trace.h
@@ -0,0 +1,96 @@
+/*
+ COMMON TRACE
+
+ Common header file for tracing.
+
+ Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef COMMON_TRACE_H
+#define COMMON_TRACE_H
+
+#ifdef TRACE_LEVEL
+#define HAVE_TRACE
+#include <stdio.h>
+
+/* The trace level is a bit mask */
+#define TRACE_FLOW 0x0000001 /* - trace messages that are entry exit into functions */
+#define TRACE_ERROR 0x0000002 /* - trace messages that are errors */
+#define TRACE_INFO 0x0000004 /* - trace things that are informational */
+
+
+#ifdef TRACE_HOME /* Define this in the module that contains main */
+unsigned trace_level = TRACE_LEVEL;
+#else
+extern unsigned trace_level;
+#endif /* TRACE_HOME */
+#endif /* TRACE_LEVEL */
+
+
+
+#ifdef HAVE_TRACE
+/* Tracing strings */
+#define TRACE_STRING(level, msg, str) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %s\n", \
+ __FILE__, __LINE__, msg, str); \
+ } \
+ } while(0)
+
+/* Tracing numbers */
+#define TRACE_NUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %lu\n", \
+ __FILE__, __LINE__, msg, (unsigned long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing doubles */
+#define TRACE_DOUBLE(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %e\n", \
+ __FILE__, __LINE__, msg, (double)(num)); \
+ } \
+ } while(0)
+
+/* Assertion */
+#define TRACE_ASSERT(expression) expression ? : printf("ASSERTION FAILED\n")
+#else /* HAVE_TRACE */
+
+/* Noop in case the tracing is disabled */
+#define TRACE_STRING(level, msg, str)
+#define TRACE_NUMBER(level, msg, num)
+#define TRACE_DOUBLE(level, msg, num)
+#endif /* HAVE_TRACE */
+
+
+/* Convenience wrappers for strings */
+#define TRACE_FLOW_STRING(msg, str) TRACE_STRING(TRACE_FLOW, msg, str)
+#define TRACE_ERROR_STRING(msg, str) TRACE_STRING(TRACE_ERROR, msg, str)
+#define TRACE_INFO_STRING(msg, str) TRACE_STRING(TRACE_INFO, msg, str)
+
+/* Convenience wrappers for numbers */
+#define TRACE_FLOW_NUMBER(msg, num) TRACE_NUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_NUMBER(msg, num) TRACE_NUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_NUMBER(msg, num) TRACE_NUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for numbers */
+#define TRACE_FLOW_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_ERROR, msg, num)
+#define TRACE_INFO_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_INFO, msg, num)
+
+#endif /* COMMON_TRACE_H */
diff --git a/common/configure.ac b/common/configure.ac
index e32139967..cae2c5b37 100644
--- a/common/configure.ac
+++ b/common/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([sssd_libs], [0.3.3], [sgallagh@redhat.com])
+AC_INIT([sssd_libs], [0.4.0], [sgallagh@redhat.com])
AC_CONFIG_SRCDIR([README])
AC_CONFIG_AUX_DIR([build])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
diff --git a/common/dhash/Makefile.am b/common/dhash/Makefile.am
index 0582f849c..67e69b669 100644
--- a/common/dhash/Makefile.am
+++ b/common/dhash/Makefile.am
@@ -6,7 +6,7 @@ pkgconfig_DATA = dhash.pc
lib_LTLIBRARIES = libdhash.la
libdhash_la_SOURCES = dhash.c
-pkginclude_HEADERS = dhash.h
+include_HEADERS = dhash.h
check_PROGRAMS = dhash_test dhash_example
dhash_test_LDADD = dhash.o
diff --git a/common/ini/Makefile.am b/common/ini/Makefile.am
index be8f9ec35..7278136ec 100644
--- a/common/ini/Makefile.am
+++ b/common/ini/Makefile.am
@@ -1,7 +1,7 @@
#DEBUG_FLAGS=@DEBUG_VAR@
TRACE_LEVEL=@TRACE_VAR@
-topdir=..
+topdir=$(srcdir)/..
AM_CPPFLAGS = -Wall -I$(topdir) -I$(topdir)/trace -I$(topdir)/collection $(TRACE_LEVEL)
ACLOCAL_AMFLAGS = -I m4