This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
evat => eval as found by Tom Hukins
[metaconfig.git] / U / modified / usenm.U
1 ?RCS: $Id: usenm.U,v 3.0.1.1 1997/02/28 16:26:40 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 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 3.0.
10 ?RCS:
11 ?RCS: $Log: usenm.U,v $
12 ?RCS: Revision 3.0.1.1  1997/02/28  16:26:40  ram
13 ?RCS: patch61: don't use nm with the GNU C library
14 ?RCS: patch61: added support for Linux shared libs
15 ?RCS:
16 ?RCS: Revision 3.0  1993/08/18  12:09:57  ram
17 ?RCS: Baseline for dist 3.0 netwide release.
18 ?RCS:
19 ?MAKE:usenm runnm nm_opt nm_so_opt: cat test Myread Oldconfig myuname grep \
20         nm d_gnulibc osname egrep rsrc
21 ?MAKE:  -pick add $@ %<
22 ?S:usenm:
23 ?S:     This variable contains 'true' or 'false' depending whether the
24 ?S:     nm extraction is wanted or not.
25 ?S:.
26 ?S:runnm:
27 ?S:     This variable contains 'true' or 'false' depending whether the
28 ?S:     nm extraction should be performed or not, according to the value
29 ?S:     of usenm and the flags on the Configure command line.
30 ?S:.
31 ?S:nm_opt:
32 ?S:     This variable holds the options that may be necessary for nm.
33 ?S:.
34 ?S:nm_so_opt:
35 ?S:     This variable holds the options that may be necessary for nm
36 ?S:     to work on a shared library but that can not be used on an
37 ?S:     archive library.  Currently, this is only used by Linux, where
38 ?S:     nm --dynamic is *required* to get symbols from an ELF library which
39 ?S:     has been stripped, but nm --dynamic is *fatal* on an archive library.
40 ?S:     Maybe Linux should just always set usenm=false.
41 ?S:.
42 : see if nm is to be used to determine whether a symbol is defined or not
43 ?X: If there is enough inquiries, it might be worth to wait for the nm
44 ?X: extraction. Otherwise, the C compilations might be a better deal.
45 ?X:
46 ?X: Don't bother if we're using GNU libc -- skimo
47 ?LINT:extern PASE
48 case "$usenm" in
49 '')
50         dflt=''
51         case "$d_gnulibc" in
52         "$define")
53                 echo " "
54                 echo "nm probably won't work on the GNU C Library." >&4
55                 dflt=n
56                 ;;
57         esac
58         case "$dflt" in
59         '')
60                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
61                         echo " "
62                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
63                         echo "'nm' won't be sufficient on this system." >&4
64                         dflt=n
65                 fi
66                 ;;
67         esac
68         case "$dflt" in
69         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
70                 if $test $dflt -gt 20; then
71                         dflt=y
72                 else
73                         dflt=n
74                 fi
75                 ;;
76         esac
77         ;;
78 *)
79         case "$usenm" in
80         true|$define) dflt=y;;
81         *) dflt=n;;
82         esac
83         ;;
84 esac
85 $cat <<EOM
86
87 I can use $nm to extract the symbols from your C libraries. This
88 is a time consuming task which may generate huge output on the disk (up
89 to 3 megabytes) but that should make the symbols extraction faster. The
90 alternative is to skip the 'nm' extraction part and to compile a small
91 test program instead to determine whether each symbol is present. If
92 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
93 this may be the best solution.
94
95 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
96
97 EOM
98 rp="Shall I use $nm to extract C symbols from the libraries?"
99 . ./myread
100 case "$ans" in
101 [Nn]*) usenm=false;;
102 *) usenm=true;;
103 esac
104
105 ?X: Name extraction is to be run if 'nm' usage is wanted and if no -r flag
106 ?X: was provided to configure (in which case we simply re-use the previous
107 ?X: values).
108 runnm=$usenm
109 case "$reuseval" in
110 true) runnm=false;;
111 esac
112
113 : nm options which may be necessary
114 case "$nm_opt" in
115 '') if $test -f /mach_boot; then
116                 nm_opt=''       # Mach
117         elif $test -d /usr/ccs/lib; then
118                 nm_opt='-p'     # Solaris (and SunOS?)
119         elif $test -f /dgux; then
120                 nm_opt='-p'     # DG-UX
121         elif $test -f /lib64/rld; then
122                 nm_opt='-p'     # 64-bit Irix
123         else
124                 nm_opt=''
125         fi;;
126 esac
127
128 : nm options which may be necessary for shared libraries but illegal
129 : for archive libraries.  Thank you, Linux.
130 case "$nm_so_opt" in
131 '')     case "$myuname" in
132         *linux*|gnu*)
133                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
134                         nm_so_opt='--dynamic'
135                 fi
136                 ;;
137         esac
138         ;;
139 esac
140