This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
indent fix
[metaconfig.git] / U / perl / startperl.U
1 ?RCS: $Id: startperl.U,v 3.0 1993/08/18 12:09:50 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS:
5 ?RCS: This file is included with or a derivative work of a file included
6 ?RCS: with the metaconfig program of Raphael Manfredi's "dist" distribution.
7 ?RCS: In accordance with clause 7 of dist's modified Artistic License:
8 ?RCS:
9 ?RCS:     You may distribute under the terms of either the GNU General Public
10 ?RCS:     License or the Artistic License, as specified in the README file.
11 ?RCS:
12 ?RCS: $Log: startperl.U,v $
13 ?RCS: Perl5 version -- I always have d_portable=define.
14 ?RCS:
15 ?RCS: Revision 3.0  1993/08/18  12:09:50  ram
16 ?RCS: Baseline for dist 3.0 netwide release.
17 ?RCS:
18 ?MAKE:startperl: cat Myread sharpbang initialinstalllocation test \
19         versiononly version
20 ?MAKE:  -pick add $@ %<
21 ?Y:TOP
22 ?X: This is different from dist's standard startperl.U unit because
23 ?X: we can't directly test #!/usr/local/bin/perl (or whatever) because
24 ?X: we haven't built and installed perl yet.
25 ?S:startperl:
26 ?S:     This variable contains the string to put on the front of a perl
27 ?S:     script to make sure (hopefully) that it runs with perl and not some
28 ?S:     shell. Of course, that leading line must be followed by the classical
29 ?S:     perl idiom:
30 ?S:             eval 'exec perl -S $0 ${1+"$@"}'
31 ?S:                     if $running_under_some_shell;
32 ?S:     to guarantee perl startup should the shell execute the script. Note
33 ?S:     that this magic incatation is not understood by csh.
34 ?S:.
35 ?C:STARTPERL:
36 ?C:     This variable contains the string to put in front of a perl
37 ?C:     script to make sure (one hopes) that it runs with perl and not
38 ?C:     some shell.
39 ?C:.
40 ?H:#define STARTPERL "$startperl"               /**/
41 ?H:.
42 : figure out how to guarantee perl startup
43 : XXX Note that this currently takes advantage of the bug that binexp ignores
44 :     the Configure -Dinstallprefix setting, which in turn means that under
45 :     relocatable @INC, initialinstalllocation is what binexp started as.
46 case "$startperl" in
47 '')
48         case "$sharpbang" in
49         *!)
50                 $cat <<EOH
51
52 I can use the #! construct to start perl on your system. This will
53 make startup of perl scripts faster, but may cause problems if you
54 want to share those scripts and perl is not in a standard place
55 ($initialinstalllocation/perl) on all your platforms. The alternative
56 is to force a shell by starting the script with a single ':' character.
57
58 EOH
59                 case "$versiononly" in
60                 "$define")      dflt="$initialinstalllocation/perl$version";;
61                 *)              dflt="$initialinstalllocation/perl";;
62                 esac
63                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
64                 . ./myread
65                 case "$ans" in
66                 none)   startperl=": # use perl";;
67                 *)      startperl="#!$ans"
68                         if $test 30 -lt `echo "$ans" | wc -c`; then
69                                 $cat >&4 <<EOM
70
71 WARNING:  Some systems limit the #! command to 32 characters.
72 If you experience difficulty running Perl scripts with #!, try
73 installing Perl in a directory with a shorter pathname.
74
75 EOM
76                         fi ;;
77                 esac
78                 ;;
79         *) startperl=": # use perl"
80                 ;;
81         esac
82         ;;
83 esac
84 echo "I'll use $startperl to start perl scripts."
85