automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/6] objc++: test global, per-target, and user flags


From: Peter Breitenlohner
Subject: [PATCH 1/6] objc++: test global, per-target, and user flags
Date: Mon, 30 Apr 2012 11:12:11 +0200

* t/objcxx-flags.sh: New test.

Signed-off-by: Peter Breitenlohner <address@hidden>
---
 t/objcxx-flags.sh |   82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)
 create mode 100755 t/objcxx-flags.sh

diff --git a/t/objcxx-flags.sh b/t/objcxx-flags.sh
new file mode 100755
index 0000000..0925b41
--- /dev/null
+++ b/t/objcxx-flags.sh
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that $(OBJCXXFLAGS) takes precedence over both $(AM_OBJCXXFLAGS) and
+# $(foo_OBJCXXFLAGS).
+
+required=cc
+. ./defs || Exit 1
+
+cat >fake-objcxx <<'END'
+#!/bin/sh
+echo "$*" >>objcxxflags.list
+END
+chmod a+x fake-objcxx
+
+# Remove ObjC++ from the environment, so that it won't interfere
+# with 'make -e' below.
+unset OBJCXX || :
+
+cat >> configure.ac <<'END'
+# Objective C++ requires Autoconf 2.65 (2009-11-21)
+AC_PREREQ([2.65])
+AC_SUBST([CC], [false])
+# Simulate presence of ObjC++ using our fake-objcxx script.
+AC_SUBST([OBJCXX], ['$(abs_top_srcdir)'/fake-objcxx])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
+bin_PROGRAMS = foo bar
+foo_SOURCES = main.c foo.mm
+bar_SOURCES = main.c bar.mm
+AM_OBJCXXFLAGS = __am_flags__
+bar_OBJCXXFLAGS = __bar_flags__
+END
+
+$ACLOCAL || {
+  if test $? -eq 63; then
+    exit 77
+  else
+    exit $?
+  fi
+}
+
+$AUTOMAKE -a
+
+grep '\$(OBJCXXFLAGS).*\$(bar_OBJCXXFLAGS)' Makefile.in && Exit 1
+grep '\$(OBJCXXFLAGS).*\$(AM_OBJCXXFLAGS)' Makefile.in && Exit 1
+
+: > foo.mm
+: > bar.mm
+
+$AUTOCONF
+./configure
+env OBJCXXFLAGS=__user_flags__ $MAKE -e foo.o bar-bar.o
+
+cat objcxxflags.list
+
+grep 'foo.o' objcxxflags.list >foo.o
+grep 'bar-bar.o' objcxxflags.list >bar-bar.o
+
+cat foo.o
+cat bar-bar.o
+
+grep '__am_flags__.*__user_flags__' foo.o
+grep '__bar_flags__.*__user_flags__' bar-bar.o
+
+:
-- 
1.7.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]