Commit | Line | Data |
---|---|---|
33a01fd2 | 1 | ?RCS: $Id$ |
d8875586 MBT |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
cf39bd7e | 4 | ?RCS: |
33a01fd2 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
d8875586 MBT |
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 | |
33a01fd2 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
d8875586 MBT |
9 | ?RCS: of the source tree for dist 4.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 grep \ | |
20 | d_gnulibc nm egrep rsrc osname Guess | |
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 | |
7bfb7bd7 | 43 | ?X: If there is enough inquiries, it might be worth to wait for the nm |
d8875586 MBT |
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 | case "$usenm" in | |
48 | '') | |
49 | dflt='' | |
50 | case "$d_gnulibc" in | |
51 | "$define") | |
52 | echo " " | |
53 | echo "$nm probably won't work on the GNU C Library." >&4 | |
54 | dflt=n | |
55 | ;; | |
56 | esac | |
57 | case "$dflt" in | |
58 | '') | |
59 | if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then | |
60 | echo " " | |
61 | echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4 | |
62 | echo "'nm' won't be sufficient on this system." >&4 | |
63 | dflt=n | |
64 | fi | |
65 | ;; | |
66 | esac | |
67 | case "$dflt" in | |
68 | '') | |
69 | if ./gnu; then | |
70 | echo " " | |
71 | echo "Hmm... A GNU system without a GNU C Library? Weird..." >&4 | |
72 | dflt=n | |
73 | else | |
74 | dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null` | |
75 | if $test $dflt -gt 20; then | |
76 | dflt=y | |
77 | else | |
78 | dflt=n | |
79 | fi | |
80 | fi | |
81 | ;; | |
82 | esac | |
83 | ;; | |
84 | *) | |
85 | case "$usenm" in | |
86 | true|$define) dflt=y;; | |
87 | *) dflt=n;; | |
88 | esac | |
89 | ;; | |
90 | esac | |
91 | $cat <<EOM | |
92 | ||
93 | I can use $nm to extract the symbols from your C libraries. This | |
94 | is a time consuming task which may generate huge output on the disk (up | |
95 | to 3 megabytes) but that should make the symbols extraction faster. The | |
96 | alternative is to skip the 'nm' extraction part and to compile a small | |
97 | test program instead to determine whether each symbol is present. If | |
98 | you have a fast C compiler and/or if your 'nm' output cannot be parsed, | |
99 | this may be the best solution. | |
100 | ||
101 | EOM | |
102 | rp='Shall I use nm to extract C symbols from the libraries?' | |
103 | . ./myread | |
104 | case "$ans" in | |
105 | [Nn]*) usenm=false;; | |
106 | *) usenm=true;; | |
107 | esac | |
108 | ||
109 | ?X: Name extraction is to be run if 'nm' usage is wanted and if no -r flag | |
110 | ?X: was provided to configure (in which case we simply re-use the previous | |
111 | ?X: values). | |
112 | runnm=$usenm | |
113 | case "$reuseval" in | |
114 | true) runnm=false;; | |
115 | esac | |
116 | ||
117 | : nm options which may be necessary | |
118 | case "$nm_opt" in | |
119 | '') if $test -f /mach_boot; then | |
120 | nm_opt='' # Mach | |
121 | elif $test -d /usr/ccs/lib; then | |
122 | nm_opt='-p' # Solaris (and SunOS?) | |
123 | elif $test -f /dgux; then | |
124 | nm_opt='-p' # DG-UX | |
125 | elif $test -f /lib64/rld; then | |
126 | nm_opt='-p' # 64-bit Irix | |
127 | else | |
128 | nm_opt='' | |
129 | fi;; | |
130 | esac | |
131 | ||
132 | ?X: nm options which may be necessary for shared libraries but illegal | |
133 | ?X: for archive libraries. Thank you, Linux. | |
134 | case "$nm_so_opt" in | |
135 | '') case "$osname" in | |
136 | *linux*) | |
137 | if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then | |
138 | nm_so_opt='--dynamic' | |
139 | fi | |
140 | ;; | |
141 | esac | |
142 | ;; | |
143 | esac | |
144 |