This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
060ca8296a3439bb956842ab3dc7f0bb6a656539
[metaconfig.git] / dist / U / trnl.U
1 ?RCS: $Id: trnl.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: Copyright (c) 1998 Andy Dougherty
12 ?RCS:
13 ?RCS:   Original author Jarkko Hietaniemi <jhi@iki.fi>
14 ?RCS:   Merged into dist by Andy Dougherty  July 13, 1998
15 ?RCS:
16 ?MAKE:trnl: Nothing
17 ?MAKE:  -pick add $@ %<
18 ?S:trnl:
19 ?S:     This variable contains the value to be passed to the tr(1)
20 ?S:     command to transliterate a newline.  Typical values are
21 ?S:     '\012' and '\n'.  This is needed for EBCDIC systems where
22 ?S:     newline is not necessarily '\012'.
23 ?S:.
24 ?T: DJGPP
25 : Find the appropriate value for a newline for tr
26 echo " "
27 ?X: We can't use $tr since that would cause a circular dependency via Myread
28 ?X: dos djgpp uses '\015\012', but reportedly is happy with '\012' in the
29 ?X: tr command.  I don't know why it passes the '\n' test but later
30 ?X: refuses to work correctly with it.  --AD  6/14/98
31 if test -n "$DJGPP"; then
32        trnl='\012'
33 fi
34 if test X"$trnl" = X; then
35         case "`echo foo | tr '\n' x 2>/dev/null`" in
36         foox) trnl='\n' ;;
37         esac
38 fi
39 if test X"$trnl" = X; then
40         case "`echo foo | tr '\012' x 2>/dev/null`" in
41         foox) trnl='\012' ;;
42         esac
43 fi
44 if test X"$trnl" = X; then
45        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
46        fooxy) trnl='\n\r' ;;
47        esac
48 fi
49 if test X"$trnl" = X; then
50         cat <<EOM >&2
51
52 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
53
54 EOM
55         exit 1
56 else
57         echo "We'll use '$trnl' to transliterate a newline."
58 fi
59