This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / startperl.U
CommitLineData
959f3c4c
JH
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
0df14132 4?RCS:
959f3c4c
JH
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:
0df14132 8?RCS:
959f3c4c
JH
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:
0df14132
MB
18?MAKE:startperl: cat Myread sharpbang initialinstalllocation test \
19 versiononly version
959f3c4c
JH
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
4dd7201d 33?S: that this magic incantation is not understood by csh.
959f3c4c
JH
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
0df14132
MB
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.
959f3c4c
JH
46case "$startperl" in
47'')
48 case "$sharpbang" in
49 *!)
50 $cat <<EOH
51
52I can use the #! construct to start perl on your system. This will
53make startup of perl scripts faster, but may cause problems if you
54want to share those scripts and perl is not in a standard place
0df14132
MB
55($initialinstalllocation/perl) on all your platforms. The alternative
56is to force a shell by starting the script with a single ':' character.
959f3c4c
JH
57
58EOH
b02f6d15 59 case "$versiononly" in
0df14132
MB
60 "$define") dflt="$initialinstalllocation/perl$version";;
61 *) dflt="$initialinstalllocation/perl";;
b02f6d15 62 esac
959f3c4c
JH
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
71WARNING: Some systems limit the #! command to 32 characters.
72If you experience difficulty running Perl scripts with #!, try
73installing Perl in a directory with a shorter pathname.
74
75EOM
76 fi ;;
77 esac
78 ;;
79 *) startperl=": # use perl"
80 ;;
81 esac
82 ;;
83esac
84echo "I'll use $startperl to start perl scripts."
85