* t/objc-flags.sh: New test. Signed-off-by: Peter Breitenlohner <p...@mppmu.mpg.de> --- t/objc-flags.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) create mode 100755 t/objc-flags.sh
diff --git a/t/objc-flags.sh b/t/objc-flags.sh new file mode 100755 index 0000000..e10faf5 --- /dev/null +++ b/t/objc-flags.sh @@ -0,0 +1,73 @@ +#! /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 $(OBJCFLAGS) takes precedence over both $(AM_OBJCFLAGS) and +# $(foo_OBJCFLAGS). + +required=cc +. ./defs || Exit 1 + +cat >fake-objc <<'END' +#!/bin/sh +echo "$*" >>objcflags.list +END +chmod a+x fake-objc + +# Remove ObjC from the environment, so that it won't interfere +# with 'make -e' below. +unset OBJC || : + +cat >> configure.ac <<'END' +AC_SUBST([CC], [false]) +# Simulate presence of ObjC using our fake-objc script. +AC_SUBST([OBJC], ['$(abs_top_srcdir)'/fake-objc]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +AUTOMAKE_OPTIONS = no-dependencies +bin_PROGRAMS = foo bar +foo_SOURCES = main.c foo.m +bar_SOURCES = main.c bar.m +AM_OBJCFLAGS = __am_flags__ +bar_OBJCFLAGS = __bar_flags__ +END + +$ACLOCAL +$AUTOMAKE -a + +grep '\$(OBJCFLAGS).*\$(bar_OBJCFLAGS)' Makefile.in && Exit 1 +grep '\$(OBJCFLAGS).*\$(AM_OBJCFLAGS)' Makefile.in && Exit 1 + +: > foo.m +: > bar.m + +$AUTOCONF +./configure +env OBJCFLAGS=__user_flags__ $MAKE -e foo.o bar-bar.o + +cat objcflags.list + +grep 'foo.o' objcflags.list >foo.o +grep 'bar-bar.o' objcflags.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