Commit | Line | Data |
---|---|---|
cf070538 | 1 | ?RCS: $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $ |
959f3c4c | 2 | ?RCS: |
cf070538 | 3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi |
4c42341b | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
959f3c4c JH |
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 | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
cf070538 | 9 | ?RCS: of the source tree for dist 4.0. |
959f3c4c JH |
10 | ?RCS: |
11 | ?RCS: $Log: Head.U,v $ | |
12 | ?RCS: Revision 3.0.1.9 1997/02/28 15:02:09 ram | |
13 | ?RCS: patch61: make sure we unset CDPATH for shells that support this | |
14 | ?RCS: patch61: improved Korn shell detection and handling | |
15 | ?RCS: | |
16 | ?RCS: Revision 3.0.1.8 1995/07/25 13:40:02 ram | |
17 | ?RCS: patch56: added SVR4-ish /opt directories to path list (ADO) | |
18 | ?RCS: patch56: OS/2 platforms are using another path separator | |
19 | ?RCS: | |
20 | ?RCS: Revision 3.0.1.7 1995/03/21 08:46:15 ram | |
21 | ?RCS: patch52: definition of paths wrongly added spurious ':' chars | |
22 | ?RCS: | |
23 | ?RCS: Revision 3.0.1.6 1994/10/29 15:54:19 ram | |
24 | ?RCS: patch36: make sure ENV is unset before calling /bin/ksh | |
25 | ?RCS: | |
26 | ?RCS: Revision 3.0.1.5 1994/08/29 16:03:44 ram | |
27 | ?RCS: patch32: now sets PATH only using existing directories | |
28 | ?RCS: | |
29 | ?RCS: Revision 3.0.1.4 1994/06/20 06:54:28 ram | |
30 | ?RCS: patch30: now computes its invocation name into 'me' | |
31 | ?RCS: patch30: symbol me is made visible to all units read-only | |
32 | ?RCS: | |
33 | ?RCS: Revision 3.0.1.3 1993/12/15 08:15:07 ram | |
34 | ?RCS: patch15: added /sbin:/usr/sbin:/usr/libexec in PATH for BSD/386 | |
35 | ?RCS: | |
36 | ?RCS: Revision 3.0.1.2 1993/11/10 17:32:35 ram | |
37 | ?RCS: patch14: ensure PATH is reset to '.' before testing for alias | |
38 | ?RCS: | |
39 | ?RCS: Revision 3.0.1.1 1993/08/27 14:38:07 ram | |
40 | ?RCS: patch7: not all 'test' programs support the -x option | |
41 | ?RCS: | |
42 | ?RCS: Revision 3.0 1993/08/18 12:04:58 ram | |
43 | ?RCS: Baseline for dist 3.0 netwide release. | |
44 | ?RCS: | |
4c42341b | 45 | ?X: |
959f3c4c JH |
46 | ?X: This is the very first unit in the Configure script. It is mostly just |
47 | ?X: things to keep people from getting into a tizzy right off the bat. | |
4c42341b | 48 | ?X: |
df0bcc5d | 49 | ?MAKE:Head: |
959f3c4c | 50 | ?MAKE: -pick wipe $@ %< |
cf070538 | 51 | ?V:PATH p_ _exe me newsh |
7a4180fe | 52 | ?T:argv p paths OS2_SHELL DJGPP |
959f3c4c | 53 | ?T:inksh needksh avoidksh newsh changesh reason |
cf070538 | 54 | ?F:!* |
1056f0f3 | 55 | ?LINT:extern ENV CDPATH SHELL MACHTYPE _exe is_os2 |
4c42341b | 56 | ?LINT:change ENV CDPATH is_os2 |
cf070538 | 57 | ?LINT:nocomment |
959f3c4c JH |
58 | #! /bin/sh |
59 | # | |
60 | # If these # comments don't work, trim them. Don't worry about any other | |
61 | # shell scripts, Configure will trim # comments from them for you. | |
62 | # | |
63 | # (If you are trying to port this package to a machine without sh, | |
64 | # I would suggest you have a look at the prototypical config_h.SH file | |
65 | # and edit it to reflect your system. Some packages may include samples | |
66 | # of config.h for certain machines, so you might look for one of those.) | |
67 | # | |
68 | ?X: | |
69 | ?X: NOTE THAT A CONFIGURE SCRIPT IS IN THE PUBLIC DOMAIN (whether or not | |
70 | ?X: the software which uses it is in the public domain). | |
71 | ?X: | |
72 | # Yes, you may rip this off to use in other distribution packages. This | |
73 | # script belongs to the public domain and cannot be copyrighted. | |
74 | # | |
75 | ?X: | |
76 | ?X: WE ASK YOU NOT TO REMOVE OR ALTER THE FOLLOWING PARAGRAPH, PLEASE: | |
77 | ?X: | |
d98c1554 MBT |
78 | # Note: this Configure script was generated automatically by the tool |
79 | # called "metaconfig". Rather than working with this copy of Configure, | |
e5b33547 | 80 | # you should use metaconfig. Perl uses a modified version of this |
793bb962 DH |
81 | # tool, and this, together with the metaconfig units, are available |
82 | # in the git repository: | |
74ae66a6 | 83 | # $ git clone https://github.com/Perl/metaconfig metaconfig |
e79b7b27 | 84 | # The original dist package (including metaconfig) is available on github: |
9596f2a9 | 85 | # $ git clone https://github.com/rmanfredi/dist.git dist-git |
959f3c4c | 86 | # |
434d6b7f | 87 | ?X: OK, I'll not alter, but I'll add to it then ... |
a54cd560 | 88 | # Though this script was generated by metaconfig from metaunits, it is |
793bb962 DH |
89 | # OK to send patches against Configure itself (but not to commit them |
90 | # to blead). It's up to | |
91 | # the Configure maintainers to backport the patch to the metaunits if it | |
92 | # is accepted. Exceptions to this rule, and more information, is in | |
93 | # Porting/pumpkin.pod. | |
959f3c4c JH |
94 | ?X: |
95 | ?X: NOTA BENE: | |
96 | ?X: If you develop you own version of metaconfig based on this work, | |
97 | ?X: you have to add some comments telling that the script was generated | |
98 | ?X: by your version, not mine: It credits your work. | |
99 | ?X: | |
100 | ||
d5452d95 | 101 | # Generated using [metaconfig <VERSION> PL<PATCHLEVEL>] |
915b9f6c | 102 | # with additional metaconfig patches from https://github.com/Perl/metaconfig |
959f3c4c | 103 | |
7d2a10a8 | 104 | cat >c1$$ <<EOF |
959f3c4c JH |
105 | ARGGGHHHH!!!!! |
106 | ||
107 | SCO csh still thinks true is false. Write to SCO today and tell them that next | |
108 | year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) | |
109 | ||
110 | (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All | |
111 | we'd have to do is go in and swap the && and || tokens, wherever they are.) | |
112 | ||
113 | [End of diatribe. We now return you to your regularly scheduled programming...] | |
114 | EOF | |
7d2a10a8 | 115 | cat >c2$$ <<EOF |
959f3c4c JH |
116 | |
117 | OOPS! You naughty creature! You didn't run Configure with sh! | |
118 | I will attempt to remedy the situation by running sh for you... | |
119 | EOF | |
120 | ||
7d2a10a8 | 121 | true || cat c1$$ c2$$ |
959f3c4c JH |
122 | true || exec sh $0 $argv:q |
123 | ||
7d2a10a8 | 124 | (exit $?0) || cat c2$$ |
959f3c4c | 125 | (exit $?0) || exec sh $0 $argv:q |
7d2a10a8 | 126 | rm -f c1$$ c2$$ |
959f3c4c | 127 | |
0d7cd3e2 | 128 | if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then |
d18ebcf6 | 129 | cat <<EOF |
c077ffd0 JH |
130 | *** |
131 | *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do | |
132 | *** Configure that well. (Plan 9 is close to UNIX but not close enough.) | |
133 | *** Please read the README.plan9 for further instructions. | |
134 | *** Cannot continue, aborting. | |
135 | *** | |
136 | EOF | |
137 | exit 1 | |
138 | fi | |
139 | ||
1c013c8e MBT |
140 | if test -f /sys/utilities/MultiView ; then |
141 | # AmigaOS, test -c for /dev/null is not useful | |
142 | : | |
143 | elif test ! -c /dev/null ; then | |
d18ebcf6 | 144 | cat <<EOF |
e786dad8 MC |
145 | *** |
146 | *** I'm sorry, but /dev/null appears to be a file rather than a device. | |
147 | *** Please consult your operating sytem's notes for making a device | |
148 | *** in /dev. | |
149 | *** Cannot continue, aborting. | |
150 | *** | |
151 | EOF | |
152 | exit 1 | |
153 | fi | |
154 | ||
959f3c4c JH |
155 | : compute my invocation name |
156 | me=$0 | |
157 | case "$0" in | |
158 | */*) | |
159 | me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` | |
160 | test "$me" || me=$0 | |
161 | ;; | |
162 | esac | |
163 | ||
164 | ?X: | |
165 | ?X: To be able to run under OS/2, we must detect that early enough to use | |
166 | ?X: the proper path separator, stored in $p_. It is : on UNIX and ; on | |
65a32477 | 167 | ?X: DOS-ish systems such as OS/2. |
959f3c4c JH |
168 | ?X: |
169 | : Proper separator for the PATH environment variable | |
170 | p_=: | |
cf070538 | 171 | : On OS/2 this directory should exist if this is not floppy only system ":-]" |
d910675c | 172 | if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then |
cf070538 | 173 | if test -n "$OS2_SHELL"; then |
959f3c4c JH |
174 | p_=\; |
175 | PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` | |
176 | ?X: That's a bug in ksh5.22 | |
177 | OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` | |
1056f0f3 | 178 | is_os2=yes |
959f3c4c | 179 | elif test -n "$DJGPP"; then |
b5f73a83 | 180 | case "X${MACHTYPE:-nonesuchmach}" in |
ed5d019e | 181 | *cygwin|*msys) ;; |
b5f73a83 JH |
182 | *) p_=\; ;; |
183 | esac | |
959f3c4c JH |
184 | fi |
185 | fi | |
186 | ||
187 | ?X: | |
188 | ?X: There are two schools of thoughts here. Some people correctly argue that | |
189 | ?X: the user has a better chance than we do of setting a reasonable PATH and | |
190 | ?X: others argue that Configure is the best place there is to set up a suitable | |
65a32477 | 191 | ?X: PATH. Well, here we try to compromise by keeping the user's PATH and |
959f3c4c JH |
192 | ?X: appending some directories which are known to work on some machine or the |
193 | ?X: other. The rationale behind this being that a novice user might not have a | |
194 | ?X: proper environment variable set, and some directories like /etc (where | |
195 | ?X: chown is located on some BSD systems) may be missing--RAM. | |
196 | ?X: | |
197 | ?X: SVR4 adds an /opt directory for optional packages. Some sites use | |
198 | ?X: various permutations on /opt as opposed to /usr or /usr/local.-- ADO | |
199 | ?X: | |
200 | ?X: We only add directories that are not already in the PATH of the | |
201 | ?X: user and the directories must exist also. | |
202 | ?X: | |
604d9ba3 MB |
203 | ?X: 20040627, Merijn, HP-UX's ANSI compiler is in /opt/ansic/bin if present |
204 | ?X: and should be before /usr/ccs/bin, where the braindead bundled compiler | |
cf070538 | 205 | ?X: can be found. The /usr/ccs/bin compiler cannot be used to build perl. |
604d9ba3 | 206 | ?X: |
959f3c4c JH |
207 | : Proper PATH setting |
208 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' | |
209 | paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" | |
210 | paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" | |
211 | paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" | |
212 | paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" | |
604d9ba3 | 213 | paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin" |
959f3c4c JH |
214 | paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" |
215 | paths="$paths /sbin /usr/sbin /usr/libexec" | |
8c387d2d | 216 | paths="$paths /system/gnu_library/bin" |
959f3c4c JH |
217 | |
218 | for p in $paths | |
219 | do | |
220 | case "$p_$PATH$p_" in | |
221 | *$p_$p$p_*) ;; | |
222 | *) test -d $p && PATH=$PATH$p_$p ;; | |
223 | esac | |
224 | done | |
225 | ||
226 | PATH=.$p_$PATH | |
227 | export PATH | |
228 | ||
229 | : shall we be using ksh? | |
230 | inksh='' | |
231 | needksh='' | |
232 | avoidksh='' | |
233 | newsh=/bin/ksh | |
234 | changesh='' | |
235 | ?X: Use (alias -x) and not (alias) since zsh and bash recognize the alias | |
236 | ?X: builtin but not the -x option which is typically ksh... | |
237 | ?X: We need to set up PATH before calling the "alias" built-in since some | |
238 | ?X: systems like HP-UX have a binary called /bin/alias. | |
239 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
240 | inksh=true | |
241 | fi | |
242 | ?X: On HP-UX, large Configure scripts may exercise a bug in /bin/sh, use ksh | |
243 | if test -f /hp-ux -a -f /bin/ksh; then | |
244 | needksh='to avoid sh bug in "here document" expansion' | |
245 | fi | |
246 | ?X: On AIX4, /bin/sh is really ksh and it causes problems, use sh | |
247 | if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then | |
248 | if test X`/usr/bin/uname -v` = X4; then | |
249 | avoidksh="to avoid AIX 4's /bin/sh" | |
250 | newsh=/usr/bin/bsh | |
251 | fi | |
252 | fi | |
253 | ?X: On Digital UNIX, /bin/sh may start up buggy /bin/ksh, use sh | |
254 | if test -f /osf_boot -a -f /usr/sbin/setld; then | |
255 | if test X`/usr/bin/uname -s` = XOSF1; then | |
cf070538 MB |
256 | avoidksh="to avoid Digital UNIX' ksh" |
257 | newsh=/bin/sh | |
258 | ?X: if BIN_SH is set to 'xpg4', sh will start up ksh | |
259 | unset BIN_SH | |
959f3c4c JH |
260 | fi |
261 | fi | |
262 | ?X: If we are not in ksh and need it, then feed us back to it | |
263 | case "$inksh/$needksh" in | |
264 | /[a-z]*) | |
cf070538 MB |
265 | ?X: Clear ENV to avoid any ~/.kshrc that could alias cd or whatever... |
266 | ?X: Don't use "unset ENV", that is not portable enough | |
959f3c4c JH |
267 | ENV='' |
268 | changesh=true | |
269 | reason="$needksh" | |
270 | ;; | |
271 | esac | |
272 | ?X: If we are in ksh and must avoid it, then feed us back to a new shell | |
273 | case "$inksh/$avoidksh" in | |
274 | true/[a-z]*) | |
275 | changesh=true | |
276 | reason="$avoidksh" | |
277 | ;; | |
278 | esac | |
279 | ?X: Warn them if they use ksh on other systems, which are those where | |
70e7365a | 280 | ?X: we don't need ksh nor want to avoid it explicitly, yet are using it. |
959f3c4c JH |
281 | case "$inksh/$needksh-$avoidksh-" in |
282 | true/--) | |
283 | cat <<EOM | |
284 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
285 | mainly on older exotic systems. If yours does, try the Bourne shell instead.) | |
286 | EOM | |
287 | ;; | |
288 | esac | |
289 | case "$changesh" in | |
290 | true) | |
26074dbd | 291 | export newsh |
959f3c4c JH |
292 | echo "(Feeding myself to $newsh $reason.)" |
293 | ?X: Make sure they didn't say sh <Configure by checking whether $0 ends | |
294 | ?X: with Configure or not. If they did say sh <../../Configure, then too | |
295 | ?X: bad for them anyway, since we lost that path indication... | |
296 | ?X: Otherwise, execing $0 ensures we keep the full remote source dir | |
297 | ?X: indication for src.U. | |
298 | case "$0" in | |
299 | Configure|*/Configure) exec $newsh $0 "$@";; | |
300 | *) exec $newsh Configure "$@";; | |
301 | esac | |
302 | ;; | |
303 | esac | |
8230624a MHM |
304 | ?X: 2004.06.09 rac |
305 | ?X: having $newsh persist as ksh here is bad news if ksh doesn't really | |
306 | ?X: exist. this causes us to toss away a perfectly good working test in | |
65a32477 | 307 | ?X: bash in favor of more exotic external options. see bug 42665. |
8230624a | 308 | test -x "${newsh}" || unset newsh |
959f3c4c JH |
309 | |
310 | ?X: Unset CDPATH to avoid surprises when using cd under some shells | |
311 | ?X: Can't unset it because that's not portable to very old shells. | |
312 | ?X: Can't set it to '' because then bash 2.02 won't do "cd UU" --AD 6/98. | |
313 | ?X: Don't want to set it to '.' because then ksh prints out the | |
314 | ?X: name of the directory every time you cd to it. --AD 6/98 | |
315 | ?X: In order to inflict the least harm, change it only if it's set. | |
cf070538 | 316 | : if needed, set CDPATH to a harmless value that is not chatty |
959f3c4c JH |
317 | : avoid bash 2.02 problems with empty CDPATH. |
318 | case "$CDPATH" in | |
319 | '') ;; | |
320 | *) case "$SHELL" in | |
cf070538 MB |
321 | *bash*) CDPATH='.' ;; |
322 | *) CDPATH='' ;; | |
959f3c4c JH |
323 | esac |
324 | ;; | |
325 | esac | |
cf070538 | 326 | |
959f3c4c JH |
327 | : Configure runs within the UU subdirectory |
328 | test -d UU || mkdir UU | |
329 | ?X: Use ./* to avoid any confirmation prompts from enhanced shells -- WED | |
330 | cd UU && rm -f ./* | |
331 |