Hash :
201ee990
Author :
Date :
2011-01-09T12:06:24
Add test coverage for deleted header files. * tests/depcomp6.test, tests/depcomp7.test: Update tests to also check for the deleted header bug. If no dependency tracking mechanism could be found, SKIP rather than exit successfully. Use GNU style spacing and ANSI C prototypes. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
#! /bin/sh
# Copyright (C) 2006, 2007, 2010, 2011 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 dependency generation (libtool case).
required='libtoolize'
. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_LIBTOOL
AC_CONFIG_FILES([sub2/Makefile])
AC_OUTPUT
END
mkdir sub sub2 sub2/sub3
cat >Makefile.am <<'END'
SUBDIRS = sub2
bin_PROGRAMS = foo
foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
foo_LDADD = sub2/libbaz.la
END
cat >sub2/Makefile.am <<'END'
AUTOMAKE_OPTIONS = subdir-objects
noinst_LTLIBRARIES = libbaz.la
libbaz_la_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
END
cat >foo.c <<'END'
#include "foo.h"
#include "sub2/baz.h"
#include <stdlib.h>
int main (void) { printf ("foo"); return bar () + baz (); }
END
cat >foo.h <<'END'
#include <stdio.h>
#include "sub/bar.h"
END
cat >sub/bar.c <<'END'
#include "sub/bar.h"
int bar (void) { return 0; }
END
echo 'extern int x;' > sub2/sub3/ba3.h
cat >sub/bar.h <<'END'
#include <stdio.h>
extern int bar (void);
END
cat >sub2/baz.c <<'END'
#include "baz.h"
int baz (void) { return 0; }
END
cat >sub2/baz.h <<'END'
extern int baz (void);
END
cat >sub2/sub3/ba3.in <<'END'
#include "ba3.h"
int ba3 (void) { return 0; }
END
libtoolize
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
st=0
for staticshared in --disable-shared "" --disable-static; do
cp sub2/sub3/ba3.in sub2/sub3/ba3.c
./configure --enable-dependency-tracking $staticshared
$MAKE
# If we cannot enable dependency tracking, perform only the most basic
# checks, and don't consider this test to be PASSed but SKIPped, because
# the main purpose of this test is exposing the depmode features.
if grep 'depmode=none' Makefile; then
st=77
else
cd sub2
$sleep
echo 'choke me' > sub3/ba3.h
# Do not use `$MAKE && Exit 1' here, since even relatively-recent
# versions of the BSD shell wrongly exit when the `errexit' shell
# flag is active if a command within "&&" fails inside a compound
# statement.
if $MAKE; then Exit 1; else :; fi
# Ensure the deleted header bug is fixed.
rm -f sub3/ba3.h
sed 1d sub3/ba3.in >sub3/ba3.c
$MAKE
cd ..
fi
$MAKE distclean
test ! -f sub2/sub3/ba3.u
test ! -f sub2/sub3/ba3.d
echo 'extern int x;' > sub2/sub3/ba3.h
done
Exit $st