1 ?RCS: $Id: usenm.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
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 4.0.
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
16 ?RCS: Revision 3.0 1993/08/18 12:09:57 ram
17 ?RCS: Baseline for dist 3.0 netwide release.
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 $@ %<
23 ?S: This variable contains 'true' or 'false' depending whether the
24 ?S: nm extraction is wanted or not.
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.
32 ?S: This variable holds the options that may be necessary for nm.
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.
42 : see if nm is to be used to determine whether a symbol is defined or not
43 ?X: If there is enough enquiries, it might be worth to wait for the nm
44 ?X: extraction. Otherwise, the C compilations might be a better deal.
46 ?X: Don't bother if we're using GNU libc -- skimo
53 echo "$nm probably won't work on the GNU C Library." >&4
59 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
61 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
62 echo "'nm' won't be sufficient on this system." >&4
71 echo "Hmm... A GNU system without a GNU C Library? Weird..." >&4
74 dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
75 if $test $dflt -gt 20; then
86 true|$define) dflt=y;;
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.
102 rp='Shall I use nm to extract C symbols from the libraries?'
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
117 : nm options which may be necessary
119 '') if $test -f /mach_boot; then
121 elif $test -d /usr/ccs/lib; then
122 nm_opt='-p' # Solaris (and SunOS?)
123 elif $test -f /dgux; then
125 elif $test -f /lib64/rld; then
126 nm_opt='-p' # 64-bit Irix
132 ?X: nm options which may be necessary for shared libraries but illegal
133 ?X: for archive libraries. Thank you, Linux.
135 '') case "$osname" in
137 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
138 nm_so_opt='--dynamic'