Module: xenomai-forge
Branch: next
Commit: c27b27a5cbe835b04a4b5dc2d44dd83fdaf07ed1
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c27b27a5cbe835b04a4b5dc2d44dd83fdaf07ed1

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

lib/copperplate: introduce --dump-config option

We need a way to retrieve the configuration settings used for building
the user-space stack. At the moment, we produce such information when
building copperplate; we may soon make it available from libcobalt for
Cobalt-based builds instead.

The builtin --dump-config switch is introduced to dump the
configuration information from any copperplate-based application.

---

 configure                   |    2 +-
 configure.ac                |    2 +-
 lib/copperplate/Makefile.am |   13 +++++++++++++
 lib/copperplate/Makefile.in |   33 +++++++++++++++++++++++++++------
 lib/copperplate/init.c      |   24 ++++++++++++++++++++++++
 5 files changed, 66 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/lib/copperplate/Makefile.am b/lib/copperplate/Makefile.am
index 17ebeb4..53138ba 100644
--- a/lib/copperplate/Makefile.am
+++ b/lib/copperplate/Makefile.am
@@ -18,6 +18,19 @@ libcopperplate_la_SOURCES =  \
        traceobj.c      \
        wrappers.c
 
+nodist_libcopperplate_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) ) > $@
+
 libcopperplate_la_CPPFLAGS =           \
        @XENO_USER_CFLAGS@              \
        -I$(top_srcdir)                 \
diff --git a/lib/copperplate/Makefile.in b/lib/copperplate/Makefile.in
index a9b360e..7aa0707 100644
--- a/lib/copperplate/Makefile.in
+++ b/lib/copperplate/Makefile.in
@@ -157,7 +157,9 @@ am_libcopperplate_la_OBJECTS = 
libcopperplate_la-clockobj.lo \
        libcopperplate_la-timerobj.lo libcopperplate_la-traceobj.lo \
        libcopperplate_la-wrappers.lo $(am__objects_1) \
        $(am__objects_2) $(am__objects_3) $(am__objects_4)
-libcopperplate_la_OBJECTS = $(am_libcopperplate_la_OBJECTS)
+nodist_libcopperplate_la_OBJECTS =
+libcopperplate_la_OBJECTS = $(am_libcopperplate_la_OBJECTS) \
+       $(nodist_libcopperplate_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -212,7 +214,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 = $(libcopperplate_la_SOURCES) $(libregistry_la_SOURCES) \
+SOURCES = $(libcopperplate_la_SOURCES) \
+       $(nodist_libcopperplate_la_SOURCES) $(libregistry_la_SOURCES) \
        $(libversion_la_SOURCES)
 DIST_SOURCES = $(am__libcopperplate_la_SOURCES_DIST) \
        $(am__libregistry_la_SOURCES_DIST) $(libversion_la_SOURCES)
@@ -460,6 +463,9 @@ libcopperplate_la_SOURCES = clockobj.c cluster.c eventobj.c 
init.c \
        internal.c internal.h main.c syncobj.c semobj.c threadobj.c \
        timerobj.c traceobj.c wrappers.c $(am__append_1) \
        $(am__append_5) $(am__append_6) $(am__append_7)
+nodist_libcopperplate_la_SOURCES = config-dump.h
+BUILT_SOURCES = config-dump.h
+CLEANFILES = config-dump.h
 libcopperplate_la_CPPFLAGS = \
        @XENO_USER_CFLAGS@              \
        -I$(top_srcdir)                 \
@@ -478,7 +484,8 @@ libcopperplate_la_LIBADD = libversion.la $(am__append_2) \
 
 SUBDIRS = . $(am__append_8)
 SPARSE = sparse
-all: all-recursive
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
@@ -909,14 +916,16 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-recursive
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-recursive
 all-am: Makefile $(LTLIBRARIES)
 installdirs: installdirs-recursive
 installdirs-am:
        for dir in "$(DESTDIR)$(libdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-recursive
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
@@ -938,6 +947,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)
@@ -946,6 +956,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-recursive
 
 clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
@@ -1017,7 +1028,8 @@ ps-am:
 
 uninstall-am: uninstall-libLTLIBRARIES
 
-.MAKE: $(am__recursive_targets) install-am install-strip
+.MAKE: $(am__recursive_targets) all check install install-am \
+       install-strip
 
 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
        check-am clean clean-generic clean-libLTLIBRARIES \
@@ -1035,6 +1047,15 @@ uninstall-am: uninstall-libLTLIBRARIES
        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
        tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
 
+
+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) ) > $@
 version.c: git-stamp.h
 
 git-stamp.h: git-stamp
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 685d018..4bef006 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -129,6 +129,13 @@ static const struct option base_options[] = {
                .val = 0
        },
        {
+#define dumpconfig_opt 10
+               .name = "dump-config",
+               .has_arg = 0,
+               .flag = NULL,
+               .val = 0
+       },
+       {
                .name = NULL,
                .has_arg = 0,
                .flag = NULL,
@@ -142,6 +149,19 @@ static inline void print_version(void)
        fprintf(stderr, "%s\n", xenomai_version_string);
 }
 
+static const char *config_strings[] = {
+#include "config-dump.h"
+       NULL,
+};
+
+static inline void dump_configuration(void)
+{
+       int n;
+
+       for (n = 0; config_strings[n]; n++)
+               puts(config_strings[n]);
+}
+
 static void usage(void)
 {
        struct copperskin *skin;
@@ -157,6 +177,7 @@ static void usage(void)
         fprintf(stderr, "--cpu-affinity=<cpu[,cpu]...>    set CPU affinity of 
threads\n");
         fprintf(stderr, "--silent                         tame down 
verbosity\n");
         fprintf(stderr, "--version                        get version 
information\n");
+        fprintf(stderr, "--dump-config                    dump configuration 
settings\n");
        
        pvlist_for_each_entry(skin, &skins, __reserved.next) {
                if (skin->help)
@@ -360,6 +381,9 @@ static int parse_base_options(int *argcp, char *const 
**argvp,
                case version_opt:
                        print_version();
                        exit(0);
+               case dumpconfig_opt:
+                       dump_configuration();
+                       exit(0);
                case help_opt:
                        usage();
                        exit(0);


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

Reply via email to