Skip to content

Instantly share code, notes, and snippets.

@markusfisch
Created October 21, 2013 13:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markusfisch/7083520 to your computer and use it in GitHub Desktop.
Save markusfisch/7083520 to your computer and use it in GitHub Desktop.
Grep sources for system includes (e.g. for AC_CHECK_HEADERS in configure.ac)
#!/usr/bin/env bash
# Grep sources for system includes; e.g. for AC_CHECK_HEADERS:
# $ echo "AC_CHECK_HEADERS([$(./headers.sh | tr '\n' ' ')])" >> configure.ac
#
# @param ... - source files/directories
grep_for_includes()
{
grep -h '#include[ ]*<' $@ | sort | uniq | while read
do
REPLY=${REPLY#*<}
echo ${REPLY%>}
done
}
grep_for_includes ${@:-*.c *.h}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment