This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / contains.U
1 ?RCS: $Id: contains.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: $Log: contains.U,v $
12 ?RCS: Revision 3.0  1993/08/18  12:05:35  ram
13 ?RCS: Baseline for dist 3.0 netwide release.
14 ?RCS:
15 ?MAKE:contains: Nothing
16 ?MAKE:  -pick add $@ %<
17 ?S:contains:
18 ?S:     This variable holds the command to do a grep with a proper return
19 ?S:     status.  On most sane systems it is simply "grep".  On insane systems
20 ?S:     it is a grep followed by a cat followed by a test.  This variable
21 ?S:     is primarily for the use of other Configure units.
22 ?S:.
23 : Some greps do not return status, grrr.
24 echo "grimblepritz" >grimble
25 if grep blurfldyick grimble >/dev/null 2>&1 ; then
26         contains=contains
27 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
28         contains=grep
29 else
30         contains=contains
31 fi
32 rm -f grimble
33 : the following should work in any shell
34 case "$contains" in
35 contains*)
36         echo " "
37         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
38         cat >contains <<'EOSS'
39 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
40 EOSS
41 chmod +x contains
42 esac
43