Fix autoconf 2.70 compatibility
[platform/upstream/krb5.git] / src / util / check-ac-syms
1 #!/bin/sh
2
3 # args: srcdir srctop-from-srcdir header-path
4
5 d=`pwd`
6 head -1 $1/configure.in > config-in.tmp
7 echo "AC_CONFIG_HEADER(fooconfig.h:$d/fooconfig-h.tmp)" >> config-in.tmp
8 tail +2 $1/configure.in | grep -v AC_CONFIG_HEADER >> config-in.tmp
9 mv -f config-in.tmp config-in.ac~
10
11 if (cd $1 && autoheader --include=$2 $d/config-in.ac~) > /dev/null; then
12   rm -rf $1/autom4te.cache config-in.ac~
13 else
14   rm -rf $1/autom4te.cache
15 # config-in.ac~ fooconfig-h.tmp
16   echo autoheader failed, eek
17   exit 1
18 fi
19
20 awk '/^#undef/ { print $2; }' < fooconfig-h.tmp | sort > acsyms.here
21 rm -f fooconfig-h.tmp
22 awk '/^#undef/ { print $2; }' < $3 | sort > acsyms.there
23
24 comm -23 acsyms.here acsyms.there > acsyms.extra
25 rm -f acsyms.here acsyms.there
26
27 if test -s acsyms.extra; then
28   echo ERROR: Symbol or symbols defined here but not in `basename $3`: `cat acsyms.extra`
29   rm -f acsyms.extra
30   exit 1
31 fi
32 rm -f acsyms.extra
33 exit 0