This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Part 4 of a big cleanup action based on the upcoming dist-4.0
[metaconfig.git] / U / installdirs / scriptdir.U
1 ?RCS: $Id: scriptdir.U,v 3.1 1999/07/09 18:20:13 doughera Exp doughera $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, 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 3.0.
10 ?RCS:
11 ?RCS: $Log: scriptdir.U,v $
12 ?RCS: Revision 3.1  1999/07/09 18:20:13  doughera
13 ?RCS: Updated for installprefix
14 ?RCS:
15 ?RCS: Revision 3.0.1.3  1995/09/25  09:17:15  ram
16 ?RCS: patch59: unit is now forced to the top of Configure, if possible
17 ?RCS:
18 ?RCS: Revision 3.0.1.2  1995/01/30  14:46:13  ram
19 ?RCS: patch49: can now handle installation prefix changes (from WED)
20 ?RCS:
21 ?RCS: Revision 3.0.1.1  1994/08/29  16:32:04  ram
22 ?RCS: patch32: now uses installation prefix
23 ?RCS:
24 ?RCS: Revision 3.0  1993/08/18  12:09:45  ram
25 ?RCS: Baseline for dist 3.0 netwide release.
26 ?RCS:
27 ?MAKE:scriptdir scriptdirexp installscript: cat test Getfile Loc \
28         Oldconfig +bin Prefixit Setprefixvar prefixexp Prefixup
29 ?MAKE:  -pick add $@ %<
30 ?Y:TOP
31 ?D:scriptdir=''
32 ?S:scriptdir:
33 ?S:     This variable holds the name of the directory in which the user wants
34 ?S:     to put publicly scripts for the package in question.  It is either
35 ?S:     the same directory as for binaries, or a special one that can be
36 ?S:     mounted across different architectures, like /usr/share. Programs
37 ?S:     must be prepared to deal with ~name expansion.
38 ?S:.
39 ?D:scriptdirexp=''
40 ?S:scriptdirexp:
41 ?S:     This variable is the same as scriptdir, but is filename expanded
42 ?S:     at configuration time, for programs not wanting to bother with it.
43 ?S:.
44 ?S:installscript:
45 ?S:     This variable is usually the same as scriptdirexp, unless you are on
46 ?S:     a system running AFS, in which case they may differ slightly. You
47 ?S:     should always use this variable within your makefiles for portability.
48 ?S:.
49 ?C:SCRIPTDIR:
50 ?C:     This symbol holds the name of the directory in which the user wants
51 ?C:     to put publicly executable scripts for the package in question.  It
52 ?C:     is often a directory that is mounted across diverse architectures.
53 ?C:     Programs must be prepared to deal with ~name expansion.
54 ?C:.
55 ?C:SCRIPTDIR_EXP:
56 ?C:     This is the same as SCRIPTDIR, but is filename expanded at
57 ?C:     configuration time, for use in programs not prepared to do
58 ?C:     ~name substitutions at run-time.
59 ?C:.
60 ?H:#define SCRIPTDIR "$scriptdir"       /**/
61 ?H:#define SCRIPTDIR_EXP "$scriptdirexp"        /**/
62 ?H:.
63 ?T:installscriptdir
64 ?LINT:change prefixvar
65 ?LINT:set scriptdir
66 ?LINT:set scriptdirexp
67 : determine where public executable scripts go
68 set scriptdir scriptdir
69 eval $prefixit
70 case "$scriptdir" in
71 '')
72         dflt="$bin"
73         : guess some guesses
74         $test -d /usr/share/scripts && dflt=/usr/share/scripts
75         $test -d /usr/share/bin     && dflt=/usr/share/bin
76         $test -d /usr/local/script  && dflt=/usr/local/script
77         $test -d /usr/local/scripts && dflt=/usr/local/scripts
78         $test -d $prefixexp/script  && dflt=$prefixexp/script
79         set dflt
80         eval $prefixup
81         ;;
82 *)  dflt="$scriptdir"
83         ;;
84 esac
85 $cat <<EOM
86
87 Some installations have a separate directory just for executable scripts so
88 that they can mount it across multiple architectures but keep the scripts in
89 one spot.  You might, for example, have a subdirectory of /usr/share for this.
90 Or you might just lump your scripts in with all your other executables.
91
92 EOM
93 fn=d~
94 rp='Where do you keep publicly executable scripts?'
95 . ./getfile
96 if $test "X$ansexp" != "X$scriptdirexp"; then
97         installscript=''
98 fi
99 installscriptdir=''
100 prefixvar=scriptdir
101 . ./setprefixvar
102 : A little fix up for an irregularly named variable.
103 installscript="$installscriptdir"
104