[PATCH] how to set CFLAGS variable for compiling Xorg

Peter Breitenlohner peb at mppmu.mpg.de
Sat Nov 8 06:27:36 PST 2008


On Thu, 6 Nov 2008, Peter Breitenlohner wrote:

> Anyway, attached is a new version which does just the opposite: appending
> xorgversion.m4 to xorg-macros.m4.in instead of installing it as a separate
> file.

Attached are two patches, the one from yesterday and my proposal for
CWARNFLAGS (created without embedded newlines and tabs -- they produce ugly
make output).

I'm now convinced that --enable-extra-warnings is superfluous because
(a) adding XORG_CWARNFLAGS to configure.ac does not yet enable any warnings,
they also have to be activated in Makefile.am, and
(b) we want all these warnings to locate non-ANSI constructs.

==============

A different point: is there anything else that should be integrated
into xorg-macros.m4 before bumping to 1.2.0?

Regards
Peter Breitenlohner <peb at mppmu.mpg.de>
-------------- next part --------------
From 6275fc6861cdd1403f980776a060c03326e9c700 Mon Sep 17 00:00:00 2001
From: Peter Breitenlohner <peb at mppmu.mpg.de>
Date: Thu, 6 Nov 2008 09:22:59 +0100
Subject: [PATCH] define the XORG_CHANGELOG_CMD macro

xorgversion.m4 is appended to xorg-macros.m4.in, not installed
avoid copying code from xorgversion.m4 to configure.ac.
---
 Makefile.am    |    9 +++++++--
 configure.ac   |   22 ++++++++--------------
 xorgversion.m4 |   15 +++++++++++++++
 3 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index fd5c1ea..39ea9b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,14 +20,19 @@
 #  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 aclocaldir = $(datadir)/aclocal
-aclocal_DATA = xorgversion.m4 xorg-macros.m4
+aclocal_DATA = xorg-macros.m4
 
 EXTRA_DIST = $(aclocal_DATA) ChangeLog
 
 .PHONY: ChangeLog
 
 ChangeLog:
-	(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+	@CHANGELOG_CMD@
+
+# There used to be xorgversion.m4, now integrated into xorg-macros.m4,
+# explicitly remove it to avoid a macro defined in two different files.
+install-data-hook:
+	rm -f $(DESTDIR)$(aclocaldir)/xorgversion.m4
 
 dist-hook: ChangeLog
 
diff --git a/configure.ac b/configure.ac
index 676a70d..3e309f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,18 +27,12 @@ AC_INIT([util-macros],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
-# Since this is the package that installs the xorgversion.m4 file, we
-# cannot use it here.  Therefore, we copy the code from the m4 file.
-# Please try to keep them in sync.
-AC_ARG_WITH(release-version,
-		AC_HELP_STRING([--with-release-version=STRING]
-			[Use release version string in package name]),
-		[RELEASE_VERSION="$withval"],
-		[RELEASE_VERSION=""])
-if test "x$RELEASE_VERSION" != "x"; then
-	PACKAGE="$PACKAGE-$RELEASE_VERSION"
-	PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION"
-	AC_MSG_NOTICE([Building with package name set to $PACKAGE])
-fi
+# This is the package that installs xorgversion.m4,
+# in order to use it here, we include it explicitly.
 
-AC_OUTPUT([Makefile xorg-macros.m4])
+m4_include([xorgversion.m4])
+
+XORG_RELEASE_VERSION
+XORG_CHANGELOG_CMD
+
+AC_OUTPUT([Makefile xorg-macros.m4:xorg-macros.m4.in:xorgversion.m4])
diff --git a/xorgversion.m4 b/xorgversion.m4
index 7d3dda8..627a45e 100644
--- a/xorgversion.m4
+++ b/xorgversion.m4
@@ -59,3 +59,18 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
 		[$PVP],
 		[Patch version of this package])
 ])
+
+# XORG_CHANGELOG_CMD()
+# --------------------
+# Minimum version: 1.2.0
+#
+# Defines the variable CHANGELOG_CMD as the command to generate
+# ChangeLog from git.
+#
+AC_DEFUN([XORG_CHANGELOG_CMD], [
+xorg_c1='GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog'
+xorg_c2='rm -f .changelog.tmp'
+xorg_c3="touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.'"
+CHANGELOG_CMD="($xorg_c1) || ($xorg_c2; $xorg_c3 >&2)"
+AC_SUBST([CHANGELOG_CMD])
+]) # XORG_CHANGELOG_CMD
-- 
1.6.0.3

-------------- next part --------------
From d9fbf13adcb30843e88712bccc18a7975b63f4ca Mon Sep 17 00:00:00 2001
From: Peter Breitenlohner <peb at mppmu.mpg.de>
Date: Fri, 7 Nov 2008 22:43:57 +0100
Subject: [PATCH] define XORG_CWARNFLAGS macro

---
 xorg-macros.m4.in |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 0eda9a8..86aeedf 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1,3 +1,4 @@
+dnl @configure_input@
 dnl
 dnl Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
 dnl 
@@ -423,3 +424,24 @@ AC_SUBST(LINTLIB)
 AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
 
 ]) # XORG_LINT_LIBRARY
+
+# XORG_CWARNFLAGS
+# ---------------
+# Minimum version: 1.2.0
+#
+# Defines CWARNFLAGS to enable C compiler warnings.
+#
+AC_DEFUN([XORG_CWARNFLAGS], [
+if  test "x$GCC" = xyes ; then
+    CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes"
+    CWARNFLAGS="$CWARNFLAGS -Wmissing-declarations -Wnested-externs -fno-strict-aliasing"
+    CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wbad-function-cast -Wdeclaration-after-statement"
+else
+    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+    if test "x$SUNCC" = "xyes"; then
+	CWARNFLAGS="-v"
+    fi
+fi
+AC_SUBST(CWARNFLAGS)
+]) # XORG_CWARNFLAGS
+
-- 
1.6.0.3



More information about the xorg mailing list