This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig unit changes for #10592.
[metaconfig.git] / U / compline / orderlib.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: orderlib.U,v 3.0.1.4 1997/02/28 16:18:18 ram Exp $
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: orderlib.U,v $
12?RCS: Revision 3.0.1.4 1997/02/28 16:18:18 ram
13?RCS: patch61: replaced .a with $_a all over the place
14?RCS: patch61: likewise for .o replaced by $_o
15?RCS: patch61: now uses the ar located by Loc.U
16?RCS:
17?RCS: Revision 3.0.1.3 1995/01/11 15:33:04 ram
18?RCS: patch45: allows hint files to specify their own value for 'ranlib'
19?RCS:
20?RCS: Revision 3.0.1.2 1994/10/29 16:26:48 ram
21?RCS: patch36: now performs a real small compile for accurate checks (ADO)
22?RCS:
23?RCS: Revision 3.0.1.1 1994/08/29 16:31:17 ram
24?RCS: patch32: use cc variable instead of hardwired 'cc' in 1st compile
25?RCS:
26?RCS: Revision 3.0 1993/08/18 12:09:26 ram
27?RCS: Baseline for dist 3.0 netwide release.
28?RCS:
0f00356b 29?MAKE:orderlib ranlib: Loc ar cat test rm +cc +ccflags +ldflags +libs _a _o run
959f3c4c
JH
30?MAKE: -pick add $@ %<
31?S:orderlib:
32?S: This variable is "true" if the components of libraries must be ordered
33?S: (with `lorder $* | tsort`) before placing them in an archive. Set to
34?S: "false" if ranlib or ar can generate random libraries.
35?S:.
36?S:ranlib:
37?S: This variable is set to the pathname of the ranlib program, if it is
38?S: needed to generate random libraries. Set to ":" if ar can generate
39?S: random libraries or if random libraries are not supported
40?S:.
41: see if ar generates random libraries by itself
42echo " "
43echo "Checking how to generate random libraries on your machine..." >&4
44?X: Some systems (like MIPS) complain when running ar... Others like Ultrix
45?X: need an explicit 'ar ts' to add the table of contents.
46?X: Still others like Linux run ar ts successfully, but still need ranlib.
47?X: This set of tests seems the minimum necessary to check out Linux.
48?X: We need to explicitly put the entries in out-of-order so that Sun's ld
49?X: will fail. (Otherwise it complains, but gives an exit status of 0.)
50echo 'int bar1() { return bar2(); }' > bar1.c
51echo 'int bar2() { return 2; }' > bar2.c
52$cat > foo.c <<'EOP'
53int main() { printf("%d\n", bar1()); exit(0); }
54EOP
55$cc $ccflags -c bar1.c >/dev/null 2>&1
56$cc $ccflags -c bar2.c >/dev/null 2>&1
57$cc $ccflags -c foo.c >/dev/null 2>&1
58$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
ff19f974 59if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
0f00356b 60 $run ./foobar >/dev/null 2>&1; then
959f3c4c
JH
61 echo "$ar appears to generate random libraries itself."
62 orderlib=false
63 ranlib=":"
64elif $ar ts bar$_a >/dev/null 2>&1 &&
ff19f974 65 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
0f00356b 66 $run ./foobar >/dev/null 2>&1; then
959f3c4c
JH
67 echo "a table of contents needs to be added with '$ar ts'."
68 orderlib=false
69 ranlib="$ar ts"
70else
71?X: Allow hints to specify their own ranlib "script". For instance, on
72?X: some NeXT machines, the timestamp put by ranlib is not correct, and this
73?X: may raise tedious recompiles for nothing. Therefore, NeXT may add the
74?X: ranlib='sleep 5; /bin/ranlib' line in their hints to "fix" that.
75?X: (reported by Andreas Koenig <k@franz.ww.tu-berlin.de>)
76 case "$ranlib" in
77 :) ranlib='';;
78 '')
79 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
80 $test -f $ranlib || ranlib=''
81 ;;
82 esac
83 if $test -n "$ranlib"; then
84 echo "your system has '$ranlib'; we'll use that."
85 orderlib=false
86 else
87 echo "your system doesn't seem to support random libraries"
88 echo "so we'll use lorder and tsort to order the libraries."
89 orderlib=true
90 ranlib=":"
91 fi
92fi
93$rm -f foo* bar*
94