x
[heimdal.git] / cf / check-symbols.sh
blob5d1100672d55d349e2b4d173ed5bacfa76dc15ce
1 # check library exported symbols
2 # $Id$
4 esym=
5 symbols=
7 while test $# != 0 ;do
8 case "$1" in
9 -lib) lib="$2" ; shift;;
10 -com_err)
11 esym="${esym} com_right\$ free_error_table\$ initialize_error_table_r\$"
12 esym="${esym} com_err error_message\$ error_table_name\$"
13 esym="${esym} init_error_table\$ add_to_error_table\$"
14 esym="${esym} reset_com_err_hook\$ set_com_err_hook\$ _et_list\$"
15 esym="${esym} initialize_[A-Za-z0-9]*_error_table" ;;
16 -version)
17 esym="${esym} print_version\$" ;;
18 -asn1compile)
19 esym="${esym} copy_ free_ length_ decode_ encode_ length_ "
20 esym="${esym} *.2int\$ int2 .*_units\$" ;;
21 -*) echo "unknown option $1" ; exit 1 ;;
22 *) break ;;
23 esac
24 shift
25 done
27 for a in "$@" $esym; do
28 symbols="\$3 !~ /^${a}/ ${symbols:+&&} ${symbols}"
29 done
31 (nm .libs/lib${lib}.a || nm .libs/lib${lib}.so*) |
32 awk "BEGIN { stat = 0 }
33 NF == 3 && \$2 ~ /[A-Z]/ && \$2 !~ /U/ && $symbols { printf \"%s should not be exported\\n\", \$3; ++stat } END { exit stat }"