Commit | Line | Data |
---|---|---|
a0d0e21e | 1 | #!/bin/sh |
71be2cbc | 2 | # |
8c3ad6a1 JH |
3 | # Written: Nov 1994 Wayne Scott <wscott@ichips.intel.com> |
4 | # | |
5 | # Updated: 1997-8 Jarkko Hietaniemi <jhi@iki.fi> | |
71be2cbc | 6 | # |
a0d0e21e LW |
7 | # Create the export list for perl. |
8 | # Needed by AIX to do dynamic linking. | |
71be2cbc | 9 | # |
22c35a8c | 10 | # This simple program relies on global.sym and few other *.sym files |
8c3ad6a1 JH |
11 | # and the *var*.h files being up to date with all of the global |
12 | # symbols that a dynamic link library might want to access. | |
71be2cbc | 13 | # |
8c3ad6a1 JH |
14 | # Most symbols have a Perl_ or PL_prefix because that's what embed.h |
15 | # sticks in front of them. | |
71be2cbc | 16 | # |
8c3ad6a1 JH |
17 | # AIX requires the list of external symbols (variables or functions) |
18 | # that are made available for another executable object file the import. | |
19 | # The list is called the export file and it is a simple text file. | |
20 | # The first line must be | |
21 | #! | |
22 | # That is, hash-bang, pound-shout, however you want to call it. | |
23 | # The remainder of the file are the names of the symbols, one per line. | |
24 | # The file is then given to the system loader (cc/xlc command line) | |
25 | # as -bE:export.file. | |
a0d0e21e | 26 | |
2000072c | 27 | case $CONFIGDOTSH in |
71be2cbc | 28 | '') |
29 | if test -f config.sh; then TOP=.; | |
30 | elif test -f ../config.sh; then TOP=..; | |
31 | elif test -f ../../config.sh; then TOP=../..; | |
32 | elif test -f ../../../config.sh; then TOP=../../..; | |
33 | elif test -f ../../../../config.sh; then TOP=../../../..; | |
34 | else | |
35 | echo "Can't find config.sh."; exit 1 | |
36 | fi | |
37 | . $TOP/config.sh | |
38 | ;; | |
39 | esac | |
40 | : This forces SH files to create target in same directory as SH file. | |
41 | : This is so that make depend always knows where to find SH derivatives. | |
42 | case "$0" in | |
43 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; | |
44 | esac | |
bbb28fc1 | 45 | |
a0d0e21e LW |
46 | echo "Extracting perl.exp" |
47 | ||
acf072ce | 48 | rm -f perl.exp |
a0d0e21e LW |
49 | echo "#!" > perl.exp |
50 | ||
d502c9a3 | 51 | # No compat3 since 5.004_50. |
e4d5a464 JH |
52 | # No interp.sym since 5.005_03. |
53 | # perlio.sym will added later if needed. | |
54 | ||
049fc1c8 JH |
55 | grep '^Perl_' global.sym >> perl.exp |
56 | grep '^Perl_' pp.sym >> perl.exp | |
22c35a8c | 57 | sed -n '/^[A-Za-z]/ s/^/PL_/p' globvar.sym >> perl.exp |
bd656b61 | 58 | |
8c3ad6a1 JH |
59 | sed -n 's/^PERLVAR.*(G\([^[,]*\).*/PL_\1/p' perlvars.h >> perl.exp |
60 | sed -n 's/^PERLVAR.*(I\([^[,]*\).*/PL_\1/p' intrpvar.h >> perl.exp | |
61 | sed -n 's/^PERLVAR.*(T\([^[,]*\).*/PL_\1/p' thrdvar.h >> perl.exp | |
75f92628 | 62 | |
1553ab04 | 63 | # |
e4d5a464 | 64 | # If we use the PerlIO abstraction layer, add its symbols. |
1553ab04 TB |
65 | # |
66 | ||
5ff3f7a4 | 67 | if [ "X$useperlio" = "Xdefine" ] |
1553ab04 TB |
68 | then |
69 | grep '^[A-Za-z]' perlio.sym >> perl.exp | |
70 | fi | |
71 | ||
71be2cbc | 72 | # |
73 | # Extra globals not included above (including a few that might | |
74 | # not actually be defined, but there's no harm in that). | |
75 | # | |
76 | ||
864dbfa3 GS |
77 | #cat >>perl.exp <<END |
78 | #END | |
bd656b61 | 79 | |
5b877257 JH |
80 | case "$usemymalloc" in |
81 | true|[yY]*) usemymalloc=define ;; | |
82 | esac | |
83 | ||
049fc1c8 JH |
84 | # Remove mymalloc if needed. |
85 | case "$usemymalloc$d_mymalloc" in | |
5b877257 | 86 | definedefine) ;; |
049fc1c8 JH |
87 | *) |
88 | egrep -v '^(Perl_(calloc|malloc|malloced_size|mfree|realloc|safexcalloc|safexfree|safexmalloc|safexrealloc)|^PL_malloc_mutex)$' < perl.exp > perl.exp$$ | |
89 | mv -f perl.exp$$ perl.exp | |
90 | case "$ccflags" in | |
91 | *DEBUGGING*) ;; | |
92 | *) | |
93 | egrep -v '^(Perl_dump_mstats)$' < perl.exp > perl.exp$$ | |
94 | mv -f perl.exp$$ perl.exp | |
95 | ;; | |
96 | esac | |
97 | ;; | |
98 | esac | |
99 | ||
100 | # Remove unneeded utility functions. | |
101 | egrep -v '^(Perl_my_(bcopy|bzero|chsize|htonl|memcmp|memset|ntohl|swap))$' < perl.exp > perl.exp$$ | |
102 | mv -f perl.exp$$ perl.exp | |
103 | ||
5b877257 JH |
104 | case "$usethreads" in |
105 | true|[yY]*) usethreads=define ;; | |
106 | esac | |
107 | ||
049fc1c8 JH |
108 | # Remove thread symbols if needed. |
109 | case "$usethreads" in | |
5b877257 | 110 | define) ;; |
049fc1c8 JH |
111 | *) |
112 | egrep -v '^(Perl_(condpair_magic|find_threadsv|magic_mutexfree|new_struct_thread|unlock_condpair)|^PL_((eval|nthreads)_cond|curthr|eval_owner|(cred|eval|strtab|sv|svref|threads|malloc|vtbl)_mutex|nthreads|threadnum|threadsv_names|thr_key|thrsv))$' < perl.exp > perl.exp$$ | |
113 | mv -f perl.exp$$ perl.exp | |
114 | ;; | |
115 | esac | |
116 | ||
117 | # Remove debugging symbols if needed. | |
118 | case "$ccflags" in | |
119 | *DEBUGGING*) ;; | |
120 | *) | |
121 | egrep -v '^(PL_(block_type|watchaddr|watchok))$' < perl.exp > perl.exp$$ | |
122 | mv -f perl.exp$$ perl.exp | |
123 | ;; | |
124 | esac | |
125 | ||
126 | # Remove unneeded globals. | |
127 | egrep -v '^(Perl_(ErrorNo|GetVars|same_dirent|unlnk)|PL_(cryptseen|statusvalue_vms))' < perl.exp > perl.exp$$ | |
128 | mv -f perl.exp$$ perl.exp | |
129 | ||
bd656b61 JH |
130 | # The shebang line nicely sorts as the first one. |
131 | sort -o perl.exp -u perl.exp | |
132 | ||
133 | # eof |