Re: [systemd-devel] [patch] build: do not touch CFLAGS

2012-01-07 Thread Jan Engelhardt
On Saturday 2012-01-07 05:39, Kay Sievers wrote:

On Sat, Jan 7, 2012 at 04:34, Jan Engelhardt jeng...@medozas.de wrote:

 On Saturday 2012-01-07 02:22, Kay Sievers wrote:

  Furthermore,
 it overrides per_target_CFLAGS, which is also undesired.

Guess, we need a cleaner solution, this patch looks even more like a hack.

 From the rather sparse comment I suppose you wanted something like this
 instead.

 +++ b/m4/attributes.m4
 @@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
   )

   AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
 -    [CFLAGS=$CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS $1; $2], [$3])
 +    [ac_extra_CFLAGS=$ac_extra_CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS 
 $1; $2], [$3])

Yeah, something like that. Not mangling CFLAGS= with the build-sys
macros sounds much better.

So take this one in :)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [patch] build: do not touch CFLAGS

2012-01-06 Thread Jan Engelhardt
parent ba1d5596354e3299d5b9b995bb0fa9b3bdd285cc (v37-278-gba1d559)
commit 7aee03e8cd7cf1ab9de14dc293c6f994970ce9fa
Author: Jan Engelhardt jeng...@medozas.de
Date:   Fri Jan 6 12:02:55 2012 +0100

build: do not touch CFLAGS

Per the automake manual section 3.6 Variables reserved for the user,
CFLAGS should _not_ be touched. Right now, one cannot successfully
complete `make CFLAGS=-fvisibility=default`, because systemd flags are
always appended and thus override the user's wish. Furthermore,
it overrides per_target_CFLAGS, which is also undesired.
---
 configure.ac |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index ef9bfc1..43a8ab6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,8 @@ if test -z $GPERF ; then
 AC_MSG_ERROR([*** gperf not found])
 fi
 
+saved_CFLAGS=$CFLAGS
+CFLAGS=
 CC_CHECK_CFLAGS_APPEND([ \
 -pipe \
 -Wall \
@@ -110,6 +112,9 @@ CC_CHECK_CFLAGS_APPEND([ \
 -fdata-sections \
 -Wl,--as-needed \
 -Wl,--gc-sections])
+AM_CFLAGS=$CFLAGS
+CFLAGS=$saved_CFLAGS
+AC_SUBST([AM_CFLAGS])
 
 LT_PREREQ(2.2)
 LT_INIT
-- 
# Created with git-export-patch

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [patch] build: do not touch CFLAGS

2012-01-06 Thread Kay Sievers
On Sat, Jan 7, 2012 at 02:18, Jan Engelhardt jeng...@medozas.de wrote:

 Per the automake manual section 3.6 Variables reserved for the user,
 CFLAGS should _not_ be touched.

That's right.

 Right now, one cannot successfully
 complete `make CFLAGS=-fvisibility=default`, because systemd flags are
 always appended and thus override the user's wish.

That's intentional. We depend on it, and overwriting it breaks stuff.

  Furthermore,
 it overrides per_target_CFLAGS, which is also undesired.

Guess, we need a cleaner solution, this patch looks even more like a hack.

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [patch] build: do not touch CFLAGS

2012-01-06 Thread Jan Engelhardt

On Saturday 2012-01-07 02:22, Kay Sievers wrote:

  Furthermore,
 it overrides per_target_CFLAGS, which is also undesired.

Guess, we need a cleaner solution, this patch looks even more like a hack.

From the rather sparse comment I suppose you wanted something like this
instead.


diff --git a/Makefile.am b/Makefile.am
index f5cef3f..7372a12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -157,6 +157,8 @@ endif
 endif
 endif
 
+AM_CFLAGS = ${ac_extra_CFLAGS}
+
 rootbin_PROGRAMS = \
systemd \
systemctl \
diff --git a/configure.ac b/configure.ac
index a223b80..03bfb86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,7 @@ CC_CHECK_CFLAGS_APPEND([ \
 -fdata-sections \
 -Wl,--as-needed \
 -Wl,--gc-sections])
+AC_SUBST([ac_extra_CFLAGS])
 
 LT_PREREQ(2.2)
 LT_INIT
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 9d561c2..bb260d2 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
   )
 
   AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
-[CFLAGS=$CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS $1; $2], [$3])
+[ac_extra_CFLAGS=$ac_extra_CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS $1; 
$2], [$3])
 ])
 
 dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [patch] build: do not touch CFLAGS

2012-01-06 Thread Kay Sievers
On Sat, Jan 7, 2012 at 04:34, Jan Engelhardt jeng...@medozas.de wrote:

 On Saturday 2012-01-07 02:22, Kay Sievers wrote:

  Furthermore,
 it overrides per_target_CFLAGS, which is also undesired.

Guess, we need a cleaner solution, this patch looks even more like a hack.

 From the rather sparse comment I suppose you wanted something like this
 instead.

 +++ b/m4/attributes.m4
 @@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
   )

   AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
 -    [CFLAGS=$CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS $1; $2], [$3])
 +    [ac_extra_CFLAGS=$ac_extra_CFLAGS $1; DEBUG_CFLAGS=$DEBUG_CFLAGS $1; 
 $2], [$3])

Yeah, something like that. Not mangling CFLAGS= with the build-sys
macros sounds much better.

Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel