There's no need to have a separete configure.ac and Makefile.am
for the elapi_test directory. By creating test-specific helper
libraries, we can alter the CFLAGS for just the tests. This will
speed up builds, as we do not need to run configure on an extra
directory. It will also mean only one Makefile to keep in sync
with source code changes.

-- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
From 9aa1390547f50ca537bde4a619606d7865c8142d Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Wed, 4 Nov 2009 08:45:52 -0500
Subject: [PATCH] Build the elapi_test suite without extra autoconf invocation

There's no need to have a separete configure.ac and Makefile.am
for the elapi_test directory. By creating test-specific helper
libraries, we can alter the CFLAGS for just the tests. This will
speed up builds, as we do not need to run configure on an extra
directory. It will also mean only one Makefile to keep in sync
with source code changes.
---
 common/elapi/Makefile.am             |   79 +++++++++++++++++++++++++++-------
 common/elapi/configure.ac            |    2 -
 common/elapi/elapi_test/Makefile.am  |   62 --------------------------
 common/elapi/elapi_test/configure.ac |   32 --------------
 4 files changed, 63 insertions(+), 112 deletions(-)
 delete mode 100644 common/elapi/elapi_test/Makefile.am
 delete mode 100644 common/elapi/elapi_test/configure.ac

diff --git a/common/elapi/Makefile.am b/common/elapi/Makefile.am
index 747a388..153b19e 100644
--- a/common/elapi/Makefile.am
+++ b/common/elapi/Makefile.am
@@ -4,23 +4,22 @@ default_conf_app_d...@elapiconfappdir@
 app_na...@appname@
 app_name_si...@appnamesize@
 
-SUBDIRS = elapi_test
-
 topdir=$(srcdir)/..
 prvdrdir=$(srcdir)/providers
 
-AM_CFLAGS = \
-    -DELAPI_DEFAULT_CONFIG_DIR=\"$(DEFAULT_CONF_DIR)\"   \
-    -DELAPI_DEFAULT_CONFIG_APP_DIR=\"$(DEFAULT_CONF_APP_DIR)\"   \
-    -DELAPI_DEFAULT_APP_NAME=\"$(APP_NAME)\" \
-    -DELAPI_DEFAULT_APP_NAME_SIZE=$(APP_NAME_SIZE)
-
 if HAVE_GCC
-    AM_CFLAGS += \
+    GCC_CFLAGS = \
         -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
         -Wcast-align -Wwrite-strings
 endif
 
+AM_CFLAGS = \
+    -DELAPI_DEFAULT_CONFIG_DIR=\"$(DEFAULT_CONF_DIR)\" \
+    -DELAPI_DEFAULT_CONFIG_APP_DIR=\"$(DEFAULT_CONF_APP_DIR)\" \
+    -DELAPI_DEFAULT_APP_NAME=\"elapi_ut\" \
+    -DELAPI_DEFAULT_APP_NAME_SIZE=127 \
+    $(GCC_FLAGS)
+
 AM_CPPFLAGS = -I$(topdir) -I$(topdir)/ini -I$(topdir)/trace 
-I$(topdir)/collection \
               -I$(topdir)/elapi/providers/file $(TRACE_LEVEL)
 
@@ -30,16 +29,20 @@ ACLOCAL_AMFLAGS = -I m4
 pkgconfigdir = $(libdir)/pkgconfig
 dist_noinst_DATA = \
     elapi.pc \
+    elapi_test/elapi_ut.conf \
     m4
 
 # Build libraries
 noinst_LTLIBRARIES = libelapibasic.la libprovider.la libelapi.la
 
-libelapibasic_la_SOURCES = \
+BASIC_SOURCES = \
     elapi_basic.c \
     elapi_basic.h
 
-libprovider_la_SOURCES = \
+libelapibasic_la_SOURCES = \
+    $(BASIC_SOURCES)
+
+PROVIDER_SOURCES = \
     $(prvdrdir)/file/file_provider.c \
     $(prvdrdir)/file/file_provider.h \
     $(prvdrdir)/file/file_util.c \
@@ -47,7 +50,10 @@ libprovider_la_SOURCES = \
     $(prvdrdir)/file/file_fmt_csv.c \
     $(prvdrdir)/file/file_fmt_csv.h
 
-libelapi_la_SOURCES = \
+libprovider_la_SOURCES = \
+    $(PROVIDER_SOURCES)
+
+ELAPI_SOURCES = \
     elapi_event.c \
     elapi_log.c \
     elapi_internal.c \
@@ -68,9 +74,50 @@ libelapi_la_SOURCES = \
     elapi_defines.h \
     elapi.h
 
+libelapi_la_SOURCES = \
+    $(ELAPI_SOURCES)
+
 libelapi_la_LIBADD = libprovider.la libelapibasic.la
 
-tests: all
-       for subdir in $(SUBDIRS); do \
-               $(MAKE) -C $$subdir $@; \
-       done
+# Unit Tests
+TEST_CFLAGS = \
+    -DELAPI_DEFAULT_CONFIG_DIR=\"$(srcdir)/elapi_test\"   \
+    -DELAPI_DEFAULT_CONFIG_APP_DIR=\"$(srcdir)/elapi_test\"   \
+    -DELAPI_DEFAULT_APP_NAME=\"elapi_ut\" \
+    -DELAPI_DEFAULT_APP_NAME_SIZE=127 \
+    $(GCC_CFLAGS)
+
+
+check_LTLIBRARIES = \
+    libelapi_test.la \
+    libprovider_test.la \
+    libelapibasic_test.la
+
+libprovider_test_la_SOURCES = \
+    $(PROVIDER_SOURCES)
+libprovider_test_la_CFLAGS = \
+    $(TEST_CFLAGS)
+
+libelapibasic_test_la_SOURCES = \
+    $(BASIC_SOURCES)
+libelapibasic_test_la_CFLAGS = \
+    $(TEST_CFLAGS)
+
+libelapi_test_la_SOURCES = \
+    $(ELAPI_SOURCES)
+libelapi_test_la_CFLAGS = \
+    $(TEST_CFLAGS)
+
+libelapi_test_la_LIBADD = \
+    libprovider_test.la \
+    libelapibasic_test.la
+
+check_PROGRAMS = elapi_ut
+elapi_ut_SOURCES = elapi_test/elapi_ut.c
+elapi_ut_CFLAGS = $(TEST_CFLAGS)
+elapi_ut_LDADD = \
+    libelapi_test.la \
+    ../ini/libini_config.la \
+    ../collection/libcollection.la -ldl
+
+TESTS = elapi_ut
\ No newline at end of file
diff --git a/common/elapi/configure.ac b/common/elapi/configure.ac
index 82be136..64ec1f9 100644
--- a/common/elapi/configure.ac
+++ b/common/elapi/configure.ac
@@ -33,7 +33,5 @@ WITH_COMPAT
 
 m4_include(def_macros.m4)
 
-AC_CONFIG_SUBDIRS([elapi_test])
-
 AC_CONFIG_FILES([Makefile elapi.pc])
 AC_OUTPUT
diff --git a/common/elapi/elapi_test/Makefile.am 
b/common/elapi/elapi_test/Makefile.am
deleted file mode 100644
index d9f1bb0..0000000
--- a/common/elapi/elapi_test/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-trace_lev...@trace_var@
-
-topdir=$(srcdir)/../..
-
-AM_CFLAGS = -DELAPI_DEFAULT_CONFIG_DIR=\"$(srcdir)\"   \
-            -DELAPI_DEFAULT_CONFIG_APP_DIR=\"$(srcdir)\"   \
-            -DELAPI_DEFAULT_APP_NAME=\"elapi_ut\" \
-            -DELAPI_DEFAULT_APP_NAME_SIZE=127
-
-if HAVE_GCC
-    AM_CFLAGS += \
-        -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-        -Wcast-align -Wwrite-strings
-endif
-
-AM_CPPFLAGS = -I$(topdir) -I$(topdir)/ini -I$(topdir)/trace 
-I$(topdir)/collection -I$(topdir)/elapi \
-              -I$(topdir)/elapi/providers/file $(TRACE_LEVEL)
-
-ACLOCAL_AMFLAGS = -I m4
-
-dist_noinst_DATA = m4
-
-# Build library
-noinst_LTLIBRARIES = libelapi_test.la
-
-libelapi_test_la_SOURCES = \
-    ../elapi_event.c \
-    ../elapi_log.c \
-    ../elapi_internal.c \
-    ../elapi_sink.c \
-    ../elapi_basic.c \
-    ../elapi_basic.h \
-    ../elapi_resolve.c \
-    ../elapi_async.c \
-    ../elapi_subst.c \
-    ../elapi_ioctl.c \
-    ../elapi_event.h \
-    ../elapi_priv.h \
-    ../elapi_sink.h \
-    ../elapi_log.h \
-    ../elapi_async.h \
-    ../elapi_ioctl.h \
-    ../elapi_net.h \
-    ../elapi_fd.h \
-    ../elapi_tm.h \
-    ../elapi_defines.h \
-    ../elapi.h \
-    ../providers/file/file_provider.c \
-    ../providers/file/file_provider.h \
-    ../providers/file/file_util.c \
-    ../providers/file/file_util.h \
-    ../providers/file/file_fmt_csv.c \
-    ../providers/file/file_fmt_csv.h
-
-# Build unit test
-check_PROGRAMS = elapi_ut
-elapi_ut_SOURCES = elapi_ut.c
-elapi_ut_LDADD = libelapi_test.la ../../ini/libini_config.la 
../../collection/libcollection.la -ldl
-
-TESTS = elapi_ut
-
-tests: all $(check_PROGRAMS)
diff --git a/common/elapi/elapi_test/configure.ac 
b/common/elapi/elapi_test/configure.ac
deleted file mode 100644
index 44524e7..0000000
--- a/common/elapi/elapi_test/configure.ac
+++ /dev/null
@@ -1,32 +0,0 @@
-AC_INIT([elapi],[0.0.1],[sssd-de...@lists.fedorahosted.org])
-AC_CONFIG_SRCDIR([elapi_ut.c])
-AC_CONFIG_AUX_DIR([build])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign])
-AC_PROG_CC
-AC_PROG_LIBTOOL
-AC_CONFIG_MACRO_DIR([m4])
-AC_PROG_INSTALL
-
-AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
-
-m4_pattern_allow([AM_SILENT_RULES])
-AM_SILENT_RULES
-
-AC_CONFIG_HEADERS([config.h])
-
-# Enable trace build
-AC_ARG_ENABLE([trace],
-              [AS_HELP_STRING([--enable-trace[=LEVEL]],[build with low level 
tracing enabled])],
-              [trace_level="$enableval"],
-              [trace_level="0"])
-AS_IF([test ["$trace_level" -gt "0"] -a ["$trace_level" -lt "8"] 
],[AC_SUBST([TRACE_VAR],["-DTRACE_LEVEL=$trace_level"])])
-
-# Enable trace build
-AC_ARG_ENABLE([verbose],
-              [AS_HELP_STRING([--enable-verbose],[build with verbose output])],
-              [AC_DEFINE([ELAPI_VERBOSE],[],[add verbose output])],[])
-
-m4_include(../def_macros.m4)
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-- 
1.6.2.5

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to