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