Module: xenomai-forge
Branch: rtdm-api-waitqueues
Commit: 130c228f7af894466558c25cc20078d7bf7ebc8c
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=130c228f7af894466558c25cc20078d7bf7ebc8c

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Apr 14 12:35:34 2014 +0200

boilerplate: snapshot configuration settings

We need a way to retrieve the configuration settings used for building
the user-space stack.

To this end, those settings are snapshot during the build process and
stored in a NULL-terminated array of pointer to strings, so that any
client code linking against libboilerplate can retrieve them.

---

 configure                         |    2 +-
 configure.ac                      |    2 +-
 include/boilerplate/ancillaries.h |    2 ++
 lib/boilerplate/Makefile.am       |   13 +++++++++++++
 lib/boilerplate/Makefile.in       |   32 ++++++++++++++++++++++++++------
 lib/boilerplate/ancillaries.c     |    5 +++++
 6 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index 3d22f1a..9605e6e 100755
--- a/configure
+++ b/configure
@@ -14325,7 +14325,7 @@ if test x"$want_fortify" != xno; then
    ac_fn_c_check_func "$LINENO" "__vfprintf_chk" "ac_cv_func___vfprintf_chk"
 if test "x$ac_cv_func___vfprintf_chk" = xyes; then :
 
-$as_echo "#define CONFIG_XENO_FORTIFY 1 " >>confdefs.h
+$as_echo "#define CONFIG_XENO_FORTIFY 1" >>confdefs.h
 
 else
   if test x"$want_fortify" = "xyes"; then
diff --git a/configure.ac b/configure.ac
index 2e7dc90..a2dbc05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -758,7 +758,7 @@ AC_ARG_ENABLE([fortify],
 AC_MSG_RESULT(${want_fortify:-autodetect})
 if test x"$want_fortify" != xno; then
    AC_CHECK_FUNC(__vfprintf_chk,
-             [AC_DEFINE(CONFIG_XENO_FORTIFY, 1 ,[config])],
+             [AC_DEFINE(CONFIG_XENO_FORTIFY, 1,[config])],
              [if test x"$want_fortify" = "xyes"; then
              AC_MSG_ERROR([Fortify support enabled but not available in *libc])
               fi])
diff --git a/include/boilerplate/ancillaries.h 
b/include/boilerplate/ancillaries.h
index da1e827..b2c5b44 100644
--- a/include/boilerplate/ancillaries.h
+++ b/include/boilerplate/ancillaries.h
@@ -79,4 +79,6 @@ void boilerplate_init(void);
 }
 #endif
 
+extern const char *config_strings[];
+
 #endif /* _BOILERPLATE_ANCILLARIES_H */
diff --git a/lib/boilerplate/Makefile.am b/lib/boilerplate/Makefile.am
index 3e47fb2..2940df9 100644
--- a/lib/boilerplate/Makefile.am
+++ b/lib/boilerplate/Makefile.am
@@ -13,6 +13,19 @@ if XENO_DEBUG
 libboilerplate_la_SOURCES += debug.c
 endif
 
+nodist_libboilerplate_la_SOURCES = config-dump.h
+BUILT_SOURCES = config-dump.h
+CLEANFILES = config-dump.h
+
+config-dump.h: Makefile $(CONFIG_HEADER)
+       ( sed -e '/^#define CONFIG_/!d' \
+       -e 's/^#[\t ]*define \(CONFIG_[^ ]*\) \(.*\)/\1=\2/' \
+       -e 's,\",\\&,g' \
+       -e 's/^.*$$/\"&\",/' $(CONFIG_HEADER); echo '"---",'; \
+       sed -e '/#undef CONFIG_/!d' \
+       -e 's/.*\(CONFIG_[^ ]*\).*/\1/' \
+       -e 's/^.*$$/\"& is OFF\",/' $(CONFIG_HEADER) ) > $@
+
 libboilerplate_la_CPPFLAGS =                           \
        @XENO_USER_CFLAGS@                              \
        -I$(top_srcdir)                                 \
diff --git a/lib/boilerplate/Makefile.in b/lib/boilerplate/Makefile.in
index b1c3333..a4829d4 100644
--- a/lib/boilerplate/Makefile.in
+++ b/lib/boilerplate/Makefile.in
@@ -107,7 +107,9 @@ am__libboilerplate_la_SOURCES_DIST = ancillaries.c hash.c 
obstack.c \
 am_libboilerplate_la_OBJECTS = libboilerplate_la-ancillaries.lo \
        libboilerplate_la-hash.lo libboilerplate_la-obstack.lo \
        libboilerplate_la-time.lo $(am__objects_1)
-libboilerplate_la_OBJECTS = $(am_libboilerplate_la_OBJECTS)
+nodist_libboilerplate_la_OBJECTS =
+libboilerplate_la_OBJECTS = $(am_libboilerplate_la_OBJECTS) \
+       $(nodist_libboilerplate_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -154,7 +156,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libboilerplate_la_SOURCES) $(libtlsf_la_SOURCES)
+SOURCES = $(libboilerplate_la_SOURCES) \
+       $(nodist_libboilerplate_la_SOURCES) $(libtlsf_la_SOURCES)
 DIST_SOURCES = $(am__libboilerplate_la_SOURCES_DIST) \
        $(libtlsf_la_SOURCES)
 am__can_run_installinfo = \
@@ -357,6 +360,9 @@ noinst_LTLIBRARIES = libboilerplate.la $(am__append_2)
 libboilerplate_la_LDFLAGS = @XENO_LIB_LDFLAGS@ -version-info 0:0:0
 libboilerplate_la_SOURCES = ancillaries.c hash.c obstack.c time.c \
        $(am__append_1)
+nodist_libboilerplate_la_SOURCES = config-dump.h
+BUILT_SOURCES = config-dump.h
+CLEANFILES = config-dump.h
 libboilerplate_la_CPPFLAGS = \
        @XENO_USER_CFLAGS@                              \
        -I$(top_srcdir)                                 \
@@ -378,7 +384,8 @@ libtlsf_la_CPPFLAGS = \
 
 EXTRA_DIST = tlsf/README
 SPARSE = sparse
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
@@ -595,10 +602,12 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -620,6 +629,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -628,6 +638,7 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
@@ -699,7 +710,7 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
        clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
@@ -716,6 +727,15 @@ uninstall-am:
        tags tags-am uninstall uninstall-am
 
 
+config-dump.h: Makefile $(CONFIG_HEADER)
+       ( sed -e '/^#define CONFIG_/!d' \
+       -e 's/^#[\t ]*define \(CONFIG_[^ ]*\) \(.*\)/\1=\2/' \
+       -e 's,\",\\&,g' \
+       -e 's/^.*$$/\"&\",/' $(CONFIG_HEADER); echo '"---",'; \
+       sed -e '/#undef CONFIG_/!d' \
+       -e 's/.*\(CONFIG_[^ ]*\).*/\1/' \
+       -e 's/^.*$$/\"& is OFF\",/' $(CONFIG_HEADER) ) > $@
+
 sparse:
        @for i in $(libboilerplate_la_SOURCES) $(libtlsf_la_SOURCES); do \
                $(SPARSE) $(CHECKFLAGS) $(srcdir)/$$i; \
diff --git a/lib/boilerplate/ancillaries.c b/lib/boilerplate/ancillaries.c
index 35bd401..f613a8e 100644
--- a/lib/boilerplate/ancillaries.c
+++ b/lib/boilerplate/ancillaries.c
@@ -235,3 +235,8 @@ void boilerplate_init(void)
        static pthread_once_t once = PTHREAD_ONCE_INIT;
        pthread_once(&once, __boilerplate_init);
 }
+
+const char *config_strings[] = {
+#include "config-dump.h"
+       NULL,
+};


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to