This commit was manufactured by cvs2svn to create tag
[heimdal.git] / cf / check-symbols.sh
blob2660fabc4b1f7e45c85bb43c0a8cdbce4a593d1f
1 #!/bin/sh
2 # check library exported symbols
3 # $Id$
5 LANG=C
6 export LANG
8 exit 0 #disable test on release branch
10 esym=
11 symbols=
13 # AIX has different default output format
14 nmargs=""
15 if [ "`uname`" = AIX ]; then
16 nmargs="-B"
19 while test $# != 0 ;do
20 case "$1" in
21 -lib) lib="$2" ; shift;;
22 -com_err)
23 esym="${esym} com_right\$ free_error_table\$ initialize_error_table_r\$"
24 esym="${esym} com_err error_message\$ error_table_name\$"
25 esym="${esym} init_error_table\$ add_to_error_table\$"
26 esym="${esym} reset_com_err_hook\$ set_com_err_hook\$ _et_list\$"
27 esym="${esym} et_[A-Za-z0-9]*_error_table"
28 esym="${esym} initialize_[A-Za-z0-9]*_error_table et_*_error_table" ;;
29 -version)
30 esym="${esym} print_version\$" ;;
31 -asn1compile)
32 esym="${esym} copy_ free_ length_ decode_ encode_ length_ "
33 esym="${esym} *.2int\$ int2 asn1_[A-Za-z0-9]*_units\$" ;;
34 -*) echo "unknown option $1" ; exit 1 ;;
35 *) break ;;
36 esac
37 shift
38 done
40 for a in "$@" $esym; do
41 symbols="\$3 !~ /^_?${a}/ ${symbols:+&&} ${symbols}"
42 done
44 # F filename, N debugsymbols, W weak symbols, U undefined
46 (nm $nmargs .libs/lib${lib}.a || nm $nmargs .libs/lib${lib}.so*) |
47 awk "BEGIN { stat = 0 }
48 NF == 3 && \$2 ~ /[A-EG-MO-TVX-Z]/ && $symbols { printf \"%s should not be exported (type %s)\\n\", \$3, \$2; ++stat } END { exit stat }"