diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-04-22 14:53:14 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-04-22 14:53:14 +0200 |
commit | 3de27839c88bda6c755f00c7142620080b725be0 (patch) | |
tree | 9198cb2690aa76ed98aa9b7ca4abfae6b577577a /t/make-is-gnu.sh | |
parent | 40f949c71a05c411989746e74e661323b62ce083 (diff) | |
download | automake-3de27839c88bda6c755f00c7142620080b725be0.tar.gz |
header vars: can determine whether we are running under GNU make
This is mostly a preparatory patch in view of future changes.
* lib/am/header-vars.am (am__is_gnu_make): New, contains shell code that
determines whether we are running under GNU make.
* t/make-is-gnu.sh: New test.
* t/list-of-tests.mk: Add it.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/make-is-gnu.sh')
-rwxr-xr-x | t/make-is-gnu.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/t/make-is-gnu.sh b/t/make-is-gnu.sh new file mode 100755 index 000000000..c37cc17af --- /dev/null +++ b/t/make-is-gnu.sh @@ -0,0 +1,66 @@ +#! /bin/sh +# Copyright (C) 2013 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 $(am__is_gnu_make) can be used to correctly determine if +# we are running under GNU make. + +. test-init.sh + +if using_gmake; then + as_expected () { test $1 -eq 0 && test -f ok && test ! -e ko; } +else + as_expected () { test $1 -gt 0 && test -f ko && test ! -e ok; } +fi + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +all: file + $(am__is_gnu_make) +file: + if $(am__is_gnu_make); then : > ok; else : > ko; fi +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE +./configure + +st=0; $MAKE || st=$? +if using_gmake; then + test $st -eq 0 + test -f ok + test ! -e ko +else + test $st -gt 0 + test -f ko + test ! -e ok +fi + +rm -f ok ko + +$MAKE -s file >output 2>&1 +cat output +if using_gmake; then + test -f ok + test ! -e ko +else + test -f ko + test ! -e ok +fi +test ! -s output + +: |