[systemd-commits] 2 commits - autogen.sh configure.ac man/systemd-nspawn.xml src/nspawn

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Sat Jan 12 13:47:22 PST 2013


 autogen.sh             |    4 ++--
 configure.ac           |    6 ++++--
 man/systemd-nspawn.xml |    7 +++++++
 src/nspawn/nspawn.c    |   11 ++++++++++-
 4 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit acbeb42770e1e99955ebc4464a0439cf741b3aeb
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Jan 11 16:03:49 2013 -0500

    nspawn: add --version

diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml
index fef5c2c..db2d417 100644
--- a/man/systemd-nspawn.xml
+++ b/man/systemd-nspawn.xml
@@ -139,6 +139,13 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><option>--version</option></term>
+
+                                <listitem><para>Prints a version string
+                                and exits.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><option>--directory=</option></term>
                                 <term><option>-D</option></term>
 
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 1f3bda5..98b583d 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -56,6 +56,7 @@
 #include "sd-id128.h"
 #include "dev-setup.h"
 #include "fdset.h"
+#include "build.h"
 
 typedef enum LinkJournal {
         LINK_NO,
@@ -102,6 +103,7 @@ static int help(void) {
         printf("%s [OPTIONS...] [PATH] [ARGUMENTS...]\n\n"
                "Spawn a minimal namespace container for debugging, testing and building.\n\n"
                "  -h --help               Show this help\n"
+               "  --version               Print version string\n"
                "  -D --directory=NAME     Root directory for the container\n"
                "  -b --boot               Boot up full system (i.e. invoke init)\n"
                "  -u --user=USER          Run the command under specified user or uid\n"
@@ -120,7 +122,8 @@ static int help(void) {
 static int parse_argv(int argc, char *argv[]) {
 
         enum {
-                ARG_PRIVATE_NETWORK = 0x100,
+                ARG_VERSION = 0x100,
+                ARG_PRIVATE_NETWORK,
                 ARG_UUID,
                 ARG_READ_ONLY,
                 ARG_CAPABILITY,
@@ -129,6 +132,7 @@ static int parse_argv(int argc, char *argv[]) {
 
         static const struct option options[] = {
                 { "help",            no_argument,       NULL, 'h'                 },
+                { "version",         no_argument,       NULL, ARG_VERSION         },
                 { "directory",       required_argument, NULL, 'D'                 },
                 { "user",            required_argument, NULL, 'u'                 },
                 { "controllers",     required_argument, NULL, 'C'                 },
@@ -154,6 +158,11 @@ static int parse_argv(int argc, char *argv[]) {
                         help();
                         return 0;
 
+                case ARG_VERSION:
+                        puts(PACKAGE_STRING);
+                        puts(SYSTEMD_FEATURES);
+                        return 0;
+
                 case 'D':
                         free(arg_directory);
                         arg_directory = canonicalize_file_name(optarg);

commit 6a17986542912ed80d9fdc1b6eaa6d48fdd5d02d
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Jan 11 10:03:04 2013 -0500

    build-sys: use _FORTIFY_SOURCE only if optimizing
    
    Rather then force the user to undefine _FORTIFY_SOURCE,
    don't define it in the first place if it cannot be used.
    
    I'm assuming that -O* can only be sensibly specified in $CFLAGS.

diff --git a/autogen.sh b/autogen.sh
index 33d8fcd..86fe9b3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -54,7 +54,7 @@ args="$args \
 fi
 
 if [ "x$1" = "xc" ]; then
-        ./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args
+        ./configure CFLAGS='-g -O0' $args
         make clean
 else
         echo
@@ -62,6 +62,6 @@ else
         echo "Initialized build system. For a common configuration please run:"
         echo "----------------------------------------------------------------"
         echo
-        echo "./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args"
+        echo "./configure CFLAGS='-g -O0' $args"
         echo
 fi
diff --git a/configure.ac b/configure.ac
index 7a3cd87..3566dac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,8 +167,10 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         --param=ssp-buffer-size=4])
 AC_SUBST([OUR_CFLAGS], $with_cflags)
 
-CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-        -Wp,-D_FORTIFY_SOURCE=2])
+AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
+        CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
+               -Wp,-D_FORTIFY_SOURCE=2])], [
+        AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
 
 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\



More information about the systemd-commits mailing list