Blame src/util/check-ac-syms

Packit fd8b60
#!/bin/sh
Packit fd8b60
Packit fd8b60
# args: srcdir srctop-from-srcdir header-path
Packit fd8b60
Packit fd8b60
d=`pwd`
Packit fd8b60
head -1 $1/configure.ac > config-in.tmp
Packit fd8b60
echo "AC_CONFIG_HEADER(fooconfig.h:$d/fooconfig-h.tmp)" >> config-in.tmp
Packit fd8b60
tail +2 $1/configure.ac | grep -v AC_CONFIG_HEADER >> config-in.tmp
Packit fd8b60
mv -f config-in.tmp config-in.ac~
Packit fd8b60
Packit fd8b60
if (cd $1 && autoheader --include=$2 $d/config-in.ac~) > /dev/null; then
Packit fd8b60
  rm -rf $1/autom4te.cache config-in.ac~
Packit fd8b60
else
Packit fd8b60
  rm -rf $1/autom4te.cache
Packit fd8b60
# config-in.ac~ fooconfig-h.tmp
Packit fd8b60
  echo autoheader failed, eek
Packit fd8b60
  exit 1
Packit fd8b60
fi
Packit fd8b60
Packit fd8b60
awk '/^#undef/ { print $2; }' < fooconfig-h.tmp | sort > acsyms.here
Packit fd8b60
rm -f fooconfig-h.tmp
Packit fd8b60
awk '/^#undef/ { print $2; }' < $3 | sort > acsyms.there
Packit fd8b60
Packit fd8b60
comm -23 acsyms.here acsyms.there > acsyms.extra
Packit fd8b60
rm -f acsyms.here acsyms.there
Packit fd8b60
Packit fd8b60
if test -s acsyms.extra; then
Packit fd8b60
  echo ERROR: Symbol or symbols defined here but not in `basename $3`: `cat acsyms.extra`
Packit fd8b60
  rm -f acsyms.extra
Packit fd8b60
  exit 1
Packit fd8b60
fi
Packit fd8b60
rm -f acsyms.extra
Packit fd8b60
exit 0